Skip to content

Commit ffcf1fc

Browse files
tonyhutterptr1337
authored andcommitted
[2.2.5-only] Make 'rmmod zfs' work after zfs-2.2.4 (openzfs#16406)
db65272 was added to zfs-2.2.4 to stub in the VDEV_PROP_RAIDZ_EXPANDING enum without adding the RAIDz expansion feature. This was needed to provide the right enum count for when the VDEV_PROP_SLOW_IO proprieties got added. This had the unfortunate side effect of breaking module removal though. Specifically, with the VDEV_PROP_RAIDZ_EXPANDING stub added, the module would correctly omit making kobjects for the RAIDz expansion vdev property, but then would try to blindly remove its non-existent kobjects during module unload. This commit fixes the issue by checking for an uninitialized kobject. Fixes: openzfs#16249 Signed-off-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ameer Hamza <[email protected]> Reviewed-by: Tino Reichardt <[email protected]>
1 parent 4ec8b5a commit ffcf1fc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

module/os/linux/zfs/zfs_sysfs.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,17 @@ zfs_kobj_fini(zfs_mod_kobj_t *zkobj)
110110
}
111111

112112
/* kobject_put() will call zfs_kobj_release() to release memory */
113-
kobject_del(&zkobj->zko_kobj);
114-
kobject_put(&zkobj->zko_kobj);
113+
/*
114+
* Special case note:
115+
*
116+
* We have to check for 'zkobj->zko_kobj.name != NULL' as
117+
* a workaround for #16249 which was added to zfs-2.2.4
118+
* and fixed (with this change) in zfs-2.2.5.
119+
*/
120+
if (zkobj->zko_kobj.name != NULL) {
121+
kobject_del(&zkobj->zko_kobj);
122+
kobject_put(&zkobj->zko_kobj);
123+
}
115124
}
116125

117126
static void

0 commit comments

Comments
 (0)