aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-05-16 11:38:45 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:55:54 -0500
commitd659f2aaea1bd2fe9cf68b33d881470678c6ce2b (patch)
treebab1455003b41a0005c29ae3d6b82b1c94803117
parent036b17eaab935541835f4cc1fcbfe62ead5faa55 (diff)
drbd: Send PROTOCOL_UPDATE packets when appropriate
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_int.h2
-rw-r--r--drivers/block/drbd/drbd_main.c6
-rw-r--r--drivers/block/drbd/drbd_nl.c11
3 files changed, 6 insertions, 13 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 75b26d820d70..c3019730a24f 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,
1051extern int drbd_send_all(struct drbd_tconn *, struct socket *, void *, size_t, 1051extern int drbd_send_all(struct drbd_tconn *, struct socket *, void *, size_t,
1052 unsigned); 1052 unsigned);
1053 1053
1054extern int __drbd_send_protocol(struct drbd_tconn *tconn); 1054extern int __drbd_send_protocol(struct drbd_tconn *tconn, enum drbd_packet cmd);
1055extern int drbd_send_protocol(struct drbd_tconn *tconn); 1055extern int drbd_send_protocol(struct drbd_tconn *tconn);
1056extern int drbd_send_uuids(struct drbd_conf *mdev); 1056extern int drbd_send_uuids(struct drbd_conf *mdev);
1057extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); 1057extern 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 4133335e6e46..dab0a75c63b5 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)
911 return drbd_send_command(mdev, sock, cmd, size, NULL, 0); 911 return drbd_send_command(mdev, sock, cmd, size, NULL, 0);
912} 912}
913 913
914int __drbd_send_protocol(struct drbd_tconn *tconn) 914int __drbd_send_protocol(struct drbd_tconn *tconn, enum drbd_packet cmd)
915{ 915{
916 struct drbd_socket *sock; 916 struct drbd_socket *sock;
917 struct p_protocol *p; 917 struct p_protocol *p;
@@ -953,7 +953,7 @@ int __drbd_send_protocol(struct drbd_tconn *tconn)
953 strcpy(p->integrity_alg, nc->integrity_alg); 953 strcpy(p->integrity_alg, nc->integrity_alg);
954 rcu_read_unlock(); 954 rcu_read_unlock();
955 955
956 return __conn_send_command(tconn, sock, P_PROTOCOL, size, NULL, 0); 956 return __conn_send_command(tconn, sock, cmd, size, NULL, 0);
957} 957}
958 958
959int drbd_send_protocol(struct drbd_tconn *tconn) 959int drbd_send_protocol(struct drbd_tconn *tconn)
@@ -961,7 +961,7 @@ int drbd_send_protocol(struct drbd_tconn *tconn)
961 int err; 961 int err;
962 962
963 mutex_lock(&tconn->data.mutex); 963 mutex_lock(&tconn->data.mutex);
964 err = __drbd_send_protocol(tconn); 964 err = __drbd_send_protocol(tconn, P_PROTOCOL);
965 mutex_unlock(&tconn->data.mutex); 965 mutex_unlock(&tconn->data.mutex);
966 966
967 return err; 967 return err;
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 133a6724657d..b81f924c47bc 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1866,7 +1866,6 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
1866 int ovr; /* online verify running */ 1866 int ovr; /* online verify running */
1867 int rsr; /* re-sync running */ 1867 int rsr; /* re-sync running */
1868 struct crypto crypto = { }; 1868 struct crypto crypto = { };
1869 bool change_integrity_alg;
1870 1869
1871 retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_CONN); 1870 retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_CONN);
1872 if (!adm_ctx.reply_skb) 1871 if (!adm_ctx.reply_skb)
@@ -1923,9 +1922,6 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
1923 goto fail; 1922 goto fail;
1924 } 1923 }
1925 1924
1926 change_integrity_alg = strcmp(old_conf->integrity_alg,
1927 new_conf->integrity_alg);
1928
1929 retcode = alloc_crypto(&crypto, new_conf); 1925 retcode = alloc_crypto(&crypto, new_conf);
1930 if (retcode != NO_ERROR) 1926 if (retcode != NO_ERROR)
1931 goto fail; 1927 goto fail;
@@ -1949,13 +1945,10 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
1949 tconn->int_dig_vv = crypto.int_dig_vv; 1945 tconn->int_dig_vv = crypto.int_dig_vv;
1950 crypto_free_hash(tconn->integrity_tfm); 1946 crypto_free_hash(tconn->integrity_tfm);
1951 tconn->integrity_tfm = crypto.integrity_tfm; 1947 tconn->integrity_tfm = crypto.integrity_tfm;
1952 if (change_integrity_alg) { 1948 if (tconn->cstate >= C_WF_REPORT_PARAMS && tconn->agreed_pro_version >= 100)
1953 /* Do this without trying to take tconn->data.mutex again. */ 1949 /* Do this without trying to take tconn->data.mutex again. */
1954 if (__drbd_send_protocol(tconn)) 1950 __drbd_send_protocol(tconn, P_PROTOCOL_UPDATE);
1955 goto fail;
1956 }
1957 1951
1958 /* FIXME Changing cram_hmac while the connection is established is useless */
1959 crypto_free_hash(tconn->cram_hmac_tfm); 1952 crypto_free_hash(tconn->cram_hmac_tfm);
1960 tconn->cram_hmac_tfm = crypto.cram_hmac_tfm; 1953 tconn->cram_hmac_tfm = crypto.cram_hmac_tfm;
1961 1954