From 506ffd1e0bd08cc74f5177d4f4db7c66d7724f6a Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 12 Apr 2009 00:58:28 -0700 Subject: [PATCH] RebuildMap: handle missing disks When rebuilding the map file tolerate missing/offline disks, otherwise we will segfault on the NULL return from sysfs_read. Reported-by: Jacek Danecki Signed-off-by: Dan Williams --- mapfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mapfile.c b/mapfile.c index ca7072ec..f2762322 100644 --- a/mapfile.c +++ b/mapfile.c @@ -294,9 +294,12 @@ void RebuildMap(void) int mdp = get_mdp_major(); for (md = mdstat ; md ; md = md->next) { - struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_DEVS); + struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_DEVS|SKIP_GONE_DEVS); struct mdinfo *sd; + if (!sra) + continue; + for (sd = sra->devs ; sd ; sd = sd->next) { char dn[30]; int dfd; -- 2.39.2