public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
To: Bart Van Assche <bvanassche@acm.org>, 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,
	Philipp Reisner <philipp.reisner@linbit.com>,
	Lars Ellenberg <lars.ellenberg@linbit.com>,
	Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH 05/14] drbd: Make the lock context annotations compatible with Clang
Date: Mon, 9 Mar 2026 11:08:41 +0100	[thread overview]
Message-ID: <cbcfb229-9a5d-4552-9ced-788de1e69842@linbit.com> (raw)
In-Reply-To: <20260304194843.760669-6-bvanassche@acm.org>

Am 04.03.26 um 20:48 schrieb Bart Van Assche:
> Clang performs more strict checking of lock context annotations than
> sparse. This patch makes the DRBD lock context annotations compatible
> with Clang and prepares for enabling lock context analysis.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/block/drbd/drbd_bitmap.c   | 20 +++++++------
>  drivers/block/drbd/drbd_int.h      | 46 ++++++++++++++----------------
>  drivers/block/drbd/drbd_main.c     | 45 ++++++++++++++++++++++-------
>  drivers/block/drbd/drbd_nl.c       |  5 ++--
>  drivers/block/drbd/drbd_receiver.c | 20 +++++++------
>  drivers/block/drbd/drbd_req.c      |  2 ++
>  drivers/block/drbd/drbd_state.c    |  3 ++
>  drivers/block/drbd/drbd_worker.c   |  6 ++--
>  8 files changed, 91 insertions(+), 56 deletions(-)
[...]
>  
>  void drbd_send_sr_reply(struct drbd_peer_device *peer_device, enum drbd_state_rv retcode)
> +	__cond_acquires(true, peer_device->connection->data.mutex)
>  {
>  	struct drbd_socket *sock;
>  	struct p_req_state_reply *p;
> @@ -1048,6 +1063,7 @@ void drbd_send_sr_reply(struct drbd_peer_device *peer_device, enum drbd_state_rv
>  }
>  
>  void conn_send_sr_reply(struct drbd_connection *connection, enum drbd_state_rv retcode)
> +	__cond_acquires(true, connection->data.mutex)
>  {
>  	struct drbd_socket *sock;
>  	struct p_req_state_reply *p;

These are marked as acquiring connection->data.mutex, but actually use
connection->meta later. So the annotation should reference meta.mutex.

Also, I think the annotations on drbd_send_* are wrong. These functions
have no path where they return without releasing the mutex, but these
annotations would tell clang that they hold the mutex on non-zero return.

Regards,
Christoph

-- 
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA —  Disaster Recovery — Software defined Storage


  reply	other threads:[~2026-03-09 10:08 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 [this message]
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 ` [PATCH 09/14] rbd: Add " Bart Van Assche
2026-03-04 19:48 ` [PATCH 10/14] rnbd: Add more " 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=cbcfb229-9a5d-4552-9ced-788de1e69842@linbit.com \
    --to=christoph.boehmwalder@linbit.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=elver@google.com \
    --cc=hch@lst.de \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-block@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=philipp.reisner@linbit.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox