From patchwork Fri Jan 15 16:04:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8042911 Return-Path: X-Original-To: patchwork-qemu-devel@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 BA4899F716 for ; Fri, 15 Jan 2016 16:08:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E9412041A for ; Fri, 15 Jan 2016 16:08:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 316C32040F for ; Fri, 15 Jan 2016 16:08:34 +0000 (UTC) Received: from localhost ([::1]:47806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK6vR-00065R-Cw for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jan 2016 11:08:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK6rn-0007c8-C2 for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:04:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK6rm-0003Ik-HH for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:04:47 -0500 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:38607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK6rm-0003IX-B6 for qemu-devel@nongnu.org; Fri, 15 Jan 2016 11:04:46 -0500 Received: by mail-wm0-x22e.google.com with SMTP id b14so31648114wmb.1 for ; Fri, 15 Jan 2016 08:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xKrm+fbuAf4QbLDxhxqWEBDYuwhWGDoYhv1mXgInnMU=; b=z7M5RBwzjxRtE/ovwSxV1cAISfrMvh4JhMqFFtPzqBoZqluHL5nyDKWO2Bd63w5hui q/9R4q+6D9nbODUA3jLleiQpSnKBYHrdjgqMeYjsXD51mka5Zz1qeqjTxT3uFpTxq38Z F0sRb82XIpmeAkqnYu+0pl3Yw233NBGgTTyuPPRUzjpd/hbUhlqBV29QRUlQ307g1Q9D SI3qbKjNzWVYdGLmbp1c8+QC5UYEgaTkYYwkBcJvU7/fTXzMZZKlIWfpUe6rMIKbxl06 1eKv1bjTKxQfZcpEys1KUx+1KGUvZDA5IHjH63Ce/hy3b3weoAU0IFb62XF2c4NSrFir 9UBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xKrm+fbuAf4QbLDxhxqWEBDYuwhWGDoYhv1mXgInnMU=; b=XH5FRr8Y1/QTwYl1yXzkLP/iY1u1FkgpAFgxEfWCqh999uKNPapbRUpUNtfilVbYiv +Hpf/ij+csVEgFaZcnkfB/p1D+aOL0G8qfwZscfBLC9NCytRuy2wlMquh73DF8rpd1I2 GyyG0X9I2Dr3ffGyZ9wMOrpkcnQrz7KDbjOBFV/9bCNJz/PFJ29guyp5HigTf6EYdQMg 8HrCPGdiCmXHUbRQM39/m2kyT5gjuajrtiVl4bPz1KjiON8c2oLtl1wMqPkLihKXabPM iuJGuvdmeku18BYawAl0vOHTJztbAhyKuCLQI6lgUR08hkK8REkAnYFXg37HjRl3pdWt h8Pg== X-Gm-Message-State: ALoCoQkz8BntN6vr1QNO25LpJbuhW8+7zlUsGLFDOfB4hywb8CTa5lqOwiS7DynvIhzNGpyzC81r3bgSglP7eHVGphLl5ij59g== X-Received: by 10.194.6.196 with SMTP id d4mr10666062wja.120.1452873885726; Fri, 15 Jan 2016 08:04:45 -0800 (PST) Received: from 640k.lan (94-39-195-126.adsl-ull.clienti.tiscali.it. [94.39.195.126]) by smtp.gmail.com with ESMTPSA id c15sm3103036wmd.19.2016.01.15.08.04.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jan 2016 08:04:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 15 Jan 2016 17:04:23 +0100 Message-Id: <1452873871-138914-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1452873871-138914-1-git-send-email-pbonzini@redhat.com> References: <1452873871-138914-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22e Cc: Zhu Lingshan Subject: [Qemu-devel] [PULL 07/15] iscsi: send readcapacity10 when readcapacity16 failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Zhu Lingshan When play with Dell MD3000 target, for sure it is a TYPE_DISK, but readcapacity16 would fail. Then we find that readcapacity10 succeeded. It looks like the target just support readcapacity10 even through it is a TYPE_DISK or have some TYPE_ROM characteristics. This patch can give a chance to send readcapacity16 when readcapacity10 failed. This patch is not harmful to original pathes Signed-off-by: Zhu Lingshan Message-Id: <1451359934-9236-1-git-send-email-lszhu@suse.com> [Don't fall through on UNIT ATTENTION. - Paolo] Signed-off-by: Paolo Bonzini --- block/iscsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/iscsi.c b/block/iscsi.c index eb28ddc..3acb052 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1243,8 +1243,13 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) iscsilun->lbprz = !!rc16->lbprz; iscsilun->use_16_for_rw = (rc16->returned_lba > 0xffffffff); } + break; } - break; + if (task != NULL && task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) { + break; + } + /* Fall through and try READ CAPACITY(10) instead. */ case TYPE_ROM: task = iscsi_readcapacity10_sync(iscsilun->iscsi, iscsilun->lun, 0, 0); if (task != NULL && task->status == SCSI_STATUS_GOOD) {