zfs/include
Tony Hutter 9f4d64e711 Remove spa_namespace_lock from zpool status
This commit removes spa_namespace_lock from the zpool status codepath.
This means that zpool status will not hang if a pool fails while holding
the spa_namespace_lock.

Background:

The spa_namespace_lock was originally meant to protect the
spa_namespace_avl AVL tree.  The spa_namespace_avl tree held the
mappings from pool names to spa_t's.  So if you wanted to lookup the
spa_t for the "tank" pool, you would do an AVL search for "tank" while
holding spa_namespace_lock.

Over time though the spa_namespace_lock was re-purposed to protect other
critical codepaths in the spa subsystem as well.  In many cases we don't
know what the original authors meant to protect with it, or if they
needed it for read-only or read-write protection.  It is simply "too big
and risky to fix properly".

The workaround is to add a new lightweight version of the
spa_namespace_lock called spa_namespace_lite_lock.
spa_namespace_lite_lock only protects the AVL tree, and nothing else.
It can be used for read-only access to the AVL tree without requiring
the spa_namespace_lock.  Calls to spa_lookup_lite() and spa_next_lite()
only need to acquire a reader lock on spa_namespace_lite_lock; they do
not need to also acquire the old spa_namespace_lock.  This allows us to
still run zpool status even if the zfs module has spa_namespace_lock
held.  Note that these AVL tree locks only protect the tree, not the
actual spa_t contents.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
2024-09-10 14:29:19 -07:00
..
os abd_os: break out platform-specific header parts 2024-08-21 13:37:18 -07:00
sys Remove spa_namespace_lock from zpool status 2024-09-10 14:29:19 -07:00
.gitignore OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
Makefile.am value strings: pretty printers for flags and enums 2024-09-05 13:40:05 -07:00
cityhash.h libzfs: convert to -fvisibility=hidden 2021-06-03 13:17:55 -07:00
libnvpair.h nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
libuutil.h Cleanup: Remove unused uu_pname code 2022-09-19 17:33:52 -07:00
libuutil_common.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
libuutil_impl.h libuutil: deobfuscate internal pointers 2022-11-03 09:57:05 -07:00
libzdb.h libzdb: Initial breakout of libzdb 2024-02-05 10:00:41 -08:00
libzfs.h Add DDT prune command 2024-09-04 14:17:02 -07:00
libzfs_core.h Add DDT prune command 2024-09-04 14:17:02 -07:00
libzfsbootenv.h lib{efi,avl,share,tpool,zfs_core,zfsbootenv,zutil}: -fvisibility=hidden 2021-06-09 17:04:32 -07:00
libzutil.h Parallel pool import 2024-04-22 09:42:38 -07:00
thread_pool.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfeature_common.h ddt: add FDT feature and support for legacy and new on-disk formats 2024-08-16 11:58:59 -07:00
zfs_comutil.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_deleg.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_fletcher.h Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_namecheck.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_prop.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_valstr.h value strings: pretty printers for flags and enums 2024-09-05 13:40:05 -07:00