[-]
[+]
|
Changed |
mdadm.changes
|
|
[-]
[+]
|
Changed |
mdadm.spec
^
|
|
[-]
[+]
|
Added |
mdadm-3.2.6.tar.bz2/ANNOUNCE-3.2.6
^
|
@@ -0,0 +1,57 @@
+Subject: ANNOUNCE: mdadm 3.2.6 - A tool for managing Soft RAID under Linux
+
+I am pleased to announce the availability of
+ mdadm version 3.2.6
+
+It is available at the usual places, now including github:
+ countrycode=xx.
+ http://www.${countrycode}kernel.org/pub/linux/utils/raid/mdadm/
+and via git at
+ git://github.com/neilbrown/mdadm
+ git://neil.brown.name/mdadm
+ http://neil.brown.name/git/mdadm
+
+This is a stablity release which adds a number of bugfixs to 3.2.5.
+There are no real stand-out fixes, just lots of little bits and pieces.
+
+Below is the "git log --oneline --reverse" list of changes since
+3.2.5.
+
+NeilBrown 25th October 2012
+
+b7e05d2 udev-rules: prevent systemd from mount devices before they are ready.
+0d478e2 mdadm: Fix Segmentation fault.
+42f0ca1 imsm: fix: correct checking volume's degradation
+fcf2195 Monitor: fix inconsistencies in values for ->percent
+5f862fb Monitor: Report NewArray when an array the disappeared, reappears.
+6f51b1c Monitor: fix reporting for Fail vs FailSpare etc.
+68ad53b mdmon: fix arg parsing.
+517f135 Assemble: don't leak memory with fdlist.
+090900c udev-rules: prevent systemd from mount devices before they are ready.
+446e000 sha1.h: remove ansidecl.h header inclusion
+ec894f5 Manage: zero metadata before adding to 'external' array.
+3a84db5 ddf: allow a non-spare to be used to recovery a missing device.
+c5d61ca ddf: hack to fix container recognition.
+23084aa mdmon: fix arg processing for -a
+c4e96a3 mdmon: allow --takeover when original was started with --offroot
+80841df find_free_devnum: avoid auto-using names in /etc/mdadm.conf
+c5c56d6 mapfile: fix mapfile rebuild for containers
+aec89f6 fix segfaults in Detail()
+2117ad1 Fix 'enough' function for RAID10.
+0bc300d Use --offroot flag when assembling md arrays via --incrmental
+ac78f24 Grow: make warning about old metadata more explicit.
+14026ab Replace sha1.h with slightly older version.
+6f6809f Add zlib license to crc32.c
+5267ba0 Handles spaces in array names better.
+c51f288 imsm: allow --assume-clean to work.
+acf7076 Grow: allow --grow --continue to work for native metadata.
+335d2a6 Grow: fix a couple of typos with --assume-clean usage
+9ff1427 Fix open_container
+3713633 mdadm: super0: do not override uuid with homehost
+31bff58 Trivial bugfix and spelling fixes.
+e1e539f Detail: don't report a faulty device as 'spare' or 'rebuilding'.
+22a6461 super0: allow creation of array on 2TB+ devices.
+a5d47a2 Create new md devices consistently
+eb48676 Monitor: don't complain about non-monitorable arrays in mdadm.conf
+ecdf2d7 Query: don't be confused by partition tables.
+f7b75c1 Query: allow member of non-0.90 arrays to be better reported.
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Assemble.c
^
|
@@ -1239,6 +1239,7 @@
i--;
if (fdlist[i]>=0) close(fdlist[i]);
}
+ free(fdlist);
if (err) {
fprintf(stderr, Name ": Failed to restore critical section for reshape, sorry.\n");
if (backup_file == NULL)
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Build.c
^
|
@@ -174,7 +174,7 @@
goto abort;
}
if ((stb.st_mode & S_IFMT)!= S_IFBLK) {
- fprintf(stderr, Name ": Wierd: %s is no longer a block device.\n",
+ fprintf(stderr, Name ": Weird: %s is no longer a block device.\n",
dv->devname);
goto abort;
}
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Detail.c
^
|
@@ -206,8 +206,11 @@
printf("MD_UUID=%s\n", nbuf+5);
mp = map_by_uuid(&map, info->uuid);
if (mp && mp->path &&
- strncmp(mp->path, "/dev/md/", 8) == 0)
- printf("MD_DEVNAME=%s\n", mp->path+8);
+ strncmp(mp->path, "/dev/md/", 8) == 0) {
+ printf("MD_DEVNAME=");
+ print_escape(mp->path+8);
+ putchar('\n');
+ }
if (st->ss->export_detail_super)
st->ss->export_detail_super(st);
@@ -220,8 +223,11 @@
printf("MD_UUID=%s\n", nbuf+5);
}
if (mp && mp->path &&
- strncmp(mp->path, "/dev/md/", 8) == 0)
- printf("MD_DEVNAME=%s\n", mp->path+8);
+ strncmp(mp->path, "/dev/md/", 8) == 0) {
+ printf("MD_DEVNAME=");
+ print_escape(mp->path+8);
+ putchar('\n');
+ }
}
goto out;
}
@@ -374,11 +380,11 @@
printf(" State : %s%s%s%s%s%s \n",
(array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
- (!e || (e->percent < 0 && e->percent != PROCESS_PENDING &&
- e->percent != PROCESS_DELAYED)) ? "" : sync_action[e->resync],
+ (!e || (e->percent < 0 && e->percent != RESYNC_PENDING &&
+ e->percent != RESYNC_DELAYED)) ? "" : sync_action[e->resync],
larray_size ? "": ", Not Started",
- e->percent == PROCESS_DELAYED ? " (DELAYED)": "",
- e->percent == PROCESS_PENDING ? " (PENDING)": "");
+ e->percent == RESYNC_DELAYED ? " (DELAYED)": "",
+ e->percent == RESYNC_PENDING ? " (PENDING)": "");
}
if (array.raid_disks)
printf(" Active Devices : %d\n", array.active_disks);
@@ -424,7 +430,7 @@
}
free_mdstat(ms);
- if (st->sb && info->reshape_active) {
+ if ((st && st->sb) && (info && info->reshape_active)) {
#if 0
This is pretty boring
printf(" Reshape pos'n : %llu%s\n", (unsigned long long) info->reshape_progress<<9,
@@ -537,7 +543,8 @@
if (disk.state & (1<<MD_DISK_REMOVED)) printf(" removed");
if (disk.state & (1<<MD_DISK_WRITEMOSTLY)) printf(" writemostly");
if ((disk.state &
- ((1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC)|(1<<MD_DISK_REMOVED)))
+ ((1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC)
+ |(1<<MD_DISK_REMOVED)|(1<<MD_DISK_FAULTY)))
== 0) {
printf(" spare");
if (is_26) {
@@ -575,7 +582,8 @@
if (spares && brief && array.raid_disks) printf(" spares=%d", spares);
if (brief && st && st->sb)
st->ss->brief_detail_super(st);
- st->ss->free_super(st);
+ if (st)
+ st->ss->free_super(st);
if (brief > 1 && devices) printf("\n devices=%s", devices);
if (brief) printf("\n");
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Grow.c
^
|
@@ -1775,12 +1775,12 @@
goto release;
}
if (assume_clean) {
- /* This will fail on kernels newer than 3.0 unless
+ /* This will fail on kernels older than 3.0 unless
* a backport has been arranged.
*/
if (sra == NULL ||
sysfs_set_str(sra, NULL, "resync_start", "none") < 0)
- fprintf(stderr, Name ": --assume-clean not support with --grow on this kernel\n");
+ fprintf(stderr, Name ": --assume-clean not supported with --grow on this kernel\n");
}
ioctl(fd, GET_ARRAY_INFO, &array);
size = get_component_size(fd)/2;
@@ -3755,9 +3755,8 @@
(unsigned long)__le64_to_cpu(bsb.mtime),
(unsigned long)info->array.utime);
} else {
- if (verbose)
- fprintf(stderr, Name ": too-old timestamp on "
- "backup-metadata on %s\n", devname);
+ fprintf(stderr, Name ": too-old timestamp on backup-metadata on %s\n", devname);
+ fprintf(stderr, Name ": If you think it is should be safe, try 'export MDADM_GROW_ALLOW_OLD=1'\n");
continue; /* time stamp is too bad */
}
}
@@ -3994,15 +3993,49 @@
}
dprintf("Grow continue is run for ");
if (st->ss->external == 0) {
+ int d;
dprintf("native array (%s)\n", devname);
- if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
+ if (ioctl(fd, GET_ARRAY_INFO, &array.array) < 0) {
fprintf(stderr, Name ": %s is not an active md array -"
" aborting\n", devname);
ret_val = 1;
goto Grow_continue_command_exit;
}
content = &array;
- sysfs_init(content, fd, st->devnum);
+ /* Need to load a superblock.
+ * FIXME we should really get what we need from
+ * sysfs
+ */
+ for (d = 0; d < MAX_DISKS; d++) {
+ mdu_disk_info_t disk;
+ char *dv;
+ int err;
+ disk.number = d;
+ if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
+ continue;
+ if (disk.major == 0 && disk.minor == 0)
+ continue;
+ if ((disk.state & (1 << MD_DISK_ACTIVE)) == 0)
+ continue;
+ dv = map_dev(disk.major, disk.minor, 1);
+ if (!dv)
+ continue;
+ fd2 = dev_open(dv, O_RDONLY);
+ if (fd2 < 0)
+ continue;
+ err = st->ss->load_super(st, fd2, NULL);
+ close(fd2);
+ if (err)
+ continue;
+ break;
+ }
+ if (d == MAX_DISKS) {
+ fprintf(stderr, Name ": Unable to load metadata for %s\n",
+ devname);
+ ret_val = 1;
+ goto Grow_continue_command_exit;
+ }
+ st->ss->getinfo_super(st, content, NULL);
} else {
int container_dev;
@@ -4115,8 +4148,7 @@
/* verify that array under reshape is started from
* correct position
*/
- if (verify_reshape_position(content,
- map_name(pers, mdstat->level)) < 0) {
+ if (verify_reshape_position(content, content->array.level) < 0) {
ret_val = 1;
goto Grow_continue_command_exit;
}
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Manage.c
^
|
@@ -1003,6 +1003,7 @@
goto abort;
}
+ Kill(dv->devname, NULL, 0, -1, 0);
dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
if (mdmon_running(tst->container_dev))
tst->update_tail = &tst->updates;
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Monitor.c
^
|
@@ -42,6 +42,7 @@
int err;
char *spare_group;
int active, working, failed, spare, raid;
+ int from_config;
int expected_spares;
int devstate[MaxDisks];
dev_t devid[MaxDisks];
@@ -183,7 +184,8 @@
}
st->next = statelist;
st->devnum = INT_MAX;
- st->percent = -2;
+ st->percent = RESYNC_UNKNOWN;
+ st->from_config = 1;
st->expected_spares = mdlist->spare_disks;
if (mdlist->spare_group)
st->spare_group = strdup(mdlist->spare_group);
@@ -199,7 +201,7 @@
st->devname = strdup(dv->devname);
st->next = statelist;
st->devnum = INT_MAX;
- st->percent = -2;
+ st->percent = RESYNC_UNKNOWN;
st->expected_spares = -1;
if (mdlist) {
st->expected_spares = mdlist->spare_disks;
@@ -460,6 +462,7 @@
int i;
int remaining_disks;
int last_disk;
+ int new_array = 0;
if (test)
alert("TestMessage", dev, NULL, ainfo);
@@ -482,7 +485,7 @@
* have a device disappear than all of them that can
*/
if (array.level == 0 || array.level == -1) {
- if (!st->err)
+ if (!st->err && !st->from_config)
alert("DeviceDisappeared", dev, "Wrong-Level", ainfo);
st->err = 1;
close(fd);
@@ -518,6 +521,14 @@
* just make sure it is always different. */
array.utime = st->utime + 1;;
+ if (st->err) {
+ /* New array appeared where previously had and error */
+ st->err = 0;
+ st->percent = RESYNC_NONE;
+ new_array = 1;
+ alert("NewArray", st->devname, NULL, ainfo);
+ }
+
if (st->utime == array.utime &&
st->failed == array.failed_disks &&
st->working == array.working_disks &&
@@ -526,7 +537,6 @@
mse->percent == st->percent
))) {
close(fd);
- st->err = 0;
if ((st->active < st->raid) && st->spare == 0)
return 1;
else
@@ -541,7 +551,7 @@
st->expected_spares > 0 &&
array.spare_disks < st->expected_spares)
alert("SparesMissing", dev, NULL, ainfo);
- if (st->percent == -1 &&
+ if (st->percent < 0 && st->percent != RESYNC_UNKNOWN &&
mse->percent >= 0)
alert("RebuildStarted", dev, NULL, ainfo);
if (st->percent >= 0 &&
@@ -557,7 +567,7 @@
alert(percentalert, dev, NULL, ainfo);
}
- if (mse->percent == -1 &&
+ if (mse->percent == RESYNC_NONE &&
st->percent >= 0) {
/* Rebuild/sync/whatever just finished.
* If there is a number in /mismatch_cnt,
@@ -613,10 +623,8 @@
int change;
char *dv = NULL;
disc.number = i;
- if (i >= last_disk) {
- newstate = 0;
- disc.major = disc.minor = 0;
- } else if (info[i].major || info[i].minor) {
+ if (i < last_disk &&
+ (info[i].major || info[i].minor)) {
newstate = info[i].state;
dv = map_dev_preferred(
info[i].major, info[i].minor, 1,
@@ -624,37 +632,22 @@
disc.state = newstate;
disc.major = info[i].major;
disc.minor = info[i].minor;
- } else if (mse && mse->pattern && i < (int)strlen(mse->pattern)) {
- switch(mse->pattern[i]) {
- case 'U': newstate = 6 /* ACTIVE/SYNC */; break;
- case '_': newstate = 8 /* REMOVED */; break;
- }
- disc.major = disc.minor = 0;
- }
+ } else
+ newstate = (1 << MD_DISK_REMOVED);
+
if (dv == NULL && st->devid[i])
dv = map_dev_preferred(
major(st->devid[i]),
minor(st->devid[i]), 1, prefer);
change = newstate ^ st->devstate[i];
- if (st->utime && change && !st->err) {
- if (i < array.raid_disks &&
- (((newstate&change)&(1<<MD_DISK_FAULTY)) ||
- ((st->devstate[i]&change)&(1<<MD_DISK_ACTIVE)) ||
- ((st->devstate[i]&change)&(1<<MD_DISK_SYNC)))
- )
+ if (st->utime && change && !st->err && !new_array) {
+ if ((st->devstate[i]&change)&(1<<MD_DISK_SYNC))
alert("Fail", dev, dv, ainfo);
- else if (i >= array.raid_disks &&
+ else if ((newstate & (1<<MD_DISK_FAULTY)) &&
(disc.major || disc.minor) &&
- st->devid[i] == makedev(disc.major, disc.minor) &&
- ((newstate&change)&(1<<MD_DISK_FAULTY))
- )
+ st->devid[i] == makedev(disc.major, disc.minor))
alert("FailSpare", dev, dv, ainfo);
- else if (i < array.raid_disks &&
- ! (newstate & (1<<MD_DISK_REMOVED)) &&
- (((st->devstate[i]&change)&(1<<MD_DISK_FAULTY)) ||
- ((newstate&change)&(1<<MD_DISK_ACTIVE)) ||
- ((newstate&change)&(1<<MD_DISK_SYNC)))
- )
+ else if ((newstate&change)&(1<<MD_DISK_SYNC))
alert("SpareActive", dev, dv, ainfo);
}
st->devstate[i] = newstate;
@@ -707,7 +700,7 @@
st->next = *statelist;
st->err = 1;
st->devnum = mse->devnum;
- st->percent = -2;
+ st->percent = RESYNC_UNKNOWN;
st->expected_spares = -1;
if (mse->metadata_version &&
strncmp(mse->metadata_version, "external:", 9) == 0 &&
@@ -719,7 +712,6 @@
*statelist = st;
if (test)
alert("TestMessage", st->devname, NULL, info);
- alert("NewArray", st->devname, NULL, info);
new_found = 1;
}
return new_found;
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/Query.c
^
|
@@ -82,16 +82,20 @@
array.spare_disks, array.spare_disks==1?"":"s");
}
st = guess_super(fd);
- if (st)
+ if (st && st->ss->compare_super != NULL)
superror = st->ss->load_super(st, fd, dev);
else
superror = -1;
close(fd);
if (superror == 0) {
/* array might be active... */
+ int uuid[4];
+ struct map_ent *me, *map = NULL;
st->ss->getinfo_super(st, &info, NULL);
- if (st->ss == &super0) {
- mddev = get_md_name(info.array.md_minor);
+ st->ss->uuid_from_super(st, uuid);
+ me = map_by_uuid(&map, uuid);
+ if (me) {
+ mddev = me->path;
disc.number = info.disk.number;
activity = "undetected";
if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
@@ -106,7 +110,7 @@
close(fd);
}
} else {
- activity = "unknown";
+ activity = "inactive";
mddev = "array";
}
printf("%s: device %d in %d device %s %s %s. Use mdadm --examine for more detail.\n",
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/ReadMe.c
^
|
@@ -24,7 +24,7 @@
#include "mdadm.h"
-char Version[] = Name " - v3.2.5 - 18th May 2012\n";
+char Version[] = Name " - v3.2.6 - 25th October 2012\n";
/*
* File: ReadMe.c
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/crc32.c
^
|
@@ -2,6 +2,26 @@
* Copyright (C) 1995-2003 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
+ * Note: zlib license from from zlib.h added explicitly as mdadm does
+ * not include zlib.h. License from v1.2.2 of zlib:
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ *
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
* tables for updating the shift register in one step with three exclusive-ors
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/inventory
^
|
@@ -16,6 +16,7 @@
ANNOUNCE-3.2.3
ANNOUNCE-3.2.4
ANNOUNCE-3.2.5
+ANNOUNCE-3.2.6
Assemble.c
Build.c
COPYING
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/lib.c
^
|
@@ -325,3 +325,71 @@
}
return word;
}
+
+void print_quoted(char *str)
+{
+ /* Printf the string with surrounding quotes
+ * iff needed.
+ * If no space, tab, or quote - leave unchanged.
+ * Else print surrounded by " or ', swapping quotes
+ * when we find one that will cause confusion.
+ */
+
+ char first_quote = 0, q;
+ char *c;
+
+ for (c = str; *c; c++) {
+ switch(*c) {
+ case '\'':
+ case '"':
+ first_quote = *c;
+ break;
+ case ' ':
+ case '\t':
+ first_quote = *c;
+ continue;
+ default:
+ continue;
+ }
+ break;
+ }
+ if (!first_quote) {
+ printf("%s", str);
+ return;
+ }
+
+ if (first_quote == '"')
+ q = '\'';
+ else
+ q = '"';
+ putchar(q);
+ for (c = str; *c; c++) {
+ if (*c == q) {
+ putchar(q);
+ q ^= '"' ^ '\'';
+ putchar(q);
+ }
+ putchar(*c);
+ }
+ putchar(q);
+}
+
+void print_escape(char *str)
+{
+ /* print str, but change space and tab to '_'
+ * as is suitable for device names
+ */
+ for (; *str ; str++) {
+ switch (*str) {
+ case ' ':
+ case '\t':
+ putchar('_');
+ break;
+ case '/':
+ putchar('-');
+ break;
+ default:
+ putchar(*str);
+ }
+ }
+}
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mapfile.c
^
|
@@ -403,7 +403,12 @@
close(dfd);
if (ok != 0)
continue;
- info = st->ss->container_content(st, subarray);
+ if (subarray)
+ info = st->ss->container_content(st, subarray);
+ else {
+ info = malloc(sizeof(*info));
+ st->ss->getinfo_super(st, info, NULL);
+ }
if (!info)
continue;
@@ -417,7 +422,7 @@
* an MD_DEVNAME for udev.
* The name needs to be unique both in /dev/md/
* and in this mapfile.
- * It needs to match watch -I or -As would come
+ * It needs to match what -I or -As would come
* up with.
* That means:
* Check if array is in mdadm.conf
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/md.4
^
|
@@ -773,7 +773,7 @@
.I n
gives the md device number,
.I l
-gives the level, 0 for RAID0 or -1 for LINEAR,
+gives the level, 0 for RAID0 or \-1 for LINEAR,
.I c
gives the chunk size as a base-2 logarithm offset by twelve, so 0
means 4K, 1 means 8K.
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdadm.8.in
^
|
@@ -5,7 +5,7 @@
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\" See file COPYING in distribution for details.
-.TH MDADM 8 "" v3.2.5
+.TH MDADM 8 "" v3.2.6
.SH NAME
mdadm \- manage MD devices
.I aka
@@ -332,7 +332,6 @@
.IP "0, 0.90, default"
.el
.IP "0, 0.90"
-..
Use the original 0.90 format superblock. This format limits arrays to
28 component devices and limits component devices of levels 1 and
greater to 2 terabytes. It is also possible for there to be confusion
@@ -342,7 +341,6 @@
.IP "1, 1.0, 1.1, 1.2"
.el
.IP "1, 1.0, 1.1, 1.2 default"
-..
Use the new version-1 format superblock. This has fewer restrictions.
It can easily be moved between hosts with different endian-ness, and a
recovery operation can be checkpointed and restarted. The different
@@ -888,30 +886,6 @@
or
.BR \-\-build .
-.ig XX
-.\".TP
-.\".BR \-\-symlink = no
-.\"Normally when
-.\".B \-\-auto
-.\"causes
-.\".I mdadm
-.\"to create devices in
-.\".B /dev/md/
-.\"it will also create symlinks from
-.\".B /dev/
-.\"with names starting with
-.\".B md
-.\"or
-.\".BR md_ .
-.\"Use
-.\".B \-\-symlink=no
-.\"to suppress this, or
-.\".B \-\-symlink=yes
-.\"to enforce this even if it is suppressing
-.\".IR mdadm.conf .
-.\"
-.XX
-
.TP
.BR \-a ", " "\-\-add"
This option can be used in Grow mode in two cases.
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdadm.conf.5
^
|
@@ -573,7 +573,7 @@
.br
HOMEHOST <system>
.br
-AUTO +1.x homehost -all
+AUTO +1.x homehost \-all
.SH SEE ALSO
.BR mdadm (8),
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdadm.h
^
|
@@ -1156,6 +1156,8 @@
extern char *conf_get_homehost(int *require_homehostp);
extern char *conf_line(FILE *file);
extern char *conf_word(FILE *file, int allow_key);
+extern void print_quoted(char *str);
+extern void print_escape(char *str);
extern int conf_name_is_free(char *name);
extern int conf_verify_devnames(struct mddev_ident *array_list);
extern int devname_matches(char *name, char *match);
@@ -1393,8 +1395,10 @@
#define PATH_MAX 4096
#endif
-#define PROCESS_DELAYED -2
-#define PROCESS_PENDING -3
+#define RESYNC_NONE -1
+#define RESYNC_DELAYED -2
+#define RESYNC_PENDING -3
+#define RESYNC_UNKNOWN -4
/* When using "GET_DISK_INFO" it isn't certain how high
* we need to check. So we impose an absolute limit of
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdadm.spec
^
|
@@ -1,6 +1,6 @@
Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
Name: mdadm
-Version: 3.2.5
+Version: 3.2.6
Release: 1
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz
URL: http://neil.brown.name/blog/mdadm
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdassemble.8
^
|
@@ -1,5 +1,5 @@
.\" -*- nroff -*-
-.TH MDASSEMBLE 8 "" v3.2.5
+.TH MDASSEMBLE 8 "" v3.2.6
.SH NAME
mdassemble \- assemble MD devices
.I aka
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdmon.8
^
|
@@ -1,5 +1,5 @@
.\" See file COPYING in distribution for details.
-.TH MDMON 8 "" v3.2.5
+.TH MDMON 8 "" v3.2.6
.SH NAME
mdmon \- monitor MD external metadata arrays
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdmon.c
^
|
@@ -184,7 +184,11 @@
buf[sizeof(buf)-1] = 0;
close(fd);
- if (n < 0 || !strstr(buf, "mdmon"))
+ /* Note that if started with --offroot, the name
+ * might be "@dmon"
+ */
+ if (n < 0 || !(strstr(buf, "mdmon") ||
+ strstr(buf, "@dmon")))
return;
kill(pid, SIGTERM);
@@ -299,14 +303,13 @@
{NULL, 0, NULL, 0}
};
- while ((opt = getopt_long(argc, argv, "th", options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
switch (opt) {
case 'a':
container_name = argv[optind-1];
all = 1;
break;
case 't':
- container_name = optarg;
takeover = 1;
break;
case OffRootOpt:
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdopen.c
^
|
@@ -210,7 +210,10 @@
char *ep;
if (cname[0] == 'd')
sp++;
- num = strtoul(sp, &ep, 10);
+ if (isdigit(sp[0]))
+ num = strtoul(sp, &ep, 10);
+ else
+ ep = sp;
if (ep == sp || *ep || num < 0)
num = -1;
else if (cname[0] == 'd')
@@ -289,8 +292,17 @@
int cnlen;
strncpy(cname, name, 200);
cname[200] = 0;
- while ((cp = strchr(cname, '/')) != NULL)
- *cp = '-';
+ for (cp = cname; *cp ; cp++)
+ switch (*cp) {
+ case '/':
+ *cp = '-';
+ break;
+ case ' ':
+ case '\t':
+ *cp = '_';
+ break;
+ }
+
if (trustworthy == LOCAL ||
(trustworthy == FOREIGN && strchr(cname, ':') != NULL)) {
/* Only need suffix if there is a conflict */
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/mdstat.c
^
|
@@ -185,7 +185,7 @@
}
ent->dev = ent->level = ent->pattern= NULL;
ent->next = NULL;
- ent->percent = -1;
+ ent->percent = RESYNC_NONE;
ent->active = -1;
ent->resync = 0;
ent->metadata_version = NULL;
@@ -240,7 +240,7 @@
ent->pattern = strdup(w+1);
if (ent->pattern[l-2]==']')
ent->pattern[l-2] = '\0';
- } else if (ent->percent == -1 &&
+ } else if (ent->percent == RESYNC_NONE &&
strncmp(w, "re", 2)== 0 &&
w[l-1] == '%' &&
(eq=strchr(w, '=')) != NULL ) {
@@ -251,7 +251,7 @@
ent->resync = 2;
else
ent->resync = 0;
- } else if (ent->percent == -1 &&
+ } else if (ent->percent == RESYNC_NONE &&
(w[0] == 'r' || w[0] == 'c')) {
if (strncmp(w, "resync", 4)==0)
ent->resync = 1;
@@ -263,10 +263,10 @@
ent->resync = 3;
if (l > 8 && strcmp(w+l-8, "=DELAYED") == 0)
- ent->percent = PROCESS_DELAYED;
+ ent->percent = RESYNC_DELAYED;
if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
- ent->percent = PROCESS_PENDING;
- } else if (ent->percent == -1 &&
+ ent->percent = RESYNC_PENDING;
+ } else if (ent->percent == RESYNC_NONE &&
w[0] >= '0' &&
w[0] <= '9' &&
w[l-1] == '%') {
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/sha1.h
^
|
@@ -1,11 +1,11 @@
/* Declarations of functions and data types used for SHA1 sum
library functions.
- Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2010
+ Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
@@ -26,8 +26,6 @@
# include <limits.h>
#endif
-#include "ansidecl.h"
-
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/super-ddf.c
^
|
@@ -2629,7 +2629,7 @@
if (chunk && *chunk == UnSet)
*chunk = DEFAULT_CHUNK;
-
+ if (level == -1000000) level = LEVEL_CONTAINER;
if (level == LEVEL_CONTAINER) {
/* Must be a fresh device to add to a container */
return validate_geometry_ddf_container(st, level, layout,
@@ -3718,6 +3718,10 @@
} else if (ddf->phys->entries[dl->pdnum].type &
__cpu_to_be16(DDF_Global_Spare)) {
is_global = 1;
+ } else if (!(ddf->phys->entries[dl->pdnum].state &
+ __cpu_to_be16(DDF_Failed))) {
+ /* we can possibly use some of this */
+ is_global = 1;
}
if ( ! (is_dedicated ||
(is_global && global_ok))) {
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/super-intel.c
^
|
@@ -4678,7 +4678,8 @@
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
map->failed_disk_num = ~0;
if (info->level > 0)
- map->map_state = IMSM_T_STATE_UNINITIALIZED;
+ map->map_state = (info->state ? IMSM_T_STATE_NORMAL
+ : IMSM_T_STATE_UNINITIALIZED);
else
map->map_state = info->failed_disks ? IMSM_T_STATE_FAILED :
IMSM_T_STATE_NORMAL;
@@ -10370,8 +10371,10 @@
int degraded)
{
unsigned long long new_degraded;
- sysfs_get_ll(info, NULL, "degraded", &new_degraded);
- if (new_degraded != (unsigned long long)degraded) {
+ int rv;
+
+ rv = sysfs_get_ll(info, NULL, "degraded", &new_degraded);
+ if ((rv == -1) || (new_degraded != (unsigned long long)degraded)) {
/* check each device to ensure it is still working */
struct mdinfo *sd;
new_degraded = 0;
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/super0.c
^
|
@@ -445,7 +445,7 @@
sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
(MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
if (verbose >= 0)
- fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
+ fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatibility.\n",
devname);
} else if (strcmp(update, "super-minor") ==0) {
sb->md_minor = info->array.md_minor;
@@ -633,9 +633,9 @@
sb->gvalid_words = 0; /* ignored */
sb->ctime = time(0);
sb->level = info->level;
- if (size != (unsigned long long)info->size)
+ sb->size = size;
+ if (size != (unsigned long long)sb->size)
return 0;
- sb->size = info->size;
sb->nr_disks = info->nr_disks;
sb->raid_disks = info->raid_disks;
sb->md_minor = info->md_minor;
@@ -657,7 +657,7 @@
if (rfd >= 0)
close(rfd);
}
- if (homehost) {
+ if (homehost && !uuid) {
char buf[20];
char *hash = sha1_buffer(homehost,
strlen(homehost),
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/super1.c
^
|
@@ -468,7 +468,12 @@
else
nm = NULL;
- printf("ARRAY%s%s", nm ? " /dev/md/":"", nm);
+ printf("ARRAY ");
+ if (nm) {
+ printf("/dev/md/");
+ print_escape(nm);
+ putchar(' ');
+ }
if (verbose && c)
printf(" level=%s", c);
sb_offset = __le64_to_cpu(sb->super_offset);
@@ -485,8 +490,10 @@
if ((i&3)==0 && i != 0) printf(":");
printf("%02x", sb->set_uuid[i]);
}
- if (sb->set_name[0])
- printf(" name=%.32s", sb->set_name);
+ if (sb->set_name[0]) {
+ printf(" name=");
+ print_quoted(sb->set_name);
+ }
printf("\n");
}
@@ -548,8 +555,10 @@
struct mdp_superblock_1 *sb = st->sb;
int i;
- if (sb->set_name[0])
- printf(" name=%.32s", sb->set_name);
+ if (sb->set_name[0]) {
+ printf(" name=");
+ print_quoted(sb->set_name);
+ }
printf(" UUID=");
for (i=0; i<16; i++) {
if ((i&3)==0 && i != 0) printf(":");
@@ -1096,7 +1105,7 @@
unsigned long long dsize, array_size;
unsigned long long sb_offset, headroom;
- for (di = st->info; di && ! rv ; di = di->next) {
+ for (di = st->info; di; di = di->next) {
if (di->disk.state == 1)
continue;
if (di->fd < 0)
@@ -1242,6 +1251,8 @@
rv = st->ss->write_bitmap(st, di->fd);
close(di->fd);
di->fd = -1;
+ if (rv)
+ goto error_out;
}
error_out:
if (rv)
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/udev-md-raid.rules
^
|
@@ -10,7 +10,7 @@
# remember you can limit what gets auto/incrementally assembled by
# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
-ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode"
+ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode --offroot"
ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
@@ -27,8 +27,8 @@
# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
-TEST!="md/array_state", GOTO="md_end"
-ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
+TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end"
+ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
LABEL="md_ignore_state"
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
[-]
[+]
|
Changed |
mdadm-3.2.6.tar.bz2/util.c
^
|
@@ -332,14 +332,15 @@
/* there must be one of the 'copies' form 'first' */
int n = copies;
int cnt=0;
+ int this = first;
while (n--) {
- if (avail[first])
+ if (avail[this])
cnt++;
- first = (first+1) % raid_disks;
+ this = (this+1) % raid_disks;
}
if (cnt == 0)
return 0;
-
+ first = (first+(layout&255)) % raid_disks;
} while (first != 0);
return 1;
@@ -796,10 +797,14 @@
devnum = devnum ? devnum-1 : (1<<20)-1) {
char *dn;
int _devnum;
+ char nbuf[50];
_devnum = use_partitions ? (-1-devnum) : devnum;
if (mddev_busy(_devnum))
continue;
+ sprintf(nbuf, "%s%d", use_partitions?"mdp":"md", devnum);
+ if (!conf_name_is_free(nbuf))
+ continue;
/* make sure it is new to /dev too, at least as a
* non-standard */
dn = map_dev(dev2major(_devnum), dev2minor(_devnum), 0);
@@ -1310,6 +1315,20 @@
continue;
if (de->d_name[0] == '.')
continue;
+ /* Need to make sure it is a container and not a volume */
+ sprintf(e, "/%s/md/metadata_version", de->d_name);
+ dfd = open(path, O_RDONLY);
+ if (dfd < 0)
+ continue;
+ n = read(dfd, buf, sizeof(buf));
+ close(dfd);
+ if (n <= 0 || (unsigned)n >= sizeof(buf))
+ continue;
+ buf[n] = 0;
+ if (strncmp(buf, "external", 8) != 0 ||
+ n < 10 ||
+ buf[9] == '/')
+ continue;
sprintf(e, "/%s/dev", de->d_name);
dfd = open(path, O_RDONLY);
if (dfd < 0)
|