aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_nl.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-06-08 19:26:16 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2014-02-17 10:44:54 -0500
commita10f6b8ae6971680ead81444b48c11263abd70a1 (patch)
treedfa7aff5fed06f8fb8c4be275a490b79bda37de7 /drivers/block/drbd/drbd_nl.c
parent77c556f663b7ac066268c94c18670ce93dec60c0 (diff)
drbd: drbd_adm_down(): Move valid resource name check to drbd_adm_prepare()
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.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index b8eacccbdc5c..ddff39182a23 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -221,6 +221,8 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info,
221 } 221 }
222 if (!adm_ctx.connection && (flags & DRBD_ADM_NEED_RESOURCE)) { 222 if (!adm_ctx.connection && (flags & DRBD_ADM_NEED_RESOURCE)) {
223 drbd_msg_put_info("unknown resource"); 223 drbd_msg_put_info("unknown resource");
224 if (adm_ctx.resource_name)
225 return ERR_RES_NOT_KNOWN;
224 return ERR_INVALID_REQUEST; 226 return ERR_INVALID_REQUEST;
225 } 227 }
226 228
@@ -3355,17 +3357,12 @@ int drbd_adm_down(struct sk_buff *skb, struct genl_info *info)
3355 struct drbd_device *device; 3357 struct drbd_device *device;
3356 unsigned i; 3358 unsigned i;
3357 3359
3358 retcode = drbd_adm_prepare(skb, info, 0); 3360 retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_RESOURCE);
3359 if (!adm_ctx.reply_skb) 3361 if (!adm_ctx.reply_skb)
3360 return retcode; 3362 return retcode;
3361 if (retcode != NO_ERROR) 3363 if (retcode != NO_ERROR)
3362 goto out; 3364 goto out;
3363 3365
3364 if (!adm_ctx.connection) {
3365 retcode = ERR_RES_NOT_KNOWN;
3366 goto out;
3367 }
3368
3369 /* demote */ 3366 /* demote */
3370 idr_for_each_entry(&adm_ctx.connection->volumes, device, i) { 3367 idr_for_each_entry(&adm_ctx.connection->volumes, device, i) {
3371 retcode = drbd_set_role(device, R_SECONDARY, 0); 3368 retcode = drbd_set_role(device, R_SECONDARY, 0);