NFSD support for FedFS junctions [v3]
Subsystems (2)
cover NFSD support for FedFS junctions [v3]
Sometime soon we are going to have easy-to-install user space FedFS components. Here are kernel patches needed to make server-side FedFS support work. Please consider these for the 3.2 kernel.
This respin addresses recent review comments.
Note that because NFSD previously didn't care about the execute bits of junctions, neither does fedfs-utils-0.7.0 (released September 3, 2011). Junctions created by this release and previous releases have the sticky bit set, but the other mode bits are left untouched during junction creation.
I will publish fedfs-utils-0.7.1 soon with a commit that makes new junctions non-executable.
---
Trond Myklebust (3):
NFSD: Add a cache for fs_locations information
NFSD: Remove the ex_pathname field from struct svc_export
NFSD: Cleanup for nfsd4_path()
fs/nfsd/export.c | 15 +----- fs/nfsd/nfs4xdr.c | 106 ++++++++++++++++++++++++++++++++----------- fs/nfsd/nfsd.h | 7 +++ fs/nfsd/vfs.c | 18 +++++++ include/linux/nfsd/export.h | 2 - 5 files changed, 106 insertions(+), 42 deletions(-)
Signature · 1 line
Chuck Lever
PATCH 1/3 NFSD: Cleanup for nfsd4_path()
From: Trond Myklebust <[email protected]>
The current code is sort of hackish in that it assumes a referral is always matched to an export. When we add support for junctions that may not be the case.
We can replace nfsd4_path() with a function that encodes the components directly from the dentries. Since nfsd4_path is currently the only user of the 'ex_pathname' field in struct svc_export, this has the added benefit of allowing us to get rid of that.
---
fs/nfsd/export.c | 4 +- fs/nfsd/nfs4xdr.c | 106 ++++++++++++++++++++++++++++++++----------- include/linux/nfsd/export.h | 1 3 files changed, 81 insertions(+), 30 deletions(-)
fs/nfsd/export.c +2 -2
@@ -1010,7 +1010,7 @@ rqst_exp_parent(struct svc_rqst *rqstp, struct path *path)return exp; } -static struct svc_export *find_fsidzero_export (struct svc_rqst *rqstp) +struct svc_export *rqst_find_fsidzero_export (struct svc_rqst *rqstp) {u32 fsidv[2 ];
@@ -1030,7 +1030,7 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)struct svc_export *exp;__be32 rv; - exp =find_fsidzero_export (rqstp); + exp =rqst_find_fsidzero_export (rqstp);if (IS_ERR (exp))return nfserrno (PTR_ERR (exp)); rv =fh_compose (fhp, exp, exp->ex_path.dentry,NULL );
fs/nfsd/nfs4xdr.c +78 -28
125 lines not on this page · raw message
include/linux/nfsd/export.h +1 -0
@@ -137,6 +137,7 @@ struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, struct path *);struct svc_export *rqst_exp_parent (struct svc_rqst *,struct path *); +struct svc_export *rqst_find_fsidzero_export (struct svc_rqst *);int exp_rootfh (struct auth_domain *,char *path,struct knfsd_fh *,int maxsize);__be32 exp_pseudoroot (struct svc_rqst *,struct svc_fh *);
PATCH 2/3 NFSD: Remove the ex_pathname field from struct svc_export
In reply to Chuck LeverFrom: Trond Myklebust <[email protected]>
There are no more users...
---
fs/nfsd/export.c | 11 ----------- include/linux/nfsd/export.h | 1 - 2 files changed, 0 insertions(+), 12 deletions(-)
fs/nfsd/export.c +0 -11
@@ -318,7 +318,6 @@ static void svc_export_put(struct kref *ref) struct svc_export *exp = container_of(ref, struct svc_export, h.ref);path_put (&exp->ex_path);auth_domain_put (exp->ex_client); -kfree (exp->ex_pathname);nfsd4_fslocs_free (&exp->ex_fslocs);kfree (exp); }
@@ -528,11 +527,6 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) exp.ex_client = dom; - err = -ENOMEM ; - exp.ex_pathname =kstrdup (buf,GFP_KERNEL ); -if (!exp.ex_pathname) - goto out2; -/* expiry */ err = -EINVAL ; exp.h.expiry_time =get_expiry (&mesg);
@@ -613,8 +607,6 @@ out4:nfsd4_fslocs_free (&exp.ex_fslocs);kfree (exp.ex_uuid); out3: -kfree (exp.ex_pathname); -out2:path_put (&exp.ex_path); out1:auth_domain_put (dom);
@@ -678,7 +670,6 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem) new->ex_client = item->ex_client; new->ex_path.dentry =dget (item->ex_path.dentry); new->ex_path.mnt =mntget (item->ex_path.mnt); - new->ex_pathname =NULL ; new->ex_fslocs.locations =NULL ; new->ex_fslocs.locations_count =0 ; new->ex_fslocs.migrated =0 ;
@@ -696,8 +687,6 @@ static void export_update(struct cache_head *cnew, struct cache_head *citem) new->ex_fsid = item->ex_fsid; new->ex_uuid = item->ex_uuid; item->ex_uuid =NULL ; - new->ex_pathname = item->ex_pathname; - item->ex_pathname =NULL ; new->ex_fslocs.locations = item->ex_fslocs.locations; item->ex_fslocs.locations =NULL ; new->ex_fslocs.locations_count = item->ex_fslocs.locations_count;
include/linux/nfsd/export.h +0 -1
@@ -96,7 +96,6 @@ struct svc_export {struct auth_domain * ex_client;int ex_flags;struct path ex_path; -char *ex_pathname;uid_t ex_anon_uid;gid_t ex_anon_gid;int ex_fsid;
PATCH 3/3 NFSD: Add a cache for fs_locations information
In reply to Chuck LeverFrom: Trond Myklebust <[email protected]>
---
fs/nfsd/nfsd.h | 7 +++++++ fs/nfsd/vfs.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-)
fs/nfsd/nfsd.h +7 -0
@@ -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 */
fs/nfsd/vfs.c +18 -0
@@ -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,22 @@ 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_IXUGO ) +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
Re: [PATCH 3/3] NFSD: Add a cache for fs_locations information
Quoted 49 lines · On Mon, 12 Sep 2011 19:37:26 -0400 Chuck Lever <[email protected]> wrote:
From: Trond Myklebust <[email protected]>
Signed-off-by Trond Myklebust <[email protected]>[ 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 <[email protected]>---
fs/nfsd/nfsd.h | 7 +++++++ fs/nfsd/vfs.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-)fs/nfsd/nfsd.h +7
-0@@ -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 */ fs/nfsd/vfs.c +4
-0@@ -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,22 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_acreturn error; } +#define NFSD_XATTR_JUNCTION_PREFIX XATTR_TRUSTED_PREFIX "junction." +#define NFSD_XATTR_JUNCTION_TYPE NFSD_XATTR_JUNCTION_PREFIX "type"
fs/nfsd/vfs.c nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_ac · line 608
Quoted 10 lines
fs/nfsd/vfs.c +10
-0+int nfsd4_is_junction (struct dentry *dentry) +{ +struct inode *inode = dentry->d_inode; + +if (inode ==NULL ) +return 0 ; +if (inode->i_mode &S_IXUGO ) +return 0 ; +if (!(inode->i_mode &S_ISVTX )) +return 0 ;
^^^^^^^^^^^^^^^^^^
Minor nit: it's more likely that a directory will have the execute bit set everywhere than the sticky bit. Checking for the sticky bit first seems like it might cut out some unnecessary checks for S_IXUGO.
Quoted 9 lines
fs/nfsd/vfs.c +4
-1+if (vfs_getxattr (dentry,NFSD_XATTR_JUNCTION_TYPE ,NULL ,0 ) <=0 ) +return 0 ; + return 1; +}#endif /* defined(CONFIG_NFSD_V4) */ #ifdef CONFIG_NFSD_V3 --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Other than that, this (and the previous patches) look fine...
Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
Reviewed-byRe: [PATCH 3/3] NFSD: Add a cache for fs_locations information
Quoted 64 lines · On Tue, 13 Sep 2011 09:16:54 -0400 Jeff Layton <[email protected]> wrote:
Quoted 49 lines · On Mon, 12 Sep 2011 19:37:26 -0400 Chuck Lever <[email protected]> wrote:
From: Trond Myklebust <[email protected]>
Signed-off-by Trond Myklebust <[email protected]>[ 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 <[email protected]>---
fs/nfsd/nfsd.h | 7 +++++++ fs/nfsd/vfs.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-)fs/nfsd/nfsd.h +7
-0@@ -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 */ fs/nfsd/vfs.c +4
-0@@ -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,22 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_acreturn error; } +#define NFSD_XATTR_JUNCTION_PREFIX XATTR_TRUSTED_PREFIX "junction." +#define NFSD_XATTR_JUNCTION_TYPE NFSD_XATTR_JUNCTION_PREFIX "type"fs/nfsd/vfs.c nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_ac · line 608
Quoted 10 lines
fs/nfsd/vfs.c +10
-0+int nfsd4_is_junction (struct dentry *dentry) +{ +struct inode *inode = dentry->d_inode; + +if (inode ==NULL ) +return 0 ; +if (inode->i_mode &S_IXUGO ) +return 0 ; +if (!(inode->i_mode &S_ISVTX )) +return 0 ;^^^^^^^^^^^^^^^^^^
Quoted 4 lines
Minor nit: it's more likely that a directory will have the execute bit set everywhere than the sticky bit. Checking for the sticky bit first seems like it might cut out some unnecessary checks for
S_IXUGO.
Chuck pointed out on IRC that he's checking for an absence of execute bits in the first check, which is probably more rare than having the sticky bit set. So my nit above isn't correct...
Quoted 6 lines
Quoted 6 lines
fs/nfsd/vfs.c +4
-0+if (vfs_getxattr (dentry,NFSD_XATTR_JUNCTION_TYPE ,NULL ,0 ) <=0 ) +return 0 ; + return 1; +}#endif /* defined(CONFIG_NFSD_V4) */
Quoted 8 lines
Quoted 6 lines
fs/nfsd/vfs.c +0
-1#ifdef CONFIG_NFSD_V3 --To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlOther than that, this (and the previous patches) look fine...
You can add my reviewed by on this patch and the others...
Re: [PATCH 3/3] NFSD: Add a cache for fs_locations information
In reply to a message not in the archiveQuoted 5 lines · Chuck Lever
From: Trond Myklebust <[email protected]>
Signed-off-by Trond Myklebust <[email protected]>[ cel: since this is server-side, use nfsd4_ prefix instead of nfs4_ prefix. ][ cel: implement S_ISVTX filter in bfields-normal form ]
Hm.--b.
Quoted 66 lines
Signed-off-by Chuck Lever <[email protected]>---
fs/nfsd/nfsd.h | 7 +++++++ fs/nfsd/vfs.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-)fs/nfsd/nfsd.h +7
-0@@ -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 */ fs/nfsd/vfs.c +18
-1@@ -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,22 @@ 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_IXUGO ) +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 --To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] NFSD: Add a cache for fs_locations information
In reply to a message not in the archiveQuoted 1 line · Jeff Layton
You can add my reviewed by on this patch and the others...
OK, thanks to both of you, applying for 3.2.--b.
Quoted 6 lines
Reviewed-by Jeff Layton <[email protected]>--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html