[PATCH 04/23] nvmet: add context annotation for nvmet_ns::bdev_file
Nilay Shroff
nilay at linux.ibm.com
Sun Nov 8 19:28:09 PST 2026
The nvmet_ns::bdev_file 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 74b066ce9ab0..b63664250ef4 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -149,7 +149,8 @@ struct nvmet_subsys {
struct nvmet_ns {
struct percpu_ref ref;
- struct file *bdev_file;
+ struct file *bdev_file
+ __guarded_by(&subsys->lock);
struct block_device *bdev
__guarded_by(&subsys->lock);
struct file *file
--
2.53.0
More information about the Linux-nvme
mailing list