Message ID | 20250218065835.19503-1-zhaoyang.huang@unisoc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Revert "driver: block: release the lo_work_lock before queue_work" | expand |
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,
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.
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)