Commit a10f6b8a authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: drbd_adm_down(): Move valid resource name check to drbd_adm_prepare()

Signed-off-by: default avatarAndreas Gruenbacher <agruen@linbit.com>
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
parent 77c556f6
...@@ -221,6 +221,8 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info, ...@@ -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)) { if (!adm_ctx.connection && (flags & DRBD_ADM_NEED_RESOURCE)) {
drbd_msg_put_info("unknown resource"); drbd_msg_put_info("unknown resource");
if (adm_ctx.resource_name)
return ERR_RES_NOT_KNOWN;
return ERR_INVALID_REQUEST; return ERR_INVALID_REQUEST;
} }
...@@ -3355,17 +3357,12 @@ int drbd_adm_down(struct sk_buff *skb, struct genl_info *info) ...@@ -3355,17 +3357,12 @@ int drbd_adm_down(struct sk_buff *skb, struct genl_info *info)
struct drbd_device *device; struct drbd_device *device;
unsigned i; unsigned i;
retcode = drbd_adm_prepare(skb, info, 0); retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_RESOURCE);
if (!adm_ctx.reply_skb) if (!adm_ctx.reply_skb)
return retcode; return retcode;
if (retcode != NO_ERROR) if (retcode != NO_ERROR)
goto out; goto out;
if (!adm_ctx.connection) {
retcode = ERR_RES_NOT_KNOWN;
goto out;
}
/* demote */ /* demote */
idr_for_each_entry(&adm_ctx.connection->volumes, device, i) { idr_for_each_entry(&adm_ctx.connection->volumes, device, i) {
retcode = drbd_set_role(device, R_SECONDARY, 0); retcode = drbd_set_role(device, R_SECONDARY, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment