Skip to content

Commit

Permalink
md: move revalidate_disk() back outside open_mutex
Browse files Browse the repository at this point in the history
Commit b821eaa "md: remove ->changed and related code" moved
revalidate_disk() under open_mutex, and lockdep noticed.

[ INFO: possible circular locking dependency detected ]
2.6.32-mdadm-locking #1
-------------------------------------------------------
mdadm/3640 is trying to acquire lock:
 (&bdev->bd_mutex){+.+.+.}, at: [<ffffffff811acecb>] revalidate_disk+0x5b/0x90

but task is already holding lock:
 (&mddev->open_mutex){+.+...}, at: [<ffffffffa055e07a>] do_md_stop+0x4a/0x4d0 [md_mod]

which lock already depends on the new lock.

It is suitable for 2.6.35.x

Cc: <stable@kernel.org>
Reported-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
Dan Williams authored and NeilBrown committed Aug 8, 2010
1 parent 51e9ac7 commit 147e0b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -4765,7 +4765,7 @@ static int md_set_readonly(mddev_t *mddev, int is_open)
*/
static int do_md_stop(mddev_t * mddev, int mode, int is_open)
{
int err = 0;
int err = 0, revalidate = 0;
struct gendisk *disk = mddev->gendisk;
mdk_rdev_t *rdev;

Expand Down Expand Up @@ -4795,14 +4795,16 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
}

set_capacity(disk, 0);
revalidate_disk(disk);
revalidate = 1;

if (mddev->ro)
mddev->ro = 0;

err = 0;
}
mutex_unlock(&mddev->open_mutex);
if (revalidate)
revalidate_disk(disk);
if (err)
return err;
/*
Expand Down

0 comments on commit 147e0b6

Please sign in to comment.