From nobody Sat May 18 12:29:52 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1691127225; cv=none; d=zohomail.com; s=zohoarc; b=TRt0M56pH9IDC0gEWGiYqShylV9+sSZOU2rGbo6tr3qu5J7q5rjTKGqDZZQBTVGgoTL0ozwQzeON324lVK1qJD+Mnoa+KW9F164J0ZsRXkYGrsj3FmINGxeI8kVocRMetoGaPhpZVGuE1kgVU5Q7zIm11xgGiynFzS2XLJBaPrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691127225; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ALIcxf6j8pNVpITSgEknPHvhepLbPSdSA4YsdvgTdqk=; b=Xdq/aX0Jx0NVtn02SrRzqXrSHjOfhknTKwgwGbglDJiUCevN59WZMVlIVnuGH9CdZrEu4FIfywAoUhGFiRNJu6kDh6pbeDwE3PoP4RJaLlOpKSlgqtNanFgF4ceUCeLzPZQmJjIHXCWTcmEqt8RxIvbbY0HlTNATrVT1/893Rmk= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1691127225481279.41180377306773; Thu, 3 Aug 2023 22:33:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qRnRD-0004Iz-Fs; Fri, 04 Aug 2023 01:33:23 -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 1qRnQl-0003cb-Sj for qemu-devel@nongnu.org; Fri, 04 Aug 2023 01:32:56 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qRnQi-0003RE-CD for qemu-devel@nongnu.org; Fri, 04 Aug 2023 01:32:55 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1bb9e6c2a90so14746925ad.1 for ; Thu, 03 Aug 2023 22:30:37 -0700 (PDT) Received: from bogon.gitgo.cc ([47.75.78.161]) by smtp.gmail.com with ESMTPSA id p7-20020a170902bd0700b001bc2831e1a8sm781183pls.80.2023.08.03.22.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 22:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20221208.gappssmtp.com; s=20221208; t=1691127036; x=1691731836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ALIcxf6j8pNVpITSgEknPHvhepLbPSdSA4YsdvgTdqk=; b=5LL34cZlMYOG7PX5hYEsX88hVMaXwi3l4aknkO+cFFaTKK6PzFIUPVsqeEC0ePd14C mBtCdzxSqRm9dICPfjonvmJFNcsfstqKqOrzVGf7+i9eOEQQf9qUSRtND6VWOwTxZQbn MObuo+1WzWJh8WqM589j9mJby8NTABPyWB42brZpkFwrvuIUHdla/IWsua1RmeUNUfG6 KYG5wQFPgUSMbDf+AgEK2VvWWoVO0e1f5S0wVzgcH9Epj7f+rjKthFmgh0/FIY7Yz74g 7+US6UlywmmFl3zGK1+PPNKvf73G8rK6DHfvp/hdrX/votgOmU4aJLmo41AUiSaZPiS5 u8fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691127036; x=1691731836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ALIcxf6j8pNVpITSgEknPHvhepLbPSdSA4YsdvgTdqk=; b=FKe/FB5zm6ol7jKAM2pGlF6Swz33if2z6hJpurmuSSegG5q1Oo1idUKc11zNfhREWc 5LREZ9Sx69NAyAjnSliCxlCTuTZieUWD1O3cuFPv6l7VCPT36TZwEZTWnDKoMuWAdYY7 CtAEXsFRkbewZrRBAGbhLMw4KSs+ddSmrdX6JhDxqvSgtrTQr87fcr4KMLsv92z0yfcv DC7/KyWmrMfhW9BmN3hC7atNqOgKFZMFkAGqYv1DVHVqHiDDR7UJlNE36snZtZeff1Vz +xX8lInGuzPvE7YW82VIJJ3YMNFisROX9PA8blayLVxUZefA9ONGIVzUl9Icu82cklgU e0iQ== X-Gm-Message-State: AOJu0YwjO9WeBCidbWiVSMsjhNZcxuve2jm9LGqQr7aZHkYEeLjXqZ52 EVSdEAmp8ILs1QudygQRxdqRPw== X-Google-Smtp-Source: AGHT+IEvojtbjnWlQqOxczhmdpJID19wYJV4hQSo0aihn1ShjioMjNTwiIPHQdWD5QMnmeoWlG/9MQ== X-Received: by 2002:a17:902:830b:b0:1b6:6b03:10cd with SMTP id bd11-20020a170902830b00b001b66b0310cdmr716161plb.67.1691127036147; Thu, 03 Aug 2023 22:30:36 -0700 (PDT) From: Li Feng To: "Michael S. Tsirkin" , Paolo Bonzini , Fam Zheng , Raphael Norwitz , qemu-devel@nongnu.org (open list:All patches CC here) Cc: Li Feng Subject: [PATCH 1/2] vhost-user: fix lost reconnect Date: Fri, 4 Aug 2023 13:29:47 +0800 Message-ID: <20230804052954.2918915-2-fengli@smartx.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230804052954.2918915-1-fengli@smartx.com> References: <20230804052954.2918915-1-fengli@smartx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::62f; envelope-from=fengli@smartx.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @smartx-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1691127227409100003 Content-Type: text/plain; charset="utf-8" When the vhost-user is reconnecting to the backend, and if the vhost-user f= ails at the get_features in vhost_dev_init(), then the reconnect will fail and it will not be retriggered forever. The reason is: When the vhost-user fail at get_features, the vhost_dev_cleanup will be cal= led immediately. vhost_dev_cleanup calls 'memset(hdev, 0, sizeof(struct vhost_dev))'. The reconnect path is: vhost_user_blk_event vhost_user_async_close(.. vhost_user_blk_disconnect ..) qemu_chr_fe_set_handlers <----- clear the notifier callback schedule vhost_user_async_close_bh The vhost->vdev is null, so the vhost_user_blk_disconnect will not be called, then the event fd callback will not be reinstalled. With this patch, the vhost_user_blk_disconnect will call the vhost_dev_cleanup() again, it's safe. All vhost-user devices have this issue, including vhost-user-blk/scsi. Fixes: 71e076a07d ("hw/virtio: generalise CHR_EVENT_CLOSED handling") Signed-off-by: Li Feng --- hw/virtio/vhost-user.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 8dcf049d42..697b403fe2 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2648,16 +2648,8 @@ typedef struct { static void vhost_user_async_close_bh(void *opaque) { VhostAsyncCallback *data =3D opaque; - struct vhost_dev *vhost =3D data->vhost; =20 - /* - * If the vhost_dev has been cleared in the meantime there is - * nothing left to do as some other path has completed the - * cleanup. - */ - if (vhost->vdev) { - data->cb(data->dev); - } + data->cb(data->dev); =20 g_free(data); } --=20 2.41.0 From nobody Sat May 18 12:29:52 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1691127210; cv=none; d=zohomail.com; s=zohoarc; b=A13BMK6v3WIJ78ohEDSh0tdQ3ZojFTHj+0AVKAmkWHKS+ylHdQxY9IS2dTrg7bo95G57bVwGYGm9xklVnx68YkAgYqKOoQQiLpp0GTcvB0cq2UuoVw6mK+ID9mEdv+Z02mczxNRl1wRziG1oBZxWmAEzeha84LRLyn0btS1NQGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691127210; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EoWKMRQRQvee5AHqMGvEiCAid/6peZU+GJ4Uu3wHwRQ=; b=cZESPKq8ZsnumIrfSy9rRW1BIeJlONLqgRJO21VkSN+PKbSs69wi4G2Iz5XtK+0obN0GoiHrDAeftB753tXnbOszZM4OASRUiWH3+vP+Q6IzIPXzao9qi8kcA3GRAzNy2NQRh50siB8JoMtXm6nSHUIWw7zCSPWW54jCbxcPYR4= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1691127210295356.580250141846; Thu, 3 Aug 2023 22:33:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qRnQs-0003rd-L9; Fri, 04 Aug 2023 01:33:04 -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 1qRnQm-0003dt-4A for qemu-devel@nongnu.org; Fri, 04 Aug 2023 01:32:56 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qRnQh-0003RT-89 for qemu-devel@nongnu.org; Fri, 04 Aug 2023 01:32:55 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1bc02bd4eafso14771625ad.1 for ; Thu, 03 Aug 2023 22:30:40 -0700 (PDT) Received: from bogon.gitgo.cc ([47.75.78.161]) by smtp.gmail.com with ESMTPSA id p7-20020a170902bd0700b001bc2831e1a8sm781183pls.80.2023.08.03.22.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 22:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20221208.gappssmtp.com; s=20221208; t=1691127039; x=1691731839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EoWKMRQRQvee5AHqMGvEiCAid/6peZU+GJ4Uu3wHwRQ=; b=16ZiA+k9aIzzlOyD3kZKe8xTk57E127Yp4X8puZN0XDBUQxf6fNLEW04JCPZyOdP/p ZnhBgMOBwRiygyFm4Qn9c8O+Oe1yIcxzhIz3vOsM4PJTb2lG/v/NY1t/1zs9vUmsyLkm bJajU9rFbDRaBRuWEeSDAyGGL1yGOwh++OXohalgoF/Xwns+40WW8wVE/jhzapAHWKfn RdA3pjTiHHDIEyCBNZRgFsqpByudZM4xv1iKVW38MaOawLodOpMjeIDr2KdhiU0E36R3 kBoRXKIGVHTOc/0bpsHiZPsmdLbo5tih8zUiSvxNvumPt17WXjciTLc/NROMFXki1459 kRVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691127039; x=1691731839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EoWKMRQRQvee5AHqMGvEiCAid/6peZU+GJ4Uu3wHwRQ=; b=bIjpSZiZlfuFhWk4prwkNs3bcHMrXHj456z640yoAcXSoub4KwY6sqyWDrIB+RFFr2 2reQ7+tUu+mg7OmpOYgODdtnhmExcXgRWSZwpMR2YKTZOEA6FUvfVMdIgx6NO5Y+BgfU ROFiFJ6BJooq9EJ97DMjwcSn3Kk2822UMkFQjN5qKOiuI4S7Zl075TMpnmk3I9baWcBY HaXiI9nsVEYiJuYzDKUqcIatCDzqCCgcApuzD4DHJjNlfU+XuVTKQf33zukYcLrYQuw4 DbpSJ8kM1vEfzS7s1A4279fPcTI1eouVnrl8rMAttp2vxY4BFQRXDW1GO8mygMPKBoSW XTyw== X-Gm-Message-State: AOJu0Yy/Hy4ZHTmtdcMugLh91+2xv6ziJujmd0Xr1VFqHE0J1iakkD0P QqBEJsOA/+Xt6bn/flLWq3tvCQ== X-Google-Smtp-Source: AGHT+IFoFclPjVBRAwqsnvFJSuttMGnaD3/hv7VqABnu5uXhjxpCo/5DWsV8rjklgOZAfCLFHMetKQ== X-Received: by 2002:a17:902:e847:b0:1bb:d860:9efd with SMTP id t7-20020a170902e84700b001bbd8609efdmr976815plg.15.1691127038538; Thu, 03 Aug 2023 22:30:38 -0700 (PDT) From: Li Feng To: "Michael S. Tsirkin" , Paolo Bonzini , Fam Zheng , Raphael Norwitz , qemu-devel@nongnu.org (open list:All patches CC here) Cc: Li Feng Subject: [PATCH 2/2] vhost: Add Error parameter to vhost_scsi_common_start() Date: Fri, 4 Aug 2023 13:29:48 +0800 Message-ID: <20230804052954.2918915-3-fengli@smartx.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230804052954.2918915-1-fengli@smartx.com> References: <20230804052954.2918915-1-fengli@smartx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::634; envelope-from=fengli@smartx.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @smartx-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1691127212414100004 Content-Type: text/plain; charset="utf-8" Add a Error parameter to report the real error, like vhost-user-blk. Signed-off-by: Li Feng --- hw/scsi/vhost-scsi-common.c | 17 ++++++++++------- hw/scsi/vhost-scsi.c | 5 +++-- hw/scsi/vhost-user-scsi.c | 14 ++++++++------ include/hw/virtio/vhost-scsi-common.h | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c index a61cd0e907..392587dfb5 100644 --- a/hw/scsi/vhost-scsi-common.c +++ b/hw/scsi/vhost-scsi-common.c @@ -16,6 +16,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "hw/virtio/vhost.h" @@ -25,7 +26,7 @@ #include "hw/virtio/virtio-access.h" #include "hw/fw-path-provider.h" =20 -int vhost_scsi_common_start(VHostSCSICommon *vsc) +int vhost_scsi_common_start(VHostSCSICommon *vsc, Error **errp) { int ret, i; VirtIODevice *vdev =3D VIRTIO_DEVICE(vsc); @@ -35,18 +36,19 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) VirtIOSCSICommon *vs =3D (VirtIOSCSICommon *)vsc; =20 if (!k->set_guest_notifiers) { - error_report("binding does not support guest notifiers"); + error_setg(errp, "binding does not support guest notifiers"); return -ENOSYS; } =20 ret =3D vhost_dev_enable_notifiers(&vsc->dev, vdev); if (ret < 0) { + error_setg_errno(errp, -ret, "Error enabling host notifiers"); return ret; } =20 ret =3D k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, true); if (ret < 0) { - error_report("Error binding guest notifier"); + error_setg_errno(errp, -ret, "Error binding guest notifier"); goto err_host_notifiers; } =20 @@ -54,7 +56,7 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) =20 ret =3D vhost_dev_prepare_inflight(&vsc->dev, vdev); if (ret < 0) { - error_report("Error setting inflight format: %d", -ret); + error_setg_errno(errp, -ret, "Error setting inflight format: %d", = -ret); goto err_guest_notifiers; } =20 @@ -64,21 +66,22 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) vs->conf.virtqueue_size, vsc->inflight); if (ret < 0) { - error_report("Error getting inflight: %d", -ret); + error_setg_errno(errp, -ret, "Error getting inflight: %d", + -ret); goto err_guest_notifiers; } } =20 ret =3D vhost_dev_set_inflight(&vsc->dev, vsc->inflight); if (ret < 0) { - error_report("Error setting inflight: %d", -ret); + error_setg_errno(errp, -ret, "Error setting inflight: %d", -re= t); goto err_guest_notifiers; } } =20 ret =3D vhost_dev_start(&vsc->dev, vdev, true); if (ret < 0) { - error_report("Error start vhost dev"); + error_setg_errno(errp, -ret, "Error start vhost dev"); goto err_guest_notifiers; } =20 diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 443f67daa4..01a3ab4277 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -75,6 +75,7 @@ static int vhost_scsi_start(VHostSCSI *s) int ret, abi_version; VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); const VhostOps *vhost_ops =3D vsc->dev.vhost_ops; + Error *local_err =3D NULL; =20 ret =3D vhost_ops->vhost_scsi_get_abi_version(&vsc->dev, &abi_version); if (ret < 0) { @@ -88,14 +89,14 @@ static int vhost_scsi_start(VHostSCSI *s) return -ENOSYS; } =20 - ret =3D vhost_scsi_common_start(vsc); + ret =3D vhost_scsi_common_start(vsc, &local_err); if (ret < 0) { return ret; } =20 ret =3D vhost_scsi_set_endpoint(s); if (ret < 0) { - error_report("Error setting vhost-scsi endpoint"); + error_reportf_err(local_err, "Error setting vhost-scsi endpoint"); vhost_scsi_common_stop(vsc); } =20 diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index a7fa8e8df2..d368171e28 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -43,12 +43,12 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_RESET_DEVICE =3D 13, }; =20 -static int vhost_user_scsi_start(VHostUserSCSI *s) +static int vhost_user_scsi_start(VHostUserSCSI *s, Error **errp) { VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); int ret; =20 - ret =3D vhost_scsi_common_start(vsc); + ret =3D vhost_scsi_common_start(vsc, errp); s->started_vu =3D (ret < 0 ? false : true); =20 return ret; @@ -73,6 +73,7 @@ static void vhost_user_scsi_set_status(VirtIODevice *vdev= , uint8_t status) VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); bool should_start =3D virtio_device_should_start(vdev, status); + Error *local_err =3D NULL; int ret; =20 if (!s->connected) { @@ -84,9 +85,10 @@ static void vhost_user_scsi_set_status(VirtIODevice *vde= v, uint8_t status) } =20 if (should_start) { - ret =3D vhost_user_scsi_start(s); + ret =3D vhost_user_scsi_start(s, &local_err); if (ret < 0) { - error_report("unable to start vhost-user-scsi: %s", strerror(-= ret)); + error_reportf_err(local_err, "unable to start vhost-user-scsi:= %s", + strerror(-ret)); qemu_chr_fe_disconnect(&vs->conf.chardev); } } else { @@ -139,7 +141,7 @@ static void vhost_user_scsi_handle_output(VirtIODevice = *vdev, VirtQueue *vq) * Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start * vhost here instead of waiting for .set_status(). */ - ret =3D vhost_user_scsi_start(s); + ret =3D vhost_user_scsi_start(s, &local_err); if (ret < 0) { error_reportf_err(local_err, "vhost-user-scsi: vhost start failed:= "); qemu_chr_fe_disconnect(&vs->conf.chardev); @@ -184,7 +186,7 @@ static int vhost_user_scsi_connect(DeviceState *dev, Er= ror **errp) =20 /* restore vhost state */ if (virtio_device_started(vdev, vdev->status)) { - ret =3D vhost_user_scsi_start(s); + ret =3D vhost_user_scsi_start(s, errp); if (ret < 0) { return ret; } diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhos= t-scsi-common.h index 18f115527c..c5d2c09455 100644 --- a/include/hw/virtio/vhost-scsi-common.h +++ b/include/hw/virtio/vhost-scsi-common.h @@ -39,7 +39,7 @@ struct VHostSCSICommon { struct vhost_inflight *inflight; }; =20 -int vhost_scsi_common_start(VHostSCSICommon *vsc); +int vhost_scsi_common_start(VHostSCSICommon *vsc, Error **errp); void vhost_scsi_common_stop(VHostSCSICommon *vsc); char *vhost_scsi_common_get_fw_dev_path(FWPathProvider *p, BusState *bus, DeviceState *dev); --=20 2.41.0