From: "Michael S. Tsirkin" <mst@redhat.com> To: Matej Genci <matej.genci@nutanix.com> Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "jasowang@redhat.com" <jasowang@redhat.com>, "pbonzini@redhat.com" <pbonzini@redhat.com>, "stefanha@redhat.com" <stefanha@redhat.com>, "jejb@linux.ibm.com" <jejb@linux.ibm.com>, "martin.petersen@oracle.com" <martin.petersen@oracle.com>, "virtualization@lists.linux-foundation.org" <virtualization@lists.linux-foundation.org>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, Felipe Franciosi <felipe@nutanix.com> Subject: Re: [PATCH] Rescan the entire target on transport reset when LUN is 0 Date: Tue, 8 Sep 2020 10:15:50 -0400 [thread overview] Message-ID: <20200908101531-mutt-send-email-mst@kernel.org> (raw) In-Reply-To: <CY4PR02MB33354370E0A81E75DD9DFE74FB520@CY4PR02MB3335.namprd02.prod.outlook.com> On Fri, Aug 28, 2020 at 12:21:35PM +0000, 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 <matej@nutanix.com> > Suggested-by: Felipe Franciosi <felipe@nutanix.com> Stefan, Paolo, could you review this pls? > --- > 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); > -- > 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com> To: Matej Genci <matej.genci@nutanix.com> Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "martin.petersen@oracle.com" <martin.petersen@oracle.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "virtualization@lists.linux-foundation.org" <virtualization@lists.linux-foundation.org>, "stefanha@redhat.com" <stefanha@redhat.com>, Felipe Franciosi <felipe@nutanix.com>, "pbonzini@redhat.com" <pbonzini@redhat.com>, "jejb@linux.ibm.com" <jejb@linux.ibm.com> Subject: Re: [PATCH] Rescan the entire target on transport reset when LUN is 0 Date: Tue, 8 Sep 2020 10:15:50 -0400 [thread overview] Message-ID: <20200908101531-mutt-send-email-mst@kernel.org> (raw) In-Reply-To: <CY4PR02MB33354370E0A81E75DD9DFE74FB520@CY4PR02MB3335.namprd02.prod.outlook.com> On Fri, Aug 28, 2020 at 12:21:35PM +0000, 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 <matej@nutanix.com> > Suggested-by: Felipe Franciosi <felipe@nutanix.com> Stefan, Paolo, could you review this pls? > --- > 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); > -- > 2.20.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2020-09-08 16:44 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-28 12:21 [PATCH] Rescan the entire target on transport reset when LUN is 0 Matej Genci 2020-09-08 14:15 ` Michael S. Tsirkin [this message] 2020-09-08 14:15 ` Michael S. Tsirkin 2020-09-08 14:22 ` Paolo Bonzini 2020-09-08 14:22 ` Paolo Bonzini 2020-09-08 17:53 ` Felipe Franciosi 2020-09-08 17:53 ` Felipe Franciosi 2020-09-09 5:54 ` Greg KH 2020-09-09 5:54 ` Greg KH 2020-09-16 1:52 ` Martin K. Petersen 2020-09-16 1:52 ` Martin K. Petersen 2020-09-22 3:56 ` Martin K. Petersen 2020-09-22 3:56 ` Martin K. Petersen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200908101531-mutt-send-email-mst@kernel.org \ --to=mst@redhat.com \ --cc=felipe@nutanix.com \ --cc=jasowang@redhat.com \ --cc=jejb@linux.ibm.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=matej.genci@nutanix.com \ --cc=pbonzini@redhat.com \ --cc=stefanha@redhat.com \ --cc=virtualization@lists.linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.