From: Al Viro <viro@ZenIV.linux.org.uk>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Jeff Layton <jlayton@kernel.org>
Subject: Re: [RFC][PATCH] nfsd: vfs_mkdir() might succeed leaving dentry negative unhashed
Date: Mon, 14 May 2018 16:45:51 +0100 [thread overview]
Message-ID: <20180514154550.GH30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180514153216.GC7160@fieldses.org>
On Mon, May 14, 2018 at 11:32:16AM -0400, J. Bruce Fields wrote:
> On Fri, May 11, 2018 at 10:13:39PM +0100, Al Viro wrote:
> > [-stable fodder; as it is, one can e.g. add
> > /mnt/cgroup localhost(rw,no_root_squash,fsid=4242)
> > to /etc/exports,
> > mount -t cgroup none /mnt/cgroup
> > mkdir /tmp/a
> > mount -t nfs localhost://mnt/cgroup /tmp/a
> > mkdir /tmp/a/foo
>
> How is the cgroup filesystem exportable? That sounds like a bug in
> itself. We don't want people using NFS as some kind of weird remote
> configuration protocol.
You can't have open-by-fhandle without exportability. And it's not
the only fs like that.
> > and have knfsd oops; the patch below deals with that.
> >
> > Questions:
> > 1) is fh_update() use below legitimate, or should we
> > do fh_put/fh_compose instead?
>
> fh_update looks OK to me, but do we need it here? There's already a
>
> if (!err)
> err = fh_update(reshp);
>
> at the end of nfsd_create_locked.
Might be too late for that, though - the trouble hits when we hit
nfsd_create_setattr().
> > 2) is nfserr_serverfail valid for situation when
> > directory created by such vfs_mkdir() manages to disappear
> > under us immediately afterwards? Or should we return nfserr_stale
> > instead?
>
> We just got a successful result on the create and the parent's still
> locked, so if somebody hits this I think we want them reporting a bug,
> not wasting time trying to find a mistake in their own logic.
No. Suppose it's NFS-over-NFS (and yes, I agree that it's a bad idea;
somebody *has* done that). Lookup after successful mkdir can legitimately
fail if it's been removed server-side.
And we *will* need to allow nfs_mkdir() to return that way in some cases
(== success with dentry passed to it left unhashed negative), I'm afraid ;-/
next prev parent reply other threads:[~2018-05-14 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 21:13 [RFC][PATCH] nfsd: vfs_mkdir() might succeed leaving dentry negative unhashed Al Viro
2018-05-14 15:32 ` J. Bruce Fields
2018-05-14 15:45 ` Al Viro [this message]
2018-05-14 16:27 ` J. Bruce Fields
2018-05-14 17:00 ` Al Viro
2018-05-14 17:56 ` J. Bruce Fields
2018-05-14 16:47 ` Al Viro
2018-05-16 14:09 ` J. Bruce Fields
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=20180514154550.GH30522@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=bfields@fieldses.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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