diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-06-09 03:26:16 +0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 19:44:54 +0400 |
commit | a10f6b8ae6971680ead81444b48c11263abd70a1 (patch) | |
tree | dfa7aff5fed06f8fb8c4be275a490b79bda37de7 /drivers | |
parent | 77c556f663b7ac066268c94c18670ce93dec60c0 (diff) | |
download | linux-a10f6b8ae6971680ead81444b48c11263abd70a1.tar.xz |
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')
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 9 |
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, } if (!adm_ctx.connection && (flags & DRBD_ADM_NEED_RESOURCE)) { drbd_msg_put_info("unknown resource"); + if (adm_ctx.resource_name) + return ERR_RES_NOT_KNOWN; return ERR_INVALID_REQUEST; } @@ -3355,17 +3357,12 @@ int drbd_adm_down(struct sk_buff *skb, struct genl_info *info) struct drbd_device *device; unsigned i; - retcode = drbd_adm_prepare(skb, info, 0); + retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_RESOURCE); if (!adm_ctx.reply_skb) return retcode; if (retcode != NO_ERROR) goto out; - if (!adm_ctx.connection) { - retcode = ERR_RES_NOT_KNOWN; - goto out; - } - /* demote */ idr_for_each_entry(&adm_ctx.connection->volumes, device, i) { retcode = drbd_set_role(device, R_SECONDARY, 0); |