linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] VFS: fix recent breakage of FS_REVAL_DOT
@ 2010-05-24  6:57 Neil Brown
  2010-05-24 11:59 ` Al Viro
  0 siblings, 1 reply; 16+ messages in thread
From: Neil Brown @ 2010-05-24  6:57 UTC (permalink / raw)
  To: Al Viro; +Cc: Trond Myklebust, Chuck Lever, linux-nfs, linux-kernel


Commit 1f36f774b22a0ceb7dd33eca626746c81a97b6a5 broke FS_REVAL_DOT semantics.

In particular, before this patch, the command
   ls -l
in an NFS mounted directory would always check if the directory on the server
had changed and if so would flush and refill the pagecache for the dir.
After this patch, the same "ls -l" will repeatedly return stale date until
the cached attributes for the directory time out.

The following patch fixes this by ensuring the d_revalidate is called by
do_last when "." is being looked-up.
link_path_walk has already called d_revalidate, but in that case LOOKUP_OPEN
is not set so nfs_lookup_verify_inode chooses not to do any validation.

The following patch restores the original behaviour.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>

---
As an aside the whole "FS_REVAL_DOT" concept seems deeply flawed to me.
The apparent purpose for d_revalidate is to ensure that the given name in the
given directory still points to the given inode.  For '.' this is pointless
as '.' in a given directory has a very well defined and unchangeable value.

It seems that d_revalidate is also used to update the cached attributes for
the target as well.  While that is reasonable side effect it seems wrong to
expect it as is the basis for FS_REVAL_DOT.

Surely ->open should perform any final validation of cached attributes.

NeilBrown

(Yes, I have posted this before but I didn't seem to be getting any real
progress, so I split this more obviously correct patch out from the other
less obvious one relating to mountpoints.  Once I succeed with this I'll try
again with the other).

diff --git a/fs/namei.c b/fs/namei.c
index 48e1f60..868d0cb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1621,6 +1621,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
 	case LAST_DOTDOT:
 		follow_dotdot(nd);
 		dir = nd->path.dentry;
+	case LAST_DOT:
 		if (nd->path.mnt->mnt_sb->s_type->fs_flags & FS_REVAL_DOT) {
 			if (!dir->d_op->d_revalidate(dir, nd)) {
 				error = -ESTALE;
@@ -1628,7 +1629,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
 			}
 		}
 		/* fallthrough */
-	case LAST_DOT:
 	case LAST_ROOT:
 		if (open_flag & O_CREAT)
 			goto exit;

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-05-26  2:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-24  6:57 [PATCH] VFS: fix recent breakage of FS_REVAL_DOT Neil Brown
2010-05-24 11:59 ` Al Viro
2010-05-24 15:50   ` Al Viro
2010-05-24 16:21     ` Trond Myklebust
2010-05-24 16:47       ` Al Viro
2010-05-24 17:06         ` Trond Myklebust
2010-05-24 19:08           ` Al Viro
2010-05-24 21:13             ` Trond Myklebust
2010-05-24 23:01               ` Al Viro
2010-05-24 23:44                 ` Al Viro
2010-05-25 13:04                   ` Trond Myklebust
2010-05-25 12:57                 ` Trond Myklebust
2010-05-25  1:35         ` Neil Brown
2010-05-25  1:14   ` Neil Brown
2010-05-25  1:58     ` Al Viro
2010-05-26  2:52       ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).