Commit 69540466 authored by jan.koester's avatar jan.koester
Browse files

test

parent 02ee9e9f
Loading
Loading
Loading
Loading
+7 −4
Changes for src/raid.cpp: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -1034,7 +1034,8 @@ Result replace(const sysbus::Message &a) {
    int slot = m->slot;
    if (!with.empty()) {
        if (Check e = addSpare(arr, with, flag(a, "confirm"))) return *e;
        if (!loadArray(arr.name, arr)) return fail(tr("no array %1", "kein Array %1", {arr.name}), 404);
        std::string name = arr.name;  // loadArray clears arr first
        if (!loadArray(name, arr)) return fail(tr("no array %1", "kein Array %1", {name}), 404);
    }
    bool spare = false;
    for (const Member &x : arr.members)
@@ -1122,8 +1123,8 @@ Result destroy(const sysbus::Message &a) {
// mdadm --assemble --force: the freshest of the stale members are taken
// as current, one at a time, until md can run the set -- their events
// are raised to the newest and every current superblock gives them their
// slot back. A degraded RAID 4/5/6 with a resync pending is marked clean,
// md refuses to run it otherwise. What was written while they were out
// slot back. A degraded RAID 4/5/6 is marked clean, md refuses to run it
// with a resync pending. What was written while they were out
// isn't on them: a repair (CheckArray) afterwards evens out the parity.
// "" or an error; forced: the devices taken.
std::string forceSet(const Found &f, std::vector<std::string> &forced) {
@@ -1147,8 +1148,10 @@ std::string forceSet(const Found &f, std::vector<std::string> &forced) {
        take.push_back(best);
        have.insert(disks[best].second.role());
    }
    // (whichever superblock md goes by: with equal events a taken one may
    // be the one with the resync pending -- mdadm's force-array)
    bool parity = f.level == 4 || f.level == 5 || f.level == 6;
    bool markClean = parity && f.dirty && (int)have.size() < f.raidDisks;
    bool markClean = parity && (int)have.size() < f.raidDisks;
    if (take.empty() && !markClean) return "";
    // every superblock written gets the newest one's slots, the taken
    // devices in theirs: md may go by any of them, their events are equal