Accepting request 318290 from network:ha-clustering:Factory

1

OBS-URL: https://build.opensuse.org/request/show/318290
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/drbd?expand=0&rev=44
This commit is contained in:
Stephan Kulow 2015-07-25 05:44:30 +00:00 committed by Git OBS Bridge
parent 7e4c01e0c9
commit 7e1e97ef29
18 changed files with 1135 additions and 124 deletions

View File

@ -0,0 +1,68 @@
From 5874ec7ba93074fdc3c2e878080a4b08d3408bbf Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Mon, 13 Jul 2015 10:46:29 +0800
Subject: [Patch v2 00/10] Zero out devices instead of initial full sync
Patch set is based on drbd-8.4 859e34a9, have
already compiled/tested against SLES12.
If this feature can be merged into upstream, please
ignore v1, since v1 may caused pingACK timeout when
zeroing out large device.
Compare to v1, changes are as follow:
1. Using drbd_device_post_work to zero out device as background
task, so that it won't block pingACK when zeroing out
large device.
2. Fix bug of won't update peer node status if it finished
zeroing out earier.
3. Change some functions from file drbd_receive.c to
drbd_worker.c and reorder the patch set.
Full sync for drbd initial usually take a long time, especically
when network become the bottleneck of the syncing. Simply skip
the full sync with "--clear-bitmap" may not the perfect solution
for all the cases, like using the bare device(no filesystem) to
work,etc database,vm... This patche set can be used to zero out
devices locally instead of a full sync to make the consistent
block device. This approach can be useful when lack of network
bandwidth to sync.
The patches add one new option "--zap-devices" to "new-current-uuid"
to zero out devices. It will start zeroing out devices of both
side.
Nick Wang (10):
drbd: Fix the wrong logic of move history.
drbd: Add options zap_devices to new-current-uuid
drbd: Add a function to zero out drbd backing device.
drbd: New packet P_ZERO_OUT.
drbd: Functions to notify peer node to start
zeroing out and zero out finished.
drbd: Wapper for zeroing out device by worker.
drbd: Add flag for drbd device work.
drbd: Function to work with packet P_ZERO_OUT.
drbd: Receive zero out command from peer node.
drbd: Handle new-current-uuid --zap-devices.
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_int.h | 13 ++++++++
drbd/drbd_main.c | 51 ++++++++++++++++++++++++++--
drbd/drbd_nl.c | 21 +++++++++++-
drbd/drbd_protocol.h | 1 +
drbd/drbd_receiver.c | 69 ++++++++++++++++++++++++++++++++++++++
drbd/drbd_worker.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
drbd/linux/drbd_genl.h | 1 +
7 files changed, 243 insertions(+), 3 deletions(-)
--
1.8.4.5

View File

@ -0,0 +1,37 @@
From 4d75389962585d5a543cadb2742cb4dfe22dc807 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 17:20:04 +0800
Subject: [Patch v2 01/10] drbd: Fix the wrong logic of moving history
Logic of moving history is wrong. May overlap
history when more than two history.
If won't extent more that two history. The loop
can be delete.
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_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index 9871894..a3dc39e 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -3466,8 +3466,8 @@ void drbd_uuid_move_history(struct drbd_device *device) __must_hold(local)
{
int i;
- for (i = UI_HISTORY_START; i < UI_HISTORY_END; i++)
- device->ldev->md.uuid[i+1] = device->ldev->md.uuid[i];
+ for (i = UI_HISTORY_END; i > UI_HISTORY_START; i--)
+ device->ldev->md.uuid[i] = device->ldev->md.uuid[i-1];
}
void __drbd_uuid_set(struct drbd_device *device, int idx, u64 val) __must_hold(local)
--
1.8.4.5

View File

@ -0,0 +1,61 @@
From 84ae2314faeff2a9e06a66bc9a79520eadcbf305 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 17:28:18 +0800
Subject: [Patch v2 02/10] drbd: Add option zap_devices to new-current-uuid
Using zeroing out device instead of initial
full sync of device. Can be useful in high
latency network environment.
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 | 9 +++++++++
drbd/linux/drbd_genl.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
index 691b615..1d17663 100644
--- a/drbd/drbd_nl.c
+++ b/drbd/drbd_nl.c
@@ -4017,6 +4017,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
struct drbd_device *device;
enum drbd_ret_code retcode;
int skip_initial_sync = 0;
+ int zero_out_devices = 0;
int err;
struct new_c_uuid_parms args;
@@ -4051,6 +4052,14 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED && args.clear_bm) {
drbd_info(device, "Preparing to skip initial sync\n");
skip_initial_sync = 1;
+ /* this is "zero out" devices to make it all zero.
+ * ignore "zero out" if both "clear_bm" and "zap_devices" set. */
+ } else if (device->state.conn == C_CONNECTED &&
+ first_peer_device(device)->connection->agreed_pro_version >= 90 &&
+ device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED &&
+ args.zap_devices) {
+ drbd_info(device, "Preparing to zero out devices, will take a long time\n");
+ zero_out_devices = 1;
} else if (device->state.conn != C_STANDALONE) {
retcode = ERR_CONNECTED;
goto out_dec;
diff --git a/drbd/linux/drbd_genl.h b/drbd/linux/drbd_genl.h
index 5db53f5..eef8d8c 100644
--- a/drbd/linux/drbd_genl.h
+++ b/drbd/linux/drbd_genl.h
@@ -240,6 +240,7 @@ GENL_struct(DRBD_NLA_START_OV_PARMS, 9, start_ov_parms,
GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms,
__flg_field(1, DRBD_GENLA_F_MANDATORY, clear_bm)
+ __flg_field(2, DRBD_GENLA_F_MANDATORY, zap_devices)
)
GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms,
--
1.8.4.5

View File

@ -0,0 +1,65 @@
From 94d1f879305b472aff6009ba4c4f08b9d70f1cf1 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 17:34:46 +0800
Subject: [Patch v2 03/10] drbd: A function to zero out drbd backing device
The function can be used to zero out the whole
backing device.
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_int.h | 1 +
drbd/drbd_worker.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index a234228..9ecf971 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -1662,6 +1662,7 @@ extern void drbd_send_acks_wf(struct work_struct *ws);
extern bool drbd_rs_c_min_rate_throttle(struct drbd_device *device);
extern bool drbd_rs_should_slow_down(struct drbd_device *device, sector_t sector,
bool throttle_if_app_is_waiting);
+extern int zero_out_local_device(struct drbd_device *device);
extern int drbd_submit_peer_request(struct drbd_device *,
struct drbd_peer_request *, const unsigned,
const int);
diff --git a/drbd/drbd_worker.c b/drbd/drbd_worker.c
index 2a15aeb..50564f5 100644
--- a/drbd/drbd_worker.c
+++ b/drbd/drbd_worker.c
@@ -1653,6 +1653,27 @@ void drbd_rs_controller_reset(struct drbd_device *device)
rcu_read_unlock();
}
+/**
+ * zero_out_local_device()
+ * @device: DRBD device.
+ *
+ * Description:
+ * Zero out drbd backing device when creating new uuid.
+ *
+**/
+int zero_out_local_device(struct drbd_device *device)
+{
+ struct block_device *bdev;
+
+ bdev = device->ldev->backing_bdev;
+ if (device->ldev->known_size != drbd_get_capacity(bdev))
+ device->ldev->known_size = drbd_get_capacity(bdev);
+
+ /* zero out the backing device */
+ return blkdev_issue_zeroout(bdev, 0,
+ device->ldev->known_size, GFP_NOIO, false);
+}
+
void start_resync_timer_fn(unsigned long data)
{
struct drbd_device *device = (struct drbd_device *) data;
--
1.8.4.5

View File

@ -0,0 +1,96 @@
From c6085cdb8f55facfae4468548f258117e63134d4 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 17:59:12 +0800
Subject: [Patch v2 04/10] drbd: New packet P_ZERO_OUT
Using packet P_ZERO_OUT to get peer node's result
of zeroing out.
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_int.h | 5 +++++
drbd/drbd_main.c | 28 ++++++++++++++++++++++++++++
drbd/drbd_protocol.h | 1 +
3 files changed, 34 insertions(+)
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index 9ecf971..014b65e 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -622,6 +622,9 @@ enum {
RS_START, /* tell worker to start resync/OV */
RS_PROGRESS, /* tell worker that resync made significant progress */
RS_DONE, /* tell worker that resync is done */
+ /* used for zero out device */
+ ZERO_DONE, /* succeed on zero out a device */
+ ZERO_FAIL, /* fail to zero out a device */
};
struct drbd_bitmap; /* opaque for drbd_device */
@@ -1205,6 +1208,8 @@ extern int __drbd_send_protocol(struct drbd_connection *connection, enum drbd_pa
extern int drbd_send_protocol(struct drbd_connection *connection);
extern int drbd_send_uuids(struct drbd_peer_device *);
extern int drbd_send_uuids_skip_initial_sync(struct drbd_peer_device *);
+extern int drbd_send_zero_out_ok(struct drbd_peer_device *);
+extern int drbd_send_zero_out_fail(struct drbd_peer_device *);
extern void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *);
extern int drbd_send_sizes(struct drbd_peer_device *peer_device, int trigger_reply, enum dds_flags flags);
extern int drbd_send_state(struct drbd_peer_device *, union drbd_state);
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index a3dc39e..740015e 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -908,6 +908,34 @@ int drbd_send_uuids_skip_initial_sync(struct drbd_peer_device *peer_device)
return _drbd_send_uuids(peer_device, 8);
}
+/**
+ * _drbd_send_zero_out_state() - Sends the drbd state to the peer
+ * @peer_device: DRBD peer device.
+ * @state: Device zero out status.
+ */
+static int _drbd_send_zero_out_state(struct drbd_peer_device *peer_device, unsigned int status)
+{
+ struct drbd_socket *sock;
+ struct p_state *p;
+
+ sock = &peer_device->connection->data;
+ p = drbd_prepare_command(peer_device, sock);
+ if (!p)
+ return -EIO;
+ p->state = cpu_to_be32(status);
+ return drbd_send_command(peer_device, sock, P_ZERO_OUT, sizeof(*p), NULL, 0);
+}
+
+int drbd_send_zero_out_ok(struct drbd_peer_device *peer_device)
+{
+ return _drbd_send_zero_out_state(peer_device, 0);
+}
+
+int drbd_send_zero_out_fail(struct drbd_peer_device *peer_device)
+{
+ return _drbd_send_zero_out_state(peer_device, 1);
+}
+
void drbd_print_uuids(struct drbd_device *device, const char *text)
{
if (get_ldev_if_state(device, D_NEGOTIATING)) {
diff --git a/drbd/drbd_protocol.h b/drbd/drbd_protocol.h
index 405b181..3a82442 100644
--- a/drbd/drbd_protocol.h
+++ b/drbd/drbd_protocol.h
@@ -59,6 +59,7 @@ enum drbd_packet {
/* REQ_DISCARD. We used "discard" in different contexts before,
* which is why I chose TRIM here, to disambiguate. */
P_TRIM = 0x31,
+ P_ZERO_OUT = 0x32,
P_MAY_IGNORE = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */
P_MAX_OPT_CMD = 0x101,
--
1.8.4.5

View File

@ -0,0 +1,65 @@
From b831a988370d6b6e2c989c40736155d529be3273 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 18:15:07 +0800
Subject: [Patch v2 05/10] drbd: Functions to notify peer node to zero out
Notify peer node to start zeroing out device.
Update state of peer node when both nodes are
finished zeroing.
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_int.h | 2 ++
drbd/drbd_main.c | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index 014b65e..f43f957 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -1208,6 +1208,8 @@ extern int __drbd_send_protocol(struct drbd_connection *connection, enum drbd_pa
extern int drbd_send_protocol(struct drbd_connection *connection);
extern int drbd_send_uuids(struct drbd_peer_device *);
extern int drbd_send_uuids_skip_initial_sync(struct drbd_peer_device *);
+extern int drbd_send_zero_out_start(struct drbd_peer_device *);
+extern int drbd_send_zero_out_finish(struct drbd_peer_device *);
extern int drbd_send_zero_out_ok(struct drbd_peer_device *);
extern int drbd_send_zero_out_fail(struct drbd_peer_device *);
extern void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *);
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index 740015e..2b821cd 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -908,6 +908,25 @@ int drbd_send_uuids_skip_initial_sync(struct drbd_peer_device *peer_device)
return _drbd_send_uuids(peer_device, 8);
}
+
+/**
+ * drbd_send_zero_out_start() - Notify peer node to start zero out
+ * @peer_device: DRBD peer device.
+ */
+int drbd_send_zero_out_start(struct drbd_peer_device *peer_device)
+{
+ return _drbd_send_uuids(peer_device, 16);
+}
+
+/**
+ * drbd_send_zero_out_finish() - Notify both node finished zeroing out
+ * @peer_device: DRBD peer device.
+ */
+int drbd_send_zero_out_finish(struct drbd_peer_device *peer_device)
+{
+ return _drbd_send_uuids(peer_device, 32);
+}
+
/**
* _drbd_send_zero_out_state() - Sends the drbd state to the peer
* @peer_device: DRBD peer device.
--
1.8.4.5

View File

@ -0,0 +1,109 @@
From 8bef1ececca3cf22c35f3e9ef95e72c0fd8125a9 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 18:22:25 +0800
Subject: [Patch v2 06/10] drbd: Wapper for zeroing out device by worker
Wapper functions for drbd_device_post_work to start
zeroing out device. Change state when both node
finish zeroing.
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_int.h | 2 ++
drbd/drbd_worker.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index f43f957..dd680a9 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -1670,6 +1670,8 @@ extern bool drbd_rs_c_min_rate_throttle(struct drbd_device *device);
extern bool drbd_rs_should_slow_down(struct drbd_device *device, sector_t sector,
bool throttle_if_app_is_waiting);
extern int zero_out_local_device(struct drbd_device *device);
+extern void require_zero_out_local_device(struct drbd_device *device);
+extern void receive_zero_out_local_device(struct drbd_device *device);
extern int drbd_submit_peer_request(struct drbd_device *,
struct drbd_peer_request *, const unsigned,
const int);
diff --git a/drbd/drbd_worker.c b/drbd/drbd_worker.c
index 50564f5..293aa27 100644
--- a/drbd/drbd_worker.c
+++ b/drbd/drbd_worker.c
@@ -1674,6 +1674,69 @@ int zero_out_local_device(struct drbd_device *device)
device->ldev->known_size, GFP_NOIO, false);
}
+/**
+ * require_zero_out_local_device()
+ * @device: DRBD device.
+ *
+ * Description:
+ * Start to zero out local device. Update
+ * status if peer node (secondary) finished
+ * zeroing.
+ *
+**/
+void require_zero_out_local_device(struct drbd_device *device)
+{
+ int zero_out_err = 0;
+
+ zero_out_err = zero_out_local_device(device);
+
+ if (zero_out_err) {
+ drbd_err(device, "Failed to zero out local device\n");
+ set_bit(ZERO_FAIL, &device->flags);
+ drbd_chk_io_error(device, 1, DRBD_WRITE_ERROR);
+ } else {
+ drbd_info(device, "Finished zero out local device.\n");
+
+ if (test_and_clear_bit(ZERO_DONE, &device->flags)) {
+ spin_lock_irq(&device->resource->req_lock);
+ _drbd_set_state(_NS2(device, disk, D_UP_TO_DATE,
+ pdsk, D_UP_TO_DATE), CS_VERBOSE, NULL);
+ spin_unlock_irq(&device->resource->req_lock);
+ drbd_send_zero_out_finish(first_peer_device(device));
+ } else if (test_and_clear_bit(ZERO_FAIL, &device->flags)) {
+ drbd_info(device, "Peer device has already failed on zero out\n");
+ } else {
+ /* waiting for peer device finished */
+ set_bit(ZERO_DONE, &device->flags);
+ }
+ }
+}
+
+/**
+ * receive_zero_out_local_device()
+ * @device: DRBD device.
+ *
+ * Description:
+ * Start to zero out local device.
+ * Notify peer node the zeroing result.
+ *
+**/
+void receive_zero_out_local_device(struct drbd_device *device)
+{
+ int zero_out_err = 0;
+ struct drbd_peer_device *const peer_device = first_peer_device(device);
+
+ zero_out_err = zero_out_local_device(device);
+ if (zero_out_err) {
+ drbd_err(device, "Failed to zero out local device\n");
+ drbd_send_zero_out_fail(peer_device);
+ drbd_chk_io_error(device, 1, DRBD_WRITE_ERROR);
+ } else {
+ drbd_info(device, "Finished zero out local device.\n");
+ drbd_send_zero_out_ok(peer_device);
+ }
+}
+
void start_resync_timer_fn(unsigned long data)
{
struct drbd_device *device = (struct drbd_device *) data;
--
1.8.4.5

View File

@ -0,0 +1,58 @@
From 88d3c5ee059952db304f5f3f82ca4c5e4a72a7a5 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 18:25:19 +0800
Subject: [Patch v2 07/10] drbd: Flags for background drbd device work
Background drbd device work for zeroing out device.
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_int.h | 3 +++
drbd/drbd_worker.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index dd680a9..287ffd7 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -622,6 +622,9 @@ enum {
RS_START, /* tell worker to start resync/OV */
RS_PROGRESS, /* tell worker that resync made significant progress */
RS_DONE, /* tell worker that resync is done */
+ P_ZERO_START, /* tell worker to zero out device */
+ S_ZERO_START, /* tell worker to zero out device as requested*/
+
/* used for zero out device */
ZERO_DONE, /* succeed on zero out a device */
ZERO_FAIL, /* fail to zero out a device */
diff --git a/drbd/drbd_worker.c b/drbd/drbd_worker.c
index 293aa27..23e82c1 100644
--- a/drbd/drbd_worker.c
+++ b/drbd/drbd_worker.c
@@ -2070,6 +2070,10 @@ static void do_device_work(struct drbd_device *device, const unsigned long todo)
drbd_ldev_destroy(device);
if (test_bit(RS_START, &todo))
do_start_resync(device);
+ if (test_bit(P_ZERO_START, &todo))
+ require_zero_out_local_device(device);
+ if (test_bit(S_ZERO_START, &todo))
+ receive_zero_out_local_device(device);
}
#define DRBD_DEVICE_WORK_MASK \
@@ -2079,6 +2083,8 @@ static void do_device_work(struct drbd_device *device, const unsigned long todo)
|(1UL << RS_START) \
|(1UL << RS_PROGRESS) \
|(1UL << RS_DONE) \
+ |(1UL << P_ZERO_START) \
+ |(1UL << S_ZERO_START) \
)
static unsigned long get_work_bits(unsigned long *flags)
--
1.8.4.5

View File

@ -0,0 +1,74 @@
From fb7da7037d9096bd34285425f85c4b4584e55701 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 18:29:25 +0800
Subject: [Patch v2 08/10] drbd: Function to work with packet P_ZERO_OUT
Using packet P_ZERO_OUT to update zero out
status of peer node.
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_receiver.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
index 5e6b149..6eae84f 100644
--- a/drbd/drbd_receiver.c
+++ b/drbd/drbd_receiver.c
@@ -4383,6 +4383,41 @@ static union drbd_state convert_state(union drbd_state ps)
return ms;
}
+static int receive_zero_out_state(struct drbd_connection *connection, struct packet_info *pi)
+{
+ struct drbd_peer_device *peer_device;
+ struct drbd_device *device;
+ struct p_state *p = pi->data;
+ unsigned int isfail;
+
+ peer_device = conn_peer_device(connection, pi->vnr);
+ if (!peer_device)
+ return -EIO;
+ device = peer_device->device;
+
+ isfail = be32_to_cpu(p->state);
+
+ if (isfail) {
+ drbd_info(device, "Failed to zero out peer device\n");
+ set_bit(ZERO_FAIL, &device->flags);
+ } else {
+ drbd_info(device, "Finished zero out peer device\n");
+ if (test_and_clear_bit(ZERO_DONE, &device->flags)) {
+ drbd_info(device, "Both side finished zeroing.\n");
+ spin_lock_irq(&device->resource->req_lock);
+ _drbd_set_state(_NS2(device, disk, D_UP_TO_DATE,
+ pdsk, D_UP_TO_DATE), CS_VERBOSE, NULL);
+ spin_unlock_irq(&device->resource->req_lock);
+ drbd_send_zero_out_finish(peer_device);
+ } else {
+ /* waiting for local device finished */
+ set_bit(ZERO_DONE, &device->flags);
+ }
+ }
+
+ return 0;
+}
+
static int receive_req_state(struct drbd_connection *connection, struct packet_info *pi)
{
struct drbd_peer_device *peer_device;
@@ -5008,6 +5043,7 @@ static struct data_cmd drbd_cmd_handler[] = {
[P_CONN_ST_CHG_REQ] = { 0, sizeof(struct p_req_state), receive_req_conn_state },
[P_PROTOCOL_UPDATE] = { 1, sizeof(struct p_protocol), receive_protocol },
[P_TRIM] = { 0, sizeof(struct p_trim), receive_Data },
+ [P_ZERO_OUT] = { 0, sizeof(struct p_state), receive_zero_out_state },
};
static void drbdd(struct drbd_connection *connection)
--
1.8.4.5

View File

@ -0,0 +1,77 @@
From 8ef810075675a5453d81adb64f5d35b375cd0959 Mon Sep 17 00:00:00 2001
From: Nick Wang <nwang@suse.com>
Date: Fri, 10 Jul 2015 18:34:30 +0800
Subject: [Patch v2 09/10] drbd: Handle zero out command from peer node
Recevie P_UUID flag 16 for starting zero out device,
P_UUID flag 32 after both side finished zeroing,
Change state to uptodate.
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_receiver.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
index 6eae84f..4d6d99a 100644
--- a/drbd/drbd_receiver.c
+++ b/drbd/drbd_receiver.c
@@ -4317,6 +4317,15 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
peer_device->connection->agreed_pro_version >= 90 &&
device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED &&
(p_uuid[UI_FLAGS] & 8);
+ int zero_out_devices =
+ device->state.conn == C_CONNECTED &&
+ peer_device->connection->agreed_pro_version >= 90 &&
+ device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED &&
+ (p_uuid[UI_FLAGS] & 16);
+ int zero_out_finish =
+ device->state.conn == C_CONNECTED &&
+ peer_device->connection->agreed_pro_version >= 90 &&
+ (p_uuid[UI_FLAGS] & 32);
if (skip_initial_sync) {
drbd_info(device, "Accepted new current UUID, preparing to skip initial sync\n");
drbd_bitmap_io(device, &drbd_bmio_clear_n_write,
@@ -4324,11 +4333,35 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
BM_LOCKED_TEST_ALLOWED);
_drbd_uuid_set(device, UI_CURRENT, p_uuid[UI_CURRENT]);
_drbd_uuid_set(device, UI_BITMAP, 0);
+ spin_lock_irq(&device->resource->req_lock);
_drbd_set_state(_NS2(device, disk, D_UP_TO_DATE, pdsk, D_UP_TO_DATE),
CS_VERBOSE, NULL);
+ spin_unlock_irq(&device->resource->req_lock);
drbd_md_sync(device);
updated_uuids = 1;
}
+
+ if (zero_out_devices) {
+ drbd_info(device, "Accepted to zero out devices, will take a long time\n");
+ drbd_bitmap_io(device, &drbd_bmio_clear_n_write,
+ "clear_n_write from receive_uuids",
+ BM_LOCKED_TEST_ALLOWED);
+ _drbd_uuid_set(device, UI_CURRENT, p_uuid[UI_CURRENT]);
+ _drbd_uuid_set(device, UI_BITMAP, 0);
+ drbd_print_uuids(device, "cleared bitmap UUID for zeroing device");
+
+ drbd_device_post_work(device, S_ZERO_START);
+ updated_uuids = 1;
+ }
+
+ if (zero_out_finish) {
+ drbd_info(device, "Both side finished zero out devices.\n");
+ spin_lock_irq(&device->resource->req_lock);
+ _drbd_set_state(_NS2(device, disk, D_UP_TO_DATE, pdsk, D_UP_TO_DATE),
+ CS_VERBOSE, NULL);
+ spin_unlock_irq(&device->resource->req_lock);
+ }
+
put_ldev(device);
} else if (device->state.disk < D_INCONSISTENT &&
device->state.role == R_PRIMARY) {
--
1.8.4.5

View File

@ -0,0 +1,50 @@
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

1
Module.supported Normal file
View File

@ -0,0 +1 @@
updates/drbd.ko

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:19b4d466d1af070f3960eddf0c824d91002da7e006e9168c53d2640db22e3897
size 420230

3
drbd-8.4.6.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c10c4d7a5389a9194eb2f7c094a3c1685b87f52513ae0af15fdc1df6a091d014
size 321974

View File

@ -1,3 +1,297 @@
-------------------------------------------------------------------
Mon Jul 20 07:52:36 UTC 2015 - nwang@suse.com
- Fate#317940. Speed up initial sync by supporting zero out
device.
Patch 0000-cover-letter-fate317940.patch
Patch 0001-drbd-Fix-the-wrong-logic-of-moving-history.patch
Patch 0002-drbd-Add-options-zap_devices-to-new-current-uuid.patch
Patch 0003-drbd-A-function-to-zero-out-drbd-backing-device.patch
Patch 0004-drbd-New-packet-P_ZERO_OUT.patch
Patch 0005-drbd-Functions-to-notify-peer-node-to-start.patch
Patch 0006-drbd-Wapper-for-zeroing-out-device-by-worker.patch
Patch 0007-drbd-Flags-for-background-drbd-device-work.patch
Patch 0008-drbd-Function-to-work-with-packet-P_ZERO_OUT.patch
Patch 0009-drbd-Receive-zero-out-command-from-peer-node.patch
Patch 0010-drbd-Handle-new-current-uuid-zap-devices.patch
- Delete useless patch init-script-fixes.diff
- ExcludeArch i586 and s390, since user space split into
drbd-utils.
-------------------------------------------------------------------
Fri Apr 17 06:34:51 UTC 2015 - nwang@suse.com
- Update to 8.4.6
- With DRBD module version 8.4.5, we split out the management tools
into their own repository. Started out as "drbd-utils version
8.9.0". To manage DRBD 8.4.5 kernel modules and above, want
drbd-utils >= 8.9.0
- fix failing of user space helpers since kernel 3.13. This bug is
known as 'out of mem, failed to invoke fence-peer helper'
- fix connection timeouts for resources with multiple volumes
- fix an issue with DRBD on linux software raid by properly
remapping bi_bdev
- fix a (hard to trigger) race condition between promoting to primary
an connection handshake. In case the bug was hit the Primary got
stuck in WFBitmapS connection state
- Fix a NULL deref when resuming IO on a diskless primary
- Fix compile issues with uncommon architectures
- improvements to asender performance. With high end backing storage
and networking equipment you may see IOPS improvements between
25% to 50%.
- Highest number on a single drbd seen by LINBIT so far: 160000 IOPS
- backport of events2 and status commands from drbd9. This allows
to be DRBD9 compatible starting with this release, and to get used
to DRBD9 compatible status reporting
- support for lsblk in drbd
- Update to 8.4.5
- fix potential BUG_ON in mempool_alloc for older kernels (<2.6.23)
- fix cornercase of resync finished detection
- fix drbd_ldev_destroy to run exactly once and in worker context
- fix spurious detach/disconnect: don't announce WRITE_SAME
- fix NULL pointer deref in blk_add_request_payload
- (DISCARD/TRIM handling in sd)
- fix regression: potential NULL pointer dereference
- fix regression: potential list corruption
- fix regression: potential deadlock in adm functions (drbdsetup)
- fix regression: /sbin vs /usr/sbin in scripts
- fix race stopping the worker thread
- new debugfs presence expose oldest requests and other details
- userspace moved to own repository
- linux 3.13 and 3.14 compatibility
- improve adaptive resync controler
- reduce bitmap IO during resync
- allow write-ordering policy to be bumped up again
- trigger tcp_flush_pending_frames() for PING/PING_ACK
- fix potential segfault in drbdadm adjust
- drbdsetup improvements: fix netlink socket buffers; detect
modprobe failure
-------------------------------------------------------------------
Fri May 30 04:29:22 UTC 2014 - lwang@suse.com
- modify drbd.rules by removing NAME and adding SYMLINK in case that
configuration has a device name diffrent from kernel node (bnc#878119)
add: fix-udev-for-drbd-start-timeout.patch
-------------------------------------------------------------------
Tue May 20 09:13:32 UTC 2014 - lmb@suse.com
- Packages drbd-xen, drbd-utils, drbd-bash-completion, and
drbd-pacemaker were merged into drbd (bnc#878793)
-------------------------------------------------------------------
Sun Apr 13 20:10:00 UTC 2014 - mmarek@suse.cz
- Add # needssslcertforbuild to use the project's certificate when
building in a home project.
-------------------------------------------------------------------
Mon Mar 31 21:44:23 UTC 2014 - rgoldwyn@suse.com
- Add Module.supported and preamble (bnc#871132)
-------------------------------------------------------------------
Thu Mar 27 07:40:07 UTC 2014 - xli@suse.com
- Update to 8.4.4.7
- fix potential BUG_ON in mempool_alloc for older kernels (<2.6.23)
- fix cornercase of resync finished detection
- fix drbd_ldev_destroy to run exactly once and in worker context
- fix spurious detach/disconnect: don't announce WRITE_SAME
- fix NULL pointer deref in blk_add_request_payload
(DISCARD/TRIM handling in sd)
- fix regression: potential NULL pointer dereference
- fix regression: potential list corruption
- fix regression: potential deadlock in adm functions (drbdsetup)
- fix regression: /sbin vs /usr/sbin in scripts
- fix race stopping the worker thread
- linux 3.13 compatibility
- improve adaptive resync controler
- reduce bitmap IO during resync
- allow write-ordering policy to be bumped up again
- trigger tcp_flush_pending_frames() for PING/PING_ACK
- new sysfs oldest_requests attribute (may be moved to debugfs)
- fix potential segfault in drbdadm adjust
- drbdsetup improvements: fix socket buffers; detect modprobe failure
- Upstream version cs: 3c1f46cb19993f98b22fdf7e18958c21ad75176d
-------------------------------------------------------------------
Thu Mar 13 06:40:32 UTC 2014 - xli@suse.com
- Handle drbd devices when presented as phy devices by xenstore with
libxl (bnc#865682)
+ add_phy_to_block-drbd.diff
-------------------------------------------------------------------
Wed Jan 29 13:21:11 CET 2014 - ro@suse.de
- disable build_kmp on i586 and s390, SLE-12 does not build a
runnable kernel there
-------------------------------------------------------------------
Mon Oct 14 09:56:15 UTC 2013 - lmb@suse.com
-------------------------------------------------------------------
Mon Oct 14 09:27:25 UTC 2013 - lmb@suse.com
- Update to official 8.4.4
- drbd: evaluate disk and network timeout on different requests
- drbd: Fix a hole in the challange-response connection authentication
- drbd: always implicitly close last epoch when idle
- drbd: add back some fairness to AL transactions
- drbd: keep max-bio size during detach/attach on disconnected primary
- drbd: fix a race between start_resync and send_and_submit
- drbd: fix deadlock in discard fallback code
- Build drbd KMPs.
-------------------------------------------------------------------
Thu Oct 10 14:04:56 UTC 2013 - lmb@suse.com
- Update to 8.4.4rc2
- fix potential deadlock when concurrently fencing and establishing a
connection
- fix potential distributed deadlock during verify or resync
- fix decoding of bitmap vli rle for device sizes > 64 TB
- fix for deadlock when using automatic split-brain-recovery
- only fail empty flushes if no good data is reachable
- avoid to shrink max_bio_size due to peer re-configuration
- fix resume-io after reconnect with broken fence-peer handler
- crm-fence-peer: less cib polling, peer-alive detection using crmadmin,
and other improvements
- OCF RA: avoid too tight pacemaker driven recovery loop on failed
promote, implement adjust_master_score parameter
- fix too large bursts for very slow resync rates
- don't let application IO throttle resync to a stall
- Fixed attaching to disks with fixed size external meta-data (This
regressions was introduced with 8.4.3)
- Fixed a crash when the connection broke at a very exact point in time
while a graceful disconnect executes
- Support for REQ_DISCARD
- Allow parallel promote/demote
- Allow online changing of al-stripes and al-stripe-size with the resize
command
- drbdadm adjust now deals with IP-address changes correctly
- Align the internal object model with drbd-9.0 (away from drbd-8.3)
- New drbd-proxy option "bwlimit"; allow proxy options on host level
- Compiles on Linux v3.10
-------------------------------------------------------------------
Wed Sep 18 09:56:22 UTC 2013 - lmb@suse.com
- Update drbd version string in specfile so that a future 8.4.4 check-in
will be considered newer than 8.4.4rc1.
- Clean-up specfile based on spec-cleaner
-------------------------------------------------------------------
Mon Sep 16 11:22:46 UTC 2013 - lmb@suse.com
- Update to drbd 8.4.4rc1
- Disable heartbeat support (heartbeat no longer ships on openSUSE)
- fix decoding of bitmap vli rle for device sizes > 64 TB
- fix for deadlock when using automatic split-brain-recovery
- only fail empty flushes if no good data is reachable
- avoid to shrink max_bio_size due to peer re-configuration
- fix resume-io after reconnect with broken fence-peer handler
- fencing script improvements
- Fixed attaching to disks with fixed size external meta-data (This
regressions was introduced with 8.4.3)
- Allow online changing of al-stripes and al-stripe-size with the resize
command
- drbdadm adjust now deals with IP-address changes correctly
- Align the internal object model with drbd-9.0 (away from drbd-8.3)
- Do not end up in Unconnected state if the connection breaks at a
certain point during the handshake (was introduced with 8.3.12)
- Closed a race condition between promoting and connection handshake,
that could lead to an inconsistent view of the peer's UUIDS
- Fixed a race condition that could lead to a full sync, if connection
breaks at a certain point while starting a regular resync
- Fixed crm-fence-peer.sh for pacemaker 1.1.8
- Fixed a list corruption for read requests that complete with an error
after they were aborted
- Fixed a kernel panic if the device size was an exact multiple of
128MiB
- Fixed a potential memory allocation during deadlock online resize
- Improve the handling of read-errors: Make sure that sectors that had a
read error are overwritten with data from the peer on the next resync
- Expose the data-generation-uuids through /sys/block/drbdXX/drbd/
- The new flag --peer-max-bio-size for drbdmeta create-md is of use if
you plan to use the device for long time without peer
- Fixed a potential protocol error and resulting disconnect/reconnect,
when a disk fails on the secondary node. (Introduced with 8.4.2)
- Do not fail empty flushed on diskless, primary node
- Fixed calculation of master scores for single volume and unconfigured
resources in the drbd.ocf RA
- When the connection breaks during a grace full disconnect DRBD failed
to call the eventually configured fence-peer handler. Fixed.
- Obey md-barrier setting when changed via the disk-options command
- Non blocking queuing of AL-updates; This change significantly improves
the number of IOPs in case the workload does not fit into the
configured AL size. (Backport from drbd-9)
- New options for drbdmeta create-md --al-stripes and --al-stripe-size
to create a larger and striped AL
- Fixed drbdadm adjust of max-bio-bvecs
- Fixed a memory leak of 336 byte per attach/detach cycle
- Fix a potential null-pointer deference when configuring invalid resync
after dependencies
- Fixed IO resuming after connection was established before fence peer
handler returned
- Fixed an issue in the state engine that could cause state lockup with
multiple volumes
- Write all pages of the bitmap if it gets moved during an online resize
operation. (This issue was introduced with 8.3.10)
- Fixed a race condition could cause DRBD to go through a NetworkFailure
state during disconnect
- Fixed a race condition in the disconnect code path that could lead to
a BUG() (introduced with 8.4.0)
- Fixed a write ordering problem on SyncTarget nodes for a write to a
block that gets resynced at the same time. The bug can only be
triggered with a device that has a firmware that actually reorders
writes to the same block (merged from 8.3.13)
- Fixed a potential deadlock during restart of conflicting writes
- Disable the write ordering method "barrier" by default, since it is
not possible for a driver to find out if it works reliably since
2.6.36
- All fixes that went into 8.3.13
- Removed a null pointer access when using on-congestion policy on a
diskless device
- In case of a graceful detach under IO load, wait for the outstanding
IO. (As opposed to aborting IOs as a forcefully detach does)
- Reinstate disabling AL updates with invalidate-remote (8.4.0
regression)
- Reinstate the 'disk-barrier no', 'disk-flushes no', and 'disk-drain
no' switches (8.4.0 regression)
- Backported the request code from DRBD-9. Improves handling of many
corner cases.
- Support FLUSH/FUA bio flags
- Made the establishing of connections faster
- New option 'al-updates no' to disable writing transactions into the
- activity log. It is use full if you prefer a full sync after a primary
crash, for improved performance of a spread out random write work load
- Expose the data generation identifies via sysfs
- "--stop" option for online verify to specify a stop sector
- Fixed a bug that might cause in kernel list corruption triggered by
simultaneous IO on multiple volumes in a single resource
- Fixed a bug that might cause a kernel OOPS in the worker thread while
the receiver tied to establish a connection (drbd-8.4.0 regression)
- Fixed an issue in the receiver that could cause connection triggered
by simultaneous IO on multiple volumes in a single resource
- Consider the discard-my-data flag for all volumes
- Fixed attaching to backing devices that do not support
barriers/flushes, when barriers/flushes are not disabled by the
configuration. (drbd-8.4.0 regression)
- Fixed a rare compatibility issue with DRBD's older than 8.3.7 when
negotiating the bio_size
- Fixed a rare race condition where an empty resync could stall with if
pause/unpause events happen in parallel
- Made the re-establishing of connections quicker, if it got a broken
pipe once. Previously there was a bug in the code caused it to waste
the first successful established connection after a broken pipe event.
- crm-fence-peer.sh: Can now deal with multiple DRBD instances being in
a master/slave group
- Optional load balancing for read requests: new keyword "read-balance"
-------------------------------------------------------------------
Mon May 13 10:44:16 CEST 2013 - ohering@suse.de

166
drbd.spec
View File

@ -1,7 +1,7 @@
#
# spec file for package drbd
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,114 +16,100 @@
#
# needssslcertforbuild
%ifarch x86_64
%define buildrt 0
%endif
Name: drbd
BuildRequires: bison
BuildRequires: flex
BuildRequires: udev
Summary: Distributed Replicated Block Device
Version: 8.4.6
Release: 0
#Name: drbd-kernel
Summary: Kernel driver for DRBD
License: GPL-2.0+
Group: Productivity/Clustering/HA
Version: 8.3.11
Release: 0
Source: %{name}-%{version}.tar.bz2
Patch1: init-script-fixes.diff
Provides: drbd-control
Provides: drbdsetup
Url: http://www.drbd.org/
Source: http://oss.linbit.com/drbd/8.4/%{name}-%{version}.tar.gz
Source1: preamble
# In kernel is: kernel/drivers/block/drbd/drbd.ko
Source2: Module.supported
# Patch set (0-10) for fate: https://fate.suse.com/317940
# Already merged into linbit upstream and waiting for next release
Patch0: 0000-cover-letter-fate317940.patch
Patch1: 0001-drbd-Fix-the-wrong-logic-of-moving-history.patch
Patch2: 0002-drbd-Add-options-zap_devices-to-new-current-uuid.patch
Patch3: 0003-drbd-A-function-to-zero-out-drbd-backing-device.patch
Patch4: 0004-drbd-New-packet-P_ZERO_OUT.patch
Patch5: 0005-drbd-Functions-to-notify-peer-node-to-start.patch
Patch6: 0006-drbd-Wapper-for-zeroing-out-device-by-worker.patch
Patch7: 0007-drbd-Flags-for-background-drbd-device-work.patch
Patch8: 0008-drbd-Function-to-work-with-packet-P_ZERO_OUT.patch
Patch9: 0009-drbd-Receive-zero-out-command-from-peer-node.patch
Patch10: 0010-drbd-Handle-new-current-uuid-zap-devices.patch
BuildRequires: kernel-source
BuildRequires: kernel-syms
BuildRequires: module-init-tools
%if 0%{?buildrt} == 1
BuildRequires: kernel-syms-rt
%endif
Requires: drbd-utils >= 8.9.0
Supplements: drbd-utils >= 8.9.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(post): %insserv_prereq %fillup_prereq
Requires(preun): %insserv_prereq %fillup_prereq
Requires(postun): %insserv_prereq fileutils
ExcludeArch: i586 s390
%kernel_module_package -n drbd -p %_sourcedir/preamble
%description
Drbd is a distributed replicated block device. It mirrors a block
device over the network to another machine. Think of it as networked
raid 1. It is a building block for setting up clusters.
This module is the kernel-dependent driver for DRBD. This is split out so
that multiple kernel driver versions can be installed, one for each
installed kernel.
%prep
%setup
%patch1
%setup -q -n drbd-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
PATH=/sbin:$PATH %configure \
--without-km \
--with-utils \
--with-udev \
--with-distro=suse \
--with-heartbeat \
--with-pacemaker \
--with-xen \
--with-bashcompletion
rm -rf obj
mkdir obj
ln -s ../scripts obj/
make OPTFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
for flavor in %{flavors_to_build}; do
cp -r drbd obj/$flavor
cp %_sourcedir/Module.supported obj/$flavor
#make -C %{kernel_source $flavor} modules M=$PWD/obj/$flavor
make -C obj/$flavor %{_smp_mflags} all KDIR=%{kernel_source $flavor}
done
%install
%makeinstall
ln -sf ../etc/init.d/drbd $RPM_BUILD_ROOT/sbin/rcdrbd
mkdir -p $RPM_BUILD_ROOT/var/lib/drbd
#
# and I only want to install a hint to the example conf
#
cat <<___ > $RPM_BUILD_ROOT/etc/drbd.conf
#
# please have a a look at the example configuration file in
# %{_docdir}/drbd/drbd.conf
#
___
#
%ifnarch %ix86 x86_64
rm -rf $RPM_BUILD_ROOT/etc/xen
%endif
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
%post
%{fillup_and_insserv}
for flavor in %{flavors_to_build} ; do
make -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor
#From upstream file: drbd-kernel.spec
#kernelrelease=$(cat %{kernel_source $flavor}/include/config/kernel.release || make -s -C %{kernel_source $flavor} kernelrelease)
#mv obj/$flavor/.kernel.config.gz obj/k-config-$kernelrelease.gz
done
%preun
%{stop_on_removal}
rm -f drbd.conf
%postun
%{insserv_cleanup}
%clean
rm -rf %{buildroot}
%files -n drbd
%defattr(-, root, root)
%config(noreplace) /etc/drbd.conf
/etc/bash_completion.d/drbdadm.sh
%config /etc/drbd.d/global_common.conf
%doc %{_mandir}/man5/drbd.conf.5*
%doc %{_mandir}/man8/drbd.8*
%doc %{_mandir}/man8/drbdsetup.8*
%doc %{_mandir}/man8/drbdadm.8*
%doc %{_mandir}/man8/drbddisk.8*
%doc %{_mandir}/man8/drbdmeta.8*
%files
%defattr(-,root,root)
%doc COPYING
%doc README
%doc ChangeLog
%doc scripts/drbd.conf
%dir /etc/drbd.d
/sbin/drbdadm
/sbin/drbdsetup
/sbin/rcdrbd
/sbin/drbdmeta
/usr/sbin/drbd-overview
%ifarch %ix86 x86_64
%dir %attr(700,root,root) /etc/xen
%dir /etc/xen/scripts
/etc/xen/scripts/block-drbd
%endif
/usr/lib/ocf/resource.d/linbit/drbd
/etc/ha.d/resource.d/drbddisk
/etc/ha.d/resource.d/drbdupper
%dir /etc/udev
%dir /etc/udev/rules.d
/etc/udev/rules.d/65-drbd.rules
%config /etc/init.d/drbd
%defattr(-, root, root)
/var/lib/drbd
/usr/lib/drbd
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/linbit
%dir /etc/ha.d
%dir /etc/ha.d/resource.d
%changelog

View File

@ -1,31 +0,0 @@
Index: scripts/drbd
===================================================================
--- scripts/drbd.orig
+++ scripts/drbd
@@ -9,8 +9,8 @@
#
### BEGIN INIT INFO
# Provides: drbd
-# Required-Start: $local_fs $network $syslog
-# Required-Stop: $local_fs $network $syslog
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $network $syslog
# Should-Start: sshd multipathd
# Should-Stop: sshd multipathd
# Default-Start: 2 3 4 5
@@ -184,7 +184,6 @@ case "$1" in
done
done
- [ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
$DRBDADM wait-con-int # User interruptible version of wait-connect all
$DRBDADM sh-b-pri all # Become primary if configured
@@ -211,7 +210,6 @@ case "$1" in
_udev_settle &> /dev/null
$RMMOD drbd
fi
- [ -f /var/lock/subsys/drbd ] && rm /var/lock/subsys/drbd
log_end_msg 0
;;
status)

1
preamble Normal file
View File

@ -0,0 +1 @@
Requires: kernel-%1