[lkml]   [2001]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 2.4.5] Fix NFS Oops w.r.t. unhashed inodes

Hi Linus,

One consequence of the removal of the 'put_inode: force_delete' made for
2.4.5 mmap() is that we now use the 'magic nfs' codepath in
iput(). The result is that when we unhash inodes due to staleness in
nfs_revalidate_inode(), we now end up calling clear_inode() in iput
without first calling truncate_inode_pages(), and thus trigger the
BUG() on line 486 in fs/inode.c.

After discussion with Al, I think the minimal solution would be to
add a call to truncate_inode_pages() to the magic nfs code. To do the
call in nfs_revalidate_inode() itself (Al's suggestion) would be racy
w.r.t. adding pages in read or write itself.

A second consequence of the removal of force_delete was the fact
that file or directory deletion no longer results in the inode getting
thrown out of the icache upon last iput(). This gave problems due to
inode number reuse on the userland nfsd. The solution is to update
i_nlink when we delete or rmdir.


--- linux-2.4.5-pre6/fs/inode.c.orig Fri May 25 14:15:38 2001
+++ linux-2.4.5-pre6/fs/inode.c Wed May 30 12:17:29 2001
@@ -1044,6 +1044,8 @@
+ if (inode->i_data.nrpages)
+ truncate_inode_pages(&inode->i_data, 0);
--- linux-2.4.5-pre6/fs/nfs/dir.c.orig Fri May 25 14:15:38 2001
+++ linux-2.4.5-pre6/fs/nfs/dir.c Thu May 31 14:53:32 2001
@@ -753,6 +753,8 @@

error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
+ if (!error)
+ dentry->d_inode->i_nlink = 0;

return error;
@@ -870,6 +872,8 @@
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
if (error < 0)
goto out;
+ if (inode)
+ inode->i_nlink--;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 12:54    [W:0.055 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site