* [PATCH] Revert "driver: block: release the lo_work_lock before queue_work"
@ 2025-02-18 6:58 zhaoyang.huang
2025-02-18 16:28 ` Jens Axboe
2025-02-18 16:31 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: zhaoyang.huang @ 2025-02-18 6:58 UTC (permalink / raw)
To: Jens Axboe, Dan Schatzberg, Ming Lei, linux-block, linux-kernel,
Zhaoyang Huang, steve.kang
From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
This reverts commit ad934fc1784802fd1408224474b25ee5289fadfc.
loop_queue_work should be strictly serialized to loop_process_work since
the lo_worker could be freed without noticing new work has been queued
again.
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
drivers/block/loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 68c943a77e41..c05fe27a96b6 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -894,8 +894,8 @@ static void loop_queue_work(struct loop_device *lo, struct loop_cmd *cmd)
cmd_list = &lo->rootcg_cmd_list;
}
list_add_tail(&cmd->list_entry, cmd_list);
- spin_unlock_irq(&lo->lo_work_lock);
queue_work(lo->workqueue, work);
+ spin_unlock_irq(&lo->lo_work_lock);
}
static void loop_set_timer(struct loop_device *lo)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "driver: block: release the lo_work_lock before queue_work"
2025-02-18 6:58 [PATCH] Revert "driver: block: release the lo_work_lock before queue_work" zhaoyang.huang
@ 2025-02-18 16:28 ` Jens Axboe
2025-02-18 16:31 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-02-18 16:28 UTC (permalink / raw)
To: Dan Schatzberg, Ming Lei, linux-block, linux-kernel,
Zhaoyang Huang, steve.kang, zhaoyang.huang
On Tue, 18 Feb 2025 14:58:35 +0800, zhaoyang.huang wrote:
> This reverts commit ad934fc1784802fd1408224474b25ee5289fadfc.
>
> loop_queue_work should be strictly serialized to loop_process_work since
> the lo_worker could be freed without noticing new work has been queued
> again.
>
>
> [...]
Applied, thanks!
[1/1] Revert "driver: block: release the lo_work_lock before queue_work"
commit: 02b3c61aab443d8c1cc7d7eb0ae0a8d86b547224
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "driver: block: release the lo_work_lock before queue_work"
2025-02-18 6:58 [PATCH] Revert "driver: block: release the lo_work_lock before queue_work" zhaoyang.huang
2025-02-18 16:28 ` Jens Axboe
@ 2025-02-18 16:31 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-02-18 16:31 UTC (permalink / raw)
To: zhaoyang.huang
Cc: Jens Axboe, Dan Schatzberg, Ming Lei, linux-block, linux-kernel,
Zhaoyang Huang, steve.kang
On Tue, Feb 18, 2025 at 02:58:35PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> This reverts commit ad934fc1784802fd1408224474b25ee5289fadfc.
>
> loop_queue_work should be strictly serialized to loop_process_work since
> the lo_worker could be freed without noticing new work has been queued
> again.
Btw, if you care about the lock contention you might want to split out
the trivial non-cgroup version into a separate helper or at least
branch and reduce the lock hold time there.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-18 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-18 6:58 [PATCH] Revert "driver: block: release the lo_work_lock before queue_work" zhaoyang.huang
2025-02-18 16:28 ` Jens Axboe
2025-02-18 16:31 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox