diff options
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index f4f3edcdaf8d..2ae7021320e1 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -863,9 +863,22 @@ static void wait_barrier(struct r10conf *conf) | |||
863 | spin_lock_irq(&conf->resync_lock); | 863 | spin_lock_irq(&conf->resync_lock); |
864 | if (conf->barrier) { | 864 | if (conf->barrier) { |
865 | conf->nr_waiting++; | 865 | conf->nr_waiting++; |
866 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, | 866 | /* Wait for the barrier to drop. |
867 | * However if there are already pending | ||
868 | * requests (preventing the barrier from | ||
869 | * rising completely), and the | ||
870 | * pre-process bio queue isn't empty, | ||
871 | * then don't wait, as we need to empty | ||
872 | * that queue to get the nr_pending | ||
873 | * count down. | ||
874 | */ | ||
875 | wait_event_lock_irq(conf->wait_barrier, | ||
876 | !conf->barrier || | ||
877 | (conf->nr_pending && | ||
878 | current->bio_list && | ||
879 | !bio_list_empty(current->bio_list)), | ||
867 | conf->resync_lock, | 880 | conf->resync_lock, |
868 | ); | 881 | ); |
869 | conf->nr_waiting--; | 882 | conf->nr_waiting--; |
870 | } | 883 | } |
871 | conf->nr_pending++; | 884 | conf->nr_pending++; |