Skip to contentSkip to conversation

VFS list corruption in fs/inode.c (2.4.x)

PATCH Trond Myklebust 1 participant 1 message Mar 27, 2004 VFS

lore
Share & tools
lore
#0 lore raw

Hi,

Someone filed a 2.4.x bug in Bugzilla and via some wierd and tortuous
path, the thing ended up on my plate...
See the description in
http://bugme.osdl.org/show_bug.cgi?id=2367

AFAICS the only case where a locked inode can be placed on the dirty list is in refile_inode(), which fails to lock the inode itself or to check for whether or not the inode already is locked...

The problem is that the only thing that ever calls refile_inode() is remove_page_from_inode_queue(), which cannot lock inode...

Fix would appear to be add a check to refile_inode() as per the appended patch.

Does this look correct, Al?

Cheers,
Trond

fs/inode.c renamed from fs/inode.c.orig +2 -1
@@ -319,7 +319,8 @@ void refile_inode(struct inode *inode)
 	if (!inode)
 		return;
 	spin_lock(&inode_lock);
-	__refile_inode(inode);
+	if (!(inode->i_state & I_LOCK))
+		__refile_inode(inode);
 	spin_unlock(&inode_lock);
 }