Skip to contentSkip to conversation

igrab() should check for I_CLEAR

PATCH New Jan Blunck 1 participant 1 message Dec 19, 2006 VFS

lore
Share & tools
lore

Jan Blunck

author
#0 lore raw

PATCH 1/1 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.

---
 fs/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/inode.c +1 -1
Index: linux-2.6/fs/inode.c
===================================================================
@@ -709,7 +709,7 @@ EXPORT_SYMBOL(iunique);
 struct inode *igrab(struct inode *inode)
 {
 	spin_lock(&inode_lock);
-	if (!(inode->i_state & (I_FREEING|I_WILL_FREE)))
+	if (!(inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)))
 		__iget(inode);
 	else
 		/*