This is a note to let you know that I've just added the patch titled Revert "Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"" to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-revert-md-raid5-wait-for-md_sb_change_pending-in-raid5d.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From song@xxxxxxxxxx Thu Jan 25 13:56:36 2024 From: Song Liu <song@xxxxxxxxxx> Date: Thu, 25 Jan 2024 00:21:31 -0800 Subject: Revert "Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"" To: linux-raid@xxxxxxxxxxxxxxx Cc: yukuai1@xxxxxxxxxxxxxxx, Song Liu <song@xxxxxxxxxx>, Dan Moulding <dan@xxxxxxxx>, stable@xxxxxxxxxxxxxxx, Junxiao Bi <junxiao.bi@xxxxxxxxxx>, Yu Kuai <yukuai3@xxxxxxxxxx> Message-ID: <20240125082131.788600-1-song@xxxxxxxxxx> From: Song Liu <song@xxxxxxxxxx> This reverts commit bed9e27baf52a09b7ba2a3714f1e24e17ced386d. The original set [1][2] was expected to undo a suboptimal fix in [2], and replace it with a better fix [1]. However, as reported by Dan Moulding [2] causes an issue with raid5 with journal device. Revert [2] for now to close the issue. We will follow up on another issue reported by Juxiao Bi, as [2] is expected to fix it. We believe this is a good trade-off, because the latter issue happens less freqently. In the meanwhile, we will NOT revert [1], as it contains the right logic. [1] commit d6e035aad6c0 ("md: bypass block throttle for superblock update") [2] commit bed9e27baf52 ("Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"") Reported-by: Dan Moulding <dan@xxxxxxxx> Closes: https://lore.kernel.org/linux-raid/20240123005700.9302-1-dan@xxxxxxxx/ Fixes: bed9e27baf52 ("Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"") Cc: stable@xxxxxxxxxxxxxxx # v5.19+ Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Cc: Yu Kuai <yukuai3@xxxxxxxxxx> Signed-off-by: Song Liu <song@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/raid5.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -36,6 +36,7 @@ */ #include <linux/blkdev.h> +#include <linux/delay.h> #include <linux/kthread.h> #include <linux/raid/pq.h> #include <linux/async_tx.h> @@ -6521,7 +6522,18 @@ static void raid5d(struct md_thread *thr spin_unlock_irq(&conf->device_lock); md_check_recovery(mddev); spin_lock_irq(&conf->device_lock); + + /* + * Waiting on MD_SB_CHANGE_PENDING below may deadlock + * seeing md_check_recovery() is needed to clear + * the flag when using mdmon. + */ + continue; } + + wait_event_lock_irq(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), + conf->device_lock); } pr_debug("%d stripes handled\n", handled); Patches currently in stable-queue which might be from song@xxxxxxxxxx are queue-5.15/revert-md-raid5-wait-for-md_sb_change_pending-in-raid5d.patch queue-5.15/perf-env-avoid-recursively-taking-env-bpf_progs.lock.patch queue-5.15/bpf-fix-re-attachment-branch-in-bpf_tracing_prog_attach.patch queue-5.15/revert-revert-md-raid5-wait-for-md_sb_change_pending-in-raid5d.patch