Re: [PATCH] block: fix PF_BLOCK_TS/current->plug ordering in blk_finish_plug()
From: Sandeep Dhavale
Date: Tue Nov 17 2026 - 14:08:04 EST
Cc: +Chao Yu <chao@xxxxxxxxxx>
> Fixes: 06b23f92af87 ("block: update cached timestamp post schedule/preemption")
> Cc: stable@xxxxxxxxxxxxxxx # v6.9+
> Signed-off-by: Zi-Hao Huang <zi-hao.huang@xxxxxxxxxxxx>
Note that Chao independently hit and posted a fix for the same panic a
few days later [1], placing barrier() at the end of __blk_flush_plug()
instead. Placing barrier() here in blk_finish_plug() looks slightly
cleaner since blk_finish_plug() is the only caller of __blk_flush_plug()
that clears current->plug.
One correction on the Fixes/stable tags (which Chao's patch got right):
06b23f92af87 checked `if (plug)` in blk_plug_invalidate_ts() and only ran
from sched_update_worker(), so this preemption race and NULL dereference
was introduced by
fad156c2af22 ("block: invalidate cached plug timestamp after task switch"),
similar to
691b052139c9 ("block: fix race in blk_time_get_ns() returning 0").
So the tags should be:
Fixes: fad156c2af22 ("block: invalidate cached plug timestamp after
task switch")
Cc: stable@xxxxxxxxxxxxxxx
With the updated Fixes/stable tags:
Reviewed-by: Sandeep Dhavale <dhavale@xxxxxxxxxx>
- Sandeep.
[1] https://lore.kernel.org/all/20261116000723.934826-1-chao@xxxxxxxxxx/