[PATCH] knfsd: Fix some more errno/nfserr confusion in vfs.c
nfsd_sync* return an errno, which usually needs to be converted to an errno, sometimes immediately, sometimes a little later. Also, nfsd_setattr returns an nfserr which SHOULDN'T be converted from an errno (because it isn't one). Also some tidyups of the form: err = XX err = nfserrno(err) and err = XX if (err) err = nfserrno(err) become err = nfserrno(XX) Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
7fcd53303d
commit
45bd3b3dff
|
@ -891,9 +891,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int stable = *stablep;
|
int stable = *stablep;
|
||||||
|
|
||||||
|
#ifdef MSNFS
|
||||||
err = nfserr_perm;
|
err = nfserr_perm;
|
||||||
|
|
||||||
#ifdef MSNFS
|
|
||||||
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
|
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
|
||||||
(!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
|
(!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1065,8 +1065,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||||
return err;
|
return err;
|
||||||
if (EX_ISSYNC(fhp->fh_export)) {
|
if (EX_ISSYNC(fhp->fh_export)) {
|
||||||
if (file->f_op && file->f_op->fsync) {
|
if (file->f_op && file->f_op->fsync) {
|
||||||
err = nfsd_sync(file);
|
err = nfserrno(nfsd_sync(file));
|
||||||
err = nfserrno(err);
|
|
||||||
} else {
|
} else {
|
||||||
err = nfserr_notsupp;
|
err = nfserr_notsupp;
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1176,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
|
|
||||||
if (EX_ISSYNC(fhp->fh_export)) {
|
if (EX_ISSYNC(fhp->fh_export)) {
|
||||||
err = nfsd_sync_dir(dentry);
|
err = nfserrno(nfsd_sync_dir(dentry));
|
||||||
write_inode_now(dchild->d_inode, 1);
|
write_inode_now(dchild->d_inode, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1310,9 +1309,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
|
|
||||||
if (EX_ISSYNC(fhp->fh_export)) {
|
if (EX_ISSYNC(fhp->fh_export)) {
|
||||||
err = nfsd_sync_dir(dentry);
|
err = nfserrno(nfsd_sync_dir(dentry));
|
||||||
if (err)
|
|
||||||
err = nfserrno(err);
|
|
||||||
/* setattr will sync the child (or not) */
|
/* setattr will sync the child (or not) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,7 +1336,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||||
if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
|
if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
|
||||||
int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
|
int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
|
||||||
if (err2)
|
if (err2)
|
||||||
err = nfserrno(err2);
|
err = err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1514,10 +1511,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
|
||||||
err = vfs_link(dold, dirp, dnew);
|
err = vfs_link(dold, dirp, dnew);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (EX_ISSYNC(ffhp->fh_export)) {
|
if (EX_ISSYNC(ffhp->fh_export)) {
|
||||||
err = nfsd_sync_dir(ddir);
|
err = nfserrno(nfsd_sync_dir(ddir));
|
||||||
write_inode_now(dest, 1);
|
write_inode_now(dest, 1);
|
||||||
if (err)
|
|
||||||
err = nfserrno(err);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (err == -EXDEV && rqstp->rq_vers == 2)
|
if (err == -EXDEV && rqstp->rq_vers == 2)
|
||||||
|
|
Loading…
Reference in New Issue