diff mbox series

[09/11] xfs_scrub: return bytes verified from a SCSI VERIFY command

Message ID 156944735184.298887.10018131559275191626.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs_scrub: fix IO error detection during media verify | expand

Commit Message

Darrick J. Wong Sept. 25, 2019, 9:35 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 scrub/disk.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Sandeen Oct. 17, 2019, 1:56 a.m. UTC | #1
On 9/25/19 4:35 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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>
diff mbox series

Patch

diff --git a/scrub/disk.c b/scrub/disk.c
index d2101cc6..bf9c795a 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -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)