svn commit: r318570 - projects/pnfs-planb-server/sys/fs/nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Sat May 20 01:04:49 UTC 2017
Author: rmacklem
Date: Sat May 20 01:04:47 2017
New Revision: 318570
URL: https://svnweb.freebsd.org/changeset/base/318570
Log:
Check for the correct layout stateid when the server has already issued a
layout to the client for the file. This check is required by RFC5661.
Modified:
projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c
Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sat May 20 01:04:19 2017 (r318569)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sat May 20 01:04:47 2017 (r318570)
@@ -6251,6 +6251,16 @@ nfsrv_layoutget(struct nfsrv_descript *n
error = nfsrv_findlayout(nd, &fh, p, &lyp);
NFSD_DEBUG(4, "layoutget findlay=%d\n", error);
if (error == 0) {
+ /*
+ * Not sure if the seqid must be the same, so I won't check it.
+ */
+ if (stateidp->other[0] != lyp->lay_stateid.other[0] ||
+ stateidp->other[1] != lyp->lay_stateid.other[1] ||
+ stateidp->other[2] != lyp->lay_stateid.other[2]) {
+ NFSUNLOCKLAYOUT(lhyp);
+ NFSD_DEBUG(1, "ret bad stateid\n");
+ return (NFSERR_BADSTATEID);
+ }
if (*iomode == NFSLAYOUTIOMODE_RW)
lyp->lay_rw = 1;
else
@@ -6260,9 +6270,6 @@ nfsrv_layoutget(struct nfsrv_descript *n
if (++lyp->lay_stateid.seqid == 0)
lyp->lay_stateid.seqid = 1;
stateidp->seqid = lyp->lay_stateid.seqid;
- stateidp->other[0] = lyp->lay_stateid.other[0];
- stateidp->other[1] = lyp->lay_stateid.other[1];
- stateidp->other[2] = lyp->lay_stateid.other[2];
NFSUNLOCKLAYOUT(lhyp);
NFSD_DEBUG(4, "ret fnd layout\n");
return (0);
More information about the svn-src-projects
mailing list