summaryrefslogtreecommitdiffstats
path: root/mapfile.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-04-12 00:58:28 -0700
committerDan Williams <dan.j.williams@intel.com>2009-04-12 00:58:28 -0700
commit506ffd1e0bd08cc74f5177d4f4db7c66d7724f6a (patch)
tree86972ba933cd8b81e32c09ceda431955bb653eba /mapfile.c
parent252d23c018cefb2e42c494b1789f5e4945063ee3 (diff)
downloadmdadm-506ffd1e0bd08cc74f5177d4f4db7c66d7724f6a.tar.gz
mdadm-506ffd1e0bd08cc74f5177d4f4db7c66d7724f6a.tar.xz
mdadm-506ffd1e0bd08cc74f5177d4f4db7c66d7724f6a.zip
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 <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'mapfile.c')
-rw-r--r--mapfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mapfile.c b/mapfile.c
index ca7072e..f276232 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;