From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn3nam01on0092.outbound.protection.outlook.com ([104.47.33.92]:53808 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032305AbeCAPcc (ORCPT ); Thu, 1 Mar 2018 10:32:32 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Trond Myklebust , "J . Bruce Fields" , Sasha Levin Subject: [added to the 4.1 stable tree] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0) Date: Thu, 1 Mar 2018 15:25:27 +0000 Message-ID: <20180301152116.1486-268-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Trond Myklebust This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit fb500a7cfee7f2f447d2bbf30cb59629feab6ac1 ] Signed-off-by: Trond Myklebust Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 529434f926f1..72019f141ebc 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -63,6 +63,9 @@ static const stateid_t zero_stateid =3D { static const stateid_t currentstateid =3D { .si_generation =3D 1, }; +static const stateid_t close_stateid =3D { + .si_generation =3D 0xffffffffU, +}; =20 static u64 current_sessionid =3D 1; =20 @@ -5107,6 +5110,11 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_com= pound_state *cstate, =20 nfsd4_close_open_stateid(stp); =20 + /* See RFC5661 sectionm 18.2.4 */ + if (stp->st_stid.sc_client->cl_minorversion) + memcpy(&close->cl_stateid, &close_stateid, + sizeof(close->cl_stateid)); + /* put reference from nfs4_preprocess_seqid_op */ nfs4_put_stid(&stp->st_stid); out: --=20 2.14.1