summaryrefslogtreecommitdiffstats
path: root/Monitor.c
diff options
context:
space:
mode:
authorTomasz Majchrzak <tomasz.majchrzak@intel.com>2017-06-19 11:19:53 +0200
committerJes Sorensen <jsorensen@fb.com>2017-07-10 19:40:05 +0200
commitcb91230c87e02bf885759e9218abea629ab9f4b9 (patch)
treea66f4a98c45f1bf36399c26cd361ab739815fdbf /Monitor.c
parentmdadm/test: Add '--disks=' to support testing phsical devices (diff)
downloadmdadm-cb91230c87e02bf885759e9218abea629ab9f4b9.tar.xz
mdadm-cb91230c87e02bf885759e9218abea629ab9f4b9.zip
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 9e04ac1c43e6 ("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>
Diffstat (limited to 'Monitor.c')
-rw-r--r--Monitor.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Monitor.c b/Monitor.c
index bef2f1be..48c451c4 100644
--- a/Monitor.c
+++ b/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;
+
+ tmp = devid2devnm(rdev);
+ if (!tmp) {
+ pr_err("Cannot get md device name.\n");
return 2;
- strcpy(devnm, dev);
+ }
+
+ strcpy(devnm, tmp);
while(1) {
struct mdstat_ent *ms = mdstat_read(1, 0);