From: Jared Holzman <jholzman@nvidia.com>
To: stable@vger.kernel.org
Cc: ming.lei@redhat.com, axboe@kernel.dk, ushankar@purestorage.com,
gregkh@linuxfoundation.org, jholzman@nvidia.com
Subject: [PATCH 6.14.y v2 5/7] ublk: remove __ublk_quiesce_dev()
Date: Wed, 7 May 2025 12:47:00 +0300 [thread overview]
Message-ID: <20250507094702.73459-6-jholzman@nvidia.com> (raw)
In-Reply-To: <20250507094702.73459-1-jholzman@nvidia.com>
From: Ming Lei <ming.lei@redhat.com>
[ Upstream commit 736b005b413a172670711ee17cab3c8ccab83223 ]
Remove __ublk_quiesce_dev() and open code for updating device state as
QUIESCED.
We needn't to drain inflight requests in __ublk_quiesce_dev() any more,
because all inflight requests are aborted in ublk char device release
handler.
Also we needn't to set ->canceling in __ublk_quiesce_dev() any more
because it is done unconditionally now in ublk_ch_release().
Reviewed-by: Uday Shankar <ushankar@purestorage.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250416035444.99569-7-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/block/ublk_drv.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 652742db0396..c3f576a9dbf2 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -205,7 +205,6 @@ struct ublk_params_header {
static void ublk_stop_dev_unlocked(struct ublk_device *ub);
static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq);
-static void __ublk_quiesce_dev(struct ublk_device *ub);
static inline unsigned int ublk_req_build_flags(struct request *req);
static inline struct ublksrv_io_desc *ublk_get_iod(struct ublk_queue *ubq,
@@ -1558,7 +1557,8 @@ static int ublk_ch_release(struct inode *inode, struct file *filp)
ublk_stop_dev_unlocked(ub);
} else {
if (ublk_nosrv_dev_should_queue_io(ub)) {
- __ublk_quiesce_dev(ub);
+ /* ->canceling is set and all requests are aborted */
+ ub->dev_info.state = UBLK_S_DEV_QUIESCED;
} else {
ub->dev_info.state = UBLK_S_DEV_FAIL_IO;
for (i = 0; i < ub->dev_info.nr_hw_queues; i++)
@@ -1804,21 +1804,6 @@ static void ublk_wait_tagset_rqs_idle(struct ublk_device *ub)
}
}
-static void __ublk_quiesce_dev(struct ublk_device *ub)
-{
- int i;
-
- pr_devel("%s: quiesce ub: dev_id %d state %s\n",
- __func__, ub->dev_info.dev_id,
- ub->dev_info.state == UBLK_S_DEV_LIVE ?
- "LIVE" : "QUIESCED");
- /* mark every queue as canceling */
- for (i = 0; i < ub->dev_info.nr_hw_queues; i++)
- ublk_get_queue(ub, i)->canceling = true;
- ublk_wait_tagset_rqs_idle(ub);
- ub->dev_info.state = UBLK_S_DEV_QUIESCED;
-}
-
static void ublk_force_abort_dev(struct ublk_device *ub)
{
int i;
--
2.43.0
next prev parent reply other threads:[~2025-05-07 9:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 9:46 [PATCH 6.14.y v2 0/7] ublk: fix race between io_uring_cmd_complete_in_task and ublk_cancel_cmd Jared Holzman
2025-05-07 9:46 ` [PATCH 6.14.y v2 1/7] ublk: add helper of ublk_need_map_io() Jared Holzman
2025-05-08 16:17 ` Sasha Levin
2025-05-07 9:46 ` [PATCH 6.14.y v2 2/7] ublk: properly serialize all FETCH_REQs Jared Holzman
2025-05-08 16:18 ` Sasha Levin
2025-05-07 9:46 ` [PATCH 6.14.y v2 3/7] ublk: move device reset into ublk_ch_release() Jared Holzman
2025-05-08 16:19 ` Sasha Levin
2025-05-07 9:46 ` [PATCH 6.14.y v2 4/7] ublk: improve detection and handling of ublk server exit Jared Holzman
2025-05-08 16:19 ` Sasha Levin
2025-05-07 9:47 ` Jared Holzman [this message]
2025-05-08 16:17 ` [PATCH 6.14.y v2 5/7] ublk: remove __ublk_quiesce_dev() Sasha Levin
2025-05-07 9:47 ` [PATCH 6.14.y v2 6/7] ublk: simplify aborting ublk request Jared Holzman
2025-05-08 16:18 ` Sasha Levin
2025-05-07 9:47 ` [PATCH 6.14.y v2 7/7] ublk: fix race between io_uring_cmd_complete_in_task and ublk_cancel_cmd Jared Holzman
2025-05-08 16:17 ` Sasha Levin
2025-05-07 11:18 ` [PATCH 6.14.y v2 0/7] " Ming Lei
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=20250507094702.73459-6-jholzman@nvidia.com \
--to=jholzman@nvidia.com \
--cc=axboe@kernel.dk \
--cc=gregkh@linuxfoundation.org \
--cc=ming.lei@redhat.com \
--cc=stable@vger.kernel.org \
--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