mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
nvmet: add sanity checks when freeing subsystem
Add WARN_ON_ONCE checks in nvmet_subsys_free() to ensure that the ctrls and hosts lists are all empty during subsystem release. This helps catch resource leaks. Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
d211a28035
commit
7fce856f11
|
|
@ -1903,6 +1903,8 @@ static void nvmet_subsys_free(struct kref *ref)
|
|||
struct nvmet_subsys *subsys =
|
||||
container_of(ref, struct nvmet_subsys, ref);
|
||||
|
||||
WARN_ON_ONCE(!list_empty(&subsys->ctrls));
|
||||
WARN_ON_ONCE(!list_empty(&subsys->hosts));
|
||||
WARN_ON_ONCE(!xa_empty(&subsys->namespaces));
|
||||
|
||||
nvmet_debugfs_subsys_free(subsys);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user