hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/dlm/lockspace.c
....@@ -1,12 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23 *******************************************************************************
34 **
45 ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
56 ** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
67 **
7
-** This copyrighted material is made available to anyone wishing to use,
8
-** modify, copy, or redistribute it subject to the terms and conditions
9
-** of the GNU General Public License v.2.
108 **
119 *******************************************************************************
1210 ******************************************************************************/
....@@ -160,6 +158,7 @@
160158 &dlm_attr_recover_nodeid.attr,
161159 NULL,
162160 };
161
+ATTRIBUTE_GROUPS(dlm);
163162
164163 static ssize_t dlm_attr_show(struct kobject *kobj, struct attribute *attr,
165164 char *buf)
....@@ -189,7 +188,7 @@
189188 };
190189
191190 static struct kobj_type dlm_ktype = {
192
- .default_attrs = dlm_attrs,
191
+ .default_groups = dlm_groups,
193192 .sysfs_ops = &dlm_attr_ops,
194193 .release = lockspace_kobj_release,
195194 };
....@@ -198,8 +197,6 @@
198197
199198 static int do_uevent(struct dlm_ls *ls, int in)
200199 {
201
- int error;
202
-
203200 if (in)
204201 kobject_uevent(&ls->ls_kobj, KOBJ_ONLINE);
205202 else
....@@ -210,20 +207,12 @@
210207 /* dlm_controld will see the uevent, do the necessary group management
211208 and then write to sysfs to wake us */
212209
213
- error = wait_event_interruptible(ls->ls_uevent_wait,
214
- test_and_clear_bit(LSFL_UEVENT_WAIT, &ls->ls_flags));
210
+ wait_event(ls->ls_uevent_wait,
211
+ test_and_clear_bit(LSFL_UEVENT_WAIT, &ls->ls_flags));
215212
216
- log_rinfo(ls, "group event done %d %d", error, ls->ls_uevent_result);
213
+ log_rinfo(ls, "group event done %d", ls->ls_uevent_result);
217214
218
- if (error)
219
- goto out;
220
-
221
- error = ls->ls_uevent_result;
222
- out:
223
- if (error)
224
- log_error(ls, "group %s failed %d %d", in ? "join" : "leave",
225
- error, ls->ls_uevent_result);
226
- return error;
215
+ return ls->ls_uevent_result;
227216 }
228217
229218 static int dlm_uevent(struct kset *kset, struct kobject *kobj,
....@@ -431,7 +420,7 @@
431420 int do_unreg = 0;
432421 int namelen = strlen(name);
433422
434
- if (namelen > DLM_LOCKSPACE_LEN)
423
+ if (namelen > DLM_LOCKSPACE_LEN || namelen == 0)
435424 return -EINVAL;
436425
437426 if (!lvblen || (lvblen % 8))
....@@ -681,10 +670,8 @@
681670 out_lkbidr:
682671 idr_destroy(&ls->ls_lkbidr);
683672 out_rsbtbl:
684
- for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
685
- if (ls->ls_remove_names[i])
686
- kfree(ls->ls_remove_names[i]);
687
- }
673
+ for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++)
674
+ kfree(ls->ls_remove_names[i]);
688675 vfree(ls->ls_rsbtbl);
689676 out_lsfree:
690677 if (do_unreg)