diff options
| author | Yu Kuai | 2026-01-24 02:26:23 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman | 2026-02-26 14:59:00 -0800 |
| commit | 095417d6b669c2dec39a5842ccb94df915f97f54 (patch) | |
| tree | 947f65a91f516fa5070391809964cba83612c9e4 /drivers/md | |
| parent | 870b9f15867b0e70f3459ef3974b043e8b229690 (diff) | |
md/md-llbitmap: fix percpu_ref not resurrected on suspend timeout
[ Upstream commit d119bd2e1643cc023210ff3c6f0657e4f914e71d ]
When llbitmap_suspend_timeout() times out waiting for percpu_ref to
become zero, it returns -ETIMEDOUT without resurrecting the percpu_ref.
The caller (md_llbitmap_daemon_fn) then continues to the next page
without calling llbitmap_resume(), leaving the percpu_ref in a killed
state permanently.
Fix this by resurrecting the percpu_ref before returning the error,
ensuring the page control structure remains usable for subsequent
operations.
Link: https://lore.kernel.org/linux-raid/20260123182623.3718551-3-yukuai@fnnas.com
Fixes: 5ab829f1971d ("md/md-llbitmap: introduce new lockless bitmap")
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
Reviewed-by: Li Nan <linan122@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/md')
| -rw-r--r-- | drivers/md/md-llbitmap.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/md-llbitmap.c b/drivers/md/md-llbitmap.c index 1eb434306162..bcb6eae1c711 100644 --- a/drivers/md/md-llbitmap.c +++ b/drivers/md/md-llbitmap.c @@ -712,8 +712,10 @@ static int llbitmap_suspend_timeout(struct llbitmap *llbitmap, int page_idx) percpu_ref_kill(&pctl->active); if (!wait_event_timeout(pctl->wait, percpu_ref_is_zero(&pctl->active), - llbitmap->mddev->bitmap_info.daemon_sleep * HZ)) + llbitmap->mddev->bitmap_info.daemon_sleep * HZ)) { + percpu_ref_resurrect(&pctl->active); return -ETIMEDOUT; + } return 0; } |
