summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNilay Shroff <nilay@linux.ibm.com>2026-07-13 17:24:10 +0530
committerKeith Busch <kbusch@kernel.org>2026-07-28 10:37:26 -0700
commit4258bf237e7f26cbbd44c9dada11b87cda18041c (patch)
treec0685e6a130d1d993b02a351c8923c9941637c6c
parent696d2aeb77513eb474eb3557efc32be763289e4f (diff)
downloadlinux-4258bf237e7f26cbbd44c9dada11b87cda18041c.tar.gz
linux-4258bf237e7f26cbbd44c9dada11b87cda18041c.zip
nvme: add context annotations for nvme_dev::shutdown_lock
nvme_setup_io_queues_trylock() conditionally acquires dev->shutdown_lock using mutex_trylock(). The function returns 0 when the lock is successfully acquired and a negative error code otherwise. Annotate the function with __cond_acquires(0, &dev->shutdown_lock) so that Clang's lock context analysis can track the lock state based on the return value and verify correct lock usage at call sites. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
-rw-r--r--drivers/nvme/host/pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8438c904ec49..8c6d169f2c38 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2199,6 +2199,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
* Try getting shutdown_lock while setting up IO queues.
*/
static int nvme_setup_io_queues_trylock(struct nvme_dev *dev)
+ __cond_acquires(0, &dev->shutdown_lock)
{
/*
* Give up if the lock is being held by nvme_dev_disable.