[PATCH 15/23] nvmet: add context annotation for nvmet_ns::enabled

Nilay Shroff nilay at linux.ibm.com
Sun Nov 8 19:28:20 PST 2026


The nvmet_ns::enabled field is protected by nvmet_subsys::lock.
Annotate it with __guarded_by(&subsys->lock) so that the clang
context analyzer can validate accesses to this field.

Signed-off-by: Nilay Shroff <nilay at linux.ibm.com>
---
 drivers/nvme/target/nvmet.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 572f495b06df..a6fb3aab0c5d 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -171,7 +171,8 @@ struct nvmet_ns {
 
 	bool			buffered_io
 		__guarded_by(&subsys->lock);
-	bool			enabled;
+	bool			enabled
+		__guarded_by(&subsys->lock);
 #define NVMET_NS_IO_LIVE	0
 	unsigned long		flags;
 	struct nvmet_subsys	*subsys;
-- 
2.53.0




More information about the Linux-nvme mailing list