Skip to content

Commit a1fd37f

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
md: Don't wait for MD_RECOVERY_NEEDED for HOT_REMOVE_DISK ioctl
Commit 90f5f7a ("md: Wait for md_check_recovery before attempting device removal.") explained in the commit message that failed device must be reomoved from the personality first by md_check_recovery(), before it can be removed from the array. That's the reason the commit add the code to wait for MD_RECOVERY_NEEDED. However, this is not the case now, because remove_and_add_spares() is called directly from hot_remove_disk() from ioctl path, hence failed device(marked faulty) can be removed from the personality by ioctl. On the other hand, the commit introduced a performance problem that if MD_RECOVERY_NEEDED is set and the array is not running, ioctl will wait for 5s before it can return failure to user. Since the waiting is not needed now, fix the problem by removing the waiting. Fixes: 90f5f7a ("md: Wait for md_check_recovery before attempting device removal.") Reported-by: Mateusz Kusiak <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1f4a72f commit a1fd37f

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

drivers/md/md.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7765,12 +7765,6 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
77657765
return get_bitmap_file(mddev, argp);
77667766
}
77677767

7768-
if (cmd == HOT_REMOVE_DISK)
7769-
/* need to ensure recovery thread has run */
7770-
wait_event_interruptible_timeout(mddev->sb_wait,
7771-
!test_bit(MD_RECOVERY_NEEDED,
7772-
&mddev->recovery),
7773-
msecs_to_jiffies(5000));
77747768
if (cmd == STOP_ARRAY || cmd == STOP_ARRAY_RO) {
77757769
/* Need to flush page cache, and ensure no-one else opens
77767770
* and writes

0 commit comments

Comments
 (0)