forked from pool/mdadm
ceac01b560
- 0002-DDF-guard-against-pdnum-being-negative.patch - 0003-DDF-fix-possible-mdmon-crash-when-updating-metadata.patch - 0004-DDF-Don-t-fail-compare_super_ddf-due-to-re-configure.patch More upstream DDF fixes (bnc#866660) - 0001-mdmon-.service-Change-type-of-process-start-up-to-fo.patch - 0003-Work-around-architectures-having-statfs.f_type-defin.patch - 0004-DDF-report-seq-counter-as-events.patch - 0005-DDF-when-first-activating-an-array-record-any-missin.patch Two fixes for DDF (bnc#866660) and a couple of other upstream fixes just for good measure. - 0001-Assemble-allow-load_devices-to-change-the-st-which-i.patch 0002-Assemble-re-arrange-freeing-of-tst-in-load_devices.patch 0003-Assemble-change-load_devices-to-return-most_recent-s.patch Allow RAID5 to be assembled even when firs device listed recently failed (bnc#865221) OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=105
90 lines
2.5 KiB
Diff
90 lines
2.5 KiB
Diff
From 9ee314dab91dc8479d2e981d0849ce777f7ea492 Mon Sep 17 00:00:00 2001
|
|
From: NeilBrown <neilb@suse.de>
|
|
Date: Tue, 25 Feb 2014 14:59:12 +1100
|
|
Subject: [PATCH 2/3] Assemble: re-arrange freeing of 'tst' in load_devices().
|
|
|
|
When we return in error, we need to free(tst), and ->free_super(tst);
|
|
Sometimes we didn't.
|
|
|
|
Also the final ->free_super(tst) should be followed by free(tst)
|
|
but wasn't.
|
|
|
|
Move that file free forward in the code a bit as we will want to use
|
|
the tst there in the next patch.
|
|
|
|
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
---
|
|
Assemble.c | 19 +++++++++++--------
|
|
1 file changed, 11 insertions(+), 8 deletions(-)
|
|
|
|
--- mdadm-3.3.orig/Assemble.c
|
|
+++ mdadm-3.3/Assemble.c
|
|
@@ -572,6 +572,7 @@ static int load_devices(struct devs *dev
|
|
for (tmpdev = devlist; tmpdev; tmpdev=tmpdev->next) {
|
|
char *devname = tmpdev->devname;
|
|
struct stat stb;
|
|
+ struct supertype *tst;
|
|
int i;
|
|
|
|
if (tmpdev->used != 1)
|
|
@@ -582,7 +583,6 @@ static int load_devices(struct devs *dev
|
|
int dfd;
|
|
/* prepare useful information in info structures */
|
|
struct stat stb2;
|
|
- struct supertype *tst;
|
|
int err;
|
|
fstat(mdfd, &stb2);
|
|
|
|
@@ -611,6 +611,8 @@ static int load_devices(struct devs *dev
|
|
close(mdfd);
|
|
free(devices);
|
|
free(devmap);
|
|
+ tst->ss->free_super(tst);
|
|
+ free(tst);
|
|
*stp = st;
|
|
return -1;
|
|
}
|
|
@@ -660,15 +662,13 @@ static int load_devices(struct devs *dev
|
|
else
|
|
bitmap_done = 1;
|
|
}
|
|
- tst->ss->free_super(tst);
|
|
} else
|
|
#endif
|
|
{
|
|
- struct supertype *tst = dup_super(st);
|
|
- int dfd;
|
|
- dfd = dev_open(devname,
|
|
- tmpdev->disposition == 'I'
|
|
- ? O_RDWR : (O_RDWR|O_EXCL));
|
|
+ int dfd = dev_open(devname,
|
|
+ tmpdev->disposition == 'I'
|
|
+ ? O_RDWR : (O_RDWR|O_EXCL));
|
|
+ tst = dup_super(st);
|
|
|
|
if (dfd < 0 || tst->ss->load_super(tst, dfd, NULL) != 0) {
|
|
pr_err("cannot re-read metadata from %s - aborting\n",
|
|
@@ -678,11 +678,12 @@ static int load_devices(struct devs *dev
|
|
close(mdfd);
|
|
free(devices);
|
|
free(devmap);
|
|
+ tst->ss->free_super(tst);
|
|
+ free(tst);
|
|
*stp = st;
|
|
return -1;
|
|
}
|
|
tst->ss->getinfo_super(tst, content, devmap + devcnt * content->array.raid_disks);
|
|
- tst->ss->free_super(tst);
|
|
close(dfd);
|
|
}
|
|
|
|
@@ -705,6 +706,8 @@ static int load_devices(struct devs *dev
|
|
> devices[most_recent].i.events)
|
|
most_recent = devcnt;
|
|
}
|
|
+ tst->ss->free_super(tst);
|
|
+ free(tst);
|
|
|
|
if (content->array.level == LEVEL_MULTIPATH)
|
|
/* with multipath, the raid_disk from the superblock is meaningless */
|