Lines Matching refs:adm_ctx

159 static int drbd_adm_prepare(struct drbd_config_context *adm_ctx,  in drbd_adm_prepare()  argument
166 memset(adm_ctx, 0, sizeof(*adm_ctx)); in drbd_adm_prepare()
172 adm_ctx->reply_skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); in drbd_adm_prepare()
173 if (!adm_ctx->reply_skb) { in drbd_adm_prepare()
178 adm_ctx->reply_dh = genlmsg_put_reply(adm_ctx->reply_skb, in drbd_adm_prepare()
182 if (!adm_ctx->reply_dh) { in drbd_adm_prepare()
187 adm_ctx->reply_dh->minor = d_in->minor; in drbd_adm_prepare()
188 adm_ctx->reply_dh->ret_code = NO_ERROR; in drbd_adm_prepare()
190 adm_ctx->volume = VOLUME_UNSPECIFIED; in drbd_adm_prepare()
200 err = nla_put_nohdr(adm_ctx->reply_skb, in drbd_adm_prepare()
209 adm_ctx->volume = nla_get_u32(nla); in drbd_adm_prepare()
212 adm_ctx->resource_name = nla_data(nla); in drbd_adm_prepare()
213 adm_ctx->my_addr = nested_attr_tb[__nla_type(T_ctx_my_addr)]; in drbd_adm_prepare()
214 adm_ctx->peer_addr = nested_attr_tb[__nla_type(T_ctx_peer_addr)]; in drbd_adm_prepare()
215 if ((adm_ctx->my_addr && in drbd_adm_prepare()
216 nla_len(adm_ctx->my_addr) > sizeof(adm_ctx->connection->my_addr)) || in drbd_adm_prepare()
217 (adm_ctx->peer_addr && in drbd_adm_prepare()
218 nla_len(adm_ctx->peer_addr) > sizeof(adm_ctx->connection->peer_addr))) { in drbd_adm_prepare()
224 adm_ctx->minor = d_in->minor; in drbd_adm_prepare()
225 adm_ctx->device = minor_to_device(d_in->minor); in drbd_adm_prepare()
230 if (adm_ctx->device) in drbd_adm_prepare()
231 kref_get(&adm_ctx->device->kref); in drbd_adm_prepare()
233 if (adm_ctx->resource_name) { in drbd_adm_prepare()
234 adm_ctx->resource = drbd_find_resource(adm_ctx->resource_name); in drbd_adm_prepare()
237 if (!adm_ctx->device && (flags & DRBD_ADM_NEED_MINOR)) { in drbd_adm_prepare()
238 drbd_msg_put_info(adm_ctx->reply_skb, "unknown minor"); in drbd_adm_prepare()
241 if (!adm_ctx->resource && (flags & DRBD_ADM_NEED_RESOURCE)) { in drbd_adm_prepare()
242 drbd_msg_put_info(adm_ctx->reply_skb, "unknown resource"); in drbd_adm_prepare()
243 if (adm_ctx->resource_name) in drbd_adm_prepare()
249 if (adm_ctx->resource) { in drbd_adm_prepare()
250 drbd_msg_put_info(adm_ctx->reply_skb, "no resource name expected"); in drbd_adm_prepare()
253 if (adm_ctx->device) { in drbd_adm_prepare()
254 drbd_msg_put_info(adm_ctx->reply_skb, "no minor number expected"); in drbd_adm_prepare()
257 if (adm_ctx->my_addr && adm_ctx->peer_addr) in drbd_adm_prepare()
258 adm_ctx->connection = conn_get_by_addrs(nla_data(adm_ctx->my_addr), in drbd_adm_prepare()
259 nla_len(adm_ctx->my_addr), in drbd_adm_prepare()
260 nla_data(adm_ctx->peer_addr), in drbd_adm_prepare()
261 nla_len(adm_ctx->peer_addr)); in drbd_adm_prepare()
262 if (!adm_ctx->connection) { in drbd_adm_prepare()
263 drbd_msg_put_info(adm_ctx->reply_skb, "unknown connection"); in drbd_adm_prepare()
269 if (adm_ctx->device && adm_ctx->resource && in drbd_adm_prepare()
270 adm_ctx->device->resource != adm_ctx->resource) { in drbd_adm_prepare()
272 adm_ctx->minor, adm_ctx->resource->name, in drbd_adm_prepare()
273 adm_ctx->device->resource->name); in drbd_adm_prepare()
274 drbd_msg_put_info(adm_ctx->reply_skb, "minor exists in different resource"); in drbd_adm_prepare()
277 if (adm_ctx->device && in drbd_adm_prepare()
278 adm_ctx->volume != VOLUME_UNSPECIFIED && in drbd_adm_prepare()
279 adm_ctx->volume != adm_ctx->device->vnr) { in drbd_adm_prepare()
281 adm_ctx->minor, adm_ctx->volume, in drbd_adm_prepare()
282 adm_ctx->device->vnr, adm_ctx->device->resource->name); in drbd_adm_prepare()
283 drbd_msg_put_info(adm_ctx->reply_skb, "minor exists as different volume"); in drbd_adm_prepare()
288 if (!adm_ctx->resource) { in drbd_adm_prepare()
289 adm_ctx->resource = adm_ctx->device ? adm_ctx->device->resource in drbd_adm_prepare()
290 : adm_ctx->connection ? adm_ctx->connection->resource : NULL; in drbd_adm_prepare()
291 if (adm_ctx->resource) in drbd_adm_prepare()
292 kref_get(&adm_ctx->resource->kref); in drbd_adm_prepare()
298 nlmsg_free(adm_ctx->reply_skb); in drbd_adm_prepare()
299 adm_ctx->reply_skb = NULL; in drbd_adm_prepare()
303 static int drbd_adm_finish(struct drbd_config_context *adm_ctx, in drbd_adm_finish() argument
306 if (adm_ctx->device) { in drbd_adm_finish()
307 kref_put(&adm_ctx->device->kref, drbd_destroy_device); in drbd_adm_finish()
308 adm_ctx->device = NULL; in drbd_adm_finish()
310 if (adm_ctx->connection) { in drbd_adm_finish()
311 kref_put(&adm_ctx->connection->kref, &drbd_destroy_connection); in drbd_adm_finish()
312 adm_ctx->connection = NULL; in drbd_adm_finish()
314 if (adm_ctx->resource) { in drbd_adm_finish()
315 kref_put(&adm_ctx->resource->kref, drbd_destroy_resource); in drbd_adm_finish()
316 adm_ctx->resource = NULL; in drbd_adm_finish()
319 if (!adm_ctx->reply_skb) in drbd_adm_finish()
322 adm_ctx->reply_dh->ret_code = retcode; in drbd_adm_finish()
323 drbd_adm_send_reply(adm_ctx->reply_skb, info); in drbd_adm_finish()
769 struct drbd_config_context adm_ctx; in drbd_adm_set_role() local
775 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_set_role()
776 if (!adm_ctx.reply_skb) in drbd_adm_set_role()
786 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_set_role()
791 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_set_role()
794 rv = drbd_set_role(adm_ctx.device, R_PRIMARY, parms.assume_uptodate); in drbd_adm_set_role()
796 rv = drbd_set_role(adm_ctx.device, R_SECONDARY, 0); in drbd_adm_set_role()
798 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_set_role()
800 drbd_adm_finish(&adm_ctx, info, rv); in drbd_adm_set_role()
803 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_set_role()
1490 struct drbd_config_context adm_ctx; in drbd_adm_disk_opts() local
1498 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_disk_opts()
1499 if (!adm_ctx.reply_skb) in drbd_adm_disk_opts()
1504 device = adm_ctx.device; in drbd_adm_disk_opts()
1505 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_disk_opts()
1529 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_disk_opts()
1555 drbd_msg_put_info(adm_ctx.reply_skb, in drbd_adm_disk_opts()
1618 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_disk_opts()
1620 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_disk_opts()
1708 struct drbd_config_context adm_ctx; in drbd_adm_attach() local
1725 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_attach()
1726 if (!adm_ctx.reply_skb) in drbd_adm_attach()
1731 device = adm_ctx.device; in drbd_adm_attach()
1732 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_attach()
1777 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_attach()
1928 drbd_msg_sprintf_info(adm_ctx.reply_skb, in drbd_adm_attach()
2102 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_attach()
2103 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_attach()
2121 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_attach()
2123 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_attach()
2145 struct drbd_config_context adm_ctx; in drbd_adm_detach() local
2150 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_detach()
2151 if (!adm_ctx.reply_skb) in drbd_adm_detach()
2160 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_detach()
2165 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_detach()
2166 retcode = adm_detach(adm_ctx.device, parms.force_detach); in drbd_adm_detach()
2167 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_detach()
2169 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_detach()
2343 struct drbd_config_context adm_ctx; in drbd_adm_net_opts() local
2352 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_CONNECTION); in drbd_adm_net_opts()
2353 if (!adm_ctx.reply_skb) in drbd_adm_net_opts()
2358 connection = adm_ctx.connection; in drbd_adm_net_opts()
2359 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_net_opts()
2374 drbd_msg_put_info(adm_ctx.reply_skb, "net conf missing, try connect"); in drbd_adm_net_opts()
2386 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_net_opts()
2456 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_net_opts()
2458 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_net_opts()
2487 struct drbd_config_context adm_ctx; in drbd_adm_connect() local
2498 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_RESOURCE); in drbd_adm_connect()
2500 if (!adm_ctx.reply_skb) in drbd_adm_connect()
2504 if (!(adm_ctx.my_addr && adm_ctx.peer_addr)) { in drbd_adm_connect()
2505 drbd_msg_put_info(adm_ctx.reply_skb, "connection endpoint(s) missing"); in drbd_adm_connect()
2515 if (nla_len(adm_ctx.my_addr) == connection->my_addr_len && in drbd_adm_connect()
2516 !memcmp(nla_data(adm_ctx.my_addr), &connection->my_addr, in drbd_adm_connect()
2522 if (nla_len(adm_ctx.peer_addr) == connection->peer_addr_len && in drbd_adm_connect()
2523 !memcmp(nla_data(adm_ctx.peer_addr), &connection->peer_addr, in drbd_adm_connect()
2531 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_connect()
2532 connection = first_connection(adm_ctx.resource); in drbd_adm_connect()
2552 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_connect()
2568 mutex_lock(&adm_ctx.resource->conf_update); in drbd_adm_connect()
2572 mutex_unlock(&adm_ctx.resource->conf_update); in drbd_adm_connect()
2583 connection->my_addr_len = nla_len(adm_ctx.my_addr); in drbd_adm_connect()
2584 memcpy(&connection->my_addr, nla_data(adm_ctx.my_addr), connection->my_addr_len); in drbd_adm_connect()
2585 connection->peer_addr_len = nla_len(adm_ctx.peer_addr); in drbd_adm_connect()
2586 memcpy(&connection->peer_addr, nla_data(adm_ctx.peer_addr), connection->peer_addr_len); in drbd_adm_connect()
2604 mutex_unlock(&adm_ctx.resource->conf_update); in drbd_adm_connect()
2617 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_connect()
2618 drbd_adm_finish(&adm_ctx, info, rv); in drbd_adm_connect()
2626 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_connect()
2628 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_connect()
2700 struct drbd_config_context adm_ctx; in drbd_adm_disconnect() local
2707 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_CONNECTION); in drbd_adm_disconnect()
2708 if (!adm_ctx.reply_skb) in drbd_adm_disconnect()
2713 connection = adm_ctx.connection; in drbd_adm_disconnect()
2719 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_disconnect()
2724 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_disconnect()
2726 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_disconnect()
2728 drbd_adm_finish(&adm_ctx, info, rv); in drbd_adm_disconnect()
2733 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_disconnect()
2755 struct drbd_config_context adm_ctx; in drbd_adm_resize() local
2766 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_resize()
2767 if (!adm_ctx.reply_skb) in drbd_adm_resize()
2772 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resize()
2773 device = adm_ctx.device; in drbd_adm_resize()
2786 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_resize()
2878 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resize()
2880 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_resize()
2891 struct drbd_config_context adm_ctx; in drbd_adm_resource_opts() local
2896 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_RESOURCE); in drbd_adm_resource_opts()
2897 if (!adm_ctx.reply_skb) in drbd_adm_resource_opts()
2902 res_opts = adm_ctx.resource->res_opts; in drbd_adm_resource_opts()
2909 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_resource_opts()
2913 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resource_opts()
2914 err = set_resource_options(adm_ctx.resource, &res_opts); in drbd_adm_resource_opts()
2920 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resource_opts()
2923 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_resource_opts()
2929 struct drbd_config_context adm_ctx; in drbd_adm_invalidate() local
2933 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_invalidate()
2934 if (!adm_ctx.reply_skb) in drbd_adm_invalidate()
2939 device = adm_ctx.device; in drbd_adm_invalidate()
2945 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate()
2968 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate()
2971 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_invalidate()
2978 struct drbd_config_context adm_ctx; in drbd_adm_simple_request_state() local
2981 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_simple_request_state()
2982 if (!adm_ctx.reply_skb) in drbd_adm_simple_request_state()
2987 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_simple_request_state()
2988 retcode = drbd_request_state(adm_ctx.device, mask, val); in drbd_adm_simple_request_state()
2989 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_simple_request_state()
2991 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_simple_request_state()
3006 struct drbd_config_context adm_ctx; in drbd_adm_invalidate_peer() local
3010 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_invalidate_peer()
3011 if (!adm_ctx.reply_skb) in drbd_adm_invalidate_peer()
3016 device = adm_ctx.device; in drbd_adm_invalidate_peer()
3022 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate_peer()
3048 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_invalidate_peer()
3051 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_invalidate_peer()
3057 struct drbd_config_context adm_ctx; in drbd_adm_pause_sync() local
3060 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_pause_sync()
3061 if (!adm_ctx.reply_skb) in drbd_adm_pause_sync()
3066 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_pause_sync()
3067 if (drbd_request_state(adm_ctx.device, NS(user_isp, 1)) == SS_NOTHING_TO_DO) in drbd_adm_pause_sync()
3069 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_pause_sync()
3071 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_pause_sync()
3077 struct drbd_config_context adm_ctx; in drbd_adm_resume_sync() local
3081 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_resume_sync()
3082 if (!adm_ctx.reply_skb) in drbd_adm_resume_sync()
3087 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_sync()
3088 if (drbd_request_state(adm_ctx.device, NS(user_isp, 0)) == SS_NOTHING_TO_DO) { in drbd_adm_resume_sync()
3089 s = adm_ctx.device->state; in drbd_adm_resume_sync()
3097 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_sync()
3099 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_resume_sync()
3110 struct drbd_config_context adm_ctx; in drbd_adm_resume_io() local
3114 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_resume_io()
3115 if (!adm_ctx.reply_skb) in drbd_adm_resume_io()
3120 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_io()
3121 device = adm_ctx.device; in drbd_adm_resume_io()
3158 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_resume_io()
3160 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_resume_io()
3813 struct drbd_config_context adm_ctx; in drbd_adm_get_status() local
3817 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_get_status()
3818 if (!adm_ctx.reply_skb) in drbd_adm_get_status()
3823 err = nla_put_status_info(adm_ctx.reply_skb, adm_ctx.device, NULL); in drbd_adm_get_status()
3825 nlmsg_free(adm_ctx.reply_skb); in drbd_adm_get_status()
3829 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_get_status()
4016 struct drbd_config_context adm_ctx; in drbd_adm_get_timeout_type() local
4021 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_get_timeout_type()
4022 if (!adm_ctx.reply_skb) in drbd_adm_get_timeout_type()
4028 adm_ctx.device->state.pdsk == D_OUTDATED ? UT_PEER_OUTDATED : in drbd_adm_get_timeout_type()
4029 test_bit(USE_DEGR_WFC_T, &adm_ctx.device->flags) ? UT_DEGRADED : in drbd_adm_get_timeout_type()
4032 err = timeout_parms_to_priv_skb(adm_ctx.reply_skb, &tp); in drbd_adm_get_timeout_type()
4034 nlmsg_free(adm_ctx.reply_skb); in drbd_adm_get_timeout_type()
4038 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_get_timeout_type()
4044 struct drbd_config_context adm_ctx; in drbd_adm_start_ov() local
4049 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_start_ov()
4050 if (!adm_ctx.reply_skb) in drbd_adm_start_ov()
4055 device = adm_ctx.device; in drbd_adm_start_ov()
4064 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_start_ov()
4068 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_start_ov()
4081 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_start_ov()
4083 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_start_ov()
4090 struct drbd_config_context adm_ctx; in drbd_adm_new_c_uuid() local
4097 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_new_c_uuid()
4098 if (!adm_ctx.reply_skb) in drbd_adm_new_c_uuid()
4103 device = adm_ctx.device; in drbd_adm_new_c_uuid()
4109 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_new_c_uuid()
4114 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_c_uuid()
4159 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_c_uuid()
4161 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_new_c_uuid()
4166 drbd_check_resource_name(struct drbd_config_context *adm_ctx) in drbd_check_resource_name() argument
4168 const char *name = adm_ctx->resource_name; in drbd_check_resource_name()
4170 drbd_msg_put_info(adm_ctx->reply_skb, "resource name missing"); in drbd_check_resource_name()
4176 drbd_msg_put_info(adm_ctx->reply_skb, "invalid resource name"); in drbd_check_resource_name()
4194 struct drbd_config_context adm_ctx; in drbd_adm_new_resource() local
4199 retcode = drbd_adm_prepare(&adm_ctx, skb, info, 0); in drbd_adm_new_resource()
4200 if (!adm_ctx.reply_skb) in drbd_adm_new_resource()
4209 drbd_msg_put_info(adm_ctx.reply_skb, from_attrs_err_to_txt(err)); in drbd_adm_new_resource()
4213 retcode = drbd_check_resource_name(&adm_ctx); in drbd_adm_new_resource()
4217 if (adm_ctx.resource) { in drbd_adm_new_resource()
4220 drbd_msg_put_info(adm_ctx.reply_skb, "resource exists"); in drbd_adm_new_resource()
4228 connection = conn_create(adm_ctx.resource_name, &res_opts); in drbd_adm_new_resource()
4243 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_new_resource()
4256 struct drbd_config_context adm_ctx; in drbd_adm_new_minor() local
4260 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_RESOURCE); in drbd_adm_new_minor()
4261 if (!adm_ctx.reply_skb) in drbd_adm_new_minor()
4267 drbd_msg_put_info(adm_ctx.reply_skb, "requested minor out of range"); in drbd_adm_new_minor()
4271 if (adm_ctx.volume > DRBD_VOLUME_MAX) { in drbd_adm_new_minor()
4272 drbd_msg_put_info(adm_ctx.reply_skb, "requested volume id out of range"); in drbd_adm_new_minor()
4279 if (adm_ctx.device) { in drbd_adm_new_minor()
4286 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_minor()
4287 retcode = drbd_create_device(&adm_ctx, dh->minor); in drbd_adm_new_minor()
4318 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_new_minor()
4320 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_new_minor()
4363 struct drbd_config_context adm_ctx; in drbd_adm_del_minor() local
4366 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR); in drbd_adm_del_minor()
4367 if (!adm_ctx.reply_skb) in drbd_adm_del_minor()
4372 mutex_lock(&adm_ctx.resource->adm_mutex); in drbd_adm_del_minor()
4373 retcode = adm_del_minor(adm_ctx.device); in drbd_adm_del_minor()
4374 mutex_unlock(&adm_ctx.resource->adm_mutex); in drbd_adm_del_minor()
4376 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_del_minor()
4412 struct drbd_config_context adm_ctx; in drbd_adm_down() local
4419 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_RESOURCE); in drbd_adm_down()
4420 if (!adm_ctx.reply_skb) in drbd_adm_down()
4425 resource = adm_ctx.resource; in drbd_adm_down()
4434 drbd_msg_put_info(adm_ctx.reply_skb, "failed to demote"); in drbd_adm_down()
4441 drbd_msg_put_info(adm_ctx.reply_skb, "failed to disconnect"); in drbd_adm_down()
4450 drbd_msg_put_info(adm_ctx.reply_skb, "failed to detach"); in drbd_adm_down()
4460 drbd_msg_put_info(adm_ctx.reply_skb, "failed to delete volume"); in drbd_adm_down()
4469 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_down()
4475 struct drbd_config_context adm_ctx; in drbd_adm_del_resource() local
4479 retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_RESOURCE); in drbd_adm_del_resource()
4480 if (!adm_ctx.reply_skb) in drbd_adm_del_resource()
4484 resource = adm_ctx.resource; in drbd_adm_del_resource()
4490 drbd_adm_finish(&adm_ctx, info, retcode); in drbd_adm_del_resource()