diff options
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r-- | fs/dlm/lockspace.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index d489fcc86713..f994a7dfda85 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -148,7 +148,7 @@ static void lockspace_kobj_release(struct kobject *k) | |||
148 | kfree(ls); | 148 | kfree(ls); |
149 | } | 149 | } |
150 | 150 | ||
151 | static struct sysfs_ops dlm_attr_ops = { | 151 | static const struct sysfs_ops dlm_attr_ops = { |
152 | .show = dlm_attr_show, | 152 | .show = dlm_attr_show, |
153 | .store = dlm_attr_store, | 153 | .store = dlm_attr_store, |
154 | }; | 154 | }; |
@@ -191,6 +191,18 @@ static int do_uevent(struct dlm_ls *ls, int in) | |||
191 | return error; | 191 | return error; |
192 | } | 192 | } |
193 | 193 | ||
194 | static int dlm_uevent(struct kset *kset, struct kobject *kobj, | ||
195 | struct kobj_uevent_env *env) | ||
196 | { | ||
197 | struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj); | ||
198 | |||
199 | add_uevent_var(env, "LOCKSPACE=%s", ls->ls_name); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static struct kset_uevent_ops dlm_uevent_ops = { | ||
204 | .uevent = dlm_uevent, | ||
205 | }; | ||
194 | 206 | ||
195 | int __init dlm_lockspace_init(void) | 207 | int __init dlm_lockspace_init(void) |
196 | { | 208 | { |
@@ -199,7 +211,7 @@ int __init dlm_lockspace_init(void) | |||
199 | INIT_LIST_HEAD(&lslist); | 211 | INIT_LIST_HEAD(&lslist); |
200 | spin_lock_init(&lslist_lock); | 212 | spin_lock_init(&lslist_lock); |
201 | 213 | ||
202 | dlm_kset = kset_create_and_add("dlm", NULL, kernel_kobj); | 214 | dlm_kset = kset_create_and_add("dlm", &dlm_uevent_ops, kernel_kobj); |
203 | if (!dlm_kset) { | 215 | if (!dlm_kset) { |
204 | printk(KERN_WARNING "%s: can not create kset\n", __func__); | 216 | printk(KERN_WARNING "%s: can not create kset\n", __func__); |
205 | return -ENOMEM; | 217 | return -ENOMEM; |
@@ -430,7 +442,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
430 | 442 | ||
431 | error = -ENOMEM; | 443 | error = -ENOMEM; |
432 | 444 | ||
433 | ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_KERNEL); | 445 | ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_NOFS); |
434 | if (!ls) | 446 | if (!ls) |
435 | goto out; | 447 | goto out; |
436 | memcpy(ls->ls_name, name, namelen); | 448 | memcpy(ls->ls_name, name, namelen); |
@@ -443,11 +455,6 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
443 | if (flags & DLM_LSFL_TIMEWARN) | 455 | if (flags & DLM_LSFL_TIMEWARN) |
444 | set_bit(LSFL_TIMEWARN, &ls->ls_flags); | 456 | set_bit(LSFL_TIMEWARN, &ls->ls_flags); |
445 | 457 | ||
446 | if (flags & DLM_LSFL_FS) | ||
447 | ls->ls_allocation = GFP_NOFS; | ||
448 | else | ||
449 | ls->ls_allocation = GFP_KERNEL; | ||
450 | |||
451 | /* ls_exflags are forced to match among nodes, and we don't | 458 | /* ls_exflags are forced to match among nodes, and we don't |
452 | need to require all nodes to have some flags set */ | 459 | need to require all nodes to have some flags set */ |
453 | ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS | | 460 | ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS | |
@@ -456,7 +463,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
456 | size = dlm_config.ci_rsbtbl_size; | 463 | size = dlm_config.ci_rsbtbl_size; |
457 | ls->ls_rsbtbl_size = size; | 464 | ls->ls_rsbtbl_size = size; |
458 | 465 | ||
459 | ls->ls_rsbtbl = kmalloc(sizeof(struct dlm_rsbtable) * size, GFP_KERNEL); | 466 | ls->ls_rsbtbl = kmalloc(sizeof(struct dlm_rsbtable) * size, GFP_NOFS); |
460 | if (!ls->ls_rsbtbl) | 467 | if (!ls->ls_rsbtbl) |
461 | goto out_lsfree; | 468 | goto out_lsfree; |
462 | for (i = 0; i < size; i++) { | 469 | for (i = 0; i < size; i++) { |
@@ -468,7 +475,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
468 | size = dlm_config.ci_lkbtbl_size; | 475 | size = dlm_config.ci_lkbtbl_size; |
469 | ls->ls_lkbtbl_size = size; | 476 | ls->ls_lkbtbl_size = size; |
470 | 477 | ||
471 | ls->ls_lkbtbl = kmalloc(sizeof(struct dlm_lkbtable) * size, GFP_KERNEL); | 478 | ls->ls_lkbtbl = kmalloc(sizeof(struct dlm_lkbtable) * size, GFP_NOFS); |
472 | if (!ls->ls_lkbtbl) | 479 | if (!ls->ls_lkbtbl) |
473 | goto out_rsbfree; | 480 | goto out_rsbfree; |
474 | for (i = 0; i < size; i++) { | 481 | for (i = 0; i < size; i++) { |
@@ -480,7 +487,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
480 | size = dlm_config.ci_dirtbl_size; | 487 | size = dlm_config.ci_dirtbl_size; |
481 | ls->ls_dirtbl_size = size; | 488 | ls->ls_dirtbl_size = size; |
482 | 489 | ||
483 | ls->ls_dirtbl = kmalloc(sizeof(struct dlm_dirtable) * size, GFP_KERNEL); | 490 | ls->ls_dirtbl = kmalloc(sizeof(struct dlm_dirtable) * size, GFP_NOFS); |
484 | if (!ls->ls_dirtbl) | 491 | if (!ls->ls_dirtbl) |
485 | goto out_lkbfree; | 492 | goto out_lkbfree; |
486 | for (i = 0; i < size; i++) { | 493 | for (i = 0; i < size; i++) { |
@@ -527,7 +534,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
527 | mutex_init(&ls->ls_requestqueue_mutex); | 534 | mutex_init(&ls->ls_requestqueue_mutex); |
528 | mutex_init(&ls->ls_clear_proc_locks); | 535 | mutex_init(&ls->ls_clear_proc_locks); |
529 | 536 | ||
530 | ls->ls_recover_buf = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); | 537 | ls->ls_recover_buf = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS); |
531 | if (!ls->ls_recover_buf) | 538 | if (!ls->ls_recover_buf) |
532 | goto out_dirfree; | 539 | goto out_dirfree; |
533 | 540 | ||