From patchwork Fri Sep 2 16:38:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 1122652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p82Ghrsi021800 for ; Fri, 2 Sep 2011 16:43:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753399Ab1IBQn5 (ORCPT ); Fri, 2 Sep 2011 12:43:57 -0400 Received: from mail-qw0-f42.google.com ([209.85.216.42]:45650 "EHLO mail-qw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753195Ab1IBQn4 (ORCPT ); Fri, 2 Sep 2011 12:43:56 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 02 Sep 2011 16:43:57 +0000 (UTC) X-Greylist: delayed 339 seconds by postgrey-1.27 at vger.kernel.org; Fri, 02 Sep 2011 12:43:56 EDT Received: by qwi4 with SMTP id 4so2943403qwi.1 for ; Fri, 02 Sep 2011 09:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:subject:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=fn1kB/n0ALaj2ZH7TrRd7UCD6NACHJYP4TYUFt1T6kY=; b=DRMtYIJJqPnfILWgKS+pIhYL7YwDAgCwPHHl356MIeplKu/lIS3Ex1774qdjGLI7RK CuaSHa46+VRtnVWsF67GNLk9kXlvibAl1sHvucWV+YY1r4vrMzKw8MbIloTsLuaHQwTh +6dl/voXbBsysoIES/kD7TCY80cnF1WSiY+js= Received: by 10.224.32.197 with SMTP id e5mr934679qad.323.1314981524735; Fri, 02 Sep 2011 09:38:44 -0700 (PDT) Received: from matisse.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net. [99.26.161.222]) by mx.google.com with ESMTPS id ed9sm838138qab.5.2011.09.02.09.38.43 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Sep 2011 09:38:44 -0700 (PDT) From: Chuck Lever Subject: [PATCH 3/3] NFSD: Add a cache for fs_locations information To: linux-nfs@vger.kernel.org Date: Fri, 02 Sep 2011 12:38:42 -0400 Message-ID: <20110902163842.32190.52896.stgit@matisse.1015granger.net> In-Reply-To: <20110902162210.32190.5880.stgit@matisse.1015granger.net> References: <20110902162210.32190.5880.stgit@matisse.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Signed-off-by: Trond Myklebust [ cel: since this is server-side, use nfsd4_ prefix instead of nfs4_ prefix. ] [ cel: implement S_ISVTX filter in bfields-normal form ] Signed-off-by: Chuck Lever --- fs/nfsd/nfsd.h | 7 +++++++ fs/nfsd/vfs.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 0 deletions(-) -- 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/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 7ecfa24..d314812 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -335,6 +335,13 @@ static inline u32 nfsd_suppattrs2(u32 minorversion) #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \ NFSD_WRITEABLE_ATTRS_WORD2 +extern int nfsd4_is_junction(struct dentry *dentry); +#else +static inline int nfsd4_is_junction(struct dentry *dentry) +{ + return 0; +} + #endif /* CONFIG_NFSD_V4 */ #endif /* LINUX_NFSD_NFSD_H */ diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index fd0acca..1f2d5bf 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -168,6 +168,8 @@ int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) { if (d_mountpoint(dentry)) return 1; + if (nfsd4_is_junction(dentry)) + return 1; if (!(exp->ex_flags & NFSEXP_V4ROOT)) return 0; return dentry->d_inode != NULL; @@ -592,6 +594,20 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_ac return error; } +#define NFSD_XATTR_JUNCTION_PREFIX XATTR_TRUSTED_PREFIX "junction." +#define NFSD_XATTR_JUNCTION_TYPE NFSD_XATTR_JUNCTION_PREFIX "type" +int nfsd4_is_junction(struct dentry *dentry) +{ + struct inode *inode = dentry->d_inode; + + if (inode == NULL) + return 0; + if (!(inode->i_mode & S_ISVTX)) + return 0; + if (vfs_getxattr(dentry, NFSD_XATTR_JUNCTION_TYPE, NULL, 0) <= 0) + return 0; + return 1; +} #endif /* defined(CONFIG_NFSD_V4) */ #ifdef CONFIG_NFSD_V3