]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - spl/module/spl/spl-vnode.c
UBUNTU: SAUCE: (noup) Update spl to 0.6.5.10-1, zfs to 0.6.5.10-1ubuntu2
[mirror_ubuntu-bionic-kernel.git] / spl / module / spl / spl-vnode.c
index 6ee147e0e7d8e71111f8cec3a93ff639232a878e..e3188a1af8b091523402f0a28b66d6abda59e85e 100644 (file)
@@ -578,6 +578,9 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
     offset_t offset, void *x6, void *x7)
 {
        int error = EOPNOTSUPP;
+#ifdef FALLOC_FL_PUNCH_HOLE
+       int fstrans;
+#endif
 
        if (cmd != F_FREESP || bfp->l_whence != 0)
                return (EOPNOTSUPP);
@@ -587,6 +590,14 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
        ASSERT(bfp->l_start >= 0 && bfp->l_len > 0);
 
 #ifdef FALLOC_FL_PUNCH_HOLE
+       /*
+        * May enter XFS which generates a warning when PF_FSTRANS is set.
+        * To avoid this the flag is cleared over vfs_sync() and then reset.
+        */
+       fstrans = __spl_pf_fstrans_check();
+       if (fstrans)
+               current->flags &= ~(__SPL_PF_FSTRANS);
+
        /*
         * When supported by the underlying file system preferentially
         * use the fallocate() callback to preallocate the space.
@@ -594,6 +605,10 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
        error = -spl_filp_fallocate(vp->v_file,
            FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE,
            bfp->l_start, bfp->l_len);
+
+       if (fstrans)
+               current->flags |= __SPL_PF_FSTRANS;
+
        if (error == 0)
                return (0);
 #endif