NFSv4: Ensure nfs_atomic_open set the dentry verifier on ENOENT
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 23 Oct 2014 16:33:14 +0000 (19:33 +0300)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:09 +0000 (14:04 +0200)
commit 809fd143de8805970eec02c27c0bc2622a6ecbda upstream.

If the OPEN rpc call to the server fails with an ENOENT call, nfs_atomic_open
will create a negative dentry for that file, however it currently fails
to call nfs_set_verifier(), thus causing the dentry to be immediately
revalidated on the next call to nfs_lookup_revalidate() instead of following
the usual lookup caching rules.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/nfs/dir.c

index e093e73178b71467aa15eafa1d5327714eff284e..48038e7adb1efb49c711438765406af0920162d1 100644 (file)
@@ -1435,6 +1435,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
                switch (err) {
                case -ENOENT:
                        d_add(dentry, NULL);
+                       nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
                        break;
                case -EISDIR:
                case -ENOTDIR: