Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc
[pandora-kernel.git] / fs / nfsd / vfs.c
index e6dfa14..6aa92d0 100644 (file)
@@ -371,7 +371,6 @@ out_nfserr:
 static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
 {
        ssize_t buflen;
-       int error;
 
        buflen = vfs_getxattr(dentry, key, NULL, 0);
        if (buflen <= 0)
@@ -381,10 +380,7 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
        if (!*buf)
                return -ENOMEM;
 
-       error = vfs_getxattr(dentry, key, *buf, buflen);
-       if (error < 0)
-               return error;
-       return buflen;
+       return vfs_getxattr(dentry, key, *buf, buflen);
 }
 #endif
 
@@ -706,7 +702,7 @@ nfsd_close(struct file *filp)
  * after it.
  */
 static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
-                             struct file_operations *fop)
+                             const struct file_operations *fop)
 {
        struct inode *inode = dp->d_inode;
        int (*fsync) (struct file *, struct dentry *, int);
@@ -891,9 +887,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
        int                     err = 0;
        int                     stable = *stablep;
 
+#ifdef MSNFS
        err = nfserr_perm;
 
-#ifdef MSNFS
        if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
                (!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
                goto out;
@@ -1065,8 +1061,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
                return err;
        if (EX_ISSYNC(fhp->fh_export)) {
                if (file->f_op && file->f_op->fsync) {
-                       err = nfsd_sync(file);
-                       err = nfserrno(err);
+                       err = nfserrno(nfsd_sync(file));
                } else {
                        err = nfserr_notsupp;
                }
@@ -1177,7 +1172,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                goto out_nfserr;
 
        if (EX_ISSYNC(fhp->fh_export)) {
-               err = nfsd_sync_dir(dentry);
+               err = nfserrno(nfsd_sync_dir(dentry));
                write_inode_now(dchild->d_inode, 1);
        }
 
@@ -1310,9 +1305,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
                goto out_nfserr;
 
        if (EX_ISSYNC(fhp->fh_export)) {
-               err = nfsd_sync_dir(dentry);
-               if (err)
-                       err = nfserrno(err);
+               err = nfserrno(nfsd_sync_dir(dentry));
                /* setattr will sync the child (or not) */
        }
 
@@ -1339,7 +1332,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
        if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
                int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
                if (err2)
-                       err = nfserrno(err2);
+                       err = err2;
        }
 
        /*
@@ -1514,10 +1507,8 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
        err = vfs_link(dold, dirp, dnew);
        if (!err) {
                if (EX_ISSYNC(ffhp->fh_export)) {
-                       err = nfsd_sync_dir(ddir);
+                       err = nfserrno(nfsd_sync_dir(ddir));
                        write_inode_now(dest, 1);
-                       if (err)
-                               err = nfserrno(err);
                }
        } else {
                if (err == -EXDEV && rqstp->rq_vers == 2)