Return-Path: Received: from mail-co1nam03on0114.outbound.protection.outlook.com ([104.47.40.114]:10656 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965951AbeCSQGz (ORCPT ); Mon, 19 Mar 2018 12:06:55 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Trond Myklebust , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 019/167] NFSv4.1: Work around a Linux server bug... Date: Mon, 19 Mar 2018 16:05:45 +0000 Message-ID: <20180319160513.16384-19-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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 [ Upstream commit f4b23de3dda1536590787c9e5c3d16b8738ab108 ] It turns out the Linux server has a bug in its implementation of supattr_exclcreat; it returns the set of all attributes, whether or not they are supported by minor version 1. In order to avoid a regression, we therefore apply the supported_attrs as a mask on top of whatever the server sent us. Reported-by: Anna Schumaker Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfs4proc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index bcfddfc7a1f4..0f397e62de5a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3025,6 +3025,7 @@ static int _nfs4_server_capabilities(struct nfs_serve= r *server, struct nfs_fh *f .rpc_resp =3D &res, }; int status; + int i; =20 bitmask[0] =3D FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_FH_EXPIRE_TYPE | @@ -3090,8 +3091,13 @@ static int _nfs4_server_capabilities(struct nfs_serv= er *server, struct nfs_fh *f server->cache_consistency_bitmask[0] &=3D FATTR4_WORD0_CHANGE|FATTR4_WOR= D0_SIZE; server->cache_consistency_bitmask[1] &=3D FATTR4_WORD1_TIME_METADATA|FAT= TR4_WORD1_TIME_MODIFY; server->cache_consistency_bitmask[2] =3D 0; + + /* Avoid a regression due to buggy server */ + for (i =3D 0; i < ARRAY_SIZE(res.exclcreat_bitmask); i++) + res.exclcreat_bitmask[i] &=3D res.attr_bitmask[i]; memcpy(server->exclcreat_bitmask, res.exclcreat_bitmask, sizeof(server->exclcreat_bitmask)); + server->acl_bitmask =3D res.acl_bitmask; server->fh_expire_type =3D res.fh_expire_type; } --=20 2.14.1