md: correctly handle probe of an 'mdp' device.
commit54919a0fc2d4d7a9e42300f27fa9f3be0e0d6a75
authorNeilBrown <neilb@suse.de>
Wed, 16 Feb 2011 02:58:51 +0000 (16 13:58 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Mar 2011 19:45:20 +0000 (21 12:45 -0700)
tree2e80a604c484e9bc087333e0fe11a4884398d652
parentea08d3be6b0b8639dfa60d6803909835c9a02d49
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>
drivers/md/md.c