Skip to content

Commit

Permalink
Fix lockdep warning on insmod
Browse files Browse the repository at this point in the history
sysfs_attr_init() is required to make lockdep happy for dynamically
allocated sysfs attributes. This fixed openzfs#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 <behlendorf1@llnl.gov>
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes openzfs#8868
Closes openzfs#8884
  • Loading branch information
kusumi authored and tonyhutter committed Aug 22, 2019
1 parent 692f68b commit e084ef6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions module/zfs/zfs_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down

0 comments on commit e084ef6

Please sign in to comment.