All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Subject: Re: [PATCH] ublk: fix AB-BA lockdep warning
Date: Thu, 18 May 2023 10:59:10 +0800	[thread overview]
Message-ID: <ZGWUfv+g6EOw/pI2@ovpn-8-16.pek2.redhat.com> (raw)
In-Reply-To: <a57cn4zqgxm5hds2ekgg2y5jbfd4bgwoujimit7enm6eh5wo56@hftyn26mv3aq>

On Thu, May 18, 2023 at 02:01:17AM +0000, Shinichiro Kawasaki wrote:
> On May 17, 2023 / 21:34, Ming Lei wrote:
> > When handling UBLK_IO_FETCH_REQ, ctx->uring_lock is grabbed first, then
> > ub->mutex is acquired.
> > 
> > When handling UBLK_CMD_STOP_DEV or UBLK_CMD_DEL_DEV, ub->mutex is
> > grabbed first, then calling io_uring_cmd_done() for canceling uring
> > command, in which ctx->uring_lock may be required.
> > 
> > Real deadlock only happens when all the above commands are issued from
> > same uring context, and in reality different uring contexts are often used
> > for handing control command and IO command.
> > 
> > Fix the issue by using io_uring_cmd_complete_in_task() to cancel command
> > in ublk_cancel_dev(ublk_cancel_queue).
> > 
> > Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> > Closes: https://lore.kernel.org/linux-block/becol2g7sawl4rsjq2dztsbc7mqypfqko6wzsyoyazqydoasml@rcxarzwidrhk
> > Cc: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> 
> Using Ziyang's new blktests test cases, I confirmed this patch avoids the
> failure I reported. Thanks.
> 
> Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>

Shinichiro, Thanks for the test!

-- 
Ming


  reply	other threads:[~2023-05-18  3:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 13:34 [PATCH] ublk: fix AB-BA lockdep warning Ming Lei
2023-05-18  2:01 ` Shinichiro Kawasaki
2023-05-18  2:59   ` Ming Lei [this message]
2023-05-18 13:59 ` Jens Axboe

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=ZGWUfv+g6EOw/pI2@ovpn-8-16.pek2.redhat.com \
    --to=ming.lei@redhat.com \
    --cc=ZiyangZhang@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /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: link
Be 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.