]> granicus.if.org Git - zfs/commitdiff
Fix lseek result when dnode is dirty
authordbavatar <dbavatar@gmail.com>
Mon, 24 Apr 2017 16:38:31 +0000 (12:38 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 24 Apr 2017 16:38:31 +0000 (09:38 -0700)
Fixup commit 66aca24.  We should have equivalent return
values as generic_file_llseek() and advance to end of file.

Reviewed-by: Richard Yao <ryao@gentoo.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Tested-by: bunder2015 <omfgbunder@gmail.com>
Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>
Closes #6050
Closes #6053

module/zfs/zfs_vnops.c

index 72a3104c71a1039311b8735ec3d0636ba8f7f1ec..c065c0c59b18023863ee869750c6647b769116cb 100644 (file)
@@ -278,9 +278,13 @@ zfs_holey_common(struct inode *ip, int cmd, loff_t *off)
        if (error == ESRCH)
                return (SET_ERROR(ENXIO));
 
-       /* file was dirty, so fall back to using file_sz logic */
-       if (error == EBUSY)
-               error = 0;
+       /* file was dirty, so fall back to using generic logic */
+       if (error == EBUSY) {
+               if (hole)
+                       *off = file_sz;
+
+               return (0);
+       }
 
        /*
         * We could find a hole that begins after the logical end-of-file,