From patchwork Tue Mar 24 10:16:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 6077831 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2BD009F2A9 for ; Tue, 24 Mar 2015 10:17:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61530201E4 for ; Tue, 24 Mar 2015 10:17:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84959201F2 for ; Tue, 24 Mar 2015 10:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752246AbbCXKQn (ORCPT ); Tue, 24 Mar 2015 06:16:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58667 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751713AbbCXKQg (ORCPT ); Tue, 24 Mar 2015 06:16:36 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2OAGXGn011833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Mar 2015 06:16:33 -0400 Received: from ad.nay.redhat.com (dhcp-14-137.nay.redhat.com [10.66.14.137]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2OAGJn8019132; Tue, 24 Mar 2015 06:16:31 -0400 From: Fam Zheng To: linux-kernel@vger.kernel.org Cc: Jens Axboe , "James E.J. Bottomley" , 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 Message-Id: <1427192175-23802-4-git-send-email-famz@redhat.com> In-Reply-To: <1427192175-23802-1-git-send-email-famz@redhat.com> References: <1427192175-23802-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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]);