All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dr James Bruce Fields <bfields@fieldses.org>
To: Orion Poplawski <orion@cora.nwra.com>
Cc: "Myklebust, Trond" <Trond.Myklebust@netapp.com>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [nfsv4] open(O_CREAT) returns EEXISTS on symbolic link created on another system until stat()ed
Date: Thu, 29 Mar 2012 15:31:00 -0400	[thread overview]
Message-ID: <20120329193100.GA20329@fieldses.org> (raw)
In-Reply-To: <4F74A4D5.1040802@cora.nwra.com>

On Thu, Mar 29, 2012 at 12:07:17PM -0600, Orion Poplawski wrote:
> On 03/29/2012 11:40 AM, Myklebust, Trond wrote:
> >>Going back to v4 on EL5.8 server: nfsv4el.log, nfsv4f18.log
> >>
> >>Both get NFS4ERR_EXIST in this case.
> >
> >Which is an obvious server bug: it should be sending NFS4ERR_SYMLINK in
> >reply to that OPEN.
> >
> >Bruce?
> >
> 
> I can reproduce with a 3.4.0-0.rc0.git1.2.fc18 server as well.

Hm.  So how about this?  (Untested.)

Probably there should be a pynfs test too.

I'm assuming it should still be ERR_EXIST in the exclusive,
exclusive4_1, and guarded cases.

--b.

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7423d71..2bfcad4 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1457,9 +1457,12 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
 		switch (createmode) {
 		case NFS3_CREATE_UNCHECKED:
-			if (! S_ISREG(dchild->d_inode->i_mode))
-				err = nfserr_exist;
-			else if (truncp) {
+			if (! S_ISREG(dchild->d_inode->i_mode)) {
+				if (rqstp->rq_vers == 4)
+					err = nfserr_symlink;
+				else
+					err = nfserr_exist;
+			} else if (truncp) {
 				/* in nfsv4, we need to treat this case a little
 				 * differently.  we don't want to truncate the
 				 * file now; this would be wrong if the OPEN

  reply	other threads:[~2012-03-29 19:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29 16:28 [nfsv4] open(O_CREAT) returns EEXISTS on symbolic link created on another system until stat()ed Orion Poplawski
2012-03-29 16:54 ` Myklebust, Trond
     [not found]   ` <4F749CCA.3000400@cora.nwra.com>
2012-03-29 17:40     ` Myklebust, Trond
2012-03-29 18:07       ` Orion Poplawski
2012-03-29 19:31         ` Dr James Bruce Fields [this message]
2012-03-29 20:16           ` Myklebust, Trond
2012-03-29 20:42             ` Myklebust, Trond
2012-03-29 20:50               ` Dr James Bruce Fields
2012-03-29 20:56                 ` Myklebust, Trond
2012-03-29 21:08                   ` Dr James Bruce Fields
2012-03-29 21:17                     ` Dr James Bruce Fields
2012-04-05 16:35                       ` Orion Poplawski
2012-04-05 16:53                         ` Bruce Fields
2012-04-05 20:17                           ` Orion Poplawski
2012-04-09 22:32                             ` Bruce Fields
2012-04-09 22:58                               ` Bruce Fields
2012-03-30 17:12                     ` Peter Staubach
2012-03-30 17:20                       ` Myklebust, Trond
2012-03-29 20:43             ` Dr James Bruce Fields
2012-03-29 20:50               ` Myklebust, Trond

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=20120329193100.GA20329@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=orion@cora.nwra.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.