From nobody Tue Nov 4 15:26:28 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 1530215993542835.255520786393; Thu, 28 Jun 2018 12:59:53 -0700 (PDT) Received: from localhost ([::1]:38251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYd51-0003MQ-5S for importer@patchew.org; Thu, 28 Jun 2018 15:59:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYd36-0002DG-Bm for qemu-devel@nongnu.org; Thu, 28 Jun 2018 15:57:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYd34-0000UP-Rq for qemu-devel@nongnu.org; Thu, 28 Jun 2018 15:57:48 -0400 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:40195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYd34-0000Sc-J0 for qemu-devel@nongnu.org; Thu, 28 Jun 2018 15:57:46 -0400 Received: by mail-wm0-x232.google.com with SMTP id z13-v6so10273890wma.5 for ; Thu, 28 Jun 2018 12:57:46 -0700 (PDT) Received: from 640k.lan ([82.84.124.111]) by smtp.gmail.com with ESMTPSA id d102-v6sm12516646wma.10.2018.06.28.12.57.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 12:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NNxdw9EfoglPw0eE0yAPZpny98Ei/3+q+kS3oSgkaso=; b=Z2oXQVqIHrdQWELXdnAg2CpoDcNzQnLIWu+0VP4JnWaSDCwyZaBj1AOPPzt0yU7RCF +LYFWqzfYRnwPhKEaFvj0f4eeBosgHg2q8FtnEz/jUF4/k5onVENcmPMUluYJt7fqBDZ 5lkTCWQFICeXimWM9ZHJ+MuvKVPPndp5kbD8gkq+vAli86yynhDcO/EyCEMWx/XaDCkQ UGOzxGbS1lyTIq6qPt4UezIEqlyNmDEEOhWY4DRkD9suphMlm4kPva0d7MeUcNEz82q2 6QTs+DlwpTruzUAaYq9BHxH/LuuKkMWCHQlvtHrPZPT0gKAonpbGOndCKE8Fxrhhem21 LcIQ== 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:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NNxdw9EfoglPw0eE0yAPZpny98Ei/3+q+kS3oSgkaso=; b=HXndSOg/NWcs53HdVF6W6xLsC9ZAM9lEv/MYrW4XpAGM4D9H87fzqFlRJ+q1TIP06G CmtDYvxLbp5M+LV/EObwCYABSHJeRre+lTT6ra6eTiqxtRzOMeSenDPzGcnUbiyDa2BT ziQFui9TJd/McMOZFSZJUmgVtAfVGDTmCWAOqt7jgNNVl9s4B18ZIL4uX2QoBsmC7mb+ TpJhUQufCIQ/C9bxgHuhd2Eiwj0uTBPYqopUGJSEISu4jZ3+w5svHY7dHPBweKuvMKvx Hbuluy+jYMFXY8StOs+IFE1p0a/AXk8Oi5ilG1nbUWiWBww3sdanQTl+0EVZ/06ojJii VRiw== X-Gm-Message-State: APt69E3QFavmRvoGLrKQsyO7tIvULi4aaJxxBzPfxLKhapbFFSiyIiBU mHz+1rJdq8rdOsjo5ExLL/zj0u/h X-Google-Smtp-Source: AAOMgpc5qKTNbwqTeJkhvUNYFkfFaE4Ub7jB/IyJdQJxwzR8Ef95hWEa5mZeNUpulXuLJrJYuWsOKw== X-Received: by 2002:a1c:8312:: with SMTP id f18-v6mr9538531wmd.127.1530215865188; Thu, 28 Jun 2018 12:57:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 28 Jun 2018 21:57:34 +0200 Message-Id: <1530215858-1525-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1530215858-1525-1-git-send-email-pbonzini@redhat.com> References: <1530215858-1525-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 Subject: [Qemu-devel] [PATCH 2/6] 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: , 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 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 Reviewed-by: Michal Privoznik Signed-off-by: Paolo Bonzini Reviewed-by: Paolo Bonzini 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 4057cf3..0218d65 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 1.8.3.1