All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	linux-scsi@vger.kernel.org, famz@redhat.com
Subject: [PATCH 3/3] sd: Return -EIO if read capacity failed
Date: Tue, 24 Mar 2015 18:16:15 +0800	[thread overview]
Message-ID: <1427192175-23802-4-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1427192175-23802-1-git-send-email-famz@redhat.com>

This improves the error code if BLKRRPART ioctl failed due to connection
issue.

Before:

	$ blockdev --rereadpt /dev/sda
	BLKRRPART: Invalid argument

After:
	$ blockdev --rereadpt /dev/sda
	BLKRRPART: Input/output error

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 drivers/scsi/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7e5ca3b..bb0e38d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2019,7 +2019,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
 	if (the_result) {
 		sd_print_result(sdkp, "Read Capacity(16) failed", the_result);
 		read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	sector_size = get_unaligned_be32(&buffer[8]);
@@ -2101,7 +2101,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
 	if (the_result) {
 		sd_print_result(sdkp, "Read Capacity(10) failed", the_result);
 		read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	sector_size = get_unaligned_be32(&buffer[4]);
-- 
1.9.3


  parent reply	other threads:[~2015-03-24 10:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 10:16 [PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down Fam Zheng
2015-03-24 10:16 ` [PATCH 1/3] block: Return error in rescan_partitions if revalidating disk failed Fam Zheng
2015-04-22  2:58   ` James Bottomley
2015-04-22  4:13     ` Fam Zheng
2015-03-24 10:16 ` [PATCH 2/3] sd: Return error in sd_revalidate_disk if read capacity failed Fam Zheng
2015-03-24 10:16 ` Fam Zheng [this message]
2015-03-24 10:34 ` [PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down Paolo Bonzini
2015-03-24 10:42   ` Fam Zheng
2015-04-16  5:05   ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427192175-23802-4-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=JBottomley@parallels.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.