From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>, linux-block@vger.kernel.org
Cc: Caleb Sander Mateos <csander@purestorage.com>,
Uday Shankar <ushankar@purestorage.com>
Subject: Re: [PATCH V2] ublk: fix deadlock when reading partition table
Date: Fri, 12 Dec 2025 12:49:49 -0700 [thread overview]
Message-ID: <8dd3c141-3e92-44f3-91e2-2bf4827b36a4@kernel.dk> (raw)
In-Reply-To: <20251212143415.485359-1-ming.lei@redhat.com>
On 12/12/25 7:34 AM, Ming Lei wrote:
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index df9831783a13..38f138f248e6 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -1080,12 +1080,20 @@ static inline struct ublk_uring_cmd_pdu *ublk_get_uring_cmd_pdu(
> return io_uring_cmd_to_pdu(ioucmd, struct ublk_uring_cmd_pdu);
> }
>
> +static void ublk_end_request(struct request *req, blk_status_t error)
> +{
> + local_bh_disable();
> + blk_mq_end_request(req, error);
> + local_bh_enable();
> +}
This is really almost too ugly to live, as a work-around for what just
happens to be in __fput_deferred()... Surely we can come up with
something better here? Heck even a PF_ flag would be better than this,
imho.
> @@ -1117,14 +1125,26 @@ static inline void __ublk_complete_rq(struct request *req, struct ublk_io *io,
> if (unlikely(unmapped_bytes < io->res))
> io->res = unmapped_bytes;
>
> - if (blk_update_request(req, BLK_STS_OK, io->res))
> + /*
> + * Run bio->bi_end_io() from softirq context for preventing this
> + * ublk's blkdev_release() from being called on current's task
> + * work, see fput() implementation.
But that's not what it does, running it from softirq context. It simply
disables local bottomhalf interrupts to trick __fput_deferred(), it's
not scheduling ->bi_end_io() to run from softirq context itself.
--
Jens Axboe
next prev parent reply other threads:[~2025-12-12 19:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 14:34 [PATCH V2] ublk: fix deadlock when reading partition table Ming Lei
2025-12-12 16:57 ` Caleb Sander Mateos
2025-12-12 19:49 ` Jens Axboe [this message]
2025-12-13 2:28 ` Ming Lei
2025-12-14 6:41 ` Jens Axboe
2025-12-16 8:56 ` Ming Lei
2025-12-16 15:03 ` Jens Axboe
2025-12-16 17:57 ` Jens Axboe
2025-12-17 3:09 ` Ming Lei
2025-12-17 3:19 ` Jens Axboe
2025-12-17 3:33 ` Ming Lei
2025-12-18 2:37 ` Jens Axboe
2025-12-18 2:41 ` 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=8dd3c141-3e92-44f3-91e2-2bf4827b36a4@kernel.dk \
--to=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=ushankar@purestorage.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).