From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>,
Damien Le Moal <dlemoal@kernel.org>,
Marco Elver <elver@google.com>,
linux-block@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Ilya Dryomov <idryomov@gmail.com>,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH 09/14] rbd: Add lock context annotations
Date: Wed, 4 Mar 2026 11:48:28 -0800 [thread overview]
Message-ID: <20260304194843.760669-10-bvanassche@acm.org> (raw)
In-Reply-To: <20260304194843.760669-1-bvanassche@acm.org>
Prepare for enabling lock context analysis by adding the lock context
annotations that are required by Clang.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/block/rbd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index e7da06200c1e..595e4ba720ec 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4185,6 +4185,7 @@ static void rbd_acquire_lock(struct work_struct *work)
}
static bool rbd_quiesce_lock(struct rbd_device *rbd_dev)
+ __must_hold(&rbd_dev->lock_rwsem)
{
dout("%s rbd_dev %p\n", __func__, rbd_dev);
lockdep_assert_held_write(&rbd_dev->lock_rwsem);
@@ -4229,6 +4230,7 @@ static void __rbd_release_lock(struct rbd_device *rbd_dev)
* lock_rwsem must be held for write
*/
static void rbd_release_lock(struct rbd_device *rbd_dev)
+ __must_hold(&rbd_dev->lock_rwsem)
{
if (!rbd_quiesce_lock(rbd_dev))
return;
@@ -4597,6 +4599,7 @@ static void rbd_unregister_watch(struct rbd_device *rbd_dev)
* lock_rwsem must be held for write
*/
static void rbd_reacquire_lock(struct rbd_device *rbd_dev)
+ __must_hold(&rbd_dev->lock_rwsem)
{
struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
char cookie[32];
@@ -6789,6 +6792,7 @@ static void rbd_dev_device_release(struct rbd_device *rbd_dev)
* upon return.
*/
static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
+ __releases(&rbd_dev->header_rwsem)
{
int ret;
@@ -6890,6 +6894,7 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev)
* with @depth == 0.
*/
static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
+ __no_context_analysis /* conditional locking */
{
bool need_watch = !rbd_is_ro(rbd_dev);
int ret;
@@ -7143,6 +7148,8 @@ static ssize_t do_rbd_add(const char *buf, size_t count)
if (rc < 0)
goto err_out_rbd_dev;
+ __acquire(&rbd_dev->header_rwsem);
+
if (rbd_dev->opts->alloc_size > rbd_dev->layout.object_size) {
rbd_warn(rbd_dev, "alloc_size adjusted to %u",
rbd_dev->layout.object_size);
next prev parent reply other threads:[~2026-03-04 19:49 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 19:48 [PATCH 00/14] Enable lock context analysis Bart Van Assche
2026-03-04 19:48 ` [PATCH 01/14] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
2026-03-04 20:25 ` Damien Le Moal
2026-03-04 20:59 ` Bart Van Assche
2026-03-04 19:48 ` [PATCH 02/14] blk-ioc: Prepare for enabling thread-safety analysis Bart Van Assche
2026-03-05 10:10 ` Jan Kara
2026-03-05 12:46 ` Bart Van Assche
2026-03-05 13:18 ` Marco Elver
2026-03-05 14:35 ` Bart Van Assche
2026-03-05 20:30 ` Marco Elver
2026-03-04 19:48 ` [PATCH 03/14] block: Make the lock context annotations compatible with Clang Bart Van Assche
2026-03-04 20:03 ` Tejun Heo
2026-03-04 20:29 ` Bart Van Assche
2026-03-04 20:58 ` Tejun Heo
2026-03-04 21:34 ` Bart Van Assche
2026-03-04 21:45 ` Tejun Heo
2026-03-04 21:46 ` Tejun Heo
2026-03-04 19:48 ` [PATCH 04/14] aoe: Add a lock context annotation Bart Van Assche
2026-03-04 19:48 ` [PATCH 05/14] drbd: Make the lock context annotations compatible with Clang Bart Van Assche
2026-03-09 10:08 ` Christoph Böhmwalder
2026-03-09 23:15 ` Bart Van Assche
2026-03-11 20:42 ` Christoph Böhmwalder
2026-03-04 19:48 ` [PATCH 06/14] loop: Add lock context annotations Bart Van Assche
2026-03-04 19:48 ` [PATCH 07/14] nbd: " Bart Van Assche
2026-03-04 19:48 ` [PATCH 08/14] null_blk: Add more " Bart Van Assche
2026-03-04 19:48 ` Bart Van Assche [this message]
2026-03-04 19:48 ` [PATCH 10/14] rnbd: " Bart Van Assche
2026-03-06 13:09 ` Marco Elver
2026-03-06 14:11 ` Bart Van Assche
2026-03-04 19:48 ` [PATCH 11/14] ublk: Fix the " Bart Van Assche
2026-03-04 20:43 ` Caleb Sander Mateos
2026-03-04 20:55 ` Bart Van Assche
2026-03-04 21:03 ` Caleb Sander Mateos
2026-03-04 21:36 ` Bart Van Assche
2026-03-04 19:48 ` [PATCH 12/14] zloop: Add a " Bart Van Assche
2026-03-04 19:48 ` [PATCH 13/14] zram: Add " Bart Van Assche
2026-03-05 1:23 ` Sergey Senozhatsky
2026-03-04 19:48 ` [PATCH 14/14] block: Enable lock context analysis for all block drivers Bart Van Assche
2026-03-05 1:33 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260304194843.760669-10-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=elver@google.com \
--cc=hch@lst.de \
--cc=idryomov@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=nathan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.