[no subject]

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

 



But if you really want this and you can tell me exactly where you want
the INT or INTL (and presumably int or intl for the be32 version) I'll do it.

> 
> A short comment that explains why these /internal/ error codes need
> big-endian versions would be helpful to add. I assume it's because
> they will be stored or returned via a __be32 result that actually
> does sometimes carry an on-the-wire status code.

Yes exactly.  I'll add some text like that.

Thanks,
NeilBrown

> 
> As a note about patch series organization, it would be helpful to
> split this hunk into a separate, preceding patch, IMO.
> 
> 
> >  /* Check for dir entries '.' and '..' */
> >  #define isdotent(n, l)	(l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
> > diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> > index a485d630d10e..8fb56e2f896c 100644
> > --- a/fs/nfsd/nfsfh.c
> > +++ b/fs/nfsd/nfsfh.c
> > @@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
> >   * the write call).
> >   */
> >  static inline __be32
> > -nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > -		umode_t requested)
> > +nfsd_mode_check(struct dentry *dentry, umode_t requested)
> >  {
> >  	umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
> >  
> > @@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> >  		}
> >  		return nfs_ok;
> >  	}
> > -	/*
> > -	 * v4 has an error more specific than err_notdir which we should
> > -	 * return in preference to err_notdir:
> > -	 */
> > -	if (rqstp->rq_vers == 4 && mode == S_IFLNK)
> > +	if (mode == S_IFLNK) {
> > +		if (requested == S_IFDIR)
> > +			return nfserr_symlink_not_dir;
> >  		return nfserr_symlink;
> > +	}
> >  	if (requested == S_IFDIR)
> >  		return nfserr_notdir;
> >  	if (mode == S_IFDIR)
> >  		return nfserr_isdir;
> > -	return nfserr_inval;
> > +	return nfserr_wrong_type;
> >  }
> >  
> >  static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
> > @@ -162,10 +160,8 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
> >  	int len;
> >  	__be32 error;
> >  
> > -	error = nfserr_stale;
> > -	if (rqstp->rq_vers > 2)
> > -		error = nfserr_badhandle;
> > -	if (rqstp->rq_vers == 4 && fh->fh_size == 0)
> > +	error = nfserr_badhandle;
> > +	if (fh->fh_size == 0)
> >  		return nfserr_nofilehandle;
> >  
> >  	if (fh->fh_version != 1)
> > @@ -239,9 +235,7 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
> >  	/*
> >  	 * Look up the dentry using the NFS file handle.
> >  	 */
> > -	error = nfserr_stale;
> > -	if (rqstp->rq_vers > 2)
> > -		error = nfserr_badhandle;
> > +	error = nfserr_badhandle;
> >  
> >  	fileid_type = fh->fh_fileid_type;
> >  
> > @@ -368,7 +362,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
> >  	if (error)
> >  		goto out;
> >  
> > -	error = nfsd_mode_check(rqstp, dentry, type);
> > +	error = nfsd_mode_check(dentry, type);
> >  	if (error)
> >  		goto out;
> >  
> > diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
> > index 5777f40c7353..9bb306bdc225 100644
> > --- a/fs/nfsd/nfsxdr.c
> > +++ b/fs/nfsd/nfsxdr.c
> > @@ -38,6 +38,25 @@ svcxdr_encode_stat(struct xdr_stream *xdr, __be32 status)
> >  {
> >  	__be32 *p;
> >  
> > +	switch (status) {
> > +	case nfserr_symlink_not_dir:
> > +		status = nfserr_notdir;
> > +		break;
> > +	case nfserr_symlink:
> > +	case nfserr_wrong_type:
> > +		status = nfserr_inval;
> > +		break;
> > +	case nfserr_nofilehandle:
> > +	case nfserr_badhandle:
> > +		status = nfserr_stale;
> > +		break;
> > +	case nfserr_wrongsec:
> > +	case nfserr_xdev:
> > +	case nfserr_file_open:
> > +		status = nfserr_acces;
> > +		break;
> > +	}
> > +
> 
> Same comment as above.
> 
> 
> >  	p = xdr_reserve_space(xdr, sizeof(status));
> >  	if (!p)
> >  		return false;
> > diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> > index 0862f6ae86a9..cf96a2ef6533 100644
> > --- a/fs/nfsd/vfs.c
> > +++ b/fs/nfsd/vfs.c
> > @@ -1770,10 +1770,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
> >  		if (!err)
> >  			err = nfserrno(commit_metadata(tfhp));
> >  	} else {
> > -		if (host_err == -EXDEV && rqstp->rq_vers == 2)
> > -			err = nfserr_acces;
> > -		else
> > -			err = nfserrno(host_err);
> > +		err = nfserrno(host_err);
> >  	}
> >  	dput(dnew);
> >  out_drop_write:
> > @@ -1839,7 +1836,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
> >  	if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen))
> >  		goto out;
> >  
> > -	err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
> > +	err = nfserr_xdev;
> >  	if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
> >  		goto out;
> >  	if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
> > @@ -1854,7 +1851,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
> >  
> >  	trap = lock_rename(tdentry, fdentry);
> >  	if (IS_ERR(trap)) {
> > -		err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
> > +		err = nfserr_xdev;
> >  		goto out_want_write;
> >  	}
> >  	err = fh_fill_pre_attrs(ffhp);
> > @@ -2023,10 +2020,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
> >  		/* name is mounted-on. There is no perfect
> >  		 * error status.
> >  		 */
> > -		if (nfsd_v4client(rqstp))
> > -			err = nfserr_file_open;
> > -		else
> > -			err = nfserr_acces;
> > +		err = nfserr_file_open;
> >  	} else {
> >  		err = nfserrno(host_err);
> >  	}
> > diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> > index 0d896ce296ce..04dad965fa66 100644
> > --- a/include/linux/nfs4.h
> > +++ b/include/linux/nfs4.h
> > @@ -290,6 +290,9 @@ enum nfsstat4 {
> >  	/* xattr (RFC8276) */
> >  	NFS4ERR_NOXATTR        = 10095,
> >  	NFS4ERR_XATTR2BIG      = 10096,
> > +
> > +	/* can be used for internal errors */
> > +	NFS4ERR_FIRST_FREE
> >  };
> >  
> >  /* error codes for internal client use */
> > -- 
> > 2.44.0
> > 
> 
> -- 
> Chuck Lever
> 






[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