[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140611131931.GA6670@stefanha-thinkpad.str.redhat.com>
Date: Wed, 11 Jun 2014 15:19:31 +0200
From: Stefan Hajnoczi <stefanha@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
hch@....de, JBottomley@...allels.com, venkateshs@...gle.com
Subject: Re: Fwd: Re: [PATCH v3 3/6] virtio-scsi: avoid cancelling
uninitialized work items
On Wed, Jun 11, 2014 at 02:53:46PM +0200, Paolo Bonzini wrote:
> -------- Messaggio originale --------
> From: Christoph Hellwig <hch@...radead.org>
> To: Paolo Bonzini <pbonzini@...hat.com>
> Cc: linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org, hch@....de, JBottomley@...allels.com, venkateshs@...gle.com
> Subject: Re: [PATCH v3 3/6] virtio-scsi: avoid cancelling uninitialized work items
> Message-ID: <20140611124731.GA16990@...radead.org>
> In-Reply-To: <1401881699-1456-4-git-send-email-pbonzini@...hat.com>
>
> Can I get a second review on this one from anyone?
Reviewed-by: Stefan Hajnoczi <stefanha@...hat.com>
> On Wed, Jun 04, 2014 at 01:34:56PM +0200, Paolo Bonzini wrote:
> > Calling the workqueue interface on uninitialized work items isn't a
> > good idea even if they're zeroed. It's not failing catastrophically only
> > through happy accidents.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> > ---
> > drivers/scsi/virtio_scsi.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> > index f0b4cdbfceb0..d66c4ee2c774 100644
> > --- a/drivers/scsi/virtio_scsi.c
> > +++ b/drivers/scsi/virtio_scsi.c
> > @@ -253,6 +253,8 @@ static void virtscsi_ctrl_done(struct virtqueue *vq)
> > virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free);
> > };
> >
> > +static void virtscsi_handle_event(struct work_struct *work);
> > +
> > static int virtscsi_kick_event(struct virtio_scsi *vscsi,
> > struct virtio_scsi_event_node *event_node)
> > {
> > @@ -260,6 +262,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
> > struct scatterlist sg;
> > unsigned long flags;
> >
> > + INIT_WORK(&event_node->work, virtscsi_handle_event);
> > sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
> >
> > spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
> > @@ -377,7 +380,6 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf)
> > {
> > struct virtio_scsi_event_node *event_node = buf;
> >
> > - INIT_WORK(&event_node->work, virtscsi_handle_event);
> > schedule_work(&event_node->work);
> > }
> >
> > --
> > 1.8.3.1
>
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists