From patchwork Tue Jul 25 19:52:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 9863117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AC4AB6038C for ; Tue, 25 Jul 2017 19:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5916286CC for ; Tue, 25 Jul 2017 19:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A4D1286F5; Tue, 25 Jul 2017 19:52:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F36C286CC for ; Tue, 25 Jul 2017 19:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751568AbdGYTwm (ORCPT ); Tue, 25 Jul 2017 15:52:42 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:38082 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbdGYTwj (ORCPT ); Tue, 25 Jul 2017 15:52:39 -0400 Received: by mail-io0-f195.google.com with SMTP id l7so9936147iof.5 for ; Tue, 25 Jul 2017 12:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l9M0V+inTGTKO7Py+ESHv+zS0GwMU2iZj3y2mnBA2wA=; b=vLaRqJE37ksITPzAvRt1NljzBNF19M4S5uS2J+jpU+9b+RTEK2uhxGlDygSmAQhS6v aIPF2NG/X7pI+DekI3Q+Ahpi+yJeXE7/rrm4LYEriiRBV0MTXOb/7N+I76EIeee5Os8z e4xrMdzXPtuRL4v+1RZf87Ykhau+9AhkVaaMSqB+ZcaGRK5V17KeSWmjelntC50PmSG1 PTec8FDS3zmquRLFsiuyG3eLva7367XWP+Ua6XGf7WZ0Toyl7EW8fO2AwMFxa+8dGJvJ 3fonXmZKamjesjC0P57cVyFgQLGLPKMAT6WFfh49ats9qhUOq+uP75+0+IJ59EZr9ckp Jggg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l9M0V+inTGTKO7Py+ESHv+zS0GwMU2iZj3y2mnBA2wA=; b=J71WBrfFfiIpkqL3lOJzFGne/qPiL2rs0baw4rqPXY1K2qnglKT5+oImWHnNKqppLm U5WhHyj+ZFF0K99hgcXghlGlNRKJxwN+owQVmalV2BZJ+amlFKHtDUmBxyHm82pH/rND WfEkciXhrhVdx54FZjAUiGekyQLmuJoKZw++RfpLuoEZ3+zr73o7rbwn6fQhcmeqMkvm z+hMv9bjZn9lQg16LYRojLo2UPj8pUgiGl+UgbOBV6rwGGXQ7AHNKZE4alnWnSX/4gKo zIv4BESkFBGV22hh/vj/GSO7nmnyamXlTrJvDG27qDm+uiiSiEwqtkHNCvCR2FWPFbAi JEzw== X-Gm-Message-State: AIVw1123WTLY8OtwuyGUMYvtDCM5YBEtCUwvFYof5aNaYADFUX684OG8 PCTqGrMjvEEgqQ== X-Received: by 10.107.19.133 with SMTP id 5mr19677426iot.312.1501012358544; Tue, 25 Jul 2017 12:52:38 -0700 (PDT) Received: from gouda.nowheycreamery.com (c-68-40-188-1.hsd1.mi.comcast.net. [68.40.188.1]) by smtp.gmail.com with ESMTPSA id a64sm5379299ita.19.2017.07.25.12.52.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 12:52:37 -0700 (PDT) Subject: Re: [4.13-rc2 regression] NFSv4 fails file permission tests in fstests generic/126 To: Eryu Guan , linux-nfs@vger.kernel.org Cc: Trond Myklebust References: <20170724141935.GF9167@eguan.usersys.redhat.com> From: Anna Schumaker Message-ID: <2a18fac0-1b5c-e3d7-43b6-d932709e7655@gmail.com> Date: Tue, 25 Jul 2017 15:52:36 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170724141935.GF9167@eguan.usersys.redhat.com> Content-Language: en-US Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Eryu, On 07/24/2017 10:19 AM, Eryu Guan wrote: > Hi all, > > I saw a new NFS failure in 4.13-rc2 kernel when running fstests > generic/126 on NFSv4 mounts, 4.13-rc1 kernel passed the same test. > > git bisect pointed the first bad to commit bd8b2441742b. > > commit bd8b2441742b49c76bec707757bd9c028ea9838e > Author: Trond Myklebust > Date: Tue Jul 11 17:54:34 2017 -0400 > > NFS: Store the raw NFS access mask in the inode's access cache > > Signed-off-by: Trond Myklebust > Signed-off-by: Anna Schumaker > > I can reproduce it manually with these steps: > > mount -t nfs -o vers=4.1 server:/export /mnt/nfs > cp /usr/bin/ls /mnt/nfs > chmod 001 /mnt/nfs/ls > chown 99:99 /mnt/nfs/ls > su testuser -c "/mnt/nfs/ls" > > (testuser uid and gid are not 99.) > > The last command got permission denied with 4.13-rc2. Thanks for letting me know! I think I see the problem: the patch changed how the access system call is cached but didn't update caching for NFSv4 opens (which is why v3 still passes). Does this patch help? > > Thanks, > Eryu > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e1a26c653e78..4893c9f9829b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2250,16 +2250,16 @@ static int nfs4_opendata_access(struct rpc_cred *cred, */ if (openflags & __FMODE_EXEC) { /* ONLY check for exec rights */ - mask = MAY_EXEC; + mask = NFS4_ACCESS_EXECUTE; } else if ((fmode & FMODE_READ) && !opendata->file_created) - mask = MAY_READ; + mask = NFS4_ACCESS_READ; cache.cred = cred; cache.jiffies = jiffies; nfs_access_set_mask(&cache, opendata->o_res.access_result); nfs_access_add_cache(state->inode, &cache); - if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0) + if ((mask & ~cache.mask & (NFS4_ACCESS_READ | NFS4_ACCESS_EXECUTE)) == 0) return 0; return -EACCES;