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>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Andreas Gruenbacher <agruen@linbit.com>,
	linux-block@vger.kernel.org,
	"open list:DRBD DRIVER" <drbd-dev@lists.linbit.com>
Subject: Re: [PATCH 03/62] drbd: Balance RCU calls in drbd_adm_dump_devices()
Date: Tue, 24 Feb 2026 16:41:31 +0100	[thread overview]
Message-ID: <2b3db22a-ea67-4a3e-83e5-75eb0cf95258@linbit.com> (raw)
In-Reply-To: <20260223214950.2153735-4-bvanassche@acm.org>

Am 23.02.26 um 22:48 schrieb Bart Van Assche:
> Make drbd_adm_dump_devices() call rcu_read_lock() before
> rcu_read_unlock() is called. This has been detected by the Clang
> thread-safety analyzer. Compile-tested only.
> 
> Cc: Andreas Gruenbacher <agruen@linbit.com>
> Cc: linux-block@vger.kernel.org
> Fixes: a55bbd375d18 ("drbd: Backport the "status" command")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/block/drbd/drbd_nl.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
> index e201f0087a0f..728ecc431b38 100644
> --- a/drivers/block/drbd/drbd_nl.c
> +++ b/drivers/block/drbd/drbd_nl.c
> @@ -3378,8 +3378,10 @@ int drbd_adm_dump_devices(struct sk_buff *skb, struct netlink_callback *cb)
>  		if (resource_filter) {
>  			retcode = ERR_RES_NOT_KNOWN;
>  			resource = drbd_find_resource(nla_data(resource_filter));
> -			if (!resource)
> +			if (!resource) {
> +				rcu_read_lock();
>  				goto put_result;
> +			}
>  			cb->args[0] = (long)resource;
>  		}
>  	}
> @@ -3628,8 +3630,10 @@ int drbd_adm_dump_peer_devices(struct sk_buff *skb, struct netlink_callback *cb)
>  		if (resource_filter) {
>  			retcode = ERR_RES_NOT_KNOWN;
>  			resource = drbd_find_resource(nla_data(resource_filter));
> -			if (!resource)
> +			if (!resource) {
> +				rcu_read_lock();
>  				goto put_result;
> +			}
>  		}
>  		cb->args[0] = (long)resource;
>  	}
> 

Passes our internal DRBD test suite.

Tested-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>

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


  reply	other threads:[~2026-02-24 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260223214950.2153735-1-bvanassche@acm.org>
2026-02-23 21:48 ` [PATCH 02/62] blk-ioc: Prepare for enabling thread-safety analysis Bart Van Assche
2026-02-24 14:45   ` Christoph Hellwig
2026-02-24 17:35     ` Bart Van Assche
2026-02-23 21:48 ` [PATCH 03/62] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
2026-02-24 15:41   ` Christoph Böhmwalder [this message]
     [not found] <20260223215118.2154194-1-bvanassche@acm.org>
2026-02-23 21:50 ` Bart Van Assche
     [not found] <20260223220102.2158611-1-bart.vanassche@linux.dev>
2026-02-23 22:00 ` Bart Van Assche

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=2b3db22a-ea67-4a3e-83e5-75eb0cf95258@linbit.com \
    --to=christoph.boehmwalder@linbit.com \
    --cc=agruen@linbit.com \
    --cc=bvanassche@acm.org \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-block@vger.kernel.org \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox