Skip to content

Commit 11fcee0

Browse files
Trond MyklebustJ. Bruce Fields
authored andcommitted
NFSD: Add a cache for fs_locations information
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> [ 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 <chuck.lever@oracle.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 2f1ddda commit 11fcee0

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎fs/nfsd/nfsd.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,13 @@ static inline u32 nfsd_suppattrs2(u32 minorversion)
361361
#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
362362
NFSD_WRITEABLE_ATTRS_WORD2
363363

364+
extern int nfsd4_is_junction(struct dentry *dentry);
365+
#else
366+
static inline int nfsd4_is_junction(struct dentry *dentry)
367+
{
368+
return 0;
369+
}
370+
364371
#endif /* CONFIG_NFSD_V4 */
365372

366373
#endif /* LINUX_NFSD_NFSD_H */

‎fs/nfsd/vfs.c‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
168168
{
169169
if (d_mountpoint(dentry))
170170
return 1;
171+
if (nfsd4_is_junction(dentry))
172+
return 1;
171173
if (!(exp->ex_flags & NFSEXP_V4ROOT))
172174
return 0;
173175
return dentry->d_inode != NULL;
@@ -592,6 +594,22 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_ac
592594
return error;
593595
}
594596

597+
#define NFSD_XATTR_JUNCTION_PREFIX XATTR_TRUSTED_PREFIX "junction."
598+
#define NFSD_XATTR_JUNCTION_TYPE NFSD_XATTR_JUNCTION_PREFIX "type"
599+
int nfsd4_is_junction(struct dentry *dentry)
600+
{
601+
struct inode *inode = dentry->d_inode;
602+
603+
if (inode == NULL)
604+
return 0;
605+
if (inode->i_mode & S_IXUGO)
606+
return 0;
607+
if (!(inode->i_mode & S_ISVTX))
608+
return 0;
609+
if (vfs_getxattr(dentry, NFSD_XATTR_JUNCTION_TYPE, NULL, 0) <= 0)
610+
return 0;
611+
return 1;
612+
}
595613
#endif /* defined(CONFIG_NFSD_V4) */
596614

597615
#ifdef CONFIG_NFSD_V3

0 commit comments

Comments
 (0)