From fe2f7cf6d75aee51727f52d2c74caec06fc5e2f6 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Thu, 11 Sep 2025 01:59:57 +1000 Subject: [PATCH] linux/rw_destroy: assert no holders before destroying While rw_destroy() may do nothing on Linux, we still want to make sure that we don't have any holders outstanding like we do for mutexes. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Signed-off-by: Rob Norris Closes #17718 --- include/os/linux/spl/sys/rwlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/os/linux/spl/sys/rwlock.h b/include/os/linux/spl/sys/rwlock.h index 563e0a196..c883836c2 100644 --- a/include/os/linux/spl/sys/rwlock.h +++ b/include/os/linux/spl/sys/rwlock.h @@ -130,7 +130,7 @@ RW_READ_HELD(krwlock_t *rwp) /* * The Linux rwsem implementation does not require a matching destroy. */ -#define rw_destroy(rwp) ((void) 0) +#define rw_destroy(rwp) ASSERT(!(RW_LOCK_HELD(rwp))) /* * Upgrading a rwsem from a reader to a writer is not supported by the