drbd: change bitmap write-out when leaving resync states
When leaving resync states because of disconnect, do the bitmap write-out synchronously in the drbd_disconnected() path. When leaving resync states because we go back to AHEAD/BEHIND, or because resync actually finished, or some disk was lost during resync, trigger the write-out from after_state_ch(). The bitmap write-out for resync -> ahead/behind was missing completely before. Note that this is all only an optimization to avoid double-resyncs of already completed blocks in case this node crashes. 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>
This commit is contained in:
parent
c0065f98d5
commit
be115b69f1
|
@ -4795,9 +4795,11 @@ static int drbd_disconnected(struct drbd_peer_device *peer_device)
|
||||||
|
|
||||||
drbd_md_sync(device);
|
drbd_md_sync(device);
|
||||||
|
|
||||||
/* serialize with bitmap writeout triggered by the state change,
|
if (get_ldev(device)) {
|
||||||
* if any. */
|
drbd_bitmap_io(device, &drbd_bm_write_copy_pages,
|
||||||
wait_event(device->misc_wait, !test_bit(BITMAP_IO, &device->flags));
|
"write from disconnected", BM_LOCKED_CHANGE_ALLOWED);
|
||||||
|
put_ldev(device);
|
||||||
|
}
|
||||||
|
|
||||||
/* tcp_close and release of sendpage pages can be deferred. I don't
|
/* tcp_close and release of sendpage pages can be deferred. I don't
|
||||||
* want to use SO_LINGER, because apparently it can be deferred for
|
* want to use SO_LINGER, because apparently it can be deferred for
|
||||||
|
|
|
@ -1934,12 +1934,17 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os,
|
||||||
|
|
||||||
/* This triggers bitmap writeout of potentially still unwritten pages
|
/* This triggers bitmap writeout of potentially still unwritten pages
|
||||||
* if the resync finished cleanly, or aborted because of peer disk
|
* if the resync finished cleanly, or aborted because of peer disk
|
||||||
* failure, or because of connection loss.
|
* failure, or on transition from resync back to AHEAD/BEHIND.
|
||||||
|
*
|
||||||
|
* Connection loss is handled in drbd_disconnected() by the receiver.
|
||||||
|
*
|
||||||
* For resync aborted because of local disk failure, we cannot do
|
* For resync aborted because of local disk failure, we cannot do
|
||||||
* any bitmap writeout anymore.
|
* any bitmap writeout anymore.
|
||||||
|
*
|
||||||
* No harm done if some bits change during this phase.
|
* No harm done if some bits change during this phase.
|
||||||
*/
|
*/
|
||||||
if (os.conn > C_CONNECTED && ns.conn <= C_CONNECTED && get_ldev(device)) {
|
if ((os.conn > C_CONNECTED && os.conn < C_AHEAD) &&
|
||||||
|
(ns.conn == C_CONNECTED || ns.conn >= C_AHEAD) && get_ldev(device)) {
|
||||||
drbd_queue_bitmap_io(device, &drbd_bm_write_copy_pages, NULL,
|
drbd_queue_bitmap_io(device, &drbd_bm_write_copy_pages, NULL,
|
||||||
"write from resync_finished", BM_LOCKED_CHANGE_ALLOWED);
|
"write from resync_finished", BM_LOCKED_CHANGE_ALLOWED);
|
||||||
put_ldev(device);
|
put_ldev(device);
|
||||||
|
|
Loading…
Reference in New Issue