Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

raid10: include bio_end_io_list in nr_queued to prevent freeze_array hang

This is the raid10 counterpart of the bug fixed by Nate
(raid1: include bio_end_io_list in nr_queued to prevent freeze_array hang)

Fixes: 95af587e95(md/raid10: ensure device failure recorded before write request returns)
Cc: stable@vger.kernel.org (V4.3+)
Cc: Nate Dailey <nate.dailey@stratus.com>
Signed-off-by: Shaohua Li <shli@fb.com>

+5 -2
+5 -2
drivers/md/raid10.c
··· 2664 2664 if (fail) { 2665 2665 spin_lock_irq(&conf->device_lock); 2666 2666 list_add(&r10_bio->retry_list, &conf->bio_end_io_list); 2667 + conf->nr_queued++; 2667 2668 spin_unlock_irq(&conf->device_lock); 2668 2669 md_wakeup_thread(conf->mddev->thread); 2669 2670 } else { ··· 2692 2691 LIST_HEAD(tmp); 2693 2692 spin_lock_irqsave(&conf->device_lock, flags); 2694 2693 if (!test_bit(MD_CHANGE_PENDING, &mddev->flags)) { 2695 - list_add(&tmp, &conf->bio_end_io_list); 2696 - list_del_init(&conf->bio_end_io_list); 2694 + while (!list_empty(&conf->bio_end_io_list)) { 2695 + list_move(conf->bio_end_io_list.prev, &tmp); 2696 + conf->nr_queued--; 2697 + } 2697 2698 } 2698 2699 spin_unlock_irqrestore(&conf->device_lock, flags); 2699 2700 while (!list_empty(&tmp)) {