From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: [PATCH] NFS: revalidate on open if dcache is negative.
Date: Mon, 12 May 2014 13:50:19 +1000 [thread overview]
Message-ID: <20140512135019.56e5c465@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
NFS CTO semantics require that (absent a delegation) the server
must be contacted at each open.
nfs_lookup_verify_inode() implements this when the dcache contains
a positive cached entry. However it is not called when the dcache
contains a negative cached entry. That path uses nfs_neg_need_reval()
which doesn't impose CTO semantics.
So a sequence like:
rm -f testfile
ls -l testfile
ssh $server touch testfile
cat testfile
will fail:
cat: testfile: No such file or directory
an 'strace' will confirm that this resulted from an 'open' system
call.
So add code to nfs_neg_need_reval implement CTO semantics much like
that in nfs_lookup_verify_inode().
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index d9f3d067cd15..f8022da72460 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1062,6 +1062,8 @@ int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
/* Don't revalidate a negative dentry if we're creating a new file */
if (flags & LOOKUP_CREATE)
return 0;
+ if ((flags & LOOKUP_OPEN) && !(NFS_SERVER(dir)->flags & NFS_MOUNT_NOCTO))
+ return 1;
if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG)
return 1;
return !nfs_check_verifier(dir, dentry);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2014-05-12 3:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 3:50 NeilBrown [this message]
2014-05-12 20:58 ` [PATCH] NFS: revalidate on open if dcache is negative Trond Myklebust
2014-05-13 0:41 ` NeilBrown
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=20140512135019.56e5c465@notabene.brown \
--to=neilb@suse.de \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.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