Michael S. Tsirkin
2022-Sep-22 16:56 UTC
[PATCH v2] virtio-blk: Fix WARN_ON_ONCE in virtio_queue_rq()
On Thu, Sep 22, 2022 at 11:45:15PM +0900, Suwan Kim wrote:> Hi Michael, > > Can this patch be merged to the next rc? > We received two bug reports about this issue and need to fix it. > > Regards, > Suwan Kim > > > On Wed, Aug 31, 2022 at 9:44 PM Pankaj Raghav <pankydev8 at gmail.com> wrote: > > > > On Wed, Aug 31, 2022 at 12:01:53AM +0900, Suwan Kim wrote: > > > If a request fails at virtio_queue_rqs(), it is inserted to requeue_list > > > and passed to virtio_queue_rq(). Then blk_mq_start_request() can be called > > > again at virtio_queue_rq() and trigger WARN_ON_ONCE like below trace because > > > request state was already set to MQ_RQ_IN_FLIGHT in virtio_queue_rqs() > > > despite the failure. > > > > > > To avoid calling blk_mq_start_request() twice, This patch moves the > > > execution of blk_mq_start_request() to the end of virtblk_prep_rq(). > > > And instead of requeuing failed request to plug list in the error path of > > > virtblk_add_req_batch(), it uses blk_mq_requeue_request() to change failed > > > request state to MQ_RQ_IDLE. Then virtblk can safely handle the request > > > on the next trial. > > > > > > Fixes: 0e9911fa768f ("virtio-blk: support mq_ops->queue_rqs()") > > > Reported-by: Alexandre Courbot <acourbot at chromium.org> > > > Tested-by: Alexandre Courbot <acourbot at chromium.org> > > > Signed-off-by: Suwan Kim <suwan.kim027 at gmail.com> > > > --- > > Looks good. > > Reviewed-by: Pankaj Raghav <p.raghav at samsung.com>Stefan, Paolo, any feedback here? -- MST
Michael S. Tsirkin
2022-Sep-22 17:01 UTC
[PATCH v2] virtio-blk: Fix WARN_ON_ONCE in virtio_queue_rq()
On Thu, Sep 22, 2022 at 12:57:01PM -0400, Michael S. Tsirkin wrote:> On Thu, Sep 22, 2022 at 11:45:15PM +0900, Suwan Kim wrote: > > Hi Michael, > > > > Can this patch be merged to the next rc? > > We received two bug reports about this issue and need to fix it. > > > > Regards, > > Suwan Kim > > > > > > On Wed, Aug 31, 2022 at 9:44 PM Pankaj Raghav <pankydev8 at gmail.com> wrote: > > > > > > On Wed, Aug 31, 2022 at 12:01:53AM +0900, Suwan Kim wrote: > > > > If a request fails at virtio_queue_rqs(), it is inserted to requeue_list > > > > and passed to virtio_queue_rq(). Then blk_mq_start_request() can be called > > > > again at virtio_queue_rq() and trigger WARN_ON_ONCE like below trace because > > > > request state was already set to MQ_RQ_IN_FLIGHT in virtio_queue_rqs() > > > > despite the failure. > > > > > > > > To avoid calling blk_mq_start_request() twice, This patch moves the > > > > execution of blk_mq_start_request() to the end of virtblk_prep_rq(). > > > > And instead of requeuing failed request to plug list in the error path of > > > > virtblk_add_req_batch(), it uses blk_mq_requeue_request() to change failed > > > > request state to MQ_RQ_IDLE. Then virtblk can safely handle the request > > > > on the next trial. > > > > > > > > Fixes: 0e9911fa768f ("virtio-blk: support mq_ops->queue_rqs()") > > > > Reported-by: Alexandre Courbot <acourbot at chromium.org> > > > > Tested-by: Alexandre Courbot <acourbot at chromium.org> > > > > Signed-off-by: Suwan Kim <suwan.kim027 at gmail.com> > > > > --- > > > Looks good. > > > Reviewed-by: Pankaj Raghav <p.raghav at samsung.com> > > Stefan, Paolo, any feedback here?Oh, Stefan acked. Sorry. Will queue now.> -- > MST