From patchwork Tue Oct 2 21:49:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 1539251 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E1D38DFFAD for ; Tue, 2 Oct 2012 21:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932420Ab2JBVt5 (ORCPT ); Tue, 2 Oct 2012 17:49:57 -0400 Received: from mx2.netapp.com ([216.240.18.37]:51119 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932415Ab2JBVt4 (ORCPT ); Tue, 2 Oct 2012 17:49:56 -0400 X-IronPort-AV: E=Sophos;i="4.80,524,1344236400"; d="scan'208";a="696698730" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 02 Oct 2012 14:49:56 -0700 Received: from cyclsvl29.eng.netapp.com (cyclsvl29.eng.netapp.com [10.56.8.224]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q92LntJF003173; Tue, 2 Oct 2012 14:49:56 -0700 (PDT) From: Weston Andros Adamson To: Trond.Myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 1/2] NFSv4: don't check MAY_WRITE access bit in OPEN Date: Tue, 2 Oct 2012 14:49:51 -0700 Message-Id: <1349214592-11717-2-git-send-email-dros@netapp.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349214592-11717-1-git-send-email-dros@netapp.com> References: <1349214592-11717-1-git-send-email-dros@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Don't check MAY_WRITE as a newly created file may not have write mode bits, but POSIX allows the creating process to write regardless. This is ok because NFSv4 OPEN ops handle write permissions correctly - the ACCESS in the OPEN compound is to differentiate READ v EXEC permissions. Signed-off-by: Weston Andros Adamson --- fs/nfs/nfs4proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1e0faf9..ccada68 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1661,10 +1661,10 @@ static int nfs4_opendata_access(struct rpc_cred *cred, return 0; mask = 0; + /* don't check MAY_WRITE - a newly created file may not have + * write mode bits, but POSIX allows the creating process to write */ if (fmode & FMODE_READ) mask |= MAY_READ; - if (fmode & FMODE_WRITE) - mask |= MAY_WRITE; if (fmode & FMODE_EXEC) mask |= MAY_EXEC; @@ -1673,7 +1673,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred, nfs_access_set_mask(&cache, opendata->o_res.access_result); nfs_access_add_cache(state->inode, &cache); - if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) + if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0) return 0; /* even though OPEN succeeded, access is denied. Close the file */