Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] igrab() should check for I_CLEAR

When igrab() is calling __iget() on an inode it should check if
clear_inode() has been called on the inode already. Otherwise there is a
race window between clear_inode() and destroy_inode() where igrab() calls
__iget() which leads to already free inodes on the inode lists.

Signed-off-by: Vandana Rungta <vandana@novell.com>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jan Blunck and committed by
Linus Torvalds
4a3b0a49 068135e6

+1 -1
+1 -1
fs/inode.c
··· 709 709 struct inode *igrab(struct inode *inode) 710 710 { 711 711 spin_lock(&inode_lock); 712 - if (!(inode->i_state & (I_FREEING|I_WILL_FREE))) 712 + if (!(inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE))) 713 713 __iget(inode); 714 714 else 715 715 /*