Project

General

Profile

Bug #3944

libtopo zfs module will clobber libzfs handle when an instance of the module unloads

Added by Alek Pinchuk over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Start date:
2013-07-29
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The problem here is that g_zfs global gets clobbered by other instances of the module doing a zfs_fini() - setting g_zfs to NULL.

see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/fm/topo/libtopo/common/zfs.c#62

impact of this bug is that when g_zfs is NULL we get the wrong ASRU/FMRI string being generated which in turn will cause some corresponding FMA event(s) to not be cleared (see http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/fm/topo/libtopo/common/zfs.c#158 & http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/fm/modules/common/zfs-retire/zfs_retire.c#275).

you can use the "echo g_zfs/X |mdb -p `pgrep fmd`" command to check if you are in this state where g_zfs is zeroed out.

The proposed fix adds a refcount so that g_zfs doesn't get freed unless no one is using it.
This way when a module instance unloads it doesn't set g_zfs to NULL for all other instances.

Also available in: Atom PDF