linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zyan@redhat.com>
To: viro@ZenIV.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, "Yan, Zheng" <zyan@redhat.com>
Subject: [PATCH] namei: revalidate negative dentry before return -ENOENT
Date: Fri,  9 Oct 2015 17:01:03 +0800	[thread overview]
Message-ID: <1444381263-6505-1-git-send-email-zyan@redhat.com> (raw)

After commit 766c4cbf "namei: d_is_negative() should be checked
before ->d_seq validation", lookup_fast() can return -ENOENT without
revalidating the negative dentry. This breaks network filesystems
that allow creating/deleting files from multiple hosts.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
---
 fs/namei.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 726d211..5ffbf53 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1558,8 +1558,6 @@ static int lookup_fast(struct nameidata *nd,
 		negative = d_is_negative(dentry);
 		if (read_seqcount_retry(&dentry->d_seq, seq))
 			return -ECHILD;
-		if (negative)
-			return -ENOENT;
 
 		/*
 		 * This sequence count validates that the parent had no
@@ -1580,6 +1578,10 @@ static int lookup_fast(struct nameidata *nd,
 				goto unlazy;
 			}
 		}
+
+		if (negative)
+			return -ENOENT;
+
 		path->mnt = mnt;
 		path->dentry = dentry;
 		if (likely(__follow_mount_rcu(nd, path, inode, seqp)))
-- 
1.9.3


                 reply	other threads:[~2015-10-09  9:01 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=1444381263-6505-1-git-send-email-zyan@redhat.com \
    --to=zyan@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).