* [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd
@ 2011-10-10 11:54 Philipp Reisner
2011-10-10 11:54 ` [PATCH 01/13] drbd: Refuse to change network options online when Philipp Reisner
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
This the first request for review of drbd-8.4. The complete set has
449 patches. This is the seventeenth installment containing 13 patches.
The whole set is available here:
git://git.drbd.org/linux-2.6-drbd.git for-jens
and is jens_for-3.2_drivers...for-jens
and this part is 80c99c9^...330bea2
This patch series contains:
* Allow changing of various net options while a connection is established
* Cleanups
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/13] drbd: Refuse to change network options online when...
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
@ 2011-10-10 11:54 ` Philipp Reisner
2011-10-10 11:54 ` [PATCH 02/13] drbd: protect updates to integrits_tfm by tconn->data->mutex Philipp Reisner
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
* the peer does not speak protocol_version 100 and the
user wants to change one of:
- wire_protocol
- two_primaries
- integrity_alg
* the user wants to remove the allow_two_primaries flag
when there are two primaries
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_nl.c | 22 ++++++++++++++++++----
include/linux/drbd.h | 1 +
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 972178b..87fd3bf 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1771,10 +1771,24 @@ _check_net_options(struct drbd_tconn *tconn, struct net_conf *old_conf, struct n
struct drbd_conf *mdev;
int i;
- if (old_conf && tconn->agreed_pro_version < 100 &&
- tconn->cstate == C_WF_REPORT_PARAMS &&
- new_conf->wire_protocol != old_conf->wire_protocol)
- return ERR_NEED_APV_100;
+ if (old_conf && tconn->cstate == C_WF_REPORT_PARAMS && tconn->agreed_pro_version < 100) {
+ if (new_conf->wire_protocol != old_conf->wire_protocol)
+ return ERR_NEED_APV_100;
+
+ if (new_conf->two_primaries != old_conf->two_primaries)
+ return ERR_NEED_APV_100;
+
+ if (!new_conf->integrity_alg != !old_conf->integrity_alg)
+ return ERR_NEED_APV_100;
+
+ if (strcmp(new_conf->integrity_alg, old_conf->integrity_alg))
+ return ERR_NEED_APV_100;
+ }
+
+ if (!new_conf->two_primaries &&
+ conn_highest_role(tconn) == R_PRIMARY &&
+ conn_highest_peer(tconn) == R_PRIMARY)
+ return ERR_NEED_ALLOW_TWO_PRI;
if (new_conf->two_primaries &&
(new_conf->wire_protocol != DRBD_PROT_C))
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 05063e6..679e811 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -161,6 +161,7 @@ enum drbd_ret_code {
ERR_MINOR_EXISTS = 161,
ERR_INVALID_REQUEST = 162,
ERR_NEED_APV_100 = 163,
+ ERR_NEED_ALLOW_TWO_PRI = 164,
/* insert new ones above this line */
AFTER_LAST_ERR_CODE
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 02/13] drbd: protect updates to integrits_tfm by tconn->data->mutex
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
2011-10-10 11:54 ` [PATCH 01/13] drbd: Refuse to change network options online when Philipp Reisner
@ 2011-10-10 11:54 ` Philipp Reisner
2011-10-10 11:54 ` [PATCH 03/13] drbd: Made cmp_after_sb() more generic into convert_after_sb() Philipp Reisner
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
Since we need to hold that mutex anyways to make sure the peer
gets that change in the right position in the data stream,
it makes a lot of sense to use the same mutex to ensure existence
of the tfm.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_int.h | 2 +-
drivers/block/drbd/drbd_main.c | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index e167228..c59012f 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -848,7 +848,7 @@ struct drbd_tconn { /* is a resource from the config file */
struct list_head out_of_sequence_requests;
struct crypto_hash *cram_hmac_tfm;
- struct crypto_hash *integrity_tfm; /* checksums we compute */
+ struct crypto_hash *integrity_tfm; /* checksums we compute, updates protected by tconn->data->mutex */
struct crypto_hash *peer_integrity_tfm; /* checksums we verify */
struct crypto_hash *csums_tfm;
struct crypto_hash *verify_tfm;
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 939d31b..7c806b9 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1720,11 +1720,11 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
int dgs;
int err;
+ sock = &mdev->tconn->data;
+ p = drbd_prepare_command(mdev, sock);
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ?
crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0;
- sock = &mdev->tconn->data;
- p = drbd_prepare_command(mdev, sock);
if (!p)
return -EIO;
p->sector = cpu_to_be64(req->i.sector);
@@ -1793,11 +1793,12 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
int err;
int dgs;
+ sock = &mdev->tconn->data;
+ p = drbd_prepare_command(mdev, sock);
+
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ?
crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0;
- sock = &mdev->tconn->data;
- p = drbd_prepare_command(mdev, sock);
if (!p)
return -EIO;
p->sector = cpu_to_be64(peer_req->i.sector);
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 03/13] drbd: Made cmp_after_sb() more generic into convert_after_sb()
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
2011-10-10 11:54 ` [PATCH 01/13] drbd: Refuse to change network options online when Philipp Reisner
2011-10-10 11:54 ` [PATCH 02/13] drbd: protect updates to integrits_tfm by tconn->data->mutex Philipp Reisner
@ 2011-10-10 11:54 ` Philipp Reisner
2011-10-10 11:54 ` [PATCH 04/13] drbd: Allocation of int_dig_in and int_dig_vv was missing Philipp Reisner
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 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_receiver.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 7deade1..b5eeb8d 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -2984,25 +2984,18 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_rol
return rv;
}
-/* returns 1 if invalid */
-static int cmp_after_sb(enum drbd_after_sb_p peer, enum drbd_after_sb_p self)
+static enum drbd_after_sb_p convert_after_sb(enum drbd_after_sb_p peer)
{
/* ASB_DISCARD_REMOTE - ASB_DISCARD_LOCAL is valid */
- if ((peer == ASB_DISCARD_REMOTE && self == ASB_DISCARD_LOCAL) ||
- (self == ASB_DISCARD_REMOTE && peer == ASB_DISCARD_LOCAL))
- return 0;
+ if (peer == ASB_DISCARD_REMOTE)
+ return ASB_DISCARD_LOCAL;
/* any other things with ASB_DISCARD_REMOTE or ASB_DISCARD_LOCAL are invalid */
- if (peer == ASB_DISCARD_REMOTE || peer == ASB_DISCARD_LOCAL ||
- self == ASB_DISCARD_REMOTE || self == ASB_DISCARD_LOCAL)
- return 1;
+ if (peer == ASB_DISCARD_LOCAL)
+ return ASB_DISCARD_REMOTE;
/* everything else is valid if they are equal on both sides. */
- if (peer == self)
- return 0;
-
- /* everything es is invalid. */
- return 1;
+ return peer;
}
static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
@@ -3060,17 +3053,17 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
goto disconnect_rcu_unlock;
}
- if (cmp_after_sb(p_after_sb_0p, nc->after_sb_0p)) {
+ 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 (cmp_after_sb(p_after_sb_1p, nc->after_sb_1p)) {
+ 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 (cmp_after_sb(p_after_sb_2p, nc->after_sb_2p)) {
+ 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;
}
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 04/13] drbd: Allocation of int_dig_in and int_dig_vv was missing
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (2 preceding siblings ...)
2011-10-10 11:54 ` [PATCH 03/13] drbd: Made cmp_after_sb() more generic into convert_after_sb() Philipp Reisner
@ 2011-10-10 11:54 ` Philipp Reisner
2011-10-10 11:54 ` [PATCH 05/13] drbd: Receiving part for the PROTOCOL_UPDATE packet Philipp Reisner
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 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_receiver.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index b5eeb8d..61b57fc 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3004,6 +3004,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
int p_discard_my_data, p_two_primaries, cf;
struct net_conf *nc;
+ void *int_dig_in = NULL, *int_dig_vv = NULL;
p_proto = be32_to_cpu(p->protocol);
p_after_sb_0p = be32_to_cpu(p->after_sb_0p);
@@ -3026,6 +3027,8 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
integrity_alg[SHARED_SECRET_MAX-1] = 0;
if (integrity_alg[0]) {
+ int hash_size;
+
tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
if (!tfm) {
conn_err(tconn, "peer data-integrity-alg %s not supported\n",
@@ -3033,11 +3036,23 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
goto disconnect;
}
conn_info(tconn, "peer data-integrity-alg: %s\n", integrity_alg);
+
+ hash_size = crypto_hash_digestsize(tfm);
+ int_dig_in = kmalloc(hash_size, GFP_KERNEL);
+ int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
+ if (!(int_dig_in && int_dig_vv)) {
+ crypto_free_hash(tfm);
+ goto disconnect;
+ }
}
if (tconn->peer_integrity_tfm)
crypto_free_hash(tconn->peer_integrity_tfm);
tconn->peer_integrity_tfm = tfm;
+ kfree(tconn->int_dig_in);
+ kfree(tconn->int_dig_vv);
+ tconn->int_dig_in = int_dig_in;
+ tconn->int_dig_vv = int_dig_vv;
}
clear_bit(CONN_DRY_RUN, &tconn->flags);
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 05/13] drbd: Receiving part for the PROTOCOL_UPDATE packet
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (3 preceding siblings ...)
2011-10-10 11:54 ` [PATCH 04/13] drbd: Allocation of int_dig_in and int_dig_vv was missing Philipp Reisner
@ 2011-10-10 11:54 ` Philipp Reisner
2011-10-10 11:54 ` [PATCH 06/13] drbd: Send PROTOCOL_UPDATE packets when appropriate Philipp Reisner
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 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_int.h | 3 +-
drivers/block/drbd/drbd_main.c | 2 +
drivers/block/drbd/drbd_receiver.c | 73 +++++++++++++++++++++++++++++-------
3 files changed, 63 insertions(+), 15 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index c59012f..75b26d8 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -225,6 +225,7 @@ enum drbd_packet {
P_CONN_ST_CHG_REQ = 0x2a, /* data sock: Connection wide state request */
P_CONN_ST_CHG_REPLY = 0x2b, /* meta sock: Connection side state req reply */
P_RETRY_WRITE = 0x2c, /* Protocol C: retry conflicting write request */
+ P_PROTOCOL_UPDATE = 0x2d, /* data sock: is used in established connections */
P_MAY_IGNORE = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */
P_MAX_OPT_CMD = 0x101,
@@ -849,7 +850,7 @@ struct drbd_tconn { /* is a resource from the config file */
struct crypto_hash *cram_hmac_tfm;
struct crypto_hash *integrity_tfm; /* checksums we compute, updates protected by tconn->data->mutex */
- struct crypto_hash *peer_integrity_tfm; /* checksums we verify */
+ struct crypto_hash *peer_integrity_tfm; /* checksums we verify, only accessed from receiver thread */
struct crypto_hash *csums_tfm;
struct crypto_hash *verify_tfm;
void *int_dig_in;
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 7c806b9..eecb0fb 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3290,6 +3290,8 @@ const char *cmdname(enum drbd_packet cmd)
[P_RS_CANCEL] = "RSCancel",
[P_CONN_ST_CHG_REQ] = "conn_st_chg_req",
[P_CONN_ST_CHG_REPLY] = "conn_st_chg_reply",
+ [P_RETRY_WRITE] = "retry_write",
+ [P_PROTOCOL_UPDATE] = "protocol_update",
/* enum drbd_packet, but not commands - obsoleted flags:
* P_MAY_IGNORE
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 61b57fc..9611303 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3001,9 +3001,11 @@ static enum drbd_after_sb_p convert_after_sb(enum drbd_after_sb_p peer)
static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
{
struct p_protocol *p = pi->data;
- int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
- int p_discard_my_data, p_two_primaries, cf;
- struct net_conf *nc;
+ enum drbd_after_sb_p p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
+ 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;
void *int_dig_in = NULL, *int_dig_vv = NULL;
p_proto = be32_to_cpu(p->protocol);
@@ -3015,8 +3017,6 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
p_discard_my_data = cf & CF_DISCARD_MY_DATA;
if (tconn->agreed_pro_version >= 87) {
- char integrity_alg[SHARED_SECRET_MAX];
- struct crypto_hash *tfm = NULL;
int err;
if (pi->size > sizeof(integrity_alg))
@@ -3024,35 +3024,70 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
err = drbd_recv_all(tconn, integrity_alg, pi->size);
if (err)
return err;
- integrity_alg[SHARED_SECRET_MAX-1] = 0;
+ integrity_alg[SHARED_SECRET_MAX - 1] = 0;
+ }
+ if (pi->cmd == P_PROTOCOL_UPDATE) {
if (integrity_alg[0]) {
int hash_size;
- tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
- if (!tfm) {
+ 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)) {
conn_err(tconn, "peer data-integrity-alg %s not supported\n",
integrity_alg);
goto disconnect;
}
- conn_info(tconn, "peer data-integrity-alg: %s\n", integrity_alg);
hash_size = crypto_hash_digestsize(tfm);
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
if (!(int_dig_in && int_dig_vv)) {
- crypto_free_hash(tfm);
+ conn_err(tconn, "Allocation of buffers for data integrity checking failed\n");
goto disconnect;
}
}
- if (tconn->peer_integrity_tfm)
- crypto_free_hash(tconn->peer_integrity_tfm);
- tconn->peer_integrity_tfm = tfm;
+ new_net_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
+ if (!new_net_conf) {
+ conn_err(tconn, "Allocation of new net_conf failed\n");
+ goto disconnect;
+ }
+
+ mutex_lock(&tconn->data.mutex);
+ mutex_lock(&tconn->conf_update);
+ old_net_conf = tconn->net_conf;
+ *new_net_conf = *old_net_conf;
+
+ new_net_conf->wire_protocol = p_proto;
+ new_net_conf->after_sb_0p = convert_after_sb(p_after_sb_0p);
+ new_net_conf->after_sb_1p = convert_after_sb(p_after_sb_1p);
+ new_net_conf->after_sb_2p = convert_after_sb(p_after_sb_2p);
+ new_net_conf->two_primaries = p_two_primaries;
+ 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 = tfm;
+
+ rcu_assign_pointer(tconn->net_conf, new_net_conf);
+ mutex_unlock(&tconn->conf_update);
+ mutex_unlock(&tconn->data.mutex);
+
+ crypto_free_hash(tconn->peer_integrity_tfm);
kfree(tconn->int_dig_in);
kfree(tconn->int_dig_vv);
+ tconn->peer_integrity_tfm = peer_tfm;
tconn->int_dig_in = int_dig_in;
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);
+
+ synchronize_rcu();
+ kfree(old_net_conf);
+
+ return 0;
}
clear_bit(CONN_DRY_RUN, &tconn->flags);
@@ -3063,7 +3098,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
rcu_read_lock();
nc = rcu_dereference(tconn->net_conf);
- if (p_proto != nc->wire_protocol && tconn->agreed_pro_version < 100) {
+ if (p_proto != nc->wire_protocol) {
conn_err(tconn, "incompatible communication protocols\n");
goto disconnect_rcu_unlock;
}
@@ -3093,6 +3128,11 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
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();
return 0;
@@ -3100,6 +3140,10 @@ 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);
+ kfree(int_dig_in);
+ kfree(int_dig_vv);
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
return -EIO;
}
@@ -4197,6 +4241,7 @@ static struct data_cmd drbd_cmd_handler[] = {
[P_DELAY_PROBE] = { 0, sizeof(struct p_delay_probe93), receive_skip },
[P_OUT_OF_SYNC] = { 0, sizeof(struct p_block_desc), receive_out_of_sync },
[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 },
};
static void drbdd(struct drbd_tconn *tconn)
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 06/13] drbd: Send PROTOCOL_UPDATE packets when appropriate
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (4 preceding siblings ...)
2011-10-10 11:54 ` [PATCH 05/13] drbd: Receiving part for the PROTOCOL_UPDATE packet Philipp Reisner
@ 2011-10-10 11:54 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 07/13] drbd: Use more generic constant names Philipp Reisner
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:54 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_int.h | 2 +-
drivers/block/drbd/drbd_main.c | 6 +++---
drivers/block/drbd/drbd_nl.c | 11 ++---------
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 75b26d8..c301973 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1051,7 +1051,7 @@ extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock,
extern int drbd_send_all(struct drbd_tconn *, struct socket *, void *, size_t,
unsigned);
-extern int __drbd_send_protocol(struct drbd_tconn *tconn);
+extern int __drbd_send_protocol(struct drbd_tconn *tconn, enum drbd_packet cmd);
extern int drbd_send_protocol(struct drbd_tconn *tconn);
extern int drbd_send_uuids(struct drbd_conf *mdev);
extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev);
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index eecb0fb..73951cc 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -911,7 +911,7 @@ int drbd_send_sync_param(struct drbd_conf *mdev)
return drbd_send_command(mdev, sock, cmd, size, NULL, 0);
}
-int __drbd_send_protocol(struct drbd_tconn *tconn)
+int __drbd_send_protocol(struct drbd_tconn *tconn, enum drbd_packet cmd)
{
struct drbd_socket *sock;
struct p_protocol *p;
@@ -953,7 +953,7 @@ int __drbd_send_protocol(struct drbd_tconn *tconn)
strcpy(p->integrity_alg, nc->integrity_alg);
rcu_read_unlock();
- return __conn_send_command(tconn, sock, P_PROTOCOL, size, NULL, 0);
+ return __conn_send_command(tconn, sock, cmd, size, NULL, 0);
}
int drbd_send_protocol(struct drbd_tconn *tconn)
@@ -961,7 +961,7 @@ int drbd_send_protocol(struct drbd_tconn *tconn)
int err;
mutex_lock(&tconn->data.mutex);
- err = __drbd_send_protocol(tconn);
+ err = __drbd_send_protocol(tconn, P_PROTOCOL);
mutex_unlock(&tconn->data.mutex);
return err;
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 87fd3bf..fc0ea77 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1910,7 +1910,6 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
int ovr; /* online verify running */
int rsr; /* re-sync running */
struct crypto crypto = { };
- bool change_integrity_alg;
retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_CONN);
if (!adm_ctx.reply_skb)
@@ -1981,9 +1980,6 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
goto fail;
}
- change_integrity_alg = strcmp(old_conf->integrity_alg,
- new_conf->integrity_alg);
-
retcode = alloc_crypto(&crypto, new_conf);
if (retcode != NO_ERROR)
goto fail;
@@ -2007,13 +2003,10 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
tconn->int_dig_vv = crypto.int_dig_vv;
crypto_free_hash(tconn->integrity_tfm);
tconn->integrity_tfm = crypto.integrity_tfm;
- if (change_integrity_alg) {
+ if (tconn->cstate >= C_WF_REPORT_PARAMS && tconn->agreed_pro_version >= 100)
/* Do this without trying to take tconn->data.mutex again. */
- if (__drbd_send_protocol(tconn))
- goto fail;
- }
+ __drbd_send_protocol(tconn, P_PROTOCOL_UPDATE);
- /* FIXME Changing cram_hmac while the connection is established is useless */
crypto_free_hash(tconn->cram_hmac_tfm);
tconn->cram_hmac_tfm = crypto.cram_hmac_tfm;
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 07/13] drbd: Use more generic constant names
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (5 preceding siblings ...)
2011-10-10 11:54 ` [PATCH 06/13] drbd: Send PROTOCOL_UPDATE packets when appropriate Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 08/13] drbd: Output signed / unsigned netlink fields correctly Philipp Reisner
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
These constants are useful for the same purpose in more than one place.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/drbd_limits.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 07d5df9..2b364d5 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -111,10 +111,10 @@
#define DRBD_AL_EXTENTS_MAX 6433
#define DRBD_AL_EXTENTS_DEF 127
-#define DRBD_RESYNC_AFTER_MIN -1
-#define DRBD_RESYNC_AFTER_MAX (1<<30)
-#define DRBD_RESYNC_AFTER_DEF -1
-#define DRBD_RESYNC_AFTER_SCALE '1'
+#define DRBD_MINOR_NUMBER_MIN -1
+#define DRBD_MINOR_NUMBER_MAX (1<<30)
+#define DRBD_MINOR_NUMBER_DEF -1
+#define DRBD_MINOR_NUMBER_SCALE '1'
/* } */
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 08/13] drbd: Output signed / unsigned netlink fields correctly
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (6 preceding siblings ...)
2011-10-10 11:55 ` [PATCH 07/13] drbd: Use more generic constant names Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 09/13] drbd: Remove unused GENLA_F_MAY_IGNORE flag Philipp Reisner
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Note: All input values are still treated as signed; unsigned long long values
are still broken.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/genl_magic_func.h | 23 ++++++++++-----
include/linux/genl_magic_struct.h | 52 +++++++++++++++++++++++++++----------
2 files changed, 53 insertions(+), 22 deletions(-)
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index e8e1220..a1305b7 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -78,12 +78,13 @@ static struct nla_policy s_name ## _nl_policy[] __read_mostly = \
{ s_fields };
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, _type, __get, __put) \
+#define __field(attr_nr, attr_flag, name, nla_type, _type, __get, \
+ __put, __is_signed) \
[__nla_type(attr_nr)] = { .type = nla_type },
#undef __array
#define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \
- __get, __put) \
+ __get, __put, __is_signed) \
[__nla_type(attr_nr)] = { .type = nla_type, \
.len = maxlen - (nla_type == NLA_NUL_STRING) },
@@ -235,7 +236,8 @@ static int s_name ## _from_attrs(struct s_name *s, struct genl_info *info) \
}
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \
+#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
+ __is_signed) \
__assign(attr_nr, attr_flag, name, nla_type, type, \
if (s) \
s->name = __get(nla); \
@@ -243,7 +245,8 @@ static int s_name ## _from_attrs(struct s_name *s, struct genl_info *info) \
/* validate_nla() already checked nla_len <= maxlen appropriately. */
#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \
+#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
+ __get, __put, __is_signed) \
__assign(attr_nr, attr_flag, name, nla_type, type, \
if (s) \
s->name ## _len = \
@@ -404,14 +407,16 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \
+#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
+ __is_signed) \
if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \
DPRINT_FIELD(">>", nla_type, name, s, NULL); \
__put(skb, attr_nr, s->name); \
}
#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \
+#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
+ __get, __put, __is_signed) \
if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \
DPRINT_ARRAY(">>",nla_type, name, s, NULL); \
__put(skb, attr_nr, min_t(int, maxlen, \
@@ -425,9 +430,11 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
/* Functions for initializing structs to default values. */
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put)
+#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
+ __is_signed)
#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put)
+#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
+ __get, __put, __is_signed)
#undef __u32_field_def
#define __u32_field_def(attr_nr, attr_flag, name, default) \
x->name = default;
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
index 0fca21f..ba911da 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -87,28 +87,28 @@ enum {
/* possible field types */
#define __flg_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U8, char, \
- nla_get_u8, NLA_PUT_U8)
+ nla_get_u8, NLA_PUT_U8, false)
#define __u8_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \
- nla_get_u8, NLA_PUT_U8)
+ nla_get_u8, NLA_PUT_U8, false)
#define __u16_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U16, __u16, \
- nla_get_u16, NLA_PUT_U16)
+ nla_get_u16, NLA_PUT_U16, false)
#define __u32_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U32, __u32, \
- nla_get_u32, NLA_PUT_U32)
+ nla_get_u32, NLA_PUT_U32, false)
#define __s32_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U32, __s32, \
- nla_get_u32, NLA_PUT_U32)
+ nla_get_u32, NLA_PUT_U32, true)
#define __u64_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U64, __u64, \
- nla_get_u64, NLA_PUT_U64)
+ nla_get_u64, NLA_PUT_U64, false)
#define __str_field(attr_nr, attr_flag, name, maxlen) \
__array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \
- nla_strlcpy, NLA_PUT)
+ nla_strlcpy, NLA_PUT, false)
#define __bin_field(attr_nr, attr_flag, name, maxlen) \
__array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \
- nla_memcpy, NLA_PUT)
+ nla_memcpy, NLA_PUT, false)
/* fields with default values */
#define __flg_field_def(attr_nr, attr_flag, name, default) \
@@ -174,11 +174,13 @@ enum { \
};
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \
+#define __field(attr_nr, attr_flag, name, nla_type, type, \
+ __get, __put, __is_signed) \
T_ ## name = (__u16)(attr_nr | attr_flag),
#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \
+#define __array(attr_nr, attr_flag, name, nla_type, type, \
+ maxlen, __get, __put, __is_signed) \
T_ ## name = (__u16)(attr_nr | attr_flag),
#include GENL_MAGIC_INCLUDE_FILE
@@ -238,11 +240,13 @@ static inline void ct_assert_unique_ ## s_name ## _attributes(void) \
}
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \
+#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
+ __is_signed) \
case attr_nr:
#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \
+#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
+ __get, __put, __is_signed) \
case attr_nr:
#include GENL_MAGIC_INCLUDE_FILE
@@ -260,16 +264,36 @@ static inline void ct_assert_unique_ ## s_name ## _attributes(void) \
struct s_name { s_fields };
#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \
+#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
+ __is_signed) \
type name;
#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \
+#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
+ __get, __put, __is_signed) \
type name[maxlen]; \
__u32 name ## _len;
#include GENL_MAGIC_INCLUDE_FILE
+#undef GENL_struct
+#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
+enum { \
+ s_fields \
+};
+
+#undef __field
+#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
+ is_signed) \
+ F_ ## name ## _IS_SIGNED = is_signed,
+
+#undef __array
+#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
+ __get, __put, is_signed) \
+ F_ ## name ## _IS_SIGNED = is_signed,
+
+#include GENL_MAGIC_INCLUDE_FILE
+
/* }}}1 */
#endif /* GENL_MAGIC_STRUCT_H */
/* vim: set foldmethod=marker nofoldenable : */
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 09/13] drbd: Remove unused GENLA_F_MAY_IGNORE flag
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (7 preceding siblings ...)
2011-10-10 11:55 ` [PATCH 08/13] drbd: Output signed / unsigned netlink fields correctly Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 10/13] drbd: Make drbd's use of netlink attribute flags less confusing Philipp Reisner
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 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/genl_magic_struct.h | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
index ba911da..f3c3425 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -40,11 +40,6 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
* yet implemented features, if newer userland tries to use them even though
* the genl_family version clearly indicates they are not available.
*
- * @GENLA_F_MAY_IGNORE: To clearly document the fact, for good measure.
- * To be used for API extensions for things that have sane defaults,
- * so newer userland can still talk to older kernel, knowing it will
- * silently ignore these attributes if not yet known.
- *
* NOTE: These flags overload
* NLA_F_NESTED (1 << 15)
* NLA_F_NET_BYTEORDER (1 << 14)
@@ -55,7 +50,6 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
* See also: nla_type()
*/
enum {
- GENLA_F_MAY_IGNORE = 0,
GENLA_F_MANDATORY = 1 << 14,
GENLA_F_REQUIRED = 1 << 15,
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 10/13] drbd: Make drbd's use of netlink attribute flags less confusing
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (8 preceding siblings ...)
2011-10-10 11:55 ` [PATCH 09/13] drbd: Remove unused GENLA_F_MAY_IGNORE flag Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 11/13] drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first Philipp Reisner
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Make it more clear in the flag names which flags are internal to drbd, and
which are not.
The check for mandatory attributes is the only extension visible at the netlink
layer. Attributes with this flag set would look like unknown attributes to
some kernel versions. The netlink layer would ignore them and also skip
consistency checks on the attribute type and legth. To avoid this, we check
for mandatory attributes first, remove the mandatory flag, and then process the
attributes normally.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/drbd_genl.h | 244 ++++++++++++++++++------------------
include/linux/genl_magic_func.h | 107 +++++++---------
include/linux/genl_magic_struct.h | 64 ++++------
3 files changed, 193 insertions(+), 222 deletions(-)
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 4b446af..f3c9a5b 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -86,7 +86,7 @@
*/
GENL_struct(DRBD_NLA_CFG_REPLY, 1, drbd_cfg_reply,
/* "arbitrary" size strings, nla_policy.len = 0 */
- __str_field(1, GENLA_F_MANDATORY, info_text, 0)
+ __str_field(1, DRBD_GENLA_F_MANDATORY, info_text, 0)
)
/* Configuration requests typically need a context to operate on.
@@ -97,133 +97,133 @@ GENL_struct(DRBD_NLA_CFG_REPLY, 1, drbd_cfg_reply,
GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
/* currently only 256 volumes per group,
* but maybe we still change that */
- __u32_field(1, GENLA_F_MANDATORY, ctx_volume)
- __str_field(2, GENLA_F_MANDATORY, ctx_conn_name, 128)
+ __u32_field(1, DRBD_GENLA_F_MANDATORY, ctx_volume)
+ __str_field(2, DRBD_GENLA_F_MANDATORY, ctx_conn_name, 128)
)
GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
- __str_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT, backing_dev, 128)
- __str_field(2, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev, 128)
- __s32_field(3, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev_idx)
+ __str_field(1, DRBD_F_REQUIRED | DRBD_F_INVARIANT, backing_dev, 128)
+ __str_field(2, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev, 128)
+ __s32_field(3, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev_idx)
/* use the resize command to try and change the disk_size */
- __u64_field(4, GENLA_F_MANDATORY | GENLA_F_INVARIANT, disk_size)
+ __u64_field(4, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, disk_size)
/* we could change the max_bio_bvecs,
* but it won't propagate through the stack */
- __u32_field(5, GENLA_F_MANDATORY | GENLA_F_INVARIANT, max_bio_bvecs)
-
- __u32_field_def(6, GENLA_F_MANDATORY, on_io_error, DRBD_ON_IO_ERROR_DEF)
- __u32_field_def(7, GENLA_F_MANDATORY, fencing, DRBD_FENCING_DEF)
-
- __u32_field_def(8, GENLA_F_MANDATORY, resync_rate, DRBD_RESYNC_RATE_DEF)
- __s32_field_def(9, GENLA_F_MANDATORY, resync_after, DRBD_RESYNC_AFTER_DEF)
- __u32_field_def(10, GENLA_F_MANDATORY, al_extents, DRBD_AL_EXTENTS_DEF)
- __u32_field_def(11, GENLA_F_MANDATORY, c_plan_ahead, DRBD_C_PLAN_AHEAD_DEF)
- __u32_field_def(12, GENLA_F_MANDATORY, c_delay_target, DRBD_C_DELAY_TARGET_DEF)
- __u32_field_def(13, GENLA_F_MANDATORY, c_fill_target, DRBD_C_FILL_TARGET_DEF)
- __u32_field_def(14, GENLA_F_MANDATORY, c_max_rate, DRBD_C_MAX_RATE_DEF)
- __u32_field_def(15, GENLA_F_MANDATORY, c_min_rate, DRBD_C_MIN_RATE_DEF)
-
- __flg_field_def(16, GENLA_F_MANDATORY, disk_barrier, DRBD_DISK_BARRIER_DEF)
- __flg_field_def(17, GENLA_F_MANDATORY, disk_flushes, DRBD_DISK_FLUSHES_DEF)
- __flg_field_def(18, GENLA_F_MANDATORY, disk_drain, DRBD_DISK_DRAIN_DEF)
- __flg_field_def(19, GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF)
+ __u32_field(5, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, max_bio_bvecs)
+
+ __u32_field_def(6, DRBD_GENLA_F_MANDATORY, on_io_error, DRBD_ON_IO_ERROR_DEF)
+ __u32_field_def(7, DRBD_GENLA_F_MANDATORY, fencing, DRBD_FENCING_DEF)
+
+ __u32_field_def(8, DRBD_GENLA_F_MANDATORY, resync_rate, DRBD_RESYNC_RATE_DEF)
+ __s32_field_def(9, DRBD_GENLA_F_MANDATORY, resync_after, DRBD_MINOR_NUMBER_DEF)
+ __u32_field_def(10, DRBD_GENLA_F_MANDATORY, al_extents, DRBD_AL_EXTENTS_DEF)
+ __u32_field_def(11, DRBD_GENLA_F_MANDATORY, c_plan_ahead, DRBD_C_PLAN_AHEAD_DEF)
+ __u32_field_def(12, DRBD_GENLA_F_MANDATORY, c_delay_target, DRBD_C_DELAY_TARGET_DEF)
+ __u32_field_def(13, DRBD_GENLA_F_MANDATORY, c_fill_target, DRBD_C_FILL_TARGET_DEF)
+ __u32_field_def(14, DRBD_GENLA_F_MANDATORY, c_max_rate, DRBD_C_MAX_RATE_DEF)
+ __u32_field_def(15, DRBD_GENLA_F_MANDATORY, c_min_rate, DRBD_C_MIN_RATE_DEF)
+
+ __flg_field_def(16, DRBD_GENLA_F_MANDATORY, disk_barrier, DRBD_DISK_BARRIER_DEF)
+ __flg_field_def(17, DRBD_GENLA_F_MANDATORY, disk_flushes, DRBD_DISK_FLUSHES_DEF)
+ __flg_field_def(18, DRBD_GENLA_F_MANDATORY, disk_drain, DRBD_DISK_DRAIN_DEF)
+ __flg_field_def(19, DRBD_GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF)
)
GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
- __str_field_def(1, GENLA_F_MANDATORY, cpu_mask, 32)
- __u32_field_def(2, GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF)
+ __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, 32)
+ __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF)
)
GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
- __bin_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT, my_addr, 128)
- __bin_field(2, GENLA_F_REQUIRED | GENLA_F_INVARIANT, peer_addr, 128)
- __str_field_def(3, GENLA_F_MANDATORY | GENLA_F_SENSITIVE,
+ __bin_field(1, DRBD_F_REQUIRED | DRBD_F_INVARIANT, my_addr, 128)
+ __bin_field(2, DRBD_F_REQUIRED | DRBD_F_INVARIANT, peer_addr, 128)
+ __str_field_def(3, DRBD_GENLA_F_MANDATORY | DRBD_F_SENSITIVE,
shared_secret, SHARED_SECRET_MAX)
- __str_field_def(4, GENLA_F_MANDATORY, cram_hmac_alg, SHARED_SECRET_MAX)
- __str_field_def(5, GENLA_F_MANDATORY, integrity_alg, SHARED_SECRET_MAX)
- __str_field_def(6, GENLA_F_MANDATORY, verify_alg, SHARED_SECRET_MAX)
- __str_field_def(7, GENLA_F_MANDATORY, csums_alg, SHARED_SECRET_MAX)
- __u32_field_def(8, GENLA_F_MANDATORY, wire_protocol, DRBD_PROTOCOL_DEF)
- __u32_field_def(9, GENLA_F_MANDATORY, connect_int, DRBD_CONNECT_INT_DEF)
- __u32_field_def(10, GENLA_F_MANDATORY, timeout, DRBD_TIMEOUT_DEF)
- __u32_field_def(11, GENLA_F_MANDATORY, ping_int, DRBD_PING_INT_DEF)
- __u32_field_def(12, GENLA_F_MANDATORY, ping_timeo, DRBD_PING_TIMEO_DEF)
- __u32_field_def(13, GENLA_F_MANDATORY, sndbuf_size, DRBD_SNDBUF_SIZE_DEF)
- __u32_field_def(14, GENLA_F_MANDATORY, rcvbuf_size, DRBD_RCVBUF_SIZE_DEF)
- __u32_field_def(15, GENLA_F_MANDATORY, ko_count, DRBD_KO_COUNT_DEF)
- __u32_field_def(16, GENLA_F_MANDATORY, max_buffers, DRBD_MAX_BUFFERS_DEF)
- __u32_field_def(17, GENLA_F_MANDATORY, max_epoch_size, DRBD_MAX_EPOCH_SIZE_DEF)
- __u32_field_def(18, GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF)
- __u32_field_def(19, GENLA_F_MANDATORY, after_sb_0p, DRBD_AFTER_SB_0P_DEF)
- __u32_field_def(20, GENLA_F_MANDATORY, after_sb_1p, DRBD_AFTER_SB_1P_DEF)
- __u32_field_def(21, GENLA_F_MANDATORY, after_sb_2p, DRBD_AFTER_SB_2P_DEF)
- __u32_field_def(22, GENLA_F_MANDATORY, rr_conflict, DRBD_RR_CONFLICT_DEF)
- __u32_field_def(23, GENLA_F_MANDATORY, on_congestion, DRBD_ON_CONGESTION_DEF)
- __u32_field_def(24, GENLA_F_MANDATORY, cong_fill, DRBD_CONG_FILL_DEF)
- __u32_field_def(25, GENLA_F_MANDATORY, cong_extents, DRBD_CONG_EXTENTS_DEF)
- __flg_field_def(26, GENLA_F_MANDATORY, two_primaries, DRBD_ALLOW_TWO_PRIMARIES_DEF)
- __flg_field(27, GENLA_F_MANDATORY | GENLA_F_INVARIANT, discard_my_data)
- __flg_field_def(28, GENLA_F_MANDATORY, tcp_cork, DRBD_TCP_CORK_DEF)
- __flg_field_def(29, GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF)
- __flg_field(30, GENLA_F_MANDATORY | GENLA_F_INVARIANT, dry_run)
- __flg_field_def(31, GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
+ __str_field_def(4, DRBD_GENLA_F_MANDATORY, cram_hmac_alg, SHARED_SECRET_MAX)
+ __str_field_def(5, DRBD_GENLA_F_MANDATORY, integrity_alg, SHARED_SECRET_MAX)
+ __str_field_def(6, DRBD_GENLA_F_MANDATORY, verify_alg, SHARED_SECRET_MAX)
+ __str_field_def(7, DRBD_GENLA_F_MANDATORY, csums_alg, SHARED_SECRET_MAX)
+ __u32_field_def(8, DRBD_GENLA_F_MANDATORY, wire_protocol, DRBD_PROTOCOL_DEF)
+ __u32_field_def(9, DRBD_GENLA_F_MANDATORY, connect_int, DRBD_CONNECT_INT_DEF)
+ __u32_field_def(10, DRBD_GENLA_F_MANDATORY, timeout, DRBD_TIMEOUT_DEF)
+ __u32_field_def(11, DRBD_GENLA_F_MANDATORY, ping_int, DRBD_PING_INT_DEF)
+ __u32_field_def(12, DRBD_GENLA_F_MANDATORY, ping_timeo, DRBD_PING_TIMEO_DEF)
+ __u32_field_def(13, DRBD_GENLA_F_MANDATORY, sndbuf_size, DRBD_SNDBUF_SIZE_DEF)
+ __u32_field_def(14, DRBD_GENLA_F_MANDATORY, rcvbuf_size, DRBD_RCVBUF_SIZE_DEF)
+ __u32_field_def(15, DRBD_GENLA_F_MANDATORY, ko_count, DRBD_KO_COUNT_DEF)
+ __u32_field_def(16, DRBD_GENLA_F_MANDATORY, max_buffers, DRBD_MAX_BUFFERS_DEF)
+ __u32_field_def(17, DRBD_GENLA_F_MANDATORY, max_epoch_size, DRBD_MAX_EPOCH_SIZE_DEF)
+ __u32_field_def(18, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF)
+ __u32_field_def(19, DRBD_GENLA_F_MANDATORY, after_sb_0p, DRBD_AFTER_SB_0P_DEF)
+ __u32_field_def(20, DRBD_GENLA_F_MANDATORY, after_sb_1p, DRBD_AFTER_SB_1P_DEF)
+ __u32_field_def(21, DRBD_GENLA_F_MANDATORY, after_sb_2p, DRBD_AFTER_SB_2P_DEF)
+ __u32_field_def(22, DRBD_GENLA_F_MANDATORY, rr_conflict, DRBD_RR_CONFLICT_DEF)
+ __u32_field_def(23, DRBD_GENLA_F_MANDATORY, on_congestion, DRBD_ON_CONGESTION_DEF)
+ __u32_field_def(24, DRBD_GENLA_F_MANDATORY, cong_fill, DRBD_CONG_FILL_DEF)
+ __u32_field_def(25, DRBD_GENLA_F_MANDATORY, cong_extents, DRBD_CONG_EXTENTS_DEF)
+ __flg_field_def(26, DRBD_GENLA_F_MANDATORY, two_primaries, DRBD_ALLOW_TWO_PRIMARIES_DEF)
+ __flg_field(27, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, discard_my_data)
+ __flg_field_def(28, DRBD_GENLA_F_MANDATORY, tcp_cork, DRBD_TCP_CORK_DEF)
+ __flg_field_def(29, DRBD_GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF)
+ __flg_field(30, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, dry_run)
+ __flg_field_def(31, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
)
GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
- __flg_field(1, GENLA_F_MANDATORY, assume_uptodate)
+ __flg_field(1, DRBD_GENLA_F_MANDATORY, assume_uptodate)
)
GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
- __u64_field(1, GENLA_F_MANDATORY, resize_size)
- __flg_field(2, GENLA_F_MANDATORY, resize_force)
- __flg_field(3, GENLA_F_MANDATORY, no_resync)
+ __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
+ __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
+ __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
)
GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
/* the reason of the broadcast,
* if this is an event triggered broadcast. */
- __u32_field(1, GENLA_F_MANDATORY, sib_reason)
- __u32_field(2, GENLA_F_REQUIRED, current_state)
- __u64_field(3, GENLA_F_MANDATORY, capacity)
- __u64_field(4, GENLA_F_MANDATORY, ed_uuid)
+ __u32_field(1, DRBD_GENLA_F_MANDATORY, sib_reason)
+ __u32_field(2, DRBD_F_REQUIRED, current_state)
+ __u64_field(3, DRBD_GENLA_F_MANDATORY, capacity)
+ __u64_field(4, DRBD_GENLA_F_MANDATORY, ed_uuid)
/* These are for broadcast from after state change work.
* prev_state and new_state are from the moment the state change took
* place, new_state is not neccessarily the same as current_state,
* there may have been more state changes since. Which will be
* broadcasted soon, in their respective after state change work. */
- __u32_field(5, GENLA_F_MANDATORY, prev_state)
- __u32_field(6, GENLA_F_MANDATORY, new_state)
+ __u32_field(5, DRBD_GENLA_F_MANDATORY, prev_state)
+ __u32_field(6, DRBD_GENLA_F_MANDATORY, new_state)
/* if we have a local disk: */
- __bin_field(7, GENLA_F_MANDATORY, uuids, (UI_SIZE*sizeof(__u64)))
- __u32_field(8, GENLA_F_MANDATORY, disk_flags)
- __u64_field(9, GENLA_F_MANDATORY, bits_total)
- __u64_field(10, GENLA_F_MANDATORY, bits_oos)
+ __bin_field(7, DRBD_GENLA_F_MANDATORY, uuids, (UI_SIZE*sizeof(__u64)))
+ __u32_field(8, DRBD_GENLA_F_MANDATORY, disk_flags)
+ __u64_field(9, DRBD_GENLA_F_MANDATORY, bits_total)
+ __u64_field(10, DRBD_GENLA_F_MANDATORY, bits_oos)
/* and in case resync or online verify is active */
- __u64_field(11, GENLA_F_MANDATORY, bits_rs_total)
- __u64_field(12, GENLA_F_MANDATORY, bits_rs_failed)
+ __u64_field(11, DRBD_GENLA_F_MANDATORY, bits_rs_total)
+ __u64_field(12, DRBD_GENLA_F_MANDATORY, bits_rs_failed)
/* for pre and post notifications of helper execution */
- __str_field(13, GENLA_F_MANDATORY, helper, 32)
- __u32_field(14, GENLA_F_MANDATORY, helper_exit_code)
+ __str_field(13, DRBD_GENLA_F_MANDATORY, helper, 32)
+ __u32_field(14, DRBD_GENLA_F_MANDATORY, helper_exit_code)
)
GENL_struct(DRBD_NLA_START_OV_PARMS, 9, start_ov_parms,
- __u64_field(1, GENLA_F_MANDATORY, ov_start_sector)
+ __u64_field(1, DRBD_GENLA_F_MANDATORY, ov_start_sector)
)
GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms,
- __flg_field(1, GENLA_F_MANDATORY, clear_bm)
+ __flg_field(1, DRBD_GENLA_F_MANDATORY, clear_bm)
)
GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms,
- __u32_field(1, GENLA_F_REQUIRED, timeout_type)
+ __u32_field(1, DRBD_F_REQUIRED, timeout_type)
)
GENL_struct(DRBD_NLA_DISCONNECT_PARMS, 12, disconnect_parms,
- __flg_field(1, GENLA_F_MANDATORY, force_disconnect)
+ __flg_field(1, DRBD_GENLA_F_MANDATORY, force_disconnect)
)
/*
@@ -234,11 +234,11 @@ GENL_mc_group(events)
/* kernel -> userspace announcement of changes */
GENL_notification(
DRBD_EVENT, 1, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_STATE_INFO, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NET_CONF, GENLA_F_MANDATORY)
- GENL_tla_expected(DRBD_NLA_DISK_CONF, GENLA_F_MANDATORY)
- GENL_tla_expected(DRBD_NLA_SYNCER_CONF, GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_STATE_INFO, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_SYNCER_CONF, DRBD_GENLA_F_MANDATORY)
)
/* query kernel for specific or all info */
@@ -252,116 +252,116 @@ GENL_op(
),
/* To select the object .doit.
* Or a subset of objects in .dumpit. */
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_GENLA_F_MANDATORY)
)
#if 0
/* TO BE DONE */
/* create or destroy resources, aka replication groups */
GENL_op(DRBD_ADM_CREATE_RESOURCE, 3, GENL_doit(drbd_adm_create_resource),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_DELETE_RESOURCE, 4, GENL_doit(drbd_adm_delete_resource),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
#endif
/* add DRBD minor devices as volumes to resources */
GENL_op(DRBD_ADM_ADD_MINOR, 5, GENL_doit(drbd_adm_add_minor),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_delete_minor),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
/* add or delete replication links to resources */
GENL_op(DRBD_ADM_ADD_LINK, 7, GENL_doit(drbd_adm_create_connection),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_DEL_LINK, 8, GENL_doit(drbd_adm_delete_connection),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_RESOURCE_OPTS, 9,
GENL_doit(drbd_adm_resource_opts),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_RESOURCE_OPTS, GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_RESOURCE_OPTS, DRBD_GENLA_F_MANDATORY)
)
GENL_op(
DRBD_ADM_CONNECT, 10,
GENL_doit(drbd_adm_connect),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NET_CONF, GENLA_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
)
GENL_op(
DRBD_ADM_CHG_NET_OPTS, 29,
GENL_doit(drbd_adm_net_opts),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NET_CONF, GENLA_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
)
GENL_op(DRBD_ADM_DISCONNECT, 11, GENL_doit(drbd_adm_disconnect),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_ATTACH, 12,
GENL_doit(drbd_adm_attach),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DISK_CONF, GENLA_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_F_REQUIRED)
)
GENL_op(DRBD_ADM_CHG_DISK_OPTS, 28,
GENL_doit(drbd_adm_disk_opts),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DISK_OPTS, GENLA_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_DISK_OPTS, DRBD_F_REQUIRED)
)
GENL_op(
DRBD_ADM_RESIZE, 13,
GENL_doit(drbd_adm_resize),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_RESIZE_PARMS, GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_RESIZE_PARMS, DRBD_GENLA_F_MANDATORY)
)
GENL_op(
DRBD_ADM_PRIMARY, 14,
GENL_doit(drbd_adm_set_role),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, GENLA_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
)
GENL_op(
DRBD_ADM_SECONDARY, 15,
GENL_doit(drbd_adm_set_role),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, GENLA_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
)
GENL_op(
DRBD_ADM_NEW_C_UUID, 16,
GENL_doit(drbd_adm_new_c_uuid),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NEW_C_UUID_PARMS, GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
+ GENL_tla_expected(DRBD_NLA_NEW_C_UUID_PARMS, DRBD_GENLA_F_MANDATORY)
)
GENL_op(
DRBD_ADM_START_OV, 17,
GENL_doit(drbd_adm_start_ov),
- GENL_tla_expected(DRBD_NLA_START_OV_PARMS, GENLA_F_MANDATORY)
+ GENL_tla_expected(DRBD_NLA_START_OV_PARMS, DRBD_GENLA_F_MANDATORY)
)
GENL_op(DRBD_ADM_DETACH, 18, GENL_doit(drbd_adm_detach),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_INVALIDATE, 19, GENL_doit(drbd_adm_invalidate),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_INVAL_PEER, 20, GENL_doit(drbd_adm_invalidate_peer),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_PAUSE_SYNC, 21, GENL_doit(drbd_adm_pause_sync),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_RESUME_SYNC, 22, GENL_doit(drbd_adm_resume_sync),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_SUSPEND_IO, 23, GENL_doit(drbd_adm_suspend_io),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_RESUME_IO, 24, GENL_doit(drbd_adm_resume_io),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_OUTDATE, 25, GENL_doit(drbd_adm_outdate),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_GET_TIMEOUT_TYPE, 26, GENL_doit(drbd_adm_get_timeout_type),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
GENL_op(DRBD_ADM_DOWN, 27, GENL_doit(drbd_adm_down),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, GENLA_F_REQUIRED))
+ GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index a1305b7..99f4e95 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -4,53 +4,6 @@
#include <linux/genl_magic_struct.h>
/*
- * Extension of genl attribute validation policies {{{1
- * {{{2
- */
-
-/**
- * nla_is_required - return true if this attribute is required
- * @nla: netlink attribute
- */
-static inline int nla_is_required(const struct nlattr *nla)
-{
- return nla->nla_type & GENLA_F_REQUIRED;
-}
-
-/**
- * nla_is_mandatory - return true if understanding this attribute is mandatory
- * @nla: netlink attribute
- * Note: REQUIRED attributes are implicitly MANDATORY as well
- */
-static inline int nla_is_mandatory(const struct nlattr *nla)
-{
- return nla->nla_type & (GENLA_F_MANDATORY | GENLA_F_REQUIRED);
-}
-
-/* Functionality to be integrated into nla_parse(), and validate_nla(),
- * respectively.
- *
- * Enforcing the "mandatory" bit is done here,
- * by rejecting unknown mandatory attributes.
- *
- * Part of enforcing the "required" flag would mean to embed it into
- * nla_policy.type, and extending validate_nla(), which currently does
- * BUG_ON(pt->type > NLA_TYPE_MAX); we have to work on existing kernels,
- * so we cannot do that. Thats why enforcing "required" is done in the
- * generated assignment functions below. */
-static int nla_check_unknown(int maxtype, struct nlattr *head, int len)
-{
- struct nlattr *nla;
- int rem;
- nla_for_each_attr(nla, head, len, rem) {
- __u16 type = nla_type(nla);
- if (type > maxtype && nla_is_mandatory(nla))
- return -EOPNOTSUPP;
- }
- return 0;
-}
-
-/*
* Magic: declare tla policy {{{1
* Magic: declare nested policies
* {{{2
@@ -80,13 +33,13 @@ static struct nla_policy s_name ## _nl_policy[] __read_mostly = \
#undef __field
#define __field(attr_nr, attr_flag, name, nla_type, _type, __get, \
__put, __is_signed) \
- [__nla_type(attr_nr)] = { .type = nla_type },
+ [attr_nr] = { .type = nla_type },
#undef __array
#define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \
__get, __put, __is_signed) \
- [__nla_type(attr_nr)] = { .type = nla_type, \
- .len = maxlen - (nla_type == NLA_NUL_STRING) },
+ [attr_nr] = { .type = nla_type, \
+ .len = maxlen - (nla_type == NLA_NUL_STRING) },
#include GENL_MAGIC_INCLUDE_FILE
@@ -189,6 +142,43 @@ static struct nlattr *nested_attr_tb[128];
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
#endif
+static inline int drbd_nla_check_mandatory(int maxtype, struct nlattr *nla)
+{
+ struct nlattr *head = nla_data(nla);
+ int len = nla_len(nla);
+ int rem;
+
+ /*
+ * validate_nla (called from nla_parse_nested) ignores attributes
+ * beyond maxtype, and does not understand the DRBD_GENLA_F_MANDATORY flag.
+ * In order to have it validate attributes with the DRBD_GENLA_F_MANDATORY
+ * flag set also, check and remove that flag before calling
+ * nla_parse_nested.
+ */
+
+ nla_for_each_attr(nla, head, len, rem) {
+ if (nla->nla_type & DRBD_GENLA_F_MANDATORY) {
+ if (nla_type(nla) > maxtype)
+ return -EOPNOTSUPP;
+ nla->nla_type &= ~DRBD_GENLA_F_MANDATORY;
+ }
+ }
+ return 0;
+}
+
+static inline int drbd_nla_parse_nested(struct nlattr *tb[], int maxtype,
+ struct nlattr *nla,
+ const struct nla_policy *policy)
+{
+ int err;
+
+ err = drbd_nla_check_mandatory(maxtype, nla);
+ if (!err)
+ err = nla_parse_nested(tb, maxtype, nla, policy);
+
+ return err;
+}
+
#undef GENL_struct
#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
static int s_name ## _from_attrs(struct s_name *s, struct genl_info *info) __attribute__((unused)); \
@@ -207,12 +197,9 @@ static int s_name ## _from_attrs(struct s_name *s, struct genl_info *info) \
if (!tla) \
return -ENOMSG; \
DPRINT_TLA(#s_name, "<=-", #tag_name); \
- err = nla_parse_nested(ntb, maxtype, tla, s_name ## _nl_policy); \
+ err = drbd_nla_parse_nested(ntb, maxtype, tla, s_name ## _nl_policy); \
if (err) \
return err; \
- err = nla_check_unknown(maxtype, nla_data(tla), nla_len(tla)); \
- if (err) \
- return err; \
\
s_fields \
return 0; \
@@ -220,17 +207,17 @@ static int s_name ## _from_attrs(struct s_name *s, struct genl_info *info) \
#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
- nla = ntb[__nla_type(attr_nr)]; \
+ nla = ntb[attr_nr]; \
if (nla) { \
- if (exclude_invariants && ((attr_flag) & GENLA_F_INVARIANT)) { \
+ if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \
pr_info("<< must not change invariant attr: %s\n", #name); \
return -EEXIST; \
} \
assignment; \
- } else if (exclude_invariants && ((attr_flag) & GENLA_F_INVARIANT)) { \
+ } else if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \
/* attribute missing from payload, */ \
/* which was expected */ \
- } else if ((attr_flag) & GENLA_F_REQUIRED) { \
+ } else if ((attr_flag) & DRBD_F_REQUIRED) { \
pr_info("<< missing attr: %s\n", #name); \
return -ENOMSG; \
}
@@ -409,7 +396,7 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
#undef __field
#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
__is_signed) \
- if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \
+ if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
DPRINT_FIELD(">>", nla_type, name, s, NULL); \
__put(skb, attr_nr, s->name); \
}
@@ -417,7 +404,7 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
#undef __array
#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
__get, __put, __is_signed) \
- if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \
+ if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
DPRINT_ARRAY(">>",nla_type, name, s, NULL); \
__put(skb, attr_nr, min_t(int, maxlen, \
s->name ## _len + (nla_type == NLA_NUL_STRING)),\
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
index f3c3425..1d0bd79 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -26,50 +26,34 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
* Extension of genl attribute validation policies {{{2
*/
-/**
- * GENLA_F_FLAGS - policy type flags to ease compatible ABI evolvement
- *
- * @GENLA_F_REQUIRED: attribute has to be present, or message is considered invalid.
- * Adding new REQUIRED attributes breaks ABI compatibility, so don't do that.
+/*
+ * @DRBD_GENLA_F_MANDATORY: By default, netlink ignores attributes it does not
+ * know about. This flag can be set in nlattr->nla_type to indicate that this
+ * attribute must not be ignored.
*
- * @GENLA_F_MANDATORY: if present, receiver _must_ understand it.
- * Without this, unknown attributes (> maxtype) are _silently_ ignored
- * by validate_nla().
+ * We check and remove this flag in drbd_nla_check_mandatory() before
+ * validating the attribute types and lengths via nla_parse_nested().
+ */
+#define DRBD_GENLA_F_MANDATORY (1 << 14)
+
+/*
+ * Flags specific to drbd and not visible at the netlink layer, used in
+ * <struct>_from_attrs and <struct>_to_skb:
*
- * To be used for API extensions, so older kernel can reject requests for not
- * yet implemented features, if newer userland tries to use them even though
- * the genl_family version clearly indicates they are not available.
+ * @DRBD_F_REQUIRED: Attribute is required; a request without this attribute is
+ * invalid.
*
- * NOTE: These flags overload
- * NLA_F_NESTED (1 << 15)
- * NLA_F_NET_BYTEORDER (1 << 14)
- * from linux/netlink.h, which are not useful for validate_nla():
- * NET_BYTEORDER is not used anywhere, and NESTED would be specified by setting
- * .type = NLA_NESTED in the appropriate policy.
+ * @DRBD_F_SENSITIVE: Attribute includes sensitive information and must not be
+ * included in unpriviledged get requests or broadcasts.
*
- * See also: nla_type()
+ * @DRBD_F_INVARIANT: Attribute is set when an object is initially created, but
+ * cannot subsequently be changed.
*/
-enum {
- GENLA_F_MANDATORY = 1 << 14,
- GENLA_F_REQUIRED = 1 << 15,
-
- /* Below will not be present in the __u16 .nla_type, but can be
- * triggered on in <struct>_to_skb resp. <struct>_from_attrs */
-
- /* To exclude "sensitive" information from broadcasts, or on
- * unpriviledged get requests. This is useful because genetlink
- * multicast groups can be listened in on by anyone. */
- GENLA_F_SENSITIVE = 1 << 16,
-
- /* INVARIAN options cannot be changed at runtime.
- * Useful to share an attribute policy and struct definition,
- * between some "create" and "change" commands,
- * but disallow certain fields to be changed online.
- */
- GENLA_F_INVARIANT = 1 << 17,
-};
+#define DRBD_F_REQUIRED (1 << 0)
+#define DRBD_F_SENSITIVE (1 << 1)
+#define DRBD_F_INVARIANT (1 << 2)
-#define __nla_type(x) ((__u16)((__u16)(x) & (__u16)NLA_TYPE_MASK))
+#define __nla_type(x) ((__u16)((x) & NLA_TYPE_MASK & ~DRBD_GENLA_F_MANDATORY))
/* }}}1
* MAGIC
@@ -170,12 +154,12 @@ enum { \
#undef __field
#define __field(attr_nr, attr_flag, name, nla_type, type, \
__get, __put, __is_signed) \
- T_ ## name = (__u16)(attr_nr | attr_flag),
+ T_ ## name = (__u16)(attr_nr | ((attr_flag) & DRBD_GENLA_F_MANDATORY)),
#undef __array
#define __array(attr_nr, attr_flag, name, nla_type, type, \
maxlen, __get, __put, __is_signed) \
- T_ ## name = (__u16)(attr_nr | attr_flag),
+ T_ ## name = (__u16)(attr_nr | ((attr_flag) & DRBD_GENLA_F_MANDATORY)),
#include GENL_MAGIC_INCLUDE_FILE
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 11/13] drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (9 preceding siblings ...)
2011-10-10 11:55 ` [PATCH 10/13] drbd: Make drbd's use of netlink attribute flags less confusing Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 12/13] drbd: drbd_adm_prepare(): Pass through error codes Philipp Reisner
2011-10-10 11:55 ` [PATCH 13/13] drbd: Don't use empty nested netlink attributes Philipp Reisner
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
We need to remove the flag before checking for valid types.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
include/linux/genl_magic_func.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index 99f4e95..2d38695 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -158,9 +158,9 @@ static inline int drbd_nla_check_mandatory(int maxtype, struct nlattr *nla)
nla_for_each_attr(nla, head, len, rem) {
if (nla->nla_type & DRBD_GENLA_F_MANDATORY) {
+ nla->nla_type &= ~DRBD_GENLA_F_MANDATORY;
if (nla_type(nla) > maxtype)
return -EOPNOTSUPP;
- nla->nla_type &= ~DRBD_GENLA_F_MANDATORY;
}
}
return 0;
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 12/13] drbd: drbd_adm_prepare(): Pass through error codes
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (10 preceding siblings ...)
2011-10-10 11:55 ` [PATCH 11/13] drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
2011-10-10 11:55 ` [PATCH 13/13] drbd: Don't use empty nested netlink attributes Philipp Reisner
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 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_nl.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index fc0ea77..011f7f4 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -180,15 +180,19 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info,
return -EPERM;
adm_ctx.reply_skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
- if (!adm_ctx.reply_skb)
+ if (!adm_ctx.reply_skb) {
+ err = -ENOMEM;
goto fail;
+ }
adm_ctx.reply_dh = genlmsg_put_reply(adm_ctx.reply_skb,
info, &drbd_genl_family, 0, cmd);
/* put of a few bytes into a fresh skb of >= 4k will always succeed.
* but anyways */
- if (!adm_ctx.reply_dh)
+ if (!adm_ctx.reply_dh) {
+ err = -ENOMEM;
goto fail;
+ }
adm_ctx.reply_dh->minor = d_in->minor;
adm_ctx.reply_dh->ret_code = NO_ERROR;
@@ -257,7 +261,7 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info,
fail:
nlmsg_free(adm_ctx.reply_skb);
adm_ctx.reply_skb = NULL;
- return -ENOMEM;
+ return err;
}
static int drbd_adm_finish(struct genl_info *info, int retcode)
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 13/13] drbd: Don't use empty nested netlink attributes
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
` (11 preceding siblings ...)
2011-10-10 11:55 ` [PATCH 12/13] drbd: drbd_adm_prepare(): Pass through error codes Philipp Reisner
@ 2011-10-10 11:55 ` Philipp Reisner
12 siblings, 0 replies; 14+ messages in thread
From: Philipp Reisner @ 2011-10-10 11:55 UTC (permalink / raw)
To: linux-kernel, Jens Axboe; +Cc: drbd-dev
From: Andreas Gruenbacher <agruen@linbit.com>
Before mainline commit ea5693cc (v2.6.29-rc1), empty nested netlink attributes
were not allowed. Fix that by leaving out nested attributes if they are empty
and by allowing the top-level attributes to be missing.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_nl.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 011f7f4..f142380 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1204,7 +1204,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
set_disk_conf_defaults(new_disk_conf);
err = disk_conf_from_attrs(new_disk_conf, info);
- if (err) {
+ if (err && err != -ENOMSG) {
retcode = ERR_MANDATORY_TAG;
drbd_msg_put_info(from_attrs_err_to_txt(err));
}
@@ -1960,7 +1960,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
set_net_conf_defaults(new_conf);
err = net_conf_from_attrs(new_conf, info);
- if (err) {
+ if (err && err != -ENOMSG) {
retcode = ERR_MANDATORY_TAG;
drbd_msg_put_info(from_attrs_err_to_txt(err));
goto fail;
@@ -2395,7 +2395,7 @@ int drbd_adm_resource_opts(struct sk_buff *skb, struct genl_info *info)
set_res_opts_defaults(&res_opts);
err = res_opts_from_attrs(&res_opts, info);
- if (err) {
+ if (err && err != -ENOMSG) {
retcode = ERR_MANDATORY_TAG;
drbd_msg_put_info(from_attrs_err_to_txt(err));
goto fail;
--
1.7.4.1
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-10-10 11:57 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
2011-10-10 11:54 ` [PATCH 01/13] drbd: Refuse to change network options online when Philipp Reisner
2011-10-10 11:54 ` [PATCH 02/13] drbd: protect updates to integrits_tfm by tconn->data->mutex Philipp Reisner
2011-10-10 11:54 ` [PATCH 03/13] drbd: Made cmp_after_sb() more generic into convert_after_sb() Philipp Reisner
2011-10-10 11:54 ` [PATCH 04/13] drbd: Allocation of int_dig_in and int_dig_vv was missing Philipp Reisner
2011-10-10 11:54 ` [PATCH 05/13] drbd: Receiving part for the PROTOCOL_UPDATE packet Philipp Reisner
2011-10-10 11:54 ` [PATCH 06/13] drbd: Send PROTOCOL_UPDATE packets when appropriate Philipp Reisner
2011-10-10 11:55 ` [PATCH 07/13] drbd: Use more generic constant names Philipp Reisner
2011-10-10 11:55 ` [PATCH 08/13] drbd: Output signed / unsigned netlink fields correctly Philipp Reisner
2011-10-10 11:55 ` [PATCH 09/13] drbd: Remove unused GENLA_F_MAY_IGNORE flag Philipp Reisner
2011-10-10 11:55 ` [PATCH 10/13] drbd: Make drbd's use of netlink attribute flags less confusing Philipp Reisner
2011-10-10 11:55 ` [PATCH 11/13] drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first Philipp Reisner
2011-10-10 11:55 ` [PATCH 12/13] drbd: drbd_adm_prepare(): Pass through error codes Philipp Reisner
2011-10-10 11:55 ` [PATCH 13/13] drbd: Don't use empty nested netlink attributes Philipp Reisner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome