* [PATCH 01/11] drbd: Correctly handle resources without volumes
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 02/11] drbd: report net config even for resources without a single volume Philipp Reisner
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_nl.c | 3 ++-
drivers/block/drbd/drbd_state.c | 17 +++++++++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 20fa803..a71a5f5 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1119,7 +1119,8 @@ static void conn_reconfig_done(struct drbd_tconn *tconn)
{
bool stop_threads;
spin_lock_irq(&tconn->req_lock);
- stop_threads = conn_all_vols_unconf(tconn);
+ stop_threads = conn_all_vols_unconf(tconn) &&
+ tconn->cstate == C_STANDALONE;
spin_unlock_irq(&tconn->req_lock);
if (stop_threads) {
/* asender is implicitly stopped by receiver
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index c4dd667..eafc195 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -1491,9 +1491,15 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
void conn_old_common_state(struct drbd_tconn *tconn, union drbd_state *pcs, enum chg_state_flags *pf)
{
enum chg_state_flags flags = ~0;
- union drbd_dev_state os, cs = {}; /* old_state, common_state */
struct drbd_conf *mdev;
int vnr, first_vol = 1;
+ union drbd_dev_state os, cs = {
+ { .role = R_SECONDARY,
+ .peer = R_UNKNOWN,
+ .conn = tconn->cstate,
+ .disk = D_DISKLESS,
+ .pdsk = D_UNKNOWN,
+ } };
rcu_read_lock();
idr_for_each_entry(&tconn->volumes, mdev, vnr) {
@@ -1574,10 +1580,17 @@ void
conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state val,
union drbd_state *pns_min, union drbd_state *pns_max, enum chg_state_flags flags)
{
- union drbd_state ns, os, ns_max = { };
+ union drbd_state ns, os, ns_max = {
+ { .role = R_SECONDARY,
+ .peer = R_UNKNOWN,
+ .conn = val.conn,
+ .disk = D_DISKLESS,
+ .pdsk = D_UNKNOWN
+ } };
union drbd_state ns_min = {
{ .role = R_MASK,
.peer = R_MASK,
+ .conn = val.conn,
.disk = D_MASK,
.pdsk = D_MASK
} };
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 02/11] drbd: report net config even for resources without a single volume
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
2011-10-14 21:57 ` [PATCH 01/11] drbd: Correctly handle resources without volumes Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 03/11] drbd: Changed some defaults Philipp Reisner
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Lars Ellenberg <lars.ellenberg@linbit.com>
Currently it is legal (though unusual) to create and connect a resource,
before adding in all necessary volumes. We should include the network
configuration details, even if we don't have a single volume (yet).
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_nl.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index a71a5f5..3250c8f 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2783,14 +2783,18 @@ next_tconn:
goto out;
if (!mdev) {
- /* this is a tconn without a single volume */
+ /* This is a tconn without a single volume.
+ * Suprisingly enough, it may have a network
+ * configuration. */
+ struct net_conf *nc;
dh->minor = -1U;
dh->ret_code = NO_ERROR;
if (nla_put_drbd_cfg_context(skb, tconn, VOLUME_UNSPECIFIED))
- genlmsg_cancel(skb, dh);
- else
- genlmsg_end(skb, dh);
- goto out;
+ goto cancel;
+ nc = rcu_dereference(tconn->net_conf);
+ if (nc && net_conf_to_skb(skb, nc, 1) != 0)
+ goto cancel;
+ goto done;
}
D_ASSERT(mdev->vnr == volume);
@@ -2800,9 +2804,11 @@ next_tconn:
dh->ret_code = NO_ERROR;
if (nla_put_status_info(skb, mdev, NULL)) {
+cancel:
genlmsg_cancel(skb, dh);
goto out;
}
+done:
genlmsg_end(skb, dh);
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 03/11] drbd: Changed some defaults
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
2011-10-14 21:57 ` [PATCH 01/11] drbd: Correctly handle resources without volumes Philipp Reisner
2011-10-14 21:57 ` [PATCH 02/11] drbd: report net config even for resources without a single volume Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 04/11] drbd: Define scale factors in a single place Philipp Reisner
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
* Enabled the resync controller, with a fill target of 50Kib. That gives
reasonable resync speeds without tuning. A much better default than
the 250KiB/s fixed.
* Enable bitmap compression. It is save to use, and most people have
more CPU power than network bandwidth.
* ko-count of 7: Abort a connection if the peer fails to process a
write request within 42 seconds.
* al-extents of 1237: ~5 GiB seems to be a much more sane default
these days.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/drbd_limits.h | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 425010a..3fc554b 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -16,7 +16,7 @@
#define DEBUG_RANGE_CHECK 0
#define DRBD_MINOR_COUNT_MIN 1
-#define DRBD_MINOR_COUNT_MAX 256
+#define DRBD_MINOR_COUNT_MAX (1U << 20)
#define DRBD_MINOR_COUNT_DEF 32
#define DRBD_VOLUME_MAX 65535
@@ -99,7 +99,7 @@
* 200 should be more than enough even for very short timeouts */
#define DRBD_KO_COUNT_MIN 0
#define DRBD_KO_COUNT_MAX 200
-#define DRBD_KO_COUNT_DEF 0
+#define DRBD_KO_COUNT_DEF 7
/* } */
/* syncer { */
@@ -117,7 +117,7 @@
* 919 * 7 = 6433 */
#define DRBD_AL_EXTENTS_MIN 7
#define DRBD_AL_EXTENTS_MAX 6433
-#define DRBD_AL_EXTENTS_DEF 127
+#define DRBD_AL_EXTENTS_DEF 1237
#define DRBD_MINOR_NUMBER_MIN -1
#define DRBD_MINOR_NUMBER_MAX (1<<30)
@@ -151,7 +151,7 @@
#define DRBD_C_PLAN_AHEAD_MIN 0
#define DRBD_C_PLAN_AHEAD_MAX 300
-#define DRBD_C_PLAN_AHEAD_DEF 0 /* RS rate controller disabled by default */
+#define DRBD_C_PLAN_AHEAD_DEF 20
#define DRBD_C_DELAY_TARGET_MIN 1
#define DRBD_C_DELAY_TARGET_MAX 100
@@ -159,7 +159,7 @@
#define DRBD_C_FILL_TARGET_MIN 0
#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */
-#define DRBD_C_FILL_TARGET_DEF 0 /* By default disabled -> controlled by delay_target */
+#define DRBD_C_FILL_TARGET_DEF 100 /* Try to place 50KiB in socket send buffer during resync */
#define DRBD_C_MAX_RATE_MIN 250 /* kByte/sec */
#define DRBD_C_MAX_RATE_MAX (4 << 20)
@@ -167,7 +167,7 @@
#define DRBD_C_MIN_RATE_MIN 0 /* kByte/sec */
#define DRBD_C_MIN_RATE_MAX (4 << 20)
-#define DRBD_C_MIN_RATE_DEF 4096
+#define DRBD_C_MIN_RATE_DEF 250
#define DRBD_CONG_FILL_MIN 0
#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */
@@ -187,6 +187,6 @@
#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
#define DRBD_ALWAYS_ASBP_DEF 0
-#define DRBD_USE_RLE_DEF 0
+#define DRBD_USE_RLE_DEF 1
#endif
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 04/11] drbd: Define scale factors in a single place
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (2 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 03/11] drbd: Changed some defaults Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 05/11] drbd: Fix the maximum accepted minor device number Philipp Reisner
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/drbd_limits.h | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 3fc554b..9b76984 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -18,29 +18,35 @@
#define DRBD_MINOR_COUNT_MIN 1
#define DRBD_MINOR_COUNT_MAX (1U << 20)
#define DRBD_MINOR_COUNT_DEF 32
+#define DRBD_MINOR_COUNT_SCALE '1'
#define DRBD_VOLUME_MAX 65535
#define DRBD_DIALOG_REFRESH_MIN 0
#define DRBD_DIALOG_REFRESH_MAX 600
+#define DRBD_DIALOG_REFRESH_SCALE '1'
/* valid port number */
#define DRBD_PORT_MIN 1
#define DRBD_PORT_MAX 0xffff
+#define DRBD_PORT_SCALE '1'
/* startup { */
/* if you want more than 3.4 days, disable */
#define DRBD_WFC_TIMEOUT_MIN 0
#define DRBD_WFC_TIMEOUT_MAX 300000
#define DRBD_WFC_TIMEOUT_DEF 0
+#define DRBD_WFC_TIMEOUT_SCALE '1'
#define DRBD_DEGR_WFC_TIMEOUT_MIN 0
#define DRBD_DEGR_WFC_TIMEOUT_MAX 300000
#define DRBD_DEGR_WFC_TIMEOUT_DEF 0
+#define DRBD_DEGR_WFC_TIMEOUT_SCALE '1'
#define DRBD_OUTDATED_WFC_TIMEOUT_MIN 0
#define DRBD_OUTDATED_WFC_TIMEOUT_MAX 300000
#define DRBD_OUTDATED_WFC_TIMEOUT_DEF 0
+#define DRBD_OUTDATED_WFC_TIMEOUT_SCALE '1'
/* }*/
/* net { */
@@ -49,6 +55,7 @@
#define DRBD_TIMEOUT_MIN 1
#define DRBD_TIMEOUT_MAX 600
#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */
+#define DRBD_TIMEOUT_SCALE '1'
/* If backing disk takes longer than disk_timeout, mark the disk as failed */
#define DRBD_DISK_TIMEOUT_MIN 0 /* 0 = disabled */
@@ -60,46 +67,55 @@
#define DRBD_CONNECT_INT_MIN 1
#define DRBD_CONNECT_INT_MAX 120
#define DRBD_CONNECT_INT_DEF 10 /* seconds */
+#define DRBD_CONNECT_INT_SCALE '1'
/* keep-alive probes when idle */
#define DRBD_PING_INT_MIN 1
#define DRBD_PING_INT_MAX 120
#define DRBD_PING_INT_DEF 10
+#define DRBD_PING_INT_SCALE '1'
/* timeout for the ping packets.*/
#define DRBD_PING_TIMEO_MIN 1
#define DRBD_PING_TIMEO_MAX 300
#define DRBD_PING_TIMEO_DEF 5
+#define DRBD_PING_TIMEO_SCALE '1'
/* max number of write requests between write barriers */
#define DRBD_MAX_EPOCH_SIZE_MIN 1
#define DRBD_MAX_EPOCH_SIZE_MAX 20000
#define DRBD_MAX_EPOCH_SIZE_DEF 2048
+#define DRBD_MAX_EPOCH_SIZE_SCALE '1'
/* I don't think that a tcp send buffer of more than 10M is useful */
#define DRBD_SNDBUF_SIZE_MIN 0
#define DRBD_SNDBUF_SIZE_MAX (10<<20)
#define DRBD_SNDBUF_SIZE_DEF 0
+#define DRBD_SNDBUF_SIZE_SCALE '1'
#define DRBD_RCVBUF_SIZE_MIN 0
#define DRBD_RCVBUF_SIZE_MAX (10<<20)
#define DRBD_RCVBUF_SIZE_DEF 0
+#define DRBD_RCVBUF_SIZE_SCALE '1'
/* @4k PageSize -> 128kB - 512MB */
#define DRBD_MAX_BUFFERS_MIN 32
#define DRBD_MAX_BUFFERS_MAX 131072
#define DRBD_MAX_BUFFERS_DEF 2048
+#define DRBD_MAX_BUFFERS_SCALE '1'
/* @4k PageSize -> 4kB - 512MB */
#define DRBD_UNPLUG_WATERMARK_MIN 1
#define DRBD_UNPLUG_WATERMARK_MAX 131072
#define DRBD_UNPLUG_WATERMARK_DEF (DRBD_MAX_BUFFERS_DEF/16)
+#define DRBD_UNPLUG_WATERMARK_SCALE '1'
/* 0 is disabled.
* 200 should be more than enough even for very short timeouts */
#define DRBD_KO_COUNT_MIN 0
#define DRBD_KO_COUNT_MAX 200
#define DRBD_KO_COUNT_DEF 7
+#define DRBD_KO_COUNT_SCALE '1'
/* } */
/* syncer { */
@@ -118,6 +134,7 @@
#define DRBD_AL_EXTENTS_MIN 7
#define DRBD_AL_EXTENTS_MAX 6433
#define DRBD_AL_EXTENTS_DEF 1237
+#define DRBD_AL_EXTENTS_SCALE '1'
#define DRBD_MINOR_NUMBER_MIN -1
#define DRBD_MINOR_NUMBER_MAX (1<<30)
@@ -148,34 +165,42 @@
#define DRBD_MAX_BIO_BVECS_MIN 0
#define DRBD_MAX_BIO_BVECS_MAX 128
#define DRBD_MAX_BIO_BVECS_DEF 0
+#define DRBD_MAX_BIO_BVECS_SCALE '1'
#define DRBD_C_PLAN_AHEAD_MIN 0
#define DRBD_C_PLAN_AHEAD_MAX 300
#define DRBD_C_PLAN_AHEAD_DEF 20
+#define DRBD_C_PLAN_AHEAD_SCALE '1'
#define DRBD_C_DELAY_TARGET_MIN 1
#define DRBD_C_DELAY_TARGET_MAX 100
#define DRBD_C_DELAY_TARGET_DEF 10
+#define DRBD_C_DELAY_TARGET_SCALE '1'
#define DRBD_C_FILL_TARGET_MIN 0
#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */
#define DRBD_C_FILL_TARGET_DEF 100 /* Try to place 50KiB in socket send buffer during resync */
+#define DRBD_C_FILL_TARGET_SCALE 's' /* sectors */
-#define DRBD_C_MAX_RATE_MIN 250 /* kByte/sec */
+#define DRBD_C_MAX_RATE_MIN 250
#define DRBD_C_MAX_RATE_MAX (4 << 20)
#define DRBD_C_MAX_RATE_DEF 102400
+#define DRBD_C_MAX_RATE_SCALE 'k' /* kilobytes */
-#define DRBD_C_MIN_RATE_MIN 0 /* kByte/sec */
+#define DRBD_C_MIN_RATE_MIN 0
#define DRBD_C_MIN_RATE_MAX (4 << 20)
#define DRBD_C_MIN_RATE_DEF 250
+#define DRBD_C_MIN_RATE_SCALE 'k' /* kilobytes */
#define DRBD_CONG_FILL_MIN 0
#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */
#define DRBD_CONG_FILL_DEF 0
+#define DRBD_CONG_FILL_SCALE 's' /* sectors */
#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN
#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX
#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF
+#define DRBD_CONG_EXTENTS_SCALE DRBD_AL_EXTENTS_SCALE
#define DRBD_PROTOCOL_DEF DRBD_PROT_C
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 05/11] drbd: Fix the maximum accepted minor device number
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (3 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 04/11] drbd: Define scale factors in a single place Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 06/11] drbd: Allow to create devices with a minor number > minor_count Philipp Reisner
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
The maximum minor device number allowed by the kernel is (1<<20 - 1). Reject
device numbers higher than that to earlier catch possible errors.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/drbd_limits.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 9b76984..d3ec9cc 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -137,7 +137,7 @@
#define DRBD_AL_EXTENTS_SCALE '1'
#define DRBD_MINOR_NUMBER_MIN -1
-#define DRBD_MINOR_NUMBER_MAX (1<<30)
+#define DRBD_MINOR_NUMBER_MAX ((1 << 20) - 1)
#define DRBD_MINOR_NUMBER_DEF -1
#define DRBD_MINOR_NUMBER_SCALE '1'
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 06/11] drbd: Allow to create devices with a minor number > minor_count
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (4 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 05/11] drbd: Fix the maximum accepted minor device number Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 07/11] drbd: Print memory address in hex instead of decimal in error message Philipp Reisner
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
The minor_count module/kernel parameter serves to scale the size of drbd's
internal memory pool, but it is no longer a limit for the number of minors or
the minor number. (Minor numbers can be arbitrarily high within the allowed
limit of 2^20.)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_nl.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 3250c8f..4e0c914 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -3086,8 +3086,7 @@ int drbd_adm_add_minor(struct sk_buff *skb, struct genl_info *info)
if (retcode != NO_ERROR)
goto out;
- /* FIXME drop minor_count parameter, limit to MINORMASK */
- if (dh->minor >= minor_count) {
+ if (dh->minor > MINORMASK) {
drbd_msg_put_info("requested minor out of range");
retcode = ERR_INVALID_REQUEST;
goto out;
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 07/11] drbd: Print memory address in hex instead of decimal in error message
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (5 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 06/11] drbd: Allow to create devices with a minor number > minor_count Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 08/11] drbd: receive_protocol(): Give variables more easily searchable names Philipp Reisner
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index d4e677c..bfbc103 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1611,7 +1611,7 @@ find_request(struct drbd_conf *mdev, struct rb_root *root, u64 id,
if (drbd_contains_interval(root, sector, &req->i) && req->i.local)
return req;
if (!missing_ok) {
- dev_err(DEV, "%s: failed to find request %lu, sector %llus\n", func,
+ dev_err(DEV, "%s: failed to find request 0x%lx, sector %llus\n", func,
(unsigned long)id, (unsigned long long)sector);
}
return NULL;
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 08/11] drbd: receive_protocol(): Give variables more easily searchable names
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (6 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 07/11] drbd: Print memory address in hex instead of decimal in error message Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 09/11] drbd: receive_protocol(): Make the program flow less confusing Philipp Reisner
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index bfbc103..11f2e72 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3002,7 +3002,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
int p_proto, p_discard_my_data, p_two_primaries, cf;
struct net_conf *nc, *old_net_conf, *new_net_conf = NULL;
char integrity_alg[SHARED_SECRET_MAX] = "";
- struct crypto_hash *peer_tfm = NULL, *tfm = NULL;
+ struct crypto_hash *peer_integrity_tfm = NULL, *integrity_tfm = NULL;
void *int_dig_in = NULL, *int_dig_vv = NULL;
p_proto = be32_to_cpu(p->protocol);
@@ -3028,15 +3028,15 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
if (integrity_alg[0]) {
int hash_size;
- peer_tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
- tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
- if (!(peer_tfm && tfm)) {
+ peer_integrity_tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
+ integrity_tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
+ if (!(peer_integrity_tfm && integrity_tfm)) {
conn_err(tconn, "peer data-integrity-alg %s not supported\n",
integrity_alg);
goto disconnect;
}
- hash_size = crypto_hash_digestsize(tfm);
+ hash_size = crypto_hash_digestsize(integrity_tfm);
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
if (!(int_dig_in && int_dig_vv)) {
@@ -3065,7 +3065,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
new_net_conf->integrity_alg_len = strlen(integrity_alg) + 1;
crypto_free_hash(tconn->integrity_tfm);
- tconn->integrity_tfm = tfm;
+ tconn->integrity_tfm = integrity_tfm;
rcu_assign_pointer(tconn->net_conf, new_net_conf);
mutex_unlock(&tconn->conf_update);
@@ -3074,7 +3074,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
crypto_free_hash(tconn->peer_integrity_tfm);
kfree(tconn->int_dig_in);
kfree(tconn->int_dig_vv);
- tconn->peer_integrity_tfm = peer_tfm;
+ tconn->peer_integrity_tfm = peer_integrity_tfm;
tconn->int_dig_in = int_dig_in;
tconn->int_dig_vv = int_dig_vv;
@@ -3137,8 +3137,8 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
disconnect_rcu_unlock:
rcu_read_unlock();
disconnect:
- crypto_free_hash(peer_tfm);
- crypto_free_hash(tfm);
+ crypto_free_hash(peer_integrity_tfm);
+ crypto_free_hash(integrity_tfm);
kfree(int_dig_in);
kfree(int_dig_vv);
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 09/11] drbd: receive_protocol(): Make the program flow less confusing
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (7 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 08/11] drbd: receive_protocol(): Give variables more easily searchable names Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 10/11] drbd: Be consistent in reporting incompatibilities in P_PROTOCOL settings Philipp Reisner
2011-10-14 21:57 ` [PATCH 11/11] drbd: receive_protocol(): We cannot change our own data-integrity-alg setting here Philipp Reisner
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 73 +++++++++++++++++------------------
1 files changed, 35 insertions(+), 38 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 11f2e72..06bbf0f 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3083,55 +3083,52 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
synchronize_rcu();
kfree(old_net_conf);
+ } else {
+ clear_bit(CONN_DRY_RUN, &tconn->flags);
- return 0;
- }
-
- clear_bit(CONN_DRY_RUN, &tconn->flags);
+ if (cf & CF_DRY_RUN)
+ set_bit(CONN_DRY_RUN, &tconn->flags);
- if (cf & CF_DRY_RUN)
- set_bit(CONN_DRY_RUN, &tconn->flags);
+ rcu_read_lock();
+ nc = rcu_dereference(tconn->net_conf);
- rcu_read_lock();
- nc = rcu_dereference(tconn->net_conf);
+ if (p_proto != nc->wire_protocol) {
+ conn_err(tconn, "incompatible communication protocols\n");
+ goto disconnect_rcu_unlock;
+ }
- if (p_proto != nc->wire_protocol) {
- conn_err(tconn, "incompatible communication protocols\n");
- goto disconnect_rcu_unlock;
- }
+ if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
+ conn_err(tconn, "incompatible after-sb-0pri settings\n");
+ goto disconnect_rcu_unlock;
+ }
- if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
- conn_err(tconn, "incompatible after-sb-0pri settings\n");
- goto disconnect_rcu_unlock;
- }
+ if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
+ conn_err(tconn, "incompatible after-sb-1pri settings\n");
+ goto disconnect_rcu_unlock;
+ }
- if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
- conn_err(tconn, "incompatible after-sb-1pri settings\n");
- goto disconnect_rcu_unlock;
- }
+ if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
+ conn_err(tconn, "incompatible after-sb-2pri settings\n");
+ goto disconnect_rcu_unlock;
+ }
- if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
- conn_err(tconn, "incompatible after-sb-2pri settings\n");
- goto disconnect_rcu_unlock;
- }
+ if (p_discard_my_data && nc->discard_my_data) {
+ conn_err(tconn, "both sides have the 'discard_my_data' flag set\n");
+ goto disconnect_rcu_unlock;
+ }
- if (p_discard_my_data && nc->discard_my_data) {
- conn_err(tconn, "both sides have the 'discard_my_data' flag set\n");
- goto disconnect_rcu_unlock;
- }
+ if (p_two_primaries != nc->two_primaries) {
+ conn_err(tconn, "incompatible setting of the two-primaries options\n");
+ goto disconnect_rcu_unlock;
+ }
- if (p_two_primaries != nc->two_primaries) {
- conn_err(tconn, "incompatible setting of the two-primaries options\n");
- goto disconnect_rcu_unlock;
- }
+ if (strcmp(integrity_alg, nc->integrity_alg)) {
+ conn_err(tconn, "incompatible setting of the data-integrity-alg\n");
+ goto disconnect_rcu_unlock;
+ }
- if (strcmp(integrity_alg, nc->integrity_alg)) {
- conn_err(tconn, "incompatible setting of the data-integrity-alg\n");
- goto disconnect_rcu_unlock;
+ rcu_read_unlock();
}
-
- rcu_read_unlock();
-
return 0;
disconnect_rcu_unlock:
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 10/11] drbd: Be consistent in reporting incompatibilities in P_PROTOCOL settings
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (8 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 09/11] drbd: receive_protocol(): Make the program flow less confusing Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
2011-10-14 21:57 ` [PATCH 11/11] drbd: receive_protocol(): We cannot change our own data-integrity-alg setting here Philipp Reisner
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Refer to the settings by the names which drbdsetup and drbd.conf are using.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 06bbf0f..aa674bf 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3093,37 +3093,37 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
nc = rcu_dereference(tconn->net_conf);
if (p_proto != nc->wire_protocol) {
- conn_err(tconn, "incompatible communication protocols\n");
+ conn_err(tconn, "incompatible %s settings\n", "protocol");
goto disconnect_rcu_unlock;
}
if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
- conn_err(tconn, "incompatible after-sb-0pri settings\n");
+ conn_err(tconn, "incompatible %s settings\n", "after-sb-0pri");
goto disconnect_rcu_unlock;
}
if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
- conn_err(tconn, "incompatible after-sb-1pri settings\n");
+ conn_err(tconn, "incompatible %s settings\n", "after-sb-1pri");
goto disconnect_rcu_unlock;
}
if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
- conn_err(tconn, "incompatible after-sb-2pri settings\n");
+ conn_err(tconn, "incompatible %s settings\n", "after-sb-2pri");
goto disconnect_rcu_unlock;
}
if (p_discard_my_data && nc->discard_my_data) {
- conn_err(tconn, "both sides have the 'discard_my_data' flag set\n");
+ conn_err(tconn, "incompatible %s settings\n", "discard-my-data");
goto disconnect_rcu_unlock;
}
if (p_two_primaries != nc->two_primaries) {
- conn_err(tconn, "incompatible setting of the two-primaries options\n");
+ conn_err(tconn, "incompatible %s settings\n", "allow-two-primaries");
goto disconnect_rcu_unlock;
}
if (strcmp(integrity_alg, nc->integrity_alg)) {
- conn_err(tconn, "incompatible setting of the data-integrity-alg\n");
+ conn_err(tconn, "incompatible %s settings\n", "data-integrity-alg");
goto disconnect_rcu_unlock;
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 11/11] drbd: receive_protocol(): We cannot change our own data-integrity-alg setting here
2011-10-14 21:57 [RFC 00/11] drbd: part 20 of adding multiple volume support to drbd Philipp Reisner
` (9 preceding siblings ...)
2011-10-14 21:57 ` [PATCH 10/11] drbd: Be consistent in reporting incompatibilities in P_PROTOCOL settings Philipp Reisner
@ 2011-10-14 21:57 ` Philipp Reisner
10 siblings, 0 replies; 12+ messages in thread
From: Philipp Reisner @ 2011-10-14 21:57 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index aa674bf..68a5aba 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3002,7 +3002,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
int p_proto, p_discard_my_data, p_two_primaries, cf;
struct net_conf *nc, *old_net_conf, *new_net_conf = NULL;
char integrity_alg[SHARED_SECRET_MAX] = "";
- struct crypto_hash *peer_integrity_tfm = NULL, *integrity_tfm = NULL;
+ struct crypto_hash *peer_integrity_tfm = NULL;
void *int_dig_in = NULL, *int_dig_vv = NULL;
p_proto = be32_to_cpu(p->protocol);
@@ -3028,15 +3028,23 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
if (integrity_alg[0]) {
int hash_size;
+ /*
+ * We can only change the peer data integrity algorithm
+ * here. Changing our own data integrity algorithm
+ * requires that we send a P_PROTOCOL_UPDATE packet at
+ * the same time; otherwise, the peer has no way to
+ * tell between which packets the algorithm should
+ * change.
+ */
+
peer_integrity_tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
- integrity_tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
- if (!(peer_integrity_tfm && integrity_tfm)) {
+ if (!peer_integrity_tfm) {
conn_err(tconn, "peer data-integrity-alg %s not supported\n",
integrity_alg);
goto disconnect;
}
- hash_size = crypto_hash_digestsize(integrity_tfm);
+ hash_size = crypto_hash_digestsize(peer_integrity_tfm);
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
if (!(int_dig_in && int_dig_vv)) {
@@ -3064,9 +3072,6 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
strcpy(new_net_conf->integrity_alg, integrity_alg);
new_net_conf->integrity_alg_len = strlen(integrity_alg) + 1;
- crypto_free_hash(tconn->integrity_tfm);
- tconn->integrity_tfm = integrity_tfm;
-
rcu_assign_pointer(tconn->net_conf, new_net_conf);
mutex_unlock(&tconn->conf_update);
mutex_unlock(&tconn->data.mutex);
@@ -3079,7 +3084,8 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
tconn->int_dig_vv = int_dig_vv;
if (strcmp(old_net_conf->integrity_alg, integrity_alg))
- conn_info(tconn, "peer data-integrity-alg: %s\n", integrity_alg);
+ conn_info(tconn, "peer data-integrity-alg: %s\n",
+ integrity_alg[0] ? integrity_alg : "(none)");
synchronize_rcu();
kfree(old_net_conf);
@@ -3135,7 +3141,6 @@ disconnect_rcu_unlock:
rcu_read_unlock();
disconnect:
crypto_free_hash(peer_integrity_tfm);
- crypto_free_hash(integrity_tfm);
kfree(int_dig_in);
kfree(int_dig_vv);
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
--
1.7.4.1
^ permalink raw reply [flat|nested] 12+ messages in thread