aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/lockspace.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-17 14:54:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:26 -0500
commit901195ed7f4b2f30dc5a36271887939c5d7bfb9f (patch)
tree1d56af3b3484ba97a98e3649247da25ac289ec7b /fs/dlm/lockspace.c
parent43b98c4a66760d18d4056beed4078a8dbad193cc (diff)
Kobject: change GFS2 to use kobject_init_and_add
Stop using kobject_register, as this way we can control the sending of the uevent properly, after everything is properly initialized. Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r--fs/dlm/lockspace.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index e64b0dc664f3..b750f13d0328 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -168,23 +168,6 @@ static struct kobj_type dlm_ktype = {
168 168
169static struct kset *dlm_kset; 169static struct kset *dlm_kset;
170 170
171static int kobject_setup(struct dlm_ls *ls)
172{
173 char lsname[DLM_LOCKSPACE_LEN];
174 int error;
175
176 memset(lsname, 0, DLM_LOCKSPACE_LEN);
177 snprintf(lsname, DLM_LOCKSPACE_LEN, "%s", ls->ls_name);
178
179 error = kobject_set_name(&ls->ls_kobj, "%s", lsname);
180 if (error)
181 return error;
182
183 ls->ls_kobj.kset = dlm_kset;
184 ls->ls_kobj.ktype = &dlm_ktype;
185 return 0;
186}
187
188static int do_uevent(struct dlm_ls *ls, int in) 171static int do_uevent(struct dlm_ls *ls, int in)
189{ 172{
190 int error; 173 int error;
@@ -545,13 +528,12 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
545 goto out_delist; 528 goto out_delist;
546 } 529 }
547 530
548 error = kobject_setup(ls); 531 ls->ls_kobj.kset = dlm_kset;
549 if (error) 532 error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL,
550 goto out_stop; 533 "%s", ls->ls_name);
551
552 error = kobject_register(&ls->ls_kobj);
553 if (error) 534 if (error)
554 goto out_stop; 535 goto out_stop;
536 kobject_uevent(&ls->ls_kobj, KOBJ_ADD);
555 537
556 /* let kobject handle freeing of ls if there's an error */ 538 /* let kobject handle freeing of ls if there's an error */
557 do_unreg = 1; 539 do_unreg = 1;