diff mbox

[1/2] NFSv4: Fix a regression against the FreeBSD server

Message ID 1774242197.1390191.1374190255822.JavaMail.root@uoguelph.ca (mailing list archive)
State New, archived
Headers show

Commit Message

Rick Macklem July 18, 2013, 11:30 p.m. UTC
Andre Heider wrote:
> On Wed, Jul 17, 2013 at 11:59 PM, Trond Myklebust
> <Trond.Myklebust@netapp.com> wrote:
> > Technically, the Linux client is allowed by the NFSv4 spec to send
> > 3 word bitmaps as part of an OPEN request. However, this causes the
> > current FreeBSD server to return NFS4ERR_ATTRNOTSUPP errors.
> >
> > Fix the regression by making the Linux client use a 2 word bitmap
> > unless
> > doing NFSv4.2 with labeled NFS.
> >
> > Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> 
> Tested-by: Andre Heider <a.heider@gmail.com>
> 
I've attached the patch I plan to commit to FreeBSD's head soon, which
fixes the server so that it checks for the high order bitmaps words
being non-zero before replying with NFS4_ERR_ATTRNOTSUPP.

The patch is pretty straightforward, but if you can apply it to your
server and test it against the unpatched Linux client, that would be
appreciated.

It will take a while for the patch to find its way to a FreeBSD release,
so having the workaround in the Linux client will be very helpful.

Thanks for reporting this, rick

Comments

Trond Myklebust July 18, 2013, 11:48 p.m. UTC | #1
On Thu, 2013-07-18 at 19:30 -0400, Rick Macklem wrote:
> Andre Heider wrote:

> > On Wed, Jul 17, 2013 at 11:59 PM, Trond Myklebust

> > <Trond.Myklebust@netapp.com> wrote:

> > > Technically, the Linux client is allowed by the NFSv4 spec to send

> > > 3 word bitmaps as part of an OPEN request. However, this causes the

> > > current FreeBSD server to return NFS4ERR_ATTRNOTSUPP errors.

> > >

> > > Fix the regression by making the Linux client use a 2 word bitmap

> > > unless

> > > doing NFSv4.2 with labeled NFS.

> > >

> > > Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

> > 

> > Tested-by: Andre Heider <a.heider@gmail.com>

> > 

> I've attached the patch I plan to commit to FreeBSD's head soon, which

> fixes the server so that it checks for the high order bitmaps words

> being non-zero before replying with NFS4_ERR_ATTRNOTSUPP.

> 

> The patch is pretty straightforward, but if you can apply it to your

> server and test it against the unpatched Linux client, that would be

> appreciated.

> 

> It will take a while for the patch to find its way to a FreeBSD release,

> so having the workaround in the Linux client will be very helpful.


Right. So, my plan is to send patch 1/2 as a bugfix within the next few
days, to ensure that we end up with no gap in NFSv4 client functionality
between the release versions of Linux 3.10 and 3.11.

Since 2/2 is more of a cleanup, and actually changes the functionality
to send only a 1-word bitmap for truncate() calls, I'll wait for the
3.12 merge window before committing that.

Cheers
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
Andre Heider July 20, 2013, 8:48 a.m. UTC | #2
On Fri, Jul 19, 2013 at 1:30 AM, Rick Macklem <rmacklem@uoguelph.ca> wrote:
> Andre Heider wrote:
>> On Wed, Jul 17, 2013 at 11:59 PM, Trond Myklebust
>> <Trond.Myklebust@netapp.com> wrote:
>> > Technically, the Linux client is allowed by the NFSv4 spec to send
>> > 3 word bitmaps as part of an OPEN request. However, this causes the
>> > current FreeBSD server to return NFS4ERR_ATTRNOTSUPP errors.
>> >
>> > Fix the regression by making the Linux client use a 2 word bitmap
>> > unless
>> > doing NFSv4.2 with labeled NFS.
>> >
>> > Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
>>
>> Tested-by: Andre Heider <a.heider@gmail.com>
>>
> I've attached the patch I plan to commit to FreeBSD's head soon, which
> fixes the server so that it checks for the high order bitmaps words
> being non-zero before replying with NFS4_ERR_ATTRNOTSUPP.
>
> The patch is pretty straightforward, but if you can apply it to your
> server and test it against the unpatched Linux client, that would be
> appreciated.

Confirmed, reverting the client patches and applying this server patch
also works ;)

Thanks,
Andre
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- sys/fs/nfs/nfs_commonsubs.c.orig	2013-07-18 19:15:25.000000000 -0400
+++ sys/fs/nfs/nfs_commonsubs.c	2013-07-18 19:15:58.000000000 -0400
@@ -761,21 +761,21 @@  nfsrv_getattrbits(struct nfsrv_descript 
 		error = NFSERR_BADXDR;
 		goto nfsmout;
 	}
-	if (cnt > NFSATTRBIT_MAXWORDS) {
+	if (cnt > NFSATTRBIT_MAXWORDS)
 		outcnt = NFSATTRBIT_MAXWORDS;
-		if (retnotsupp)
-			*retnotsupp = NFSERR_ATTRNOTSUPP;
-	} else {
+	else
 		outcnt = cnt;
-	}
 	NFSZERO_ATTRBIT(attrbitp);
 	if (outcnt > 0) {
 		NFSM_DISSECT(tl, u_int32_t *, outcnt * NFSX_UNSIGNED);
 		for (i = 0; i < outcnt; i++)
 			attrbitp->bits[i] = fxdr_unsigned(u_int32_t, *tl++);
 	}
-	if (cnt > outcnt)
-		error = nfsm_advance(nd, (cnt - outcnt) * NFSX_UNSIGNED, -1);
+	for (i = 0; i < (cnt - outcnt); i++) {
+		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
+		if (retnotsupp != NULL && *tl != 0)
+			*retnotsupp = NFSERR_ATTRNOTSUPP;
+	}
 	if (cntp)
 		*cntp = NFSX_UNSIGNED + (cnt * NFSX_UNSIGNED);
 nfsmout: