linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Denis Efremov <yefremov.denis@gmail.com>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@ispras.ru
Subject: Re: [PATCH] md/linear: rcu_dereference outside read-lock section
Date: Tue, 14 Aug 2012 09:52:40 +1000	[thread overview]
Message-ID: <20120814095240.66d30903@notabene.brown> (raw)
In-Reply-To: <1344892092-13686-1-git-send-email-yefremov.denis@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]

On Tue, 14 Aug 2012 01:08:12 +0400 Denis Efremov <yefremov.denis@gmail.com>
wrote:

> According to the comment in linear_stop function
> rcu_dereference in linear_start and linear_stop functions
> occurs under reconfig_mutex. The patch represents this
> agreement in code and prevents lockdep complaint.
> 
> Found by Linux Driver Verification project (linuxtesting.org)
> 
> Signed-off-by: Denis Efremov <yefremov.denis@gmail.com>
> ---
>  drivers/md/linear.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/linear.c b/drivers/md/linear.c
> index fa211d8..093f3e4 100644
> --- a/drivers/md/linear.c
> +++ b/drivers/md/linear.c
> @@ -244,7 +244,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
>  	if (!newconf)
>  		return -ENOMEM;
>  
> -	oldconf = rcu_dereference(mddev->private);
> +	oldconf = rcu_dereference_protected(mddev->private,
> +					    lockdep_is_held(&mddev->reconfig_mutex));
>  	mddev->raid_disks++;
>  	rcu_assign_pointer(mddev->private, newconf);
>  	md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
> @@ -256,7 +257,9 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
>  
>  static int linear_stop (struct mddev *mddev)
>  {
> -	struct linear_conf *conf = mddev->private;
> +	struct linear_conf *conf =
> +		rcu_dereference_protected(mddev->private,
> +					  lockdep_is_held(&mddev->reconfig_mutex));
>  
>  	/*
>  	 * We do not require rcu protection here since


Applied, thanks.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2012-08-13 23:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 21:08 [PATCH] md/linear: rcu_dereference outside read-lock section Denis Efremov
2012-08-13 23:52 ` NeilBrown [this message]

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=20120814095240.66d30903@notabene.brown \
    --to=neilb@suse.de \
    --cc=ldv-project@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=yefremov.denis@gmail.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;
as well as URLs for NNTP newsgroup(s).