Re: [PATCH 3/3] NFSD: Add a cache for fs_locations information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 13 Sep 2011 09:16:54 -0400
Jeff Layton <jlayton@xxxxxxxxxx> wrote:

> On Mon, 12 Sep 2011 19:37:26 -0400
> Chuck Lever <chuck.lever@xxxxxxxxxx> wrote:
> 
> > From: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
> > 
> > Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
> > [ 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@xxxxxxxxxx>
> > ---
> > 
> >  fs/nfsd/nfsd.h |    7 +++++++
> >  fs/nfsd/vfs.c  |   18 ++++++++++++++++++
> >  2 files changed, 25 insertions(+), 0 deletions(-)
> > 
> > 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..d1d4d5e 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,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;
> 
> 	^^^^^^^^^^^^^^^^^^
> 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...

> > +	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 majordomo@xxxxxxxxxxxxxxx
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> Other than that, this (and the previous patches) look fine...

You can add my reviewed by on this patch and the others...

Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux