[2.2.5-only] Make 'rmmod zfs' work after zfs-2.2.4 (#16406)
commit6f27c4cadd29eb9b850c1c66bf71ef9ba119b955
authorTony Hutter <hutter2@llnl.gov>
Sat, 3 Aug 2024 00:45:00 +0000 (2 17:45 -0700)
committerTony Hutter <hutter2@llnl.gov>
Sat, 3 Aug 2024 01:03:09 +0000 (2 18:03 -0700)
tree24f1681540a709725ac46555b39266a65c1660b3
parentdd5de55ebaa60ffa3ad1a4b004cf5c068471ba78
[2.2.5-only] Make 'rmmod zfs' work after zfs-2.2.4 (#16406)

db65272ae 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: #16249

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
module/os/linux/zfs/zfs_sysfs.c