diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-07-06 08:42:39 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 10:46:43 -0500 |
commit | 270eb5c97258b9ae157d768fb19a42a685b41740 (patch) | |
tree | aa21ba6a8cd31ec354dc3f7ebecba2afd538f186 /drivers/block/drbd/drbd_nl.c | |
parent | 59515a2e3e23cee7cf7b133f7241c689a9d71136 (diff) |
drbd: Rename net_conf variables old_conf -> old_net_conf and new_conf -> new_net_conf
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_nl.c')
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 2bac2d9efb04..33bc23fc55bb 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -1921,29 +1921,29 @@ static bool conn_ov_running(struct drbd_connection *connection) | |||
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | static enum drbd_ret_code | 1923 | static enum drbd_ret_code |
1924 | _check_net_options(struct drbd_connection *connection, struct net_conf *old_conf, struct net_conf *new_conf) | 1924 | _check_net_options(struct drbd_connection *connection, struct net_conf *old_net_conf, struct net_conf *new_net_conf) |
1925 | { | 1925 | { |
1926 | struct drbd_peer_device *peer_device; | 1926 | struct drbd_peer_device *peer_device; |
1927 | int i; | 1927 | int i; |
1928 | 1928 | ||
1929 | if (old_conf && connection->cstate == C_WF_REPORT_PARAMS && connection->agreed_pro_version < 100) { | 1929 | if (old_net_conf && connection->cstate == C_WF_REPORT_PARAMS && connection->agreed_pro_version < 100) { |
1930 | if (new_conf->wire_protocol != old_conf->wire_protocol) | 1930 | if (new_net_conf->wire_protocol != old_net_conf->wire_protocol) |
1931 | return ERR_NEED_APV_100; | 1931 | return ERR_NEED_APV_100; |
1932 | 1932 | ||
1933 | if (new_conf->two_primaries != old_conf->two_primaries) | 1933 | if (new_net_conf->two_primaries != old_net_conf->two_primaries) |
1934 | return ERR_NEED_APV_100; | 1934 | return ERR_NEED_APV_100; |
1935 | 1935 | ||
1936 | if (strcmp(new_conf->integrity_alg, old_conf->integrity_alg)) | 1936 | if (strcmp(new_net_conf->integrity_alg, old_net_conf->integrity_alg)) |
1937 | return ERR_NEED_APV_100; | 1937 | return ERR_NEED_APV_100; |
1938 | } | 1938 | } |
1939 | 1939 | ||
1940 | if (!new_conf->two_primaries && | 1940 | if (!new_net_conf->two_primaries && |
1941 | conn_highest_role(connection) == R_PRIMARY && | 1941 | conn_highest_role(connection) == R_PRIMARY && |
1942 | conn_highest_peer(connection) == R_PRIMARY) | 1942 | conn_highest_peer(connection) == R_PRIMARY) |
1943 | return ERR_NEED_ALLOW_TWO_PRI; | 1943 | return ERR_NEED_ALLOW_TWO_PRI; |
1944 | 1944 | ||
1945 | if (new_conf->two_primaries && | 1945 | if (new_net_conf->two_primaries && |
1946 | (new_conf->wire_protocol != DRBD_PROT_C)) | 1946 | (new_net_conf->wire_protocol != DRBD_PROT_C)) |
1947 | return ERR_NOT_PROTO_C; | 1947 | return ERR_NOT_PROTO_C; |
1948 | 1948 | ||
1949 | idr_for_each_entry(&connection->peer_devices, peer_device, i) { | 1949 | idr_for_each_entry(&connection->peer_devices, peer_device, i) { |
@@ -1951,28 +1951,28 @@ _check_net_options(struct drbd_connection *connection, struct net_conf *old_conf | |||
1951 | if (get_ldev(device)) { | 1951 | if (get_ldev(device)) { |
1952 | enum drbd_fencing_p fp = rcu_dereference(device->ldev->disk_conf)->fencing; | 1952 | enum drbd_fencing_p fp = rcu_dereference(device->ldev->disk_conf)->fencing; |
1953 | put_ldev(device); | 1953 | put_ldev(device); |
1954 | if (new_conf->wire_protocol == DRBD_PROT_A && fp == FP_STONITH) | 1954 | if (new_net_conf->wire_protocol == DRBD_PROT_A && fp == FP_STONITH) |
1955 | return ERR_STONITH_AND_PROT_A; | 1955 | return ERR_STONITH_AND_PROT_A; |
1956 | } | 1956 | } |
1957 | if (device->state.role == R_PRIMARY && new_conf->discard_my_data) | 1957 | if (device->state.role == R_PRIMARY && new_net_conf->discard_my_data) |
1958 | return ERR_DISCARD_IMPOSSIBLE; | 1958 | return ERR_DISCARD_IMPOSSIBLE; |
1959 | } | 1959 | } |
1960 | 1960 | ||
1961 | if (new_conf->on_congestion != OC_BLOCK && new_conf->wire_protocol != DRBD_PROT_A) | 1961 | if (new_net_conf->on_congestion != OC_BLOCK && new_net_conf->wire_protocol != DRBD_PROT_A) |
1962 | return ERR_CONG_NOT_PROTO_A; | 1962 | return ERR_CONG_NOT_PROTO_A; |
1963 | 1963 | ||
1964 | return NO_ERROR; | 1964 | return NO_ERROR; |
1965 | } | 1965 | } |
1966 | 1966 | ||
1967 | static enum drbd_ret_code | 1967 | static enum drbd_ret_code |
1968 | check_net_options(struct drbd_connection *connection, struct net_conf *new_conf) | 1968 | check_net_options(struct drbd_connection *connection, struct net_conf *new_net_conf) |
1969 | { | 1969 | { |
1970 | static enum drbd_ret_code rv; | 1970 | static enum drbd_ret_code rv; |
1971 | struct drbd_peer_device *peer_device; | 1971 | struct drbd_peer_device *peer_device; |
1972 | int i; | 1972 | int i; |
1973 | 1973 | ||
1974 | rcu_read_lock(); | 1974 | rcu_read_lock(); |
1975 | rv = _check_net_options(connection, rcu_dereference(connection->net_conf), new_conf); | 1975 | rv = _check_net_options(connection, rcu_dereference(connection->net_conf), new_net_conf); |
1976 | rcu_read_unlock(); | 1976 | rcu_read_unlock(); |
1977 | 1977 | ||
1978 | /* connection->volumes protected by genl_lock() here */ | 1978 | /* connection->volumes protected by genl_lock() here */ |
@@ -2010,26 +2010,26 @@ alloc_hash(struct crypto_hash **tfm, char *tfm_name, int err_alg) | |||
2010 | } | 2010 | } |
2011 | 2011 | ||
2012 | static enum drbd_ret_code | 2012 | static enum drbd_ret_code |
2013 | alloc_crypto(struct crypto *crypto, struct net_conf *new_conf) | 2013 | alloc_crypto(struct crypto *crypto, struct net_conf *new_net_conf) |
2014 | { | 2014 | { |
2015 | char hmac_name[CRYPTO_MAX_ALG_NAME]; | 2015 | char hmac_name[CRYPTO_MAX_ALG_NAME]; |
2016 | enum drbd_ret_code rv; | 2016 | enum drbd_ret_code rv; |
2017 | 2017 | ||
2018 | rv = alloc_hash(&crypto->csums_tfm, new_conf->csums_alg, | 2018 | rv = alloc_hash(&crypto->csums_tfm, new_net_conf->csums_alg, |
2019 | ERR_CSUMS_ALG); | 2019 | ERR_CSUMS_ALG); |
2020 | if (rv != NO_ERROR) | 2020 | if (rv != NO_ERROR) |
2021 | return rv; | 2021 | return rv; |
2022 | rv = alloc_hash(&crypto->verify_tfm, new_conf->verify_alg, | 2022 | rv = alloc_hash(&crypto->verify_tfm, new_net_conf->verify_alg, |
2023 | ERR_VERIFY_ALG); | 2023 | ERR_VERIFY_ALG); |
2024 | if (rv != NO_ERROR) | 2024 | if (rv != NO_ERROR) |
2025 | return rv; | 2025 | return rv; |
2026 | rv = alloc_hash(&crypto->integrity_tfm, new_conf->integrity_alg, | 2026 | rv = alloc_hash(&crypto->integrity_tfm, new_net_conf->integrity_alg, |
2027 | ERR_INTEGRITY_ALG); | 2027 | ERR_INTEGRITY_ALG); |
2028 | if (rv != NO_ERROR) | 2028 | if (rv != NO_ERROR) |
2029 | return rv; | 2029 | return rv; |
2030 | if (new_conf->cram_hmac_alg[0] != 0) { | 2030 | if (new_net_conf->cram_hmac_alg[0] != 0) { |
2031 | snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", | 2031 | snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", |
2032 | new_conf->cram_hmac_alg); | 2032 | new_net_conf->cram_hmac_alg); |
2033 | 2033 | ||
2034 | rv = alloc_hash(&crypto->cram_hmac_tfm, hmac_name, | 2034 | rv = alloc_hash(&crypto->cram_hmac_tfm, hmac_name, |
2035 | ERR_AUTH_ALG); | 2035 | ERR_AUTH_ALG); |
@@ -2050,7 +2050,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) | |||
2050 | { | 2050 | { |
2051 | enum drbd_ret_code retcode; | 2051 | enum drbd_ret_code retcode; |
2052 | struct drbd_connection *connection; | 2052 | struct drbd_connection *connection; |
2053 | struct net_conf *old_conf, *new_conf = NULL; | 2053 | struct net_conf *old_net_conf, *new_net_conf = NULL; |
2054 | int err; | 2054 | int err; |
2055 | int ovr; /* online verify running */ | 2055 | int ovr; /* online verify running */ |
2056 | int rsr; /* re-sync running */ | 2056 | int rsr; /* re-sync running */ |
@@ -2064,8 +2064,8 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) | |||
2064 | 2064 | ||
2065 | connection = adm_ctx.connection; | 2065 | connection = adm_ctx.connection; |
2066 | 2066 | ||
2067 | new_conf = kzalloc(sizeof(struct net_conf), GFP_KERNEL); | 2067 | new_net_conf = kzalloc(sizeof(struct net_conf), GFP_KERNEL); |
2068 | if (!new_conf) { | 2068 | if (!new_net_conf) { |
2069 | retcode = ERR_NOMEM; | 2069 | retcode = ERR_NOMEM; |
2070 | goto out; | 2070 | goto out; |
2071 | } | 2071 | } |
@@ -2074,48 +2074,48 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) | |||
2074 | 2074 | ||
2075 | mutex_lock(&connection->data.mutex); | 2075 | mutex_lock(&connection->data.mutex); |
2076 | mutex_lock(&connection->conf_update); | 2076 | mutex_lock(&connection->conf_update); |
2077 | old_conf = connection->net_conf; | 2077 | old_net_conf = connection->net_conf; |
2078 | 2078 | ||
2079 | if (!old_conf) { | 2079 | if (!old_net_conf) { |
2080 | drbd_msg_put_info("net conf missing, try connect"); | 2080 | drbd_msg_put_info("net conf missing, try connect"); |
2081 | retcode = ERR_INVALID_REQUEST; | 2081 | retcode = ERR_INVALID_REQUEST; |
2082 | goto fail; | 2082 | goto fail; |
2083 | } | 2083 | } |
2084 | 2084 | ||
2085 | *new_conf = *old_conf; | 2085 | *new_net_conf = *old_net_conf; |
2086 | if (should_set_defaults(info)) | 2086 | if (should_set_defaults(info)) |
2087 | set_net_conf_defaults(new_conf); | 2087 | set_net_conf_defaults(new_net_conf); |
2088 | 2088 | ||
2089 | err = net_conf_from_attrs_for_change(new_conf, info); | 2089 | err = net_conf_from_attrs_for_change(new_net_conf, info); |
2090 | if (err && err != -ENOMSG) { | 2090 | if (err && err != -ENOMSG) { |
2091 | retcode = ERR_MANDATORY_TAG; | 2091 | retcode = ERR_MANDATORY_TAG; |
2092 | drbd_msg_put_info(from_attrs_err_to_txt(err)); | 2092 | drbd_msg_put_info(from_attrs_err_to_txt(err)); |
2093 | goto fail; | 2093 | goto fail; |
2094 | } | 2094 | } |
2095 | 2095 | ||
2096 | retcode = check_net_options(connection, new_conf); | 2096 | retcode = check_net_options(connection, new_net_conf); |
2097 | if (retcode != NO_ERROR) | 2097 | if (retcode != NO_ERROR) |
2098 | goto fail; | 2098 | goto fail; |
2099 | 2099 | ||
2100 | /* re-sync running */ | 2100 | /* re-sync running */ |
2101 | rsr = conn_resync_running(connection); | 2101 | rsr = conn_resync_running(connection); |
2102 | if (rsr && strcmp(new_conf->csums_alg, old_conf->csums_alg)) { | 2102 | if (rsr && strcmp(new_net_conf->csums_alg, old_net_conf->csums_alg)) { |
2103 | retcode = ERR_CSUMS_RESYNC_RUNNING; | 2103 | retcode = ERR_CSUMS_RESYNC_RUNNING; |
2104 | goto fail; | 2104 | goto fail; |
2105 | } | 2105 | } |
2106 | 2106 | ||
2107 | /* online verify running */ | 2107 | /* online verify running */ |
2108 | ovr = conn_ov_running(connection); | 2108 | ovr = conn_ov_running(connection); |
2109 | if (ovr && strcmp(new_conf->verify_alg, old_conf->verify_alg)) { | 2109 | if (ovr && strcmp(new_net_conf->verify_alg, old_net_conf->verify_alg)) { |
2110 | retcode = ERR_VERIFY_RUNNING; | 2110 | retcode = ERR_VERIFY_RUNNING; |
2111 | goto fail; | 2111 | goto fail; |
2112 | } | 2112 | } |
2113 | 2113 | ||
2114 | retcode = alloc_crypto(&crypto, new_conf); | 2114 | retcode = alloc_crypto(&crypto, new_net_conf); |
2115 | if (retcode != NO_ERROR) | 2115 | if (retcode != NO_ERROR) |
2116 | goto fail; | 2116 | goto fail; |
2117 | 2117 | ||
2118 | rcu_assign_pointer(connection->net_conf, new_conf); | 2118 | rcu_assign_pointer(connection->net_conf, new_net_conf); |
2119 | 2119 | ||
2120 | if (!rsr) { | 2120 | if (!rsr) { |
2121 | crypto_free_hash(connection->csums_tfm); | 2121 | crypto_free_hash(connection->csums_tfm); |
@@ -2140,7 +2140,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) | |||
2140 | mutex_unlock(&connection->conf_update); | 2140 | mutex_unlock(&connection->conf_update); |
2141 | mutex_unlock(&connection->data.mutex); | 2141 | mutex_unlock(&connection->data.mutex); |
2142 | synchronize_rcu(); | 2142 | synchronize_rcu(); |
2143 | kfree(old_conf); | 2143 | kfree(old_net_conf); |
2144 | 2144 | ||
2145 | if (connection->cstate >= C_WF_REPORT_PARAMS) | 2145 | if (connection->cstate >= C_WF_REPORT_PARAMS) |
2146 | drbd_send_sync_param(minor_to_device(conn_lowest_minor(connection))); | 2146 | drbd_send_sync_param(minor_to_device(conn_lowest_minor(connection))); |
@@ -2151,7 +2151,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) | |||
2151 | mutex_unlock(&connection->conf_update); | 2151 | mutex_unlock(&connection->conf_update); |
2152 | mutex_unlock(&connection->data.mutex); | 2152 | mutex_unlock(&connection->data.mutex); |
2153 | free_crypto(&crypto); | 2153 | free_crypto(&crypto); |
2154 | kfree(new_conf); | 2154 | kfree(new_net_conf); |
2155 | done: | 2155 | done: |
2156 | conn_reconfig_done(connection); | 2156 | conn_reconfig_done(connection); |
2157 | out: | 2157 | out: |
@@ -2162,7 +2162,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) | |||
2162 | int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info) | 2162 | int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info) |
2163 | { | 2163 | { |
2164 | struct drbd_peer_device *peer_device; | 2164 | struct drbd_peer_device *peer_device; |
2165 | struct net_conf *old_conf, *new_conf = NULL; | 2165 | struct net_conf *old_net_conf, *new_net_conf = NULL; |
2166 | struct crypto crypto = { }; | 2166 | struct crypto crypto = { }; |
2167 | struct drbd_resource *resource; | 2167 | struct drbd_resource *resource; |
2168 | struct drbd_connection *connection; | 2168 | struct drbd_connection *connection; |
@@ -2212,41 +2212,41 @@ int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info) | |||
2212 | } | 2212 | } |
2213 | 2213 | ||
2214 | /* allocation not in the IO path, drbdsetup / netlink process context */ | 2214 | /* allocation not in the IO path, drbdsetup / netlink process context */ |
2215 | new_conf = kzalloc(sizeof(*new_conf), GFP_KERNEL); | 2215 | new_net_conf = kzalloc(sizeof(*new_net_conf), GFP_KERNEL); |
2216 | if (!new_conf) { | 2216 | if (!new_net_conf) { |
2217 | retcode = ERR_NOMEM; | 2217 | retcode = ERR_NOMEM; |
2218 | goto fail; | 2218 | goto fail; |
2219 | } | 2219 | } |
2220 | 2220 | ||
2221 | set_net_conf_defaults(new_conf); | 2221 | set_net_conf_defaults(new_net_conf); |
2222 | 2222 | ||
2223 | err = net_conf_from_attrs(new_conf, info); | 2223 | err = net_conf_from_attrs(new_net_conf, info); |
2224 | if (err && err != -ENOMSG) { | 2224 | if (err && err != -ENOMSG) { |
2225 | retcode = ERR_MANDATORY_TAG; | 2225 | retcode = ERR_MANDATORY_TAG; |
2226 | drbd_msg_put_info(from_attrs_err_to_txt(err)); | 2226 | drbd_msg_put_info(from_attrs_err_to_txt(err)); |
2227 | goto fail; | 2227 | goto fail; |
2228 | } | 2228 | } |
2229 | 2229 | ||
2230 | retcode = check_net_options(connection, new_conf); | 2230 | retcode = check_net_options(connection, new_net_conf); |
2231 | if (retcode != NO_ERROR) | 2231 | if (retcode != NO_ERROR) |
2232 | goto fail; | 2232 | goto fail; |
2233 | 2233 | ||
2234 | retcode = alloc_crypto(&crypto, new_conf); | 2234 | retcode = alloc_crypto(&crypto, new_net_conf); |
2235 | if (retcode != NO_ERROR) | 2235 | if (retcode != NO_ERROR) |
2236 | goto fail; | 2236 | goto fail; |
2237 | 2237 | ||
2238 | ((char *)new_conf->shared_secret)[SHARED_SECRET_MAX-1] = 0; | 2238 | ((char *)new_net_conf->shared_secret)[SHARED_SECRET_MAX-1] = 0; |
2239 | 2239 | ||
2240 | conn_flush_workqueue(connection); | 2240 | conn_flush_workqueue(connection); |
2241 | 2241 | ||
2242 | mutex_lock(&connection->conf_update); | 2242 | mutex_lock(&connection->conf_update); |
2243 | old_conf = connection->net_conf; | 2243 | old_net_conf = connection->net_conf; |
2244 | if (old_conf) { | 2244 | if (old_net_conf) { |
2245 | retcode = ERR_NET_CONFIGURED; | 2245 | retcode = ERR_NET_CONFIGURED; |
2246 | mutex_unlock(&connection->conf_update); | 2246 | mutex_unlock(&connection->conf_update); |
2247 | goto fail; | 2247 | goto fail; |
2248 | } | 2248 | } |
2249 | rcu_assign_pointer(connection->net_conf, new_conf); | 2249 | rcu_assign_pointer(connection->net_conf, new_net_conf); |
2250 | 2250 | ||
2251 | conn_free_crypto(connection); | 2251 | conn_free_crypto(connection); |
2252 | connection->cram_hmac_tfm = crypto.cram_hmac_tfm; | 2252 | connection->cram_hmac_tfm = crypto.cram_hmac_tfm; |
@@ -2277,7 +2277,7 @@ int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info) | |||
2277 | 2277 | ||
2278 | fail: | 2278 | fail: |
2279 | free_crypto(&crypto); | 2279 | free_crypto(&crypto); |
2280 | kfree(new_conf); | 2280 | kfree(new_net_conf); |
2281 | 2281 | ||
2282 | conn_reconfig_done(connection); | 2282 | conn_reconfig_done(connection); |
2283 | out: | 2283 | out: |