]> www.infradead.org Git - nvme.git/commit
md: Don't suspend the array for interrupted reshape
authorYu Kuai <yukuai3@huawei.com>
Thu, 1 Feb 2024 09:25:50 +0000 (17:25 +0800)
committerSong Liu <song@kernel.org>
Thu, 15 Feb 2024 22:17:27 +0000 (14:17 -0800)
commit9e46c70e829bddc24e04f963471e9983a11598b7
tree60b9d3d1b60117ad7564553dd2a1f0955acb5d76
parentad39c08186f8a0f221337985036ba86731d6aafe
md: Don't suspend the array for interrupted reshape

md_start_sync() will suspend the array if there are spares that can be
added or removed from conf, however, if reshape is still in progress,
this won't happen at all or data will be corrupted(remove_and_add_spares
won't be called from md_choose_sync_action for reshape), hence there is
no need to suspend the array if reshape is not done yet.

Meanwhile, there is a potential deadlock for raid456:

1) reshape is interrupted;

2) set one of the disk WantReplacement, and add a new disk to the array,
   however, recovery won't start until the reshape is finished;

3) then issue an IO across reshpae position, this IO will wait for
   reshape to make progress;

4) continue to reshape, then md_start_sync() found there is a spare disk
   that can be added to conf, mddev_suspend() is called;

Step 4 and step 3 is waiting for each other, deadlock triggered. Noted
this problem is found by code review, and it's not reporduced yet.

Fix this porblem by don't suspend the array for interrupted reshape,
this is safe because conf won't be changed until reshape is done.

Fixes: bc08041b32ab ("md: suspend array in md_start_sync() if array need reconfiguration")
Cc: stable@vger.kernel.org # v6.7+
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240201092559.910982-6-yukuai1@huaweicloud.com
drivers/md/md.c