summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_sysfs.c
diff options
context:
space:
mode:
authorTomohiro Kusumi <[email protected]>2019-06-13 09:15:06 +0900
committerBrian Behlendorf <[email protected]>2019-06-12 17:15:06 -0700
commitdaddbdc7ccf5edc6174d6e7300f93bf009f0be12 (patch)
treed987e479f719983918316197049b98fa0d768f44 /module/zfs/zfs_sysfs.c
parentd9b4bf0665a0b1a7af2bbb34c60bca612956022d (diff)
Fix lockdep warning on insmod
sysfs_attr_init() is required to make lockdep happy for dynamically allocated sysfs attributes. This fixed #8868 on Fedora 29 running kernel-debug. This requirement was introduced in 2.6.34. See include/linux/sysfs.h for what it actually does. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Olaf Faaland <[email protected]> Signed-off-by: Tomohiro Kusumi <[email protected]> Closes #8868 Closes #8884
Diffstat (limited to 'module/zfs/zfs_sysfs.c')
-rw-r--r--module/zfs/zfs_sysfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/module/zfs/zfs_sysfs.c b/module/zfs/zfs_sysfs.c
index 30b5edb01..2f5bea9aa 100644
--- a/module/zfs/zfs_sysfs.c
+++ b/module/zfs/zfs_sysfs.c
@@ -144,6 +144,10 @@ zfs_kobj_release(struct kobject *kobj)
zkobj->zko_attr_count = 0;
}
+#ifndef sysfs_attr_init
+#define sysfs_attr_init(attr) do {} while (0)
+#endif
+
static void
zfs_kobj_add_attr(zfs_mod_kobj_t *zkobj, int attr_num, const char *attr_name)
{
@@ -154,6 +158,7 @@ zfs_kobj_add_attr(zfs_mod_kobj_t *zkobj, int attr_num, const char *attr_name)
zkobj->zko_attr_list[attr_num].name = attr_name;
zkobj->zko_attr_list[attr_num].mode = 0444;
zkobj->zko_default_attrs[attr_num] = &zkobj->zko_attr_list[attr_num];
+ sysfs_attr_init(&zkobj->zko_attr_list[attr_num]);
}
static int