From owner-svn-src-projects@freebsd.org Sat May 20 01:04:49 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10E4AD73C67 for ; Sat, 20 May 2017 01:04:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6E001ECB; Sat, 20 May 2017 01:04:48 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4K14l0d023098; Sat, 20 May 2017 01:04:47 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4K14l43023097; Sat, 20 May 2017 01:04:47 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201705200104.v4K14l43023097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 20 May 2017 01:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r318570 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 May 2017 01:04:49 -0000 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);