drbd/0010-drbd-Handle-new-current-uuid-zap-devices.patch

51 lines
1.7 KiB
Diff

From 5874ec7ba93074fdc3c2e878080a4b08d3408bbf Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 18:39:12 +0800
Subject: [Patch v2 10/10] drbd: Handle new-current-uuid --zap-devices
Zap devices for zeroing out device on both side
instead of initial full sync.
Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com
CC: linux-kernel@vger.kernel.org
---
drbd/drbd_nl.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
index 1d17663..131f112 100644
--- a/drbd/drbd_nl.c
+++ b/drbd/drbd_nl.c
@@ -4068,7 +4068,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
drbd_uuid_set(device, UI_BITMAP, 0); /* Rotate UI_BITMAP to History 1, etc... */
drbd_uuid_new_current(device); /* New current, previous to UI_BITMAP */
- if (args.clear_bm) {
+ if (args.clear_bm || args.zap_devices) {
err = drbd_bitmap_io(device, &drbd_bmio_clear_n_write,
"clear_n_write from new_c_uuid", BM_LOCKED_MASK);
if (err) {
@@ -4084,6 +4084,16 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
CS_VERBOSE, NULL);
spin_unlock_irq(&device->resource->req_lock);
}
+ if (zero_out_devices) {
+ drbd_send_zero_out_start(first_peer_device(device));
+ _drbd_uuid_set(device, UI_BITMAP, 0);
+ drbd_print_uuids(device, "cleared bitmap UUID for zeroing device");
+
+ /* CLear bit flag of zero out */
+ clear_bit(ZERO_DONE, &device->flags);
+ clear_bit(ZERO_FAIL, &device->flags);
+ drbd_device_post_work(device, P_ZERO_START);
+ }
}
drbd_md_sync(device);
--
1.8.4.5