Date: Sat, 20 May 2017 01:04:47 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r318570 - projects/pnfs-planb-server/sys/fs/nfsserver Message-ID: <201705200104.v4K14l43023097@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705200104.v4K14l43023097>