[Tux3] Bad entry->rec_len in _tux_create_entry
Ma Can
macan at ncic.ac.cn
Sat Jan 3 17:58:55 PST 2009
Working with Tux3 in kernel, after I executed
[tux3_root]$ touch a
I got: "entry: inum e, rec_len 0, name_len 1, type 1, name a"
The rec_len is _ZERO_, and it will lead to a tux_error in
_tux_find_entry(_tux_find_entry: zero length entry at <d:0>). When we
create the first entry in the root directory, name_len is 0. Then,
newent and entry point to the same address, we modify the rec_len
_TWICE_ from right to wrong.
-- tux3.org/dir.c 2009-01-01 20:50:48.000000000 -0500
+++ linux-2.6.26.5/fs/tux3/dir.c 2009-01-04 09:31:27.000000000 -0500
@@ -155,7 +155,8 @@
if (!is_deleted(entry)) {
tux_dirent *newent = (tux_dirent *)((char *)entry + name_len);
newent->rec_len = tux_rec_len_to_disk(rec_len - name_len);
- entry->rec_len = tux_rec_len_to_disk(name_len);
+ if (name_len)
+ entry->rec_len = tux_rec_len_to_disk(name_len);
entry = newent;
}
entry->name_len = len;
--
Ma Can
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list