[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120814095240.66d30903@notabene.brown>
Date: Tue, 14 Aug 2012 09:52:40 +1000
From: NeilBrown <neilb@...e.de>
To: Denis Efremov <yefremov.denis@...il.com>
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
ldv-project@...ras.ru
Subject: Re: [PATCH] md/linear: rcu_dereference outside read-lock section
On Tue, 14 Aug 2012 01:08:12 +0400 Denis Efremov <yefremov.denis@...il.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@...il.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
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists