Monitor: don't assume mdadm parameter is a block device
If symlink (e.g. /dev/md/raid) is passed as a parameter to mdadm --wait,
it fails as it's not able to find a corresponding entry in /proc/mdstat
output. Get parameter file major:minor and look for block device name in
sysfs. This commit is partial revert of commit 9e04ac1c43
("mdadm/util: unify stat checking blkdev into function").
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
parent
25357919d2
commit
cb91230c87
13
Monitor.c
13
Monitor.c
|
@ -982,12 +982,21 @@ static void link_containers_with_subarrays(struct state *list)
|
|||
int Wait(char *dev)
|
||||
{
|
||||
char devnm[32];
|
||||
dev_t rdev;
|
||||
char *tmp;
|
||||
int rv = 1;
|
||||
int frozen_remaining = 3;
|
||||
|
||||
if (!stat_is_blkdev(dev, NULL))
|
||||
if (!stat_is_blkdev(dev, &rdev))
|
||||
return 2;
|
||||
strcpy(devnm, dev);
|
||||
|
||||
tmp = devid2devnm(rdev);
|
||||
if (!tmp) {
|
||||
pr_err("Cannot get md device name.\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
strcpy(devnm, tmp);
|
||||
|
||||
while(1) {
|
||||
struct mdstat_ent *ms = mdstat_read(1, 0);
|
||||
|
|
Loading…
Reference in New Issue