[PATCH]: reiserfs: D-clear-i_blocks.patch

Nikita Danilov (NikitaDanilov@Yahoo.COM)
Thu, 2 Aug 2001 19:45:58 +0400


Hello, Linus,

This patch sets inode.i_blocks to zero on deletion of reiserfs
file. This in particular cures hard to believe bug when saving file in
EMACS caused top to loose sight of all processes:
. reiserfs didn't properly cleared i_blocks when removing
symlinks. Actually -7 was inserted into unsigned i_blocks field. This
didn't usually hurt because file is being deleted;
. inode is reused for procfs and neither get_new_inode() nor
proc_read_inode() cleared i_blocks;
. now procfs inode has huge i_blocks field;
. top calls stat on it and libc wrapper returns EOVERFLOW, as i_blocks
doesn't fit into user-level struct.
. top sees nothing.

[lkml: please CC me, I am not subscribed.]

Nikita.
diff -rup linux-2.4.8-pre3/fs/reiserfs/inode.c linux-2.4.8-pre3.patched/fs/reiserfs/inode.c
--- linux-2.4.8-pre3/fs/reiserfs/inode.c Wed Aug 1 17:21:10 2001
+++ linux-2.4.8-pre3.patched/fs/reiserfs/inode.c Wed Aug 1 21:33:37 2001
@@ -55,6 +55,7 @@ void reiserfs_delete_inode (struct inode
;
}
clear_inode (inode); /* note this must go after the journal_end to prevent deadlock */
+ inode->i_blocks = 0;
unlock_kernel() ;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/