aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-18 20:43:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-18 22:20:28 -0500
commit45bd3b3dffaa9fb1706fe001bf66276d0997a850 (patch)
tree9b5a8dc7f619cea36b3ad87d0dbd4545e24d0336
parent7fcd53303de8dbbed863f6471ca92eb96a1faa28 (diff)
[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>
-rw-r--r--fs/nfsd/vfs.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index e6dfa149a300..5320e5afaddb 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -891,9 +891,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
891 int err = 0; 891 int err = 0;
892 int stable = *stablep; 892 int stable = *stablep;
893 893
894#ifdef MSNFS
894 err = nfserr_perm; 895 err = nfserr_perm;
895 896
896#ifdef MSNFS
897 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && 897 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
898 (!lock_may_write(file->f_dentry->d_inode, offset, cnt))) 898 (!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
899 goto out; 899 goto out;
@@ -1065,8 +1065,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
1065 return err; 1065 return err;
1066 if (EX_ISSYNC(fhp->fh_export)) { 1066 if (EX_ISSYNC(fhp->fh_export)) {
1067 if (file->f_op && file->f_op->fsync) { 1067 if (file->f_op && file->f_op->fsync) {
1068 err = nfsd_sync(file); 1068 err = nfserrno(nfsd_sync(file));
1069 err = nfserrno(err);
1070 } else { 1069 } else {
1071 err = nfserr_notsupp; 1070 err = nfserr_notsupp;
1072 } 1071 }
@@ -1177,7 +1176,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1177 goto out_nfserr; 1176 goto out_nfserr;
1178 1177
1179 if (EX_ISSYNC(fhp->fh_export)) { 1178 if (EX_ISSYNC(fhp->fh_export)) {
1180 err = nfsd_sync_dir(dentry); 1179 err = nfserrno(nfsd_sync_dir(dentry));
1181 write_inode_now(dchild->d_inode, 1); 1180 write_inode_now(dchild->d_inode, 1);
1182 } 1181 }
1183 1182
@@ -1310,9 +1309,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1310 goto out_nfserr; 1309 goto out_nfserr;
1311 1310
1312 if (EX_ISSYNC(fhp->fh_export)) { 1311 if (EX_ISSYNC(fhp->fh_export)) {
1313 err = nfsd_sync_dir(dentry); 1312 err = nfserrno(nfsd_sync_dir(dentry));
1314 if (err)
1315 err = nfserrno(err);
1316 /* setattr will sync the child (or not) */ 1313 /* setattr will sync the child (or not) */
1317 } 1314 }
1318 1315
@@ -1339,7 +1336,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1339 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { 1336 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
1340 int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1337 int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1341 if (err2) 1338 if (err2)
1342 err = nfserrno(err2); 1339 err = err2;
1343 } 1340 }
1344 1341
1345 /* 1342 /*
@@ -1514,10 +1511,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1514 err = vfs_link(dold, dirp, dnew); 1511 err = vfs_link(dold, dirp, dnew);
1515 if (!err) { 1512 if (!err) {
1516 if (EX_ISSYNC(ffhp->fh_export)) { 1513 if (EX_ISSYNC(ffhp->fh_export)) {
1517 err = nfsd_sync_dir(ddir); 1514 err = nfserrno(nfsd_sync_dir(ddir));
1518 write_inode_now(dest, 1); 1515 write_inode_now(dest, 1);
1519 if (err)
1520 err = nfserrno(err);
1521 } 1516 }
1522 } else { 1517 } else {
1523 if (err == -EXDEV && rqstp->rq_vers == 2) 1518 if (err == -EXDEV && rqstp->rq_vers == 2)