From: "J. Bruce Fields" <bfields@fieldses.org>
To: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, steved@redhat.com, nfsv4@ietf.org
Subject: Re: open() of device special files
Date: Mon, 15 Aug 2011 18:27:21 -0400 [thread overview]
Message-ID: <20110815222721.GC32181@fieldses.org> (raw)
In-Reply-To: <20110815222336.GB32181@fieldses.org>
On Mon, Aug 15, 2011 at 06:23:36PM -0400, J. Bruce Fields wrote:
> On Mon, Aug 15, 2011 at 05:25:39PM -0400, J. Bruce Fields wrote:
> > On Mon, Aug 15, 2011 at 09:03:30AM -0700, Myklebust, Trond wrote:
> > > > -----Original Message-----
> > > > From: J. Bruce Fields [mailto:bfields@fieldses.org]
> > > > How is the client supposed to handle opens of device special files?
> > > On
> > > > a 3.1-rc1-based client to a linux server over v4.0 I'm seeing it try
> > > an
> > > > OPEN call and failing when it gets an INVAL return.
> > > >
> > > > This looks like bogus client behavior (OPEN should fail on such
> > > files),
> > > > unless the server has the error return wrong and the client's using an
> > > > OPEN error to recover.
> > > >
> > > > If I first stat the device and then open it then it works as expected
> > > > (the client does an open of the local device).
> > > >
> > > > I'm a bit annoyed at myself as I have a feeling we've discussed this
> > > > before but I can't find a reference now.
> > >
> > > Hmm... NFS4ERR_INVAL means 'invalid argument', which is not the case
> > > here; all the arguments that the client is passing to the server are
> > > valid, however the file cannot be opened because the pathname resolves
> > > on the server to a file of the wrong type.
>
> The long description of NFS4ERR_INVAL from rfc 3530:
>
> "Invalid argument or unsupported argument for an operation. Two
> examples are attempting a READLINK on an object other than a
> symbolic link or specifying a value for an enum field that is
> not defined in the protocol (e.g., nfs_ftype4)."
>
> So the text does recommend NFS4ERR_INVAL for the case where the
> operation doesn't make sense for the type of object given. (In the
> readlink example there's no pathname resolution, though).
>
> EINVAL seems to be used in the kernel for some such cases as well (e.g.
> attempt to truncate a device special file).
>
> > > I can't see any other error definition that is "obviously correct", but
> > > it looks to me as if NFS4ERR_SYMLINK might be the closest thing. One
> > > reason is the dot-x file defines NFS4ERR_SYMLINK as meaning "should be
> > > file/directory".
>
> And this seems more a coincidence due to vagueness resulting from the
> need for a single-line comment; the longer description is:
>
> "NFS4ERR_SYMLINK The current filehandle provided for a LOOKUP is
> not a directory but a symbolic link. Also used
> if the final component of the OPEN path is a
> symbolic link."
>
> > > The other reason is that NFS4ERR_SYMLINK should
> > > _always_ trigger the correct behaviour on a client: a fresh lookup of
> > > the component.
> >
> > Confirmed the fix; I'll apply.
>
> Applying anyway for compatibility with existing clients, but this all
> seems a little weird.
And the change also makes a bunch of pynfs tests fail, complaining that
various operations against incompatible types should have returned INVAL
and not SYMLINK.
Not that I'm convinced pynfs is correct--at the very least it should
have accepted a range of errors for those tests, I think--but anyone
else that ran pynfs against their server may have assumed it pynfs was
correct in these cases....
--b.
next prev parent reply other threads:[~2011-08-15 22:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-15 15:36 open() of device special files J. Bruce Fields
2011-08-15 16:03 ` Myklebust, Trond
2011-08-15 21:25 ` J. Bruce Fields
2011-08-15 22:23 ` J. Bruce Fields
2011-08-15 22:27 ` J. Bruce Fields [this message]
2011-08-16 5:04 ` Myklebust, Trond
2011-08-16 11:03 ` J. Bruce Fields
2011-08-16 5:03 ` Myklebust, Trond
2011-08-16 10:49 ` J. Bruce Fields
2011-08-15 22:28 ` J. Bruce Fields
2011-08-15 22:30 ` [PATCH 1/5] nfsd4: clean up S_IS -> NF4 file type mapping J. Bruce Fields
2011-08-15 22:30 ` [PATCH 2/5] nfsd4: return nfserr_symlink on v4 OPEN of non-regular file J. Bruce Fields
2011-08-15 22:30 ` [PATCH 3/5] nfsd4: fix incorrect comment in nfsd4_set_nfs4_acl J. Bruce Fields
2011-08-15 22:30 ` [PATCH 4/5] nfsd: open-code special directory-hardlink check J. Bruce Fields
2011-08-15 22:30 ` [PATCH 5/5] nfsd: clean up nfsd_mode_check() J. Bruce Fields
2011-08-15 22:48 ` J. Bruce Fields
2011-08-16 11:32 ` [nfsv4] open() of device special files Steve Dickson
2011-08-17 0:52 ` J. Bruce Fields
2011-08-17 1:40 ` 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=20110815222721.GC32181@fieldses.org \
--to=bfields@fieldses.org \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=nfsv4@ietf.org \
--cc=steved@redhat.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