[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 6/9] scsi/scsi-bus: scsi_device_find: don't return unreali
From: |
Maxim Levitsky |
Subject: |
Re: [PATCH v4 6/9] scsi/scsi-bus: scsi_device_find: don't return unrealized devices |
Date: |
Wed, 09 Sep 2020 11:15:57 +0300 |
User-agent: |
Evolution 3.36.3 (3.36.3-1.fc32) |
On Tue, 2020-09-08 at 16:00 +0100, Stefan Hajnoczi wrote:
> On Mon, Aug 31, 2020 at 06:01:21PM +0300, Maxim Levitsky wrote:
> > The device core first places a device on the bus and then realizes it.
> > Make scsi_device_find avoid returing such devices to avoid
> > races in drivers that use an iothread (currently virtio-scsi)
> >
> > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1812399
> >
> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > ---
> > hw/scsi/scsi-bus.c | 88 ++++++++++++++++++++++++++++------------------
> > 1 file changed, 53 insertions(+), 35 deletions(-)
> >
> > diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> > index 92d412b65c..7ceae2c92b 100644
> > --- a/hw/scsi/scsi-bus.c
> > +++ b/hw/scsi/scsi-bus.c
> > @@ -51,6 +51,56 @@ static const TypeInfo scsi_bus_info = {
> > };
> > static int next_scsi_bus;
> >
> > +static SCSIDevice *_scsi_device_find(SCSIBus *bus, int channel, int id,
> > int lun,
> > + bool include_unrealized)
>
> Declaring an identifier with a leading underscore with file scope is
> undefined behavior according to the C99 standard (7.1.3 Reserved
> identifiers). QEMU code usually avoids doing this by calling the
> function do_scsi_device_find() or similar.
I'll fix that, thanks!
Best regards,
Maxim Levitsky
>
> I'm not aware of any practical problem though, so don't worry about
> changing it unless you respin the series:
>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>