diff options
| author | NeilBrown <neilb@suse.de> | 2011-02-16 13:58:51 +1100 |
|---|---|---|
| committer | Willy Tarreau <w@1wt.eu> | 2011-04-30 16:53:09 +0200 |
| commit | 980a8f7b3c241580a17dbfaa0863e5ed3964ea6a (patch) | |
| tree | 6fb4ce2ea748440c1832a2e9f342f7eee1dd8785 /drivers | |
| parent | e1cdcb9854ed738e1382ddd7a8f6a0892f12ceba (diff) | |
| download | linux-980a8f7b3c241580a17dbfaa0863e5ed3964ea6a.tar.gz linux-980a8f7b3c241580a17dbfaa0863e5ed3964ea6a.tar.bz2 linux-980a8f7b3c241580a17dbfaa0863e5ed3964ea6a.zip | |
md: correctly handle probe of an 'mdp' device.
commit 8f5f02c460b7ca74ce55ce126ce0c1e58a3f923d upstream.
'mdp' devices are md devices with preallocated device numbers
for partitions. As such it is possible to mknod and open a partition
before opening the whole device.
this causes md_probe() to be called with a device number of a
partition, which in-turn calls mddev_find with such a number.
However mddev_find expects the number of a 'whole device' and
does the wrong thing with partition numbers.
So add code to mddev_find to remove the 'partition' part of
a device number and just work with the 'whole device'.
This patch addresses https://bugzilla.kernel.org/show_bug.cgi?id=28652
Reported-by: hkmaly@bigfoot.com
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/md/md.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index b0c23a6e6cf7..d7bb62d4e591 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -241,6 +241,9 @@ static mddev_t * mddev_find(dev_t unit) { mddev_t *mddev, *new = NULL; + if (unit && MAJOR(unit) != MD_MAJOR) + unit &= ~((1<<MdpMinorShift)-1); + retry: spin_lock(&all_mddevs_lock); list_for_each_entry(mddev, &all_mddevs, all_mddevs) |
