From nobody Tue Nov 4 15:31:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530027891099839.4026075874831; Tue, 26 Jun 2018 08:44:51 -0700 (PDT) Received: from localhost ([::1]:53493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXq9C-0002rw-BI for importer@patchew.org; Tue, 26 Jun 2018 11:44:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXq57-0008Ng-BG for qemu-devel@nongnu.org; Tue, 26 Jun 2018 11:40:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXq55-0005e2-G6 for qemu-devel@nongnu.org; Tue, 26 Jun 2018 11:40:37 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:39511) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXq55-0005dj-8Y for qemu-devel@nongnu.org; Tue, 26 Jun 2018 11:40:35 -0400 Received: by mail-wm0-x242.google.com with SMTP id p11-v6so2326108wmc.4 for ; Tue, 26 Jun 2018 08:40:35 -0700 (PDT) Received: from donizetti.lan ([82.84.124.111]) by smtp.gmail.com with ESMTPSA id y129-v6sm2308490wmy.4.2018.06.26.08.40.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 08:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DzC6uCTcx4CCx2z6nGcG134Pqn0i9bF9cO9eJKhbPpU=; b=HQhDXDhlf5f8eEi+LFVqwNuVjIFyTsXjhmbzyRDOfrqumdMfxBN8BB8CJZ2A7vBCwt HC5bvuegQomRFIF2Y1n2YKWkJRYg8hn18mF+Cxi/uwziHdwFdxtNhyfbhxfDxIo3LrWV 1P7jT27q3vhuUH5lki6HZ6xbzfn+Q7tegmQgt0J42c+1avOFeH4N470HECusoG+5UNyV PpbZcWcD1cgafhwq/SaJpWwYRjnP0X749xupUGJwx+WgNB97F3nCjjThpDKFtxs/xuMS Y4T0MVpSQ31brMtPxEIBZ+el9dAucSeNFW8+dmGFim6zUgd5tEY8h0s6cOVtyTOPuvdq EkiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DzC6uCTcx4CCx2z6nGcG134Pqn0i9bF9cO9eJKhbPpU=; b=LXL1xU5nw/Dpvy9jqQLzBfzTgklyC2KHtR5JyKcsmSV4q1LZOUvdDRK7skHNbpTxf3 ScyiqTtfyl0/BU+NGGEeTjFI/iC++UflCrW8kbWkSnbncEJ2Ncnq+Z4+Ld23By2lwzYn Zu42wb20pYW7bQMB9qH3TPW1Apc3EbH7I9G1ji4o+uBwRboh9zSIXzV5qdzMYwuan9ik HPYtDSwpfdGSRwmolCxwxINbivqJJEVr6vjsr2fjz1byx27mrqByZ2IFEur5105SxZPa soxjPnFDe+Vo1NHwbVI/rX+MzsYcme4Ayqohncv5Xj3Rb7M5kWjQYJIY67nq+b1NNHhm /tkA== X-Gm-Message-State: APt69E1jh5AZisU7pCaXy3NvC8vbjjXp7LF+DlD0X7Jw0yQhydzi/vDW /FtDtVvCPFrEyDkQgro+omWy7dYk X-Google-Smtp-Source: AAOMgpdXZCtgUBD5JCVHjz5V8RqWgjs8JhxiJ2xygcAzhKyo9UUuoyMq5AR2Qlq/9AONTqG0YKdNPg== X-Received: by 2002:a1c:387:: with SMTP id 129-v6mr2069141wmd.53.1530027633814; Tue, 26 Jun 2018 08:40:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 17:40:25 +0200 Message-Id: <20180626154028.11133-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626154028.11133-1-pbonzini@redhat.com> References: <20180626154028.11133-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH 2/5] pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mprivozn@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The response size is expected to be zero if the SCSI status is not "GOOD", but nothing was resetting it. This can be reproduced simply by "sg_persist -s /dev/sdb" where /dev/sdb in the guest is a scsi-block device corresponding to a multipath device on the host. Before: PR in (Read full status): Aborted command and on the host: prh_write_response: Assertion `resp->sz =3D=3D 0' failed. After: PR in (Read full status): bad field in cdb or parameter list (perhaps unsupported service action) Reported-by: Jiri Belka Signed-off-by: Paolo Bonzini Reviewed-by: Michal Privoznik Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- scsi/qemu-pr-helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 4057cf355c..0218d65bbf 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -558,7 +558,11 @@ static int do_pr_in(int fd, const uint8_t *cdb, uint8_= t *sense, #ifdef CONFIG_MPATH if (is_mpath(fd)) { /* multipath_pr_in fills the whole input buffer. */ - return multipath_pr_in(fd, cdb, sense, data, *resp_sz); + int r =3D multipath_pr_in(fd, cdb, sense, data, *resp_sz); + if (r !=3D GOOD) { + *resp_sz =3D 0; + } + return r; } #endif =20 --=20 2.17.1