aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-07-06 09:05:58 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2014-02-17 10:46:45 -0500
commit3ab706fe52a5cc12b021d7861943581db766a171 (patch)
treef209f0a447cb402be39de73f9a04572e929112b4
parentb6f85ef9538b2111a8ba0bbfae9aaebabfc94961 (diff)
drbd: drbd_adm_prepare(): Only set adm_ctx.connection when a connection is requested
Also change drbd_adm_connect() to expect a resource after it requested one. Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_nl.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 8ebcf88b0c1b..664e913cef43 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -216,10 +216,6 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info,
216 adm_ctx.device = minor_to_device(d_in->minor); 216 adm_ctx.device = minor_to_device(d_in->minor);
217 if (adm_ctx.resource_name) { 217 if (adm_ctx.resource_name) {
218 adm_ctx.resource = drbd_find_resource(adm_ctx.resource_name); 218 adm_ctx.resource = drbd_find_resource(adm_ctx.resource_name);
219 if (adm_ctx.resource) {
220 adm_ctx.connection = first_connection(adm_ctx.resource);
221 kref_get(&adm_ctx.connection->kref);
222 }
223 } 219 }
224 220
225 if (!adm_ctx.device && (flags & DRBD_ADM_NEED_MINOR)) { 221 if (!adm_ctx.device && (flags & DRBD_ADM_NEED_MINOR)) {
@@ -234,7 +230,7 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info,
234 } 230 }
235 231
236 if (flags & DRBD_ADM_NEED_CONNECTION) { 232 if (flags & DRBD_ADM_NEED_CONNECTION) {
237 if (adm_ctx.connection && !(flags & DRBD_ADM_NEED_RESOURCE)) { 233 if (adm_ctx.resource) {
238 drbd_msg_put_info("no resource name expected"); 234 drbd_msg_put_info("no resource name expected");
239 return ERR_INVALID_REQUEST; 235 return ERR_INVALID_REQUEST;
240 } 236 }
@@ -2211,7 +2207,7 @@ int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info)
2211 } 2207 }
2212 } 2208 }
2213 2209
2214 connection = adm_ctx.connection; 2210 connection = first_connection(adm_ctx.resource);
2215 conn_reconfig_start(connection); 2211 conn_reconfig_start(connection);
2216 2212
2217 if (connection->cstate > C_STANDALONE) { 2213 if (connection->cstate > C_STANDALONE) {