mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.4.5] Fix NFS Oops w.r.t. unhashed inodes
Date: Tue, 5 Jun 2001 19:50:46 +0200	[thread overview]
Message-ID: <15133.7158.481243.538585@charged.uio.no> (raw)


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.

Cheers,
  Trond

--- 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 @@
 				inode->i_state|=I_FREEING;
 				inodes_stat.nr_inodes--;
 				spin_unlock(&inode_lock);
+				if (inode->i_data.nrpages)
+					truncate_inode_pages(&inode->i_data, 0);
 				clear_inode(inode);
 			}
 		}
--- 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 @@
 
 	nfs_zap_caches(dir);
 	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--;
 
  out_delete:
 	/*

                 reply	other threads:[~2001-06-05 17:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15133.7158.481243.538585@charged.uio.no \
    --to=trond.myklebust@fys.uio.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®