drbd: drbd_adm_prepare(): Only set adm_ctx.connection when a connection is requested
authorAndreas Gruenbacher <agruen@linbit.com>
Wed, 6 Jul 2011 13:05:58 +0000 (15:05 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Mon, 17 Feb 2014 15:46:45 +0000 (16:46 +0100)
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>
drivers/block/drbd/drbd_nl.c

index 8ebcf88b0c1b01566622d81e4d93e79119bc60e1..664e913cef437dab6d6e03453565c500c16657d5 100644 (file)
@@ -216,10 +216,6 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info,
        adm_ctx.device = minor_to_device(d_in->minor);
        if (adm_ctx.resource_name) {
                adm_ctx.resource = drbd_find_resource(adm_ctx.resource_name);
-               if (adm_ctx.resource) {
-                       adm_ctx.connection = first_connection(adm_ctx.resource);
-                       kref_get(&adm_ctx.connection->kref);
-               }
        }
 
        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,
        }
 
        if (flags & DRBD_ADM_NEED_CONNECTION) {
-               if (adm_ctx.connection && !(flags & DRBD_ADM_NEED_RESOURCE)) {
+               if (adm_ctx.resource) {
                        drbd_msg_put_info("no resource name expected");
                        return ERR_INVALID_REQUEST;
                }
@@ -2211,7 +2207,7 @@ int drbd_adm_connect(struct sk_buff *skb, struct genl_info *info)
                }
        }
 
-       connection = adm_ctx.connection;
+       connection = first_connection(adm_ctx.resource);
        conn_reconfig_start(connection);
 
        if (connection->cstate > C_STANDALONE) {
This page took 0.028847 seconds and 5 git commands to generate.