[-]
[+]
|
Changed |
mdadm.changes
|
|
[-]
[+]
|
Changed |
mdadm.spec
^
|
|
[-]
[+]
|
Added |
mdadm-3.2.5.tar.bz2/ANNOUNCE-3.2.5
^
|
@@ -0,0 +1,31 @@
+Subject: ANNOUNCE: mdadm 3.2.5 - A tool for managing Soft RAID under Linux
+
+I am somewhat disappointed to have to announce the availability of
+ mdadm version 3.2.5
+
+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 release primarily fixes a serious regression in 3.2.4.
+This regression does *not* cause any risk to data. It simply
+means that adding a device with "--add" would sometime fail
+when it should not.
+
+The fix also includes a couple of minor fixes such as making
+the "--layout=preserve" option to "--grow" work again.
+
+A reminder that the default location for runtime files is now
+"/run/mdadm". If you compile this for a distro that does not
+have "/run", you will need to compile with an alternate setting for
+MAP_DIR. e.g.
+ make MAP_DIR=/var/run/mdadm
+or
+ make MAP_DIR=/dev/.mdadm
+
+NeilBrown 18th May 2012
+
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/Assemble.c
^
|
@@ -1069,6 +1069,7 @@
int j = best[i];
if (j >= 0 &&
!devices[j].uptodate &&
+ devices[j].i.recovery_start == MaxSector &&
devices[j].i.events == current_events) {
chosen_drive = j;
goto add_another;
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/Grow.c
^
|
@@ -623,8 +623,6 @@
if (sra)
sysfs_set_str(sra, NULL, "sync_action", "idle");
- else
- fprintf(stderr, Name ": failed to unfreeze array\n");
sysfs_free(sra);
}
}
@@ -1885,9 +1883,37 @@
*h = 0;
info.new_layout = map_name(r6layout, l);
}
+ } else {
+ fprintf(stderr, Name
+ ": %s is only meaningful when reshaping"
+ " a RAID6 array.\n", layout_str);
+ rv = 1;
+ goto release;
}
} else if (strcmp(layout_str, "preserve") == 0) {
- info.new_layout = UnSet;
+ /* This means that a non-standard RAID6 layout
+ * is OK.
+ * In particular:
+ * - When reshape a RAID6 (e.g. adding a device)
+ * which is in a non-standard layout, it is OK
+ * to preserve that layout.
+ * - When converting a RAID5 to RAID6, leave it in
+ * the XXX-6 layout, don't re-layout.
+ */
+ if (info.array.level == 6 && info.new_level == UnSet)
+ info.new_layout = info.array.layout;
+ else if (info.array.level == 5 && info.new_level == 6) {
+ char l[40];
+ strcpy(l, map_num(r5layout, info.array.layout));
+ strcat(l, "-6");
+ info.new_layout = map_name(r6layout, l);
+ } else {
+ fprintf(stderr, Name
+ ": %s in only meaningful when reshaping"
+ " to RAID6\n", layout_str);
+ rv = 1;
+ goto release;
+ }
} else {
int l = info.new_level;
if (l == UnSet)
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/ReadMe.c
^
|
@@ -24,7 +24,7 @@
#include "mdadm.h"
-char Version[] = Name " - v3.2.4 - 9th May 2012\n";
+char Version[] = Name " - v3.2.5 - 18th May 2012\n";
/*
* File: ReadMe.c
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/inventory
^
|
@@ -15,6 +15,7 @@
ANNOUNCE-3.2.2
ANNOUNCE-3.2.3
ANNOUNCE-3.2.4
+ANNOUNCE-3.2.5
Assemble.c
Build.c
COPYING
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/mapfile.c
^
|
@@ -404,6 +404,8 @@
if (ok != 0)
continue;
info = st->ss->container_content(st, subarray);
+ if (!info)
+ continue;
if (md->devnum >= 0)
path = map_dev(MD_MAJOR, md->devnum, 0);
|
[-]
[+]
|
Changed |
mdadm-3.2.5.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.4
+.TH MDADM 8 "" v3.2.5
.SH NAME
mdadm \- manage MD devices
.I aka
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/mdadm.conf.5
^
|
@@ -53,7 +53,7 @@
Alternatively, a
.B device
-line can contain either of both of the words
+line can contain either or both of the words
.B containers
and
.BR partitions .
|
[-]
[+]
|
Changed |
mdadm-3.2.5.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.4
+Version: 3.2.5
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.5.tar.bz2/mdassemble.8
^
|
@@ -1,5 +1,5 @@
.\" -*- nroff -*-
-.TH MDASSEMBLE 8 "" v3.2.4
+.TH MDASSEMBLE 8 "" v3.2.5
.SH NAME
mdassemble \- assemble MD devices
.I aka
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/mdmon.8
^
|
@@ -1,5 +1,5 @@
.\" See file COPYING in distribution for details.
-.TH MDMON 8 "" v3.2.4
+.TH MDMON 8 "" v3.2.5
.SH NAME
mdmon \- monitor MD external metadata arrays
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/sha1.c
^
|
@@ -1,7 +1,8 @@
/* sha1.c - Functions to compute SHA1 message digest of files or
memory blocks according to the NIST specification FIPS-180-1.
- Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2003, 2004, 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
@@ -22,9 +23,7 @@
Robert Klep <robert@ilse.nl> -- Expansion function fix
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+//#include <config.h>
#include "sha1.h"
@@ -35,9 +34,6 @@
# include "unlocked-io.h"
#endif
-/* SWAP does an endian swap on architectures that are little-endian,
- as SHA1 needs some data in a big-endian form. */
-
#ifdef WORDS_BIGENDIAN
# define SWAP(n) (n)
#else
@@ -55,11 +51,9 @@
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
-/*
- Takes a pointer to a 160 bit block of data (five 32 bit ints) and
- intializes it to the start constants of the SHA1 algorithm. This
- must be called before using hash in the call to sha1_hash.
-*/
+/* Take a pointer to a 160 bit block of data (five 32 bit ints) and
+ initialize it to the start constants of the SHA1 algorithm. This
+ must be called before using hash in the call to sha1_hash. */
void
sha1_init_ctx (struct sha1_ctx *ctx)
{
@@ -77,15 +71,15 @@
must be in little endian byte order.
IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
+ aligned for a 32-bit value. */
void *
sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
{
- ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
- ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
- ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
- ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
- ((md5_uint32 *) resbuf)[4] = SWAP (ctx->E);
+ ((sha1_uint32 *) resbuf)[0] = SWAP (ctx->A);
+ ((sha1_uint32 *) resbuf)[1] = SWAP (ctx->B);
+ ((sha1_uint32 *) resbuf)[2] = SWAP (ctx->C);
+ ((sha1_uint32 *) resbuf)[3] = SWAP (ctx->D);
+ ((sha1_uint32 *) resbuf)[4] = SWAP (ctx->E);
return resbuf;
}
@@ -94,31 +88,27 @@
prolog according to the standard and write the result to RESBUF.
IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
+ aligned for a 32-bit value. */
void *
sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
- md5_uint32 bytes = ctx->buflen;
- size_t pad;
- md5_uint32 *ptr;
+ sha1_uint32 bytes = ctx->buflen;
+ size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
/* Now count remaining bytes. */
ctx->total[0] += bytes;
if (ctx->total[0] < bytes)
++ctx->total[1];
- pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
- memcpy (&ctx->buffer[bytes], fillbuf, pad);
-
/* Put the 64-bit file length in *bits* at the end of the buffer. */
- ptr = (md5_uint32 *) &ctx->buffer[bytes + pad + 4];
- *ptr = SWAP (ctx->total[0] << 3);
- ptr = (md5_uint32 *) &ctx->buffer[bytes + pad];
- *ptr = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
+ ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
+ ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
+
+ memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
/* Process last bytes. */
- sha1_process_block (ctx->buffer, bytes + pad + 8, ctx);
+ sha1_process_block (ctx->buffer, size * 4, ctx);
return sha1_read_ctx (ctx, resbuf);
}
@@ -189,7 +179,7 @@
return 0;
}
-/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
@@ -218,7 +208,7 @@
size_t left_over = ctx->buflen;
size_t add = 128 - left_over > len ? len : 128 - left_over;
- memcpy (&ctx->buffer[left_over], buffer, add);
+ memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 64)
@@ -227,7 +217,8 @@
ctx->buflen &= 63;
/* The regions in the following copy operation cannot overlap. */
- memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+ memcpy (ctx->buffer,
+ &((char *) ctx->buffer)[(left_over + add) & ~63],
ctx->buflen);
}
@@ -240,7 +231,7 @@
{
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
-# define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0)
+# define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
if (UNALIGNED_P (buffer))
while (len > 64)
{
@@ -262,13 +253,13 @@
{
size_t left_over = ctx->buflen;
- memcpy (&ctx->buffer[left_over], buffer, len);
+ memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
left_over += len;
if (left_over >= 64)
{
sha1_process_block (ctx->buffer, 64, ctx);
left_over -= 64;
- memcpy (ctx->buffer, &ctx->buffer[64], left_over);
+ memcpy (ctx->buffer, &ctx->buffer[16], left_over);
}
ctx->buflen = left_over;
}
@@ -277,10 +268,10 @@
/* --- Code below is the primary difference between md5.c and sha1.c --- */
/* SHA1 round constants */
-#define K1 0x5a827999L
-#define K2 0x6ed9eba1L
-#define K3 0x8f1bbcdcL
-#define K4 0xca62c1d6L
+#define K1 0x5a827999
+#define K2 0x6ed9eba1
+#define K3 0x8f1bbcdc
+#define K4 0xca62c1d6
/* Round functions. Note that F2 is the same as F4. */
#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
@@ -295,15 +286,15 @@
void
sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
{
- const md5_uint32 *words = buffer;
- size_t nwords = len / sizeof (md5_uint32);
- const md5_uint32 *endp = words + nwords;
- md5_uint32 x[16];
- md5_uint32 a = ctx->A;
- md5_uint32 b = ctx->B;
- md5_uint32 c = ctx->C;
- md5_uint32 d = ctx->D;
- md5_uint32 e = ctx->E;
+ const sha1_uint32 *words = (const sha1_uint32*) buffer;
+ size_t nwords = len / sizeof (sha1_uint32);
+ const sha1_uint32 *endp = words + nwords;
+ sha1_uint32 x[16];
+ sha1_uint32 a = ctx->A;
+ sha1_uint32 b = ctx->B;
+ sha1_uint32 c = ctx->C;
+ sha1_uint32 d = ctx->D;
+ sha1_uint32 e = ctx->E;
/* First increment the byte count. RFC 1321 specifies the possible
length of the file up to 2^64 bits. Here we only compute the
@@ -312,7 +303,7 @@
if (ctx->total[0] < len)
++ctx->total[1];
-#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+#define rol(x, n) (((x) << (n)) | ((sha1_uint32) (x) >> (32 - (n))))
#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
@@ -327,7 +318,7 @@
while (words < endp)
{
- md5_uint32 tm;
+ sha1_uint32 tm;
int t;
for (t = 0; t < 16; t++)
{
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/sha1.h
^
|
@@ -1,10 +1,11 @@
/* Declarations of functions and data types used for SHA1 sum
library functions.
- Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2010
+ 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 2, or (at your option) any
+ Free Software Foundation; either version 3, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
@@ -19,21 +20,70 @@
#ifndef SHA1_H
# define SHA1_H 1
-# include <stdio.h>
-# include "md5.h"
+#include <stdio.h>
+
+#if defined HAVE_LIMITS_H || _LIBC
+# 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
+ doing that would require that the configure script compile and *run*
+ the resulting executable. Locally running cross-compiled executables
+ is usually not possible. */
+
+#ifdef _LIBC
+# include <sys/types.h>
+typedef u_int32_t sha1_uint32;
+typedef uintptr_t sha1_uintptr;
+#else
+# define INT_MAX_32_BITS 2147483647
+
+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+ This should be valid for all systems GNU cares about because
+ that doesn't include 16-bit systems, and only modern systems
+ (that certainly have <limits.h>) have 64+-bit integral types. */
+
+# ifndef INT_MAX
+# define INT_MAX INT_MAX_32_BITS
+# endif
+
+# if INT_MAX == INT_MAX_32_BITS
+ typedef unsigned int sha1_uint32;
+# else
+# if SHRT_MAX == INT_MAX_32_BITS
+ typedef unsigned short sha1_uint32;
+# else
+# if LONG_MAX == INT_MAX_32_BITS
+ typedef unsigned long sha1_uint32;
+# else
+ /* The following line is intended to evoke an error.
+ Using #error is not portable enough. */
+ "Cannot determine unsigned 32-bit data type."
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Structure to save state of computation between the single steps. */
struct sha1_ctx
{
- md5_uint32 A;
- md5_uint32 B;
- md5_uint32 C;
- md5_uint32 D;
- md5_uint32 E;
-
- md5_uint32 total[2];
- md5_uint32 buflen;
- char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
+ sha1_uint32 A;
+ sha1_uint32 B;
+ sha1_uint32 C;
+ sha1_uint32 D;
+ sha1_uint32 E;
+
+ sha1_uint32 total[2];
+ sha1_uint32 buflen;
+ sha1_uint32 buffer[32];
};
@@ -84,4 +134,8 @@
digest. */
extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
+#ifdef __cplusplus
+}
+#endif
+
#endif
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/super-intel.c
^
|
@@ -9902,6 +9902,9 @@
struct imsm_dev *dev;
struct intel_super *super;
long long current_size;
+ unsigned long long free_size;
+ long long max_size;
+ int rv;
getinfo_super_imsm_volume(st, &info, NULL);
if ((geo->level != info.array.level) &&
@@ -10015,28 +10018,33 @@
super->current_vol, st->devnum);
goto analyse_change_exit;
}
+ /* check the maximum available size
+ */
+ rv = imsm_get_free_size(st, dev->vol.map->num_members,
+ 0, chunk, &free_size);
+ if (rv == 0)
+ /* Cannot find maximum available space
+ */
+ max_size = 0;
+ else {
+ max_size = free_size + current_size;
+ /* align component size
+ */
+ max_size = imsm_component_size_aligment_check(
+ get_imsm_raid_level(dev->vol.map),
+ chunk * 1024,
+ max_size);
+ }
if (geo->size == 0) {
/* requested size change to the maximum available size
*/
- unsigned long long freesize;
- int rv;
-
- rv = imsm_get_free_size(st, dev->vol.map->num_members,
- 0, chunk, &freesize);
- if (rv == 0) {
+ if (max_size == 0) {
fprintf(stderr, Name " Error. Cannot find "
"maximum available space.\n");
change = -1;
goto analyse_change_exit;
- }
- geo->size = freesize + current_size;
-
- /* align component size
- */
- geo->size = imsm_component_size_aligment_check(
- get_imsm_raid_level(dev->vol.map),
- chunk * 1024,
- geo->size);
+ } else
+ geo->size = max_size;
}
if ((direction == ROLLBACK_METADATA_CHANGES)) {
@@ -10051,12 +10059,21 @@
geo->size );
if (current_size >= geo->size) {
fprintf(stderr,
- Name " Error. Size expanssion is "
+ Name " Error. Size expansion is "
"supported only (current size is %llu, "
"requested size /rounded/ is %llu).\n",
current_size, geo->size);
goto analyse_change_exit;
}
+ if (max_size && geo->size > max_size) {
+ fprintf(stderr,
+ Name " Error. Requested size is larger "
+ "than maximum available size (maximum "
+ "available size is %llu, "
+ "requested size /rounded/ is %llu).\n",
+ max_size, geo->size);
+ goto analyse_change_exit;
+ }
}
geo->size *= data_disks;
geo->raid_disks = dev->vol.map->num_members;
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/super1.c
^
|
@@ -1189,40 +1189,42 @@
case 1:
sb->super_offset = __cpu_to_le64(0);
reserved = bm_space + 4*2;
+ if (reserved < headroom)
+ reserved = headroom;
+ if (reserved + array_size > dsize)
+ reserved = dsize - array_size;
/* Try for multiple of 1Meg so it is nicely aligned */
#define ONE_MEG (2*1024)
- reserved = ((reserved + ONE_MEG-1)/ONE_MEG) * ONE_MEG;
- if (reserved + __le64_to_cpu(sb->size) > dsize)
- reserved = dsize - __le64_to_cpu(sb->size);
+ if (reserved > ONE_MEG)
+ reserved = (reserved/ONE_MEG) * ONE_MEG;
+
/* force 4K alignment */
reserved &= ~7ULL;
- if (reserved < headroom)
- reserved = headroom;
-
sb->data_offset = __cpu_to_le64(reserved);
sb->data_size = __cpu_to_le64(dsize - reserved);
break;
case 2:
sb_offset = 4*2;
sb->super_offset = __cpu_to_le64(4*2);
- if (4*2 + 4*2 + bm_space + __le64_to_cpu(sb->size)
+ if (4*2 + 4*2 + bm_space + array_size
> dsize)
- bm_space = dsize - __le64_to_cpu(sb->size)
+ bm_space = dsize - array_size
- 4*2 - 4*2;
reserved = bm_space + 4*2 + 4*2;
+ if (reserved < headroom)
+ reserved = headroom;
+ if (reserved + array_size > dsize)
+ reserved = dsize - array_size;
/* Try for multiple of 1Meg so it is nicely aligned */
#define ONE_MEG (2*1024)
- reserved = ((reserved + ONE_MEG-1)/ONE_MEG) * ONE_MEG;
- if (reserved + __le64_to_cpu(sb->size) > dsize)
- reserved = dsize - __le64_to_cpu(sb->size);
+ if (reserved > ONE_MEG)
+ reserved = (reserved/ONE_MEG) * ONE_MEG;
+
/* force 4K alignment */
reserved &= ~7ULL;
- if (reserved < headroom)
- reserved = headroom;
-
sb->data_offset = __cpu_to_le64(reserved);
sb->data_size = __cpu_to_le64(dsize - reserved);
break;
@@ -1234,7 +1236,6 @@
goto out;
}
-
sb->sb_csum = calc_sb_1_csum(sb);
rv = store_super1(st, di->fd);
if (rv == 0 && (__le32_to_cpu(sb->feature_map) & 1))
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/test
^
|
@@ -37,12 +37,12 @@
mdsize1a=19988
mdsize12=19988
# super1.2 for linear: round to multiple of 2, subtract 4
-mdsize1_l=18976
-mdsize2_l=18976
+mdsize1_l=19996
+mdsize2_l=19996
# subtract another 4 for bitmaps
mdsize1b=19988
mdsize11=19992
-mdsize11a=18944
+mdsize11a=19456
mdsize12=19988
# ddf needs bigger devices as 32Meg is reserved!
|
[-]
[+]
|
Changed |
mdadm-3.2.5.tar.bz2/tests/07autoassemble
^
|
@@ -20,5 +20,5 @@
mdadm -Ss
mdadm -As -c /dev/null --homehost=testing -vvv
testdev $md1 1 $mdsize1a 64
-testdev $md0 1 $[mdsize1a+mdsize11a-1024] 512
+testdev $md0 1 $[mdsize1a+mdsize11a] 512
mdadm -Ss
|