]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: return bytes verified from a SCSI VERIFY command
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 17 Oct 2019 02:35:26 +0000 (22:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 17 Oct 2019 02:35:26 +0000 (22:35 -0400)
Since disk_scsi_verify and pread are interchangeably called from
disk_read_verify(), we must return the number of bytes verified (or -1)
just like what pread returns.  This doesn't matter now due to bugs in
scrub, but we're about to fix those bugs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/disk.c

index d2101cc6ac05e22c5bb610efca48c68b76745f45..bf9c795aa004bef8a1c9ad10cd6df5fe255c5048 100644 (file)
@@ -144,7 +144,7 @@ disk_scsi_verify(
        iohdr.timeout = 30000; /* 30s */
 
        error = ioctl(disk->d_fd, SG_IO, &iohdr);
-       if (error)
+       if (error < 0)
                return error;
 
        dbg_printf("VERIFY(16) fd %d lba %"PRIu64" len %"PRIu64" info %x "
@@ -163,7 +163,7 @@ disk_scsi_verify(
                return -1;
        }
 
-       return error;
+       return blockcount << BBSHIFT;
 }
 #else
 # define disk_scsi_verify(...)         (ENOTTY)