Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / fs / nfsd / vfs.c
index bd0a385..c0dc491 100644 (file)
@@ -525,7 +525,7 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
 #endif
 
 __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst,
-               u64 dst_pos, u64 count)
+               u64 dst_pos, u64 count, bool sync)
 {
        loff_t cloned;
 
@@ -534,6 +534,12 @@ __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst,
                return nfserrno(cloned);
        if (count && cloned != count)
                return nfserrno(-EINVAL);
+       if (sync) {
+               loff_t dst_end = count ? dst_pos + count - 1 : LLONG_MAX;
+               int status = vfs_fsync_range(dst, dst_pos, dst_end, 0);
+               if (status < 0)
+                       return nfserrno(status);
+       }
        return 0;
 }
 
@@ -1809,7 +1815,17 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
 out_drop_write:
        fh_drop_write(fhp);
 out_nfserr:
-       err = nfserrno(host_err);
+       if (host_err == -EBUSY) {
+               /* name is mounted-on. There is no perfect
+                * error status.
+                */
+               if (nfsd_v4client(rqstp))
+                       err = nfserr_file_open;
+               else
+                       err = nfserr_acces;
+       } else {
+               err = nfserrno(host_err);
+       }
 out:
        return err;
 }