From patchwork Sun Apr 10 16:29:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Fields X-Patchwork-Id: 696741 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3AGTgl8006525 for ; Sun, 10 Apr 2011 16:29:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754912Ab1DJQ3m (ORCPT ); Sun, 10 Apr 2011 12:29:42 -0400 Received: from fieldses.org ([174.143.236.118]:57453 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754908Ab1DJQ3j (ORCPT ); Sun, 10 Apr 2011 12:29:39 -0400 Received: from bfields by fieldses.org with local (Exim 4.72) (envelope-from ) id 1Q8xW5-00076Z-Aa; Sun, 10 Apr 2011 12:29:37 -0400 From: "J. Bruce Fields" To: "linux-nfs@vger.kernel.org" Cc: Bryan Schumaker , "J. Bruce Fields" Subject: [PATCH 1/5] nfsd: distinguish functions of NFSD_MAY_* flags Date: Sun, 10 Apr 2011 12:29:29 -0400 Message-Id: <1302452973-27272-1-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20110410162536.GC26233@fieldses.org> References: <20110410162536.GC26233@fieldses.org> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 10 Apr 2011 16:29:43 +0000 (UTC) Most of the NFSD_MAY_* flags actually request permissions, but over the years we've accreted a few that modify the behavior of the permission or open code in other ways. Distinguish the two cases a little more. In particular, allow the shortcut at the start of nfsd_permission to ignore the non-permission-requesting bits. Signed-off-by: J. Bruce Fields --- fs/nfsd/vfs.c | 2 +- fs/nfsd/vfs.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2e1cebd..ac4f0b4 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -2027,7 +2027,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, struct inode *inode = dentry->d_inode; int err; - if (acc == NFSD_MAY_NOP) + if (acc & NFSD_MAY_MASK == NFSD_MAY_NOP) return 0; #if 0 dprintk("nfsd: permission 0x%x%s%s%s%s%s%s%s mode 0%o%s%s%s\n", diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index 9a370a5..1036913 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -17,6 +17,9 @@ #define NFSD_MAY_SATTR 8 #define NFSD_MAY_TRUNC 16 #define NFSD_MAY_LOCK 32 +#define NFSD_MAY_MASK 63 + +/* extra hints to permission and open routines: */ #define NFSD_MAY_OWNER_OVERRIDE 64 #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256