Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp85439pxk; Tue, 8 Sep 2020 22:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTxkKRFlNQnvl0qv0boG13GqXxhp+8Zk906DHh9vfO5Ef4kqoj0V6sDTK4oFbEIDHcbXcS X-Received: by 2002:a17:906:178d:: with SMTP id t13mr2135973eje.410.1599631035077; Tue, 08 Sep 2020 22:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599631035; cv=none; d=google.com; s=arc-20160816; b=XXC3WZop87SpMpCZ8lzC7DEn0AnBW/QBYdk890WGzWzD0x438K8/1hjGM5V8uNsczG /yuyh2szLscvtfeyK7qUm+jNhH2A0CYxeNO6jLnhzxJYwhX75CUZvLqCI9ouSn2ne67n lHXYmSIwtFzWF3jSzCw+Rgs7N4j3dX+V39E7MbWkYddQGkNEMhZMj/qSjxGv5suvK6c7 bf47BzeXjcp54gb1tx0B+Ves8G27dojZV000WHQPUaRqin2L0skxmDqkfIG78X3XpZj8 N7g+SXJgBAPhnev+0k4Vg3pBFCpJX0GF+SQ/iPsDiVerBYkyypH3bFqO8C99q9OSTJC+ OSpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Svb+xz+La7VaNC2xZQZMnQbIB5NQJS/ll+vUPArEG1s=; b=fsyN1lnkh7xOnyP824DbLdddesFonYRpnqxPaxXfdoE/p1P3mXypqJ1rVbrXiwKK12 iVKtDH5JPbnILst9Gw6i12C6RP39fmdlsygUDShyklCZSnuvJWB8wHk3Gu5j/jc7mSiD e9c57OG9MuG1HrbMxa7s9zCNphlz/Vk6ZmoytVFzRTA0u/kD930PXrVBk478VDvAOMaZ kJF5bPOSZoqTJcRBIKW2IaSy+z9AhTxRxZ4UqfGqbovRLUKDGLG34JXnMl8v2Q3RoDFo ugMGRSmD1LLgYKZ92WEioBFtz9QzH2qAMr2CO2st9W7CwGaUDEHCLua+A6v/Dyq9GLPd So2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Up3DXdI8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si847503edh.371.2020.09.08.22.56.51; Tue, 08 Sep 2020 22:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Up3DXdI8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725917AbgIIFyH (ORCPT + 99 others); Wed, 9 Sep 2020 01:54:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:36198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgIIFyH (ORCPT ); Wed, 9 Sep 2020 01:54:07 -0400 Received: from localhost (unknown [172.98.75.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC8532166E; Wed, 9 Sep 2020 05:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599630846; bh=pbyS4ZMWYMUKwmpi3BhxrHHLzLjXuJLnUN/DArAAcCk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Up3DXdI8JG6lYgGcC0tVjYoVSP1nLZyG6no0UVGh0mcYcuP7bLalh/ZHMcaxkd8ZT 4hKkD4LUFJoxQFZYfY0KmG9+m5OcFoTb6CHL9YtBOQqvWQ53gbXqE+GdKD+ZcMeAHE 2uF6//oVS8x+8pzmKdA8VqSS/nBIguX1Si2IuUBY= Date: Wed, 9 Sep 2020 07:54:03 +0200 From: Greg KH To: Felipe Franciosi Cc: Paolo Bonzini , "stable@vger.kernel.org" , Matej Genci , "linux-kernel@vger.kernel.org" , "mst@redhat.com" , "jasowang@redhat.com" , "stefanha@redhat.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "virtualization@lists.linux-foundation.org" , "linux-scsi@vger.kernel.org" Subject: Re: [PATCH] Rescan the entire target on transport reset when LUN is 0 Message-ID: <20200909055403.GA310264@kroah.com> References: <200ad446-1242-9555-96b6-4fa94ee27ec7@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2020 at 05:53:16PM +0000, Felipe Franciosi wrote: > > > > On Sep 8, 2020, at 3:22 PM, Paolo Bonzini wrote: > > > > On 28/08/20 14:21, Matej Genci wrote: > >> VirtIO 1.0 spec says > >> The removed and rescan events ... when sent for LUN 0, they MAY > >> apply to the entire target so the driver can ask the initiator > >> to rescan the target to detect this. > >> > >> This change introduces the behaviour described above by scanning the > >> entire scsi target when LUN is set to 0. This is both a functional and a > >> performance fix. It aligns the driver with the spec and allows control > >> planes to hotplug targets with large numbers of LUNs without having to > >> request a RESCAN for each one of them. > >> > >> Signed-off-by: Matej Genci > >> Suggested-by: Felipe Franciosi > >> --- > >> drivers/scsi/virtio_scsi.c | 7 ++++++- > >> 1 file changed, 6 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c > >> index bfec84aacd90..a4b9bc7b4b4a 100644 > >> --- a/drivers/scsi/virtio_scsi.c > >> +++ b/drivers/scsi/virtio_scsi.c > >> @@ -284,7 +284,12 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi, > >> > >> switch (virtio32_to_cpu(vscsi->vdev, event->reason)) { > >> case VIRTIO_SCSI_EVT_RESET_RESCAN: > >> - scsi_add_device(shost, 0, target, lun); > >> + if (lun == 0) { > >> + scsi_scan_target(&shost->shost_gendev, 0, target, > >> + SCAN_WILD_CARD, SCSI_SCAN_INITIAL); > >> + } else { > >> + scsi_add_device(shost, 0, target, lun); > >> + } > >> break; > >> case VIRTIO_SCSI_EVT_RESET_REMOVED: > >> sdev = scsi_device_lookup(shost, 0, target, lun); > >> > > > > > > Acked-by: Paolo Bonzini > > Cc: stable@vger.kernel.org > > Thanks, Paolo. > > I'm Cc'ing stable as I believe this fixes a driver bug where it > doesn't follow the spec. Per commit message, today devices are > required to issue RESCAN events for each LUN behind a target when > hotplugging, or risking the driver not seeing the new LUNs. > > Is this enough? Or should we resend after merge per below? > https://www.kernel.org/doc/Documentation/process/stable-kernel-rules.rst You need to let stable know the git commit id of the patch in Linus's tree if the cc: stable is not on the final commit that gets merged. thanks, greg k-h