diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2014-11-10 11:21:12 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-11-10 11:27:37 -0500 |
commit | ff8bd88b73fad369a12465dfa52ad5c0bf088ced (patch) | |
tree | f142942ea9b5529bc82591da749eee816f56d4bc | |
parent | a88215312c5ed74697973f6c9f0fce718bcf18ad (diff) |
drbd: fix resync throttling initialization
If for some reason DRBD resync was the only activity on a backend
device, drbd_rs_c_min_rate_throttle() would mistakenly decide that it is
still initialization time, and keep throttling the resync.
This patch explicitly initializes ->rs_last_events to the current
backend event counters, and drops the rs_last_events == 0 from the
throttle condition.
Reported-by: Mikhail Sugakov <msugakov@amazon.de>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_state.c | 1 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 6960fb064731..d169b4a79267 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -2482,7 +2482,7 @@ bool drbd_rs_c_min_rate_throttle(struct drbd_device *device) | |||
2482 | atomic_read(&device->rs_sect_ev); | 2482 | atomic_read(&device->rs_sect_ev); |
2483 | 2483 | ||
2484 | if (atomic_read(&device->ap_actlog_cnt) | 2484 | if (atomic_read(&device->ap_actlog_cnt) |
2485 | || !device->rs_last_events || curr_events - device->rs_last_events > 64) { | 2485 | || curr_events - device->rs_last_events > 64) { |
2486 | unsigned long rs_left; | 2486 | unsigned long rs_left; |
2487 | int i; | 2487 | int i; |
2488 | 2488 | ||
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 4529d9282cef..2d7dd269b6a8 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c | |||
@@ -1099,7 +1099,6 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns, | |||
1099 | 1099 | ||
1100 | set_ov_position(device, ns.conn); | 1100 | set_ov_position(device, ns.conn); |
1101 | device->rs_start = now; | 1101 | device->rs_start = now; |
1102 | device->rs_last_events = 0; | ||
1103 | device->rs_last_sect_ev = 0; | 1102 | device->rs_last_sect_ev = 0; |
1104 | device->ov_last_oos_size = 0; | 1103 | device->ov_last_oos_size = 0; |
1105 | device->ov_last_oos_start = 0; | 1104 | device->ov_last_oos_start = 0; |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index d2d1f97511bd..d0fae55d871d 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1592,11 +1592,15 @@ void drbd_resync_after_changed(struct drbd_device *device) | |||
1592 | 1592 | ||
1593 | void drbd_rs_controller_reset(struct drbd_device *device) | 1593 | void drbd_rs_controller_reset(struct drbd_device *device) |
1594 | { | 1594 | { |
1595 | struct gendisk *disk = device->ldev->backing_bdev->bd_contains->bd_disk; | ||
1595 | struct fifo_buffer *plan; | 1596 | struct fifo_buffer *plan; |
1596 | 1597 | ||
1597 | atomic_set(&device->rs_sect_in, 0); | 1598 | atomic_set(&device->rs_sect_in, 0); |
1598 | atomic_set(&device->rs_sect_ev, 0); | 1599 | atomic_set(&device->rs_sect_ev, 0); |
1599 | device->rs_in_flight = 0; | 1600 | device->rs_in_flight = 0; |
1601 | device->rs_last_events = | ||
1602 | (int)part_stat_read(&disk->part0, sectors[0]) + | ||
1603 | (int)part_stat_read(&disk->part0, sectors[1]); | ||
1600 | 1604 | ||
1601 | /* Updating the RCU protected object in place is necessary since | 1605 | /* Updating the RCU protected object in place is necessary since |
1602 | this function gets called from atomic context. | 1606 | this function gets called from atomic context. |
@@ -1743,7 +1747,6 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side) | |||
1743 | device->rs_failed = 0; | 1747 | device->rs_failed = 0; |
1744 | device->rs_paused = 0; | 1748 | device->rs_paused = 0; |
1745 | device->rs_same_csum = 0; | 1749 | device->rs_same_csum = 0; |
1746 | device->rs_last_events = 0; | ||
1747 | device->rs_last_sect_ev = 0; | 1750 | device->rs_last_sect_ev = 0; |
1748 | device->rs_total = tw; | 1751 | device->rs_total = tw; |
1749 | device->rs_start = now; | 1752 | device->rs_start = now; |