aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid1.c22
-rw-r--r--drivers/md/raid10.c14
2 files changed, 18 insertions, 18 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index f2db7a9d5964..5208e9d1aff0 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -890,17 +890,17 @@ static void allow_barrier(struct r1conf *conf)
890 wake_up(&conf->wait_barrier); 890 wake_up(&conf->wait_barrier);
891} 891}
892 892
893static void freeze_array(struct r1conf *conf) 893static void freeze_array(struct r1conf *conf, int extra)
894{ 894{
895 /* stop syncio and normal IO and wait for everything to 895 /* stop syncio and normal IO and wait for everything to
896 * go quite. 896 * go quite.
897 * We increment barrier and nr_waiting, and then 897 * We increment barrier and nr_waiting, and then
898 * wait until nr_pending match nr_queued+1 898 * wait until nr_pending match nr_queued+extra
899 * This is called in the context of one normal IO request 899 * This is called in the context of one normal IO request
900 * that has failed. Thus any sync request that might be pending 900 * that has failed. Thus any sync request that might be pending
901 * will be blocked by nr_pending, and we need to wait for 901 * will be blocked by nr_pending, and we need to wait for
902 * pending IO requests to complete or be queued for re-try. 902 * pending IO requests to complete or be queued for re-try.
903 * Thus the number queued (nr_queued) plus this request (1) 903 * Thus the number queued (nr_queued) plus this request (extra)
904 * must match the number of pending IOs (nr_pending) before 904 * must match the number of pending IOs (nr_pending) before
905 * we continue. 905 * we continue.
906 */ 906 */
@@ -908,7 +908,7 @@ static void freeze_array(struct r1conf *conf)
908 conf->barrier++; 908 conf->barrier++;
909 conf->nr_waiting++; 909 conf->nr_waiting++;
910 wait_event_lock_irq_cmd(conf->wait_barrier, 910 wait_event_lock_irq_cmd(conf->wait_barrier,
911 conf->nr_pending == conf->nr_queued+1, 911 conf->nr_pending == conf->nr_queued+extra,
912 conf->resync_lock, 912 conf->resync_lock,
913 flush_pending_writes(conf)); 913 flush_pending_writes(conf));
914 spin_unlock_irq(&conf->resync_lock); 914 spin_unlock_irq(&conf->resync_lock);
@@ -1568,8 +1568,8 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
1568 * we wait for all outstanding requests to complete. 1568 * we wait for all outstanding requests to complete.
1569 */ 1569 */
1570 synchronize_sched(); 1570 synchronize_sched();
1571 raise_barrier(conf); 1571 freeze_array(conf, 0);
1572 lower_barrier(conf); 1572 unfreeze_array(conf);
1573 clear_bit(Unmerged, &rdev->flags); 1573 clear_bit(Unmerged, &rdev->flags);
1574 } 1574 }
1575 md_integrity_add_rdev(rdev, mddev); 1575 md_integrity_add_rdev(rdev, mddev);
@@ -1619,11 +1619,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
1619 */ 1619 */
1620 struct md_rdev *repl = 1620 struct md_rdev *repl =
1621 conf->mirrors[conf->raid_disks + number].rdev; 1621 conf->mirrors[conf->raid_disks + number].rdev;
1622 raise_barrier(conf); 1622 freeze_array(conf, 0);
1623 clear_bit(Replacement, &repl->flags); 1623 clear_bit(Replacement, &repl->flags);
1624 p->rdev = repl; 1624 p->rdev = repl;
1625 conf->mirrors[conf->raid_disks + number].rdev = NULL; 1625 conf->mirrors[conf->raid_disks + number].rdev = NULL;
1626 lower_barrier(conf); 1626 unfreeze_array(conf);
1627 clear_bit(WantReplacement, &rdev->flags); 1627 clear_bit(WantReplacement, &rdev->flags);
1628 } else 1628 } else
1629 clear_bit(WantReplacement, &rdev->flags); 1629 clear_bit(WantReplacement, &rdev->flags);
@@ -2240,7 +2240,7 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
2240 * frozen 2240 * frozen
2241 */ 2241 */
2242 if (mddev->ro == 0) { 2242 if (mddev->ro == 0) {
2243 freeze_array(conf); 2243 freeze_array(conf, 1);
2244 fix_read_error(conf, r1_bio->read_disk, 2244 fix_read_error(conf, r1_bio->read_disk,
2245 r1_bio->sector, r1_bio->sectors); 2245 r1_bio->sector, r1_bio->sectors);
2246 unfreeze_array(conf); 2246 unfreeze_array(conf);
@@ -3020,7 +3020,7 @@ static int raid1_reshape(struct mddev *mddev)
3020 return -ENOMEM; 3020 return -ENOMEM;
3021 } 3021 }
3022 3022
3023 raise_barrier(conf); 3023 freeze_array(conf, 0);
3024 3024
3025 /* ok, everything is stopped */ 3025 /* ok, everything is stopped */
3026 oldpool = conf->r1bio_pool; 3026 oldpool = conf->r1bio_pool;
@@ -3051,7 +3051,7 @@ static int raid1_reshape(struct mddev *mddev)
3051 conf->raid_disks = mddev->raid_disks = raid_disks; 3051 conf->raid_disks = mddev->raid_disks = raid_disks;
3052 mddev->delta_disks = 0; 3052 mddev->delta_disks = 0;
3053 3053
3054 lower_barrier(conf); 3054 unfreeze_array(conf);
3055 3055
3056 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3056 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
3057 md_wakeup_thread(mddev->thread); 3057 md_wakeup_thread(mddev->thread);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 8000ee25650d..aa9ed304951e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1065,17 +1065,17 @@ static void allow_barrier(struct r10conf *conf)
1065 wake_up(&conf->wait_barrier); 1065 wake_up(&conf->wait_barrier);
1066} 1066}
1067 1067
1068static void freeze_array(struct r10conf *conf) 1068static void freeze_array(struct r10conf *conf, int extra)
1069{ 1069{
1070 /* stop syncio and normal IO and wait for everything to 1070 /* stop syncio and normal IO and wait for everything to
1071 * go quiet. 1071 * go quiet.
1072 * We increment barrier and nr_waiting, and then 1072 * We increment barrier and nr_waiting, and then
1073 * wait until nr_pending match nr_queued+1 1073 * wait until nr_pending match nr_queued+extra
1074 * This is called in the context of one normal IO request 1074 * This is called in the context of one normal IO request
1075 * that has failed. Thus any sync request that might be pending 1075 * that has failed. Thus any sync request that might be pending
1076 * will be blocked by nr_pending, and we need to wait for 1076 * will be blocked by nr_pending, and we need to wait for
1077 * pending IO requests to complete or be queued for re-try. 1077 * pending IO requests to complete or be queued for re-try.
1078 * Thus the number queued (nr_queued) plus this request (1) 1078 * Thus the number queued (nr_queued) plus this request (extra)
1079 * must match the number of pending IOs (nr_pending) before 1079 * must match the number of pending IOs (nr_pending) before
1080 * we continue. 1080 * we continue.
1081 */ 1081 */
@@ -1083,7 +1083,7 @@ static void freeze_array(struct r10conf *conf)
1083 conf->barrier++; 1083 conf->barrier++;
1084 conf->nr_waiting++; 1084 conf->nr_waiting++;
1085 wait_event_lock_irq_cmd(conf->wait_barrier, 1085 wait_event_lock_irq_cmd(conf->wait_barrier,
1086 conf->nr_pending == conf->nr_queued+1, 1086 conf->nr_pending == conf->nr_queued+extra,
1087 conf->resync_lock, 1087 conf->resync_lock,
1088 flush_pending_writes(conf)); 1088 flush_pending_writes(conf));
1089 1089
@@ -1849,8 +1849,8 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
1849 * we wait for all outstanding requests to complete. 1849 * we wait for all outstanding requests to complete.
1850 */ 1850 */
1851 synchronize_sched(); 1851 synchronize_sched();
1852 raise_barrier(conf, 0); 1852 freeze_array(conf, 0);
1853 lower_barrier(conf); 1853 unfreeze_array(conf);
1854 clear_bit(Unmerged, &rdev->flags); 1854 clear_bit(Unmerged, &rdev->flags);
1855 } 1855 }
1856 md_integrity_add_rdev(rdev, mddev); 1856 md_integrity_add_rdev(rdev, mddev);
@@ -2646,7 +2646,7 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
2646 r10_bio->devs[slot].bio = NULL; 2646 r10_bio->devs[slot].bio = NULL;
2647 2647
2648 if (mddev->ro == 0) { 2648 if (mddev->ro == 0) {
2649 freeze_array(conf); 2649 freeze_array(conf, 1);
2650 fix_read_error(conf, mddev, r10_bio); 2650 fix_read_error(conf, mddev, r10_bio);
2651 unfreeze_array(conf); 2651 unfreeze_array(conf);
2652 } else 2652 } else