From nobody Wed Apr 1 20:39:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775064050; cv=none; d=zohomail.com; s=zohoarc; b=oIHOuNQiUfm0XvMPx/iYxtyAh6/ELHBqFe8bl15nGv+WMuwfPCmQCwqGXz6jFJ9xmgO5agaCma3oikBcHHkTyN3wlP8tWl30vcSBseOrhhkVtK2G8EdCnL89aU4W0VFmJ6mYRIAj9mkakk+pHKbdTwUCZEpd9fVZeBNIo222TmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775064050; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=56IhqZsu/XJJ3I4EtYsq1VusSGeD9z30b3U0IZEUjbM=; b=g1SZ1UkpZt/2Bu9OCDIMZVotsjHMQKv0K88DW3KFk3DS1oldogWOkO67B7MgKV5rxjB7AK7G8vchA/2St9mYIRSuInlNjo8c+RRJO2TKA3zyhUuK64ARkoFh3pkWWtGpTwOPRudnjoxkofnPGwUzBVHCgaNDDpclhck9dFoLxK0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177506405003844.02674237791848; Wed, 1 Apr 2026 10:20:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7zEJ-0003Mb-4I; Wed, 01 Apr 2026 13:19:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7zEF-0003Ix-2t for qemu-devel@nongnu.org; Wed, 01 Apr 2026 13:19:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7zEC-0001In-VI for qemu-devel@nongnu.org; Wed, 01 Apr 2026 13:19:42 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-jEBZpI1AOlOrabhYHjk-5w-1; Wed, 01 Apr 2026 13:19:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B6421195608C; Wed, 1 Apr 2026 17:19:35 +0000 (UTC) Received: from localhost (unknown [10.44.32.12]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7688730001A2; Wed, 1 Apr 2026 17:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775063980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=56IhqZsu/XJJ3I4EtYsq1VusSGeD9z30b3U0IZEUjbM=; b=QXGj4tLqKr9IrFciSBIT5BKzu4xIqo+S7EAz6R+O0zQm9ND4194k0IVFcj7MELGWkhsVCY 2uI/KyCFRYtvd6TAE7nDGyPsQu1MJ7Sse6g9FOhkwhte8jUKSjvFIOQSBJozA677xfrc2V R9cba+ryY1gzOgcyBiNSgHl1qy4jfuo= X-MC-Unique: jEBZpI1AOlOrabhYHjk-5w-1 X-Mimecast-MFC-AGG-ID: jEBZpI1AOlOrabhYHjk-5w_1775063975 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Paolo Bonzini , , qemu-block@nongnu.org, Fam Zheng , Stefan Hajnoczi Subject: [PATCH 1/3] scsi: adjust error_prepend() formatting Date: Wed, 1 Apr 2026 13:19:25 -0400 Message-ID: <20260401171927.396672-2-stefanha@redhat.com> In-Reply-To: <20260401171927.396672-1-stefanha@redhat.com> References: <20260401171927.396672-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775064051757158500 Content-Type: text/plain; charset="utf-8" The error strings will be concatenated so add a separator to make the combined error message easy to read. Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index a2316a5266..b55d068323 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -439,7 +439,7 @@ static bool scsi_generic_pr_register(SCSIDevice *s, uin= t64_t key, Error **errp) ret =3D scsi_SG_IO(s->conf.blk, SG_DXFER_TO_DEV, cmd, sizeof(cmd), buf, sizeof(buf), s->io_timeout, errp); if (ret < 0) { - error_prepend(errp, "PERSISTENT RESERVE OUT with REGISTER"); + error_prepend(errp, "PERSISTENT RESERVE OUT with REGISTER: "); return false; } return true; @@ -463,7 +463,7 @@ static bool scsi_generic_pr_preempt(SCSIDevice *s, uint= 64_t key, ret =3D scsi_SG_IO(s->conf.blk, SG_DXFER_TO_DEV, cmd, sizeof(cmd), buf, sizeof(buf), s->io_timeout, errp); if (ret < 0) { - error_prepend(errp, "PERSISTENT RESERVE OUT with PREEMPT"); + error_prepend(errp, "PERSISTENT RESERVE OUT with PREEMPT: "); return false; } return true; --=20 2.53.0 From nobody Wed Apr 1 20:39:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775064063; cv=none; d=zohomail.com; s=zohoarc; b=ULEYLLZcsHPuXvTAxQ3LBKk6dOocBcvQURl0X8sHFDDMqaVt2YtLqh2NfOJ8NHDkufFJ1kyqA8XBafCp3uKoMkRbU2ssu2A7o4PwztxIVImwwVlKaU/lDSqTRN+VK3Dk5LgFIXlSYIwIZQLJXVtIetGZmnXmBnmJ+0xkeoTjZlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775064063; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MZVJJmwTxXh+7sbJhmm6vZsogwXgbvdK40MsXN3n/Gg=; b=TWFkoTvF5vvKfifz+ghKucG9qbvvXPc7Q8VK4Cpz2JNKxza0eSi8qnbRGmg12TEMlNn/t6Gn+LZCXPI5mIndCad0CjVWEaRVdfGZoXHRDzRk5bduaZ2/xTG8Z5Nlnel1ZtaYhQzLezLxjUyqr8wQJCJcgP8sqP32i37BDwcqsio= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775064063384751.8546537598518; Wed, 1 Apr 2026 10:21:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7zEI-0003LV-6Z; Wed, 01 Apr 2026 13:19:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7zEG-0003Jv-BE for qemu-devel@nongnu.org; Wed, 01 Apr 2026 13:19:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7zEE-0001Iy-PI for qemu-devel@nongnu.org; Wed, 01 Apr 2026 13:19:44 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-swJLtvw8MFiAabTc7jErBA-1; Wed, 01 Apr 2026 13:19:40 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8080F1955DDB; Wed, 1 Apr 2026 17:19:39 +0000 (UTC) Received: from localhost (unknown [10.44.32.12]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6592730002DA; Wed, 1 Apr 2026 17:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775063981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MZVJJmwTxXh+7sbJhmm6vZsogwXgbvdK40MsXN3n/Gg=; b=Ws+2UQQYg5CaJo4hivfHJQZv9TIPPnZiEQkuo2Ih1NOO5qaPnPIZADPACkQPYgypdbzxm0 ZxdAZ1ZSow5hon/kSsGiY1Gl44ONDiKmBOavGxvAlmV+yhushW1xkH+Fpr4IJsnNuP/blj hjl1NTUyNRocrxea+DCijZtSIw4FWAY= X-MC-Unique: swJLtvw8MFiAabTc7jErBA-1 X-Mimecast-MFC-AGG-ID: swJLtvw8MFiAabTc7jErBA_1775063979 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Paolo Bonzini , , qemu-block@nongnu.org, Fam Zheng , Stefan Hajnoczi , Qing Wang Subject: [PATCH 2/3] scsi: always send valid PREEMPT TYPE field Date: Wed, 1 Apr 2026 13:19:26 -0400 Message-ID: <20260401171927.396672-3-stefanha@redhat.com> In-Reply-To: <20260401171927.396672-1-stefanha@redhat.com> References: <20260401171927.396672-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775064065741158500 Content-Type: text/plain; charset="utf-8" The SPC-6 specification says that the PREEMPT service action ignores the TYPE field when there is no reservation. However, the LIO Linux iSCSI target rejects commands with a zero TYPE field. The field never ends up being used in this case, so replace it with a "valid" value to work around the issue. Reported-by: Qing Wang Buglink: https://redhat.atlassian.net/browse/RHEL-155807 Signed-off-by: Stefan Hajnoczi --- include/scsi/constants.h | 10 ++++++++++ hw/scsi/scsi-generic.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/scsi/constants.h b/include/scsi/constants.h index cb97bdb636..717e470a5d 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -340,4 +340,14 @@ #define PRO_REGISTER_AND_MOVE 0x07 #define PRO_REPLACE_LOST_RESERVATION 0x08 =20 +/* + * Persistent reservation types + */ +#define PR_TYPE_WRITE_EXCLUSIVE 0x1 +#define PR_TYPE_EXCLUSIVE_ACCESS 0x3 +#define PR_TYPE_WRITE_EXCLUSIVE_REG_ONLY 0x5 +#define PR_TYPE_EXCLUSIVE_ACCESS_REG_ONLY 0x6 +#define PR_TYPE_WRITE_EXCLUSIVE_ALL_REGS 0x7 +#define PR_TYPE_EXCLUSIVE_ACCESS_ALL_REGS 0x8 + #endif diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index b55d068323..349dea6bdd 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -453,6 +453,16 @@ static bool scsi_generic_pr_preempt(SCSIDevice *s, uin= t64_t key, uint64_t key_be =3D cpu_to_be64(key); int ret; =20 + /* + * The LIO iSCSI target in Linux up to at least version 7.0 rejects PR= EEMPT + * commands with a zero TYPE field although the SPC-6 specification sa= ys + * the field should be ignored when there is no persistent reservation. + * Work around this by choosing an arbitrary valid PR type value. + */ + if (resv_type =3D=3D 0) { + resv_type =3D PR_TYPE_WRITE_EXCLUSIVE; + } + cmd[0] =3D PERSISTENT_RESERVE_OUT; cmd[1] =3D PRO_PREEMPT; cmd[2] =3D resv_type & 0xf; --=20 2.53.0 From nobody Wed Apr 1 20:39:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775064045; cv=none; d=zohomail.com; s=zohoarc; b=NTjIEt4l8bY1MX6pW4x4kzn1TFtmCzdg8LwHBcYM4+6Msh5biht7F5Wr2SLCi0ywwxHgxKhueOqVlhxJoBfoR4qYsLOum03o+Atq5EEkWFksIXkzRSso10shVOqpewKuYBNDLi0p7YeNf5DN8+CVm+ogNV17b2lLrzY7hWif9wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775064045; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5883psE6nyExrf3yguXNZZAHUfPO/1/LQet/5J0xfFc=; b=cy3BU+w++nsDrkoLbGP416GjasNYtEQMGSxN/aeghEdNwbCHXcgx4huR0WnST2KtUblB28RaOTA3f5f9Zleerpdwa8BoHZ3av0sOujolk5nbzPxNy+/WopzDvbPGjQ2FYLfuUxWEopDO8SDYASkEBrXTsUsx+xODW/W4vOsoHNI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775064045607202.90150758398636; Wed, 1 Apr 2026 10:20:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w7zEK-0003Oq-PE; Wed, 01 Apr 2026 13:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7zEJ-0003NQ-GJ for qemu-devel@nongnu.org; Wed, 01 Apr 2026 13:19:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w7zEI-0001MU-6R for qemu-devel@nongnu.org; Wed, 01 Apr 2026 13:19:47 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-b1B6vwiQO5m3alZc1kQQTg-1; Wed, 01 Apr 2026 13:19:44 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 35936180034E; Wed, 1 Apr 2026 17:19:43 +0000 (UTC) Received: from localhost (unknown [10.44.32.12]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 283F41800671; Wed, 1 Apr 2026 17:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775063985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5883psE6nyExrf3yguXNZZAHUfPO/1/LQet/5J0xfFc=; b=NtIpBSyuEqa0RTimrPn+n2WHp0emjrqHfGXDR2IzziQhUST9H6teQ1T1uc3DOCQV5Ktfp3 YXqvxIWUrNblbonCi9izuE70kMiTSX/AT1YqTtHMehEHEjeMVrgtZhzQtswDgM6AlzeG6Q r4FLri+cWp4ltcY/6OVC7I1L5xuA/b0= X-MC-Unique: b1B6vwiQO5m3alZc1kQQTg-1 X-Mimecast-MFC-AGG-ID: b1B6vwiQO5m3alZc1kQQTg_1775063983 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Paolo Bonzini , , qemu-block@nongnu.org, Fam Zheng , Stefan Hajnoczi Subject: [PATCH 3/3] scsi: register again after PREEMPT without reservation Date: Wed, 1 Apr 2026 13:19:27 -0400 Message-ID: <20260401171927.396672-4-stefanha@redhat.com> In-Reply-To: <20260401171927.396672-1-stefanha@redhat.com> References: <20260401171927.396672-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=1, RCVD_IN_VALIDITY_RPBL_BLOCKED=1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775064049278154100 Content-Type: text/plain; charset="utf-8" The SCSI specification says PREEMPT without a reservation removes all registrations with the given key. Try to register again after PREEMPT since our key will have been removed. In practice some SCSI targets keep the calling I_T nexus' registration instead of removing it. Therefore we need to handle both the spec-compliant and the non-compliant behavior. Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-generic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 349dea6bdd..5182f9236d 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -513,6 +513,16 @@ bool scsi_generic_pr_state_preempt(SCSIDevice *s, Erro= r **errp) if (!scsi_generic_pr_preempt(s, key, resv_type, errp)) { return false; } + + /* + * Some SCSI targets, like the Linux LIO target, remove our + * registration when preempting without a reservation (resv_type i= s 0). + * Try to register again but ignore the error since a RESERVATION + * CONFLICT is expected if our registration remained in place. + */ + if (resv_type =3D=3D 0) { + scsi_generic_pr_register(s, key, NULL); + } } return true; } --=20 2.53.0