diff options
Diffstat (limited to 'fs/dlm/config.c')
-rw-r--r-- | fs/dlm/config.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 8e294fbbac39..1669f6291c95 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -343,24 +343,20 @@ static struct config_group *make_cluster(struct config_group *g, | |||
343 | struct dlm_cluster *cl = NULL; | 343 | struct dlm_cluster *cl = NULL; |
344 | struct dlm_spaces *sps = NULL; | 344 | struct dlm_spaces *sps = NULL; |
345 | struct dlm_comms *cms = NULL; | 345 | struct dlm_comms *cms = NULL; |
346 | void *gps = NULL; | ||
347 | 346 | ||
348 | cl = kzalloc(sizeof(struct dlm_cluster), GFP_NOFS); | 347 | cl = kzalloc(sizeof(struct dlm_cluster), GFP_NOFS); |
349 | gps = kcalloc(3, sizeof(struct config_group *), GFP_NOFS); | ||
350 | sps = kzalloc(sizeof(struct dlm_spaces), GFP_NOFS); | 348 | sps = kzalloc(sizeof(struct dlm_spaces), GFP_NOFS); |
351 | cms = kzalloc(sizeof(struct dlm_comms), GFP_NOFS); | 349 | cms = kzalloc(sizeof(struct dlm_comms), GFP_NOFS); |
352 | 350 | ||
353 | if (!cl || !gps || !sps || !cms) | 351 | if (!cl || !sps || !cms) |
354 | goto fail; | 352 | goto fail; |
355 | 353 | ||
356 | config_group_init_type_name(&cl->group, name, &cluster_type); | 354 | config_group_init_type_name(&cl->group, name, &cluster_type); |
357 | config_group_init_type_name(&sps->ss_group, "spaces", &spaces_type); | 355 | config_group_init_type_name(&sps->ss_group, "spaces", &spaces_type); |
358 | config_group_init_type_name(&cms->cs_group, "comms", &comms_type); | 356 | config_group_init_type_name(&cms->cs_group, "comms", &comms_type); |
359 | 357 | ||
360 | cl->group.default_groups = gps; | 358 | configfs_add_default_group(&sps->ss_group, &cl->group); |
361 | cl->group.default_groups[0] = &sps->ss_group; | 359 | configfs_add_default_group(&cms->cs_group, &cl->group); |
362 | cl->group.default_groups[1] = &cms->cs_group; | ||
363 | cl->group.default_groups[2] = NULL; | ||
364 | 360 | ||
365 | cl->cl_tcp_port = dlm_config.ci_tcp_port; | 361 | cl->cl_tcp_port = dlm_config.ci_tcp_port; |
366 | cl->cl_buffer_size = dlm_config.ci_buffer_size; | 362 | cl->cl_buffer_size = dlm_config.ci_buffer_size; |
@@ -383,7 +379,6 @@ static struct config_group *make_cluster(struct config_group *g, | |||
383 | 379 | ||
384 | fail: | 380 | fail: |
385 | kfree(cl); | 381 | kfree(cl); |
386 | kfree(gps); | ||
387 | kfree(sps); | 382 | kfree(sps); |
388 | kfree(cms); | 383 | kfree(cms); |
389 | return ERR_PTR(-ENOMEM); | 384 | return ERR_PTR(-ENOMEM); |
@@ -392,14 +387,8 @@ static struct config_group *make_cluster(struct config_group *g, | |||
392 | static void drop_cluster(struct config_group *g, struct config_item *i) | 387 | static void drop_cluster(struct config_group *g, struct config_item *i) |
393 | { | 388 | { |
394 | struct dlm_cluster *cl = config_item_to_cluster(i); | 389 | struct dlm_cluster *cl = config_item_to_cluster(i); |
395 | struct config_item *tmp; | ||
396 | int j; | ||
397 | 390 | ||
398 | for (j = 0; cl->group.default_groups[j]; j++) { | 391 | configfs_remove_default_groups(&cl->group); |
399 | tmp = &cl->group.default_groups[j]->cg_item; | ||
400 | cl->group.default_groups[j] = NULL; | ||
401 | config_item_put(tmp); | ||
402 | } | ||
403 | 392 | ||
404 | space_list = NULL; | 393 | space_list = NULL; |
405 | comm_list = NULL; | 394 | comm_list = NULL; |
@@ -410,7 +399,6 @@ static void drop_cluster(struct config_group *g, struct config_item *i) | |||
410 | static void release_cluster(struct config_item *i) | 399 | static void release_cluster(struct config_item *i) |
411 | { | 400 | { |
412 | struct dlm_cluster *cl = config_item_to_cluster(i); | 401 | struct dlm_cluster *cl = config_item_to_cluster(i); |
413 | kfree(cl->group.default_groups); | ||
414 | kfree(cl); | 402 | kfree(cl); |
415 | } | 403 | } |
416 | 404 | ||
@@ -418,21 +406,17 @@ static struct config_group *make_space(struct config_group *g, const char *name) | |||
418 | { | 406 | { |
419 | struct dlm_space *sp = NULL; | 407 | struct dlm_space *sp = NULL; |
420 | struct dlm_nodes *nds = NULL; | 408 | struct dlm_nodes *nds = NULL; |
421 | void *gps = NULL; | ||
422 | 409 | ||
423 | sp = kzalloc(sizeof(struct dlm_space), GFP_NOFS); | 410 | sp = kzalloc(sizeof(struct dlm_space), GFP_NOFS); |
424 | gps = kcalloc(2, sizeof(struct config_group *), GFP_NOFS); | ||
425 | nds = kzalloc(sizeof(struct dlm_nodes), GFP_NOFS); | 411 | nds = kzalloc(sizeof(struct dlm_nodes), GFP_NOFS); |
426 | 412 | ||
427 | if (!sp || !gps || !nds) | 413 | if (!sp || !nds) |
428 | goto fail; | 414 | goto fail; |
429 | 415 | ||
430 | config_group_init_type_name(&sp->group, name, &space_type); | 416 | config_group_init_type_name(&sp->group, name, &space_type); |
431 | config_group_init_type_name(&nds->ns_group, "nodes", &nodes_type); | ||
432 | 417 | ||
433 | sp->group.default_groups = gps; | 418 | config_group_init_type_name(&nds->ns_group, "nodes", &nodes_type); |
434 | sp->group.default_groups[0] = &nds->ns_group; | 419 | configfs_add_default_group(&nds->ns_group, &sp->group); |
435 | sp->group.default_groups[1] = NULL; | ||
436 | 420 | ||
437 | INIT_LIST_HEAD(&sp->members); | 421 | INIT_LIST_HEAD(&sp->members); |
438 | mutex_init(&sp->members_lock); | 422 | mutex_init(&sp->members_lock); |
@@ -441,7 +425,6 @@ static struct config_group *make_space(struct config_group *g, const char *name) | |||
441 | 425 | ||
442 | fail: | 426 | fail: |
443 | kfree(sp); | 427 | kfree(sp); |
444 | kfree(gps); | ||
445 | kfree(nds); | 428 | kfree(nds); |
446 | return ERR_PTR(-ENOMEM); | 429 | return ERR_PTR(-ENOMEM); |
447 | } | 430 | } |
@@ -449,24 +432,16 @@ static struct config_group *make_space(struct config_group *g, const char *name) | |||
449 | static void drop_space(struct config_group *g, struct config_item *i) | 432 | static void drop_space(struct config_group *g, struct config_item *i) |
450 | { | 433 | { |
451 | struct dlm_space *sp = config_item_to_space(i); | 434 | struct dlm_space *sp = config_item_to_space(i); |
452 | struct config_item *tmp; | ||
453 | int j; | ||
454 | 435 | ||
455 | /* assert list_empty(&sp->members) */ | 436 | /* assert list_empty(&sp->members) */ |
456 | 437 | ||
457 | for (j = 0; sp->group.default_groups[j]; j++) { | 438 | configfs_remove_default_groups(&sp->group); |
458 | tmp = &sp->group.default_groups[j]->cg_item; | ||
459 | sp->group.default_groups[j] = NULL; | ||
460 | config_item_put(tmp); | ||
461 | } | ||
462 | |||
463 | config_item_put(i); | 439 | config_item_put(i); |
464 | } | 440 | } |
465 | 441 | ||
466 | static void release_space(struct config_item *i) | 442 | static void release_space(struct config_item *i) |
467 | { | 443 | { |
468 | struct dlm_space *sp = config_item_to_space(i); | 444 | struct dlm_space *sp = config_item_to_space(i); |
469 | kfree(sp->group.default_groups); | ||
470 | kfree(sp); | 445 | kfree(sp); |
471 | } | 446 | } |
472 | 447 | ||