Skip to content

Commit d119bd2

Browse files
committed
md/md-llbitmap: fix percpu_ref not resurrected on suspend timeout
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/[email protected] Fixes: 5ab829f ("md/md-llbitmap: introduce new lockless bitmap") Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Li Nan <[email protected]>
1 parent cd1635d commit d119bd2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/md/md-llbitmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,10 @@ static int llbitmap_suspend_timeout(struct llbitmap *llbitmap, int page_idx)
712712
percpu_ref_kill(&pctl->active);
713713

714714
if (!wait_event_timeout(pctl->wait, percpu_ref_is_zero(&pctl->active),
715-
llbitmap->mddev->bitmap_info.daemon_sleep * HZ))
715+
llbitmap->mddev->bitmap_info.daemon_sleep * HZ)) {
716+
percpu_ref_resurrect(&pctl->active);
716717
return -ETIMEDOUT;
718+
}
717719

718720
return 0;
719721
}

0 commit comments

Comments
 (0)