File mdadm-3.2.2_git3b1dab1bdbda0 of Package mdadm (Revision 1)
Currently displaying revision 1, show latest
x
1
diff --git a/.gitignore b/.gitignore
2
index 2503bd8..7200741 100644
3
--- a/.gitignore
4
+++ b/.gitignore
5
@@ -2,6 +2,7 @@
6
/*.man
7
/*-stamp
8
/mdadm
9
+/mdadm.8
10
/mdadm.udeb
11
/mdmon
12
/swap_super
13
diff --git a/COPYING b/COPYING
14
index 60549be..d159169 100644
15
--- a/COPYING
16
+++ b/COPYING
17
@@ -1,12 +1,12 @@
18
- GNU GENERAL PUBLIC LICENSE
19
- Version 2, June 1991
20
+ GNU GENERAL PUBLIC LICENSE
21
+ Version 2, June 1991
22
23
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
24
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
26
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27
Everyone is permitted to copy and distribute verbatim copies
28
of this license document, but changing it is not allowed.
29
30
- Preamble
31
+ Preamble
32
33
The licenses for most software are designed to take away your
34
freedom to share and change it. By contrast, the GNU General Public
35
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
36
General Public License applies to most of the Free Software
37
Foundation's software and to any other program whose authors commit to
38
using it. (Some other Free Software Foundation software is covered by
39
-the GNU Library General Public License instead.) You can apply it to
40
+the GNU Lesser General Public License instead.) You can apply it to
41
your programs, too.
42
43
When we speak of free software, we are referring to freedom, not
44
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
45
46
The precise terms and conditions for copying, distribution and
47
modification follow.
48
-
49
- GNU GENERAL PUBLIC LICENSE
50
+
51
+ GNU GENERAL PUBLIC LICENSE
52
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
53
54
0. This License applies to any program or other work which contains
55
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
56
License. (Exception: if the Program itself is interactive but
57
does not normally print such an announcement, your work based on
58
the Program is not required to print an announcement.)
59
-
60
+
61
These requirements apply to the modified work as a whole. If
62
identifiable sections of that work are not derived from the Program,
63
and can be reasonably considered independent and separate works in
64
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
65
access to copy the source code from the same place counts as
66
distribution of the source code, even though third parties are not
67
compelled to copy the source along with the object code.
68
-
69
+
70
4. You may not copy, modify, sublicense, or distribute the Program
71
except as expressly provided under this License. Any attempt
72
otherwise to copy, modify, sublicense or distribute the Program is
73
@@ -225,7 +225,7 @@ impose that choice.
74
75
This section is intended to make thoroughly clear what is believed to
76
be a consequence of the rest of this License.
77
-
78
+
79
8. If the distribution and/or use of the Program is restricted in
80
certain countries either by patents or by copyrighted interfaces, the
81
original copyright holder who places the Program under this License
82
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
83
of preserving the free status of all derivatives of our free software and
84
of promoting the sharing and reuse of software generally.
85
86
- NO WARRANTY
87
+ NO WARRANTY
88
89
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
90
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
91
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
92
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
93
POSSIBILITY OF SUCH DAMAGES.
94
95
- END OF TERMS AND CONDITIONS
96
-
97
- How to Apply These Terms to Your New Programs
98
+ END OF TERMS AND CONDITIONS
99
+
100
+ How to Apply These Terms to Your New Programs
101
102
If you develop a new program, and you want it to be of the greatest
103
possible use to the public, the best way to achieve this is to make it
104
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
105
the "copyright" line and a pointer to where the full notice is found.
106
107
<one line to give the program's name and a brief idea of what it does.>
108
- Copyright (C) 19yy <name of author>
109
+ Copyright (C) <year> <name of author>
110
111
This program is free software; you can redistribute it and/or modify
112
it under the terms of the GNU General Public License as published by
113
@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
114
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115
GNU General Public License for more details.
116
117
- You should have received a copy of the GNU General Public License
118
- along with this program; if not, write to the Free Software
119
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
120
-
121
+ You should have received a copy of the GNU General Public License along
122
+ with this program; if not, write to the Free Software Foundation, Inc.,
123
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
124
125
Also add information on how to contact you by electronic and paper mail.
126
127
If the program is interactive, make it output a short notice like this
128
when it starts in an interactive mode:
129
130
- Gnomovision version 69, Copyright (C) 19yy name of author
131
+ Gnomovision version 69, Copyright (C) year name of author
132
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
133
This is free software, and you are welcome to redistribute it
134
under certain conditions; type `show c' for details.
135
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
136
This General Public License does not permit incorporating your program into
137
proprietary programs. If your program is a subroutine library, you may
138
consider it more useful to permit linking proprietary applications with the
139
-library. If this is what you want to do, use the GNU Library General
140
+library. If this is what you want to do, use the GNU Lesser General
141
Public License instead of this License.
142
diff --git a/Create.c b/Create.c
143
index 48115db..8d88aa1 100644
144
--- a/Create.c
145
+++ b/Create.c
146
@@ -856,15 +856,6 @@ int Create(struct supertype *st, char *mddev,
147
/* getinfo_super might have lost these ... */
148
inf->disk.major = major(stb.st_rdev);
149
inf->disk.minor = minor(stb.st_rdev);
150
- /* FIXME the following should not be needed
151
- * as getinfo_super is suppose to set
152
- * them. However it doesn't for imsm,
153
- * so we have this hack for now
154
- */
155
- if (st->ss == &super_imsm) {
156
- inf->disk.number = dnum;
157
- inf->disk.raid_disk = dnum;
158
- }
159
}
160
break;
161
case 2:
162
diff --git a/Detail.c b/Detail.c
163
index 375189d..ca34abe 100644
164
--- a/Detail.c
165
+++ b/Detail.c
166
@@ -372,11 +372,13 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
167
else
168
st = ", degraded";
169
170
- printf(" State : %s%s%s%s\n",
171
- (array.state&(1<<MD_SB_CLEAN))?"clean":"active",
172
- st,
173
- (!e || e->percent < 0) ? "" : sync_action[e->resync],
174
- larray_size ? "": ", Not Started");
175
+ printf(" State : %s%s%s%s%s%s \n",
176
+ (array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
177
+ (!e || (e->percent < 0 && e->percent != PROCESS_PENDING &&
178
+ e->percent != PROCESS_DELAYED)) ? "" : sync_action[e->resync],
179
+ larray_size ? "": ", Not Started",
180
+ e->percent == PROCESS_DELAYED ? " (DELAYED)": "",
181
+ e->percent == PROCESS_PENDING ? " (PENDING)": "");
182
}
183
if (array.raid_disks)
184
printf(" Active Devices : %d\n", array.active_disks);
185
@@ -416,10 +418,8 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
186
}
187
188
if (e && e->percent >= 0) {
189
- printf(" Re%s Status : %d%% complete\n",
190
- (st && st->sb && info->reshape_active)?
191
- "shape":"build",
192
- e->percent);
193
+ static char *sync_action[] = {"Rebuild", "Resync", "Reshape", "Check"};
194
+ printf(" %7s Status : %d%% complete\n", sync_action[e->resync], e->percent);
195
is_rebuilding = 1;
196
}
197
free_mdstat(ms);
198
@@ -430,12 +430,9 @@ This is pretty boring
199
printf(" Reshape pos'n : %llu%s\n", (unsigned long long) info->reshape_progress<<9,
200
human_size((unsigned long long)info->reshape_progress<<9));
201
#endif
202
- if (info->delta_disks > 0)
203
+ if (info->delta_disks != 0)
204
printf(" Delta Devices : %d, (%d->%d)\n",
205
info->delta_disks, array.raid_disks - info->delta_disks, array.raid_disks);
206
- if (info->delta_disks < 0)
207
- printf(" Delta Devices : %d, (%d->%d)\n",
208
- info->delta_disks, array.raid_disks, array.raid_disks + info->delta_disks);
209
if (info->new_level != array.level) {
210
char *c = map_num(pers, info->new_level);
211
printf(" New Level : %s\n", c?c:"-unknown-");
212
diff --git a/Grow.c b/Grow.c
213
index 6e31b94..1aab113 100644
214
--- a/Grow.c
215
+++ b/Grow.c
216
@@ -1268,7 +1268,7 @@ char *analyse_change(struct mdinfo *info, struct reshape *re)
217
218
if (re->after.data_disks < re->before.data_disks &&
219
get_linux_version() < 2006030)
220
- return "reshape to fewer devices is not supported before 2.6.32 - sorry.";
221
+ return "reshape to fewer devices is not supported before 2.6.30 - sorry.";
222
223
re->backup_blocks = compute_backup_blocks(
224
info->new_chunk, info->array.chunk_size,
225
@@ -1494,7 +1494,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
226
goto release;
227
}
228
if (assume_clean) {
229
- /* This will fail on kernels newer than 2.6.40 unless
230
+ /* This will fail on kernels newer than 3.0 unless
231
* a backport has been arranged.
232
*/
233
if (sra == NULL ||
234
@@ -2725,15 +2725,21 @@ check_progress:
235
int rv = -2;
236
tv.tv_sec = 10;
237
tv.tv_usec = 0;
238
- while (fd >= 0 && rv < 0) {
239
+ while (fd >= 0 && rv < 0 && tv.tv_sec > 0) {
240
fd_set rfds;
241
FD_ZERO(&rfds);
242
FD_SET(fd, &rfds);
243
if (select(fd+1, NULL, NULL, &rfds, &tv) != 1)
244
break;
245
- if (sysfs_fd_get_ll(fd, &completed) >= 0)
246
+ switch (sysfs_fd_get_ll(fd, &completed)) {
247
+ case 0:
248
/* all good again */
249
rv = 1;
250
+ break;
251
+ case -2: /* read error - abort */
252
+ tv.tv_sec = 0;
253
+ break;
254
+ }
255
}
256
if (fd >= 0)
257
close(fd);
258
diff --git a/Kill.c b/Kill.c
259
index 29a43ea..b841a5b 100644
260
--- a/Kill.c
261
+++ b/Kill.c
262
@@ -59,6 +59,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
263
close(fd);
264
return 2;
265
}
266
+ st->ignore_hw_compat = 1;
267
rv = st->ss->load_super(st, fd, dev);
268
if (force && rv >= 2)
269
rv = 0; /* ignore bad data in superblock */
270
diff --git a/Makefile b/Makefile
271
index 72087be..b8d363f 100644
272
--- a/Makefile
273
+++ b/Makefile
274
@@ -137,7 +137,7 @@ ASSEMBLE_FLAGS += -DMDASSEMBLE_AUTO
275
endif
276
277
all : mdadm mdmon
278
-man : mdadm.man md.man mdadm.conf.man mdmon.man
279
+man : mdadm.man md.man mdadm.conf.man mdmon.man raid6check.man
280
281
everything: all mdadm.static swap_super test_stripe \
282
mdassemble mdassemble.auto mdassemble.static mdassemble.man \
283
@@ -221,6 +221,9 @@ mdadm.conf.man : mdadm.conf.5
284
mdassemble.man : mdassemble.8
285
nroff -man mdassemble.8 > mdassemble.man
286
287
+raid6check.man : raid6check.8
288
+ nroff -man raid6check.8 > raid6check.man
289
+
290
$(OBJS) : $(INCL) mdmon.h
291
$(MON_OBJS) : $(INCL) mdmon.h
292
293
diff --git a/md.4 b/md.4
294
index 5e79639..378ecc9 100644
295
--- a/md.4
296
+++ b/md.4
297
@@ -128,7 +128,7 @@ have special-purpose uses and is supported.
298
From release 2.6.28, the
299
.I md
300
driver supports arrays with externally managed metadata. That is,
301
-the metadata is not managed by the kernel by rather by a user-space
302
+the metadata is not managed by the kernel but rather by a user-space
303
program which is external to the kernel. This allows support for a
304
variety of metadata formats without cluttering the kernel with lots of
305
details.
306
@@ -468,7 +468,7 @@ scrub starts and is incremented whenever a sector is
307
found that is a mismatch.
308
.I md
309
normally works in units much larger than a single sector and when it
310
-finds a mismatch, it does not determin exactly how many actual sectors were
311
+finds a mismatch, it does not determine exactly how many actual sectors were
312
affected but simply adds the number of sectors in the IO unit that was
313
used. So a value of 128 could simply mean that a single 64KB check
314
found an error (128 x 512bytes = 64KB).
315
@@ -661,7 +661,7 @@ to this file will cause the system-wide setting to have effect.
316
This is the partner of
317
.B md/sync_speed_min
318
and overrides
319
-.B /proc/sys/dev/raid/spool_limit_max
320
+.B /proc/sys/dev/raid/speed_limit_max
321
described below.
322
323
.TP
324
diff --git a/mdadm.8.in b/mdadm.8.in
325
index d2d7ef2..e22fde4 100644
326
--- a/mdadm.8.in
327
+++ b/mdadm.8.in
328
@@ -418,11 +418,22 @@ issued.
329
A suffix of 'M' or 'G' can be given to indicate Megabytes or
330
Gigabytes respectively.
331
332
+Sometimes a replacement drive can be a little smaller than the
333
+original drives though this should be minimised by IDEMA standards.
334
+Such a replacement drive will be rejected by
335
+.IR md .
336
+To guard against this it can be useful to set the initial size
337
+slightly smaller than the smaller device with the aim that it will
338
+still be larger than any replacement.
339
+
340
This value can be set with
341
.B \-\-grow
342
-for RAID level 1/4/5/6. If the array was created with a size smaller
343
-than the currently active drives, the extra space can be accessed
344
-using
345
+for RAID level 1/4/5/6 though
346
+.B CONTAINER
347
+based arrays such as those with IMSM metadata may not be able to
348
+support this.
349
+If the array was created with a size smaller than the currently
350
+active drives, the extra space can be accessed using
351
.BR \-\-grow .
352
The size can be given as
353
.B max
354
@@ -440,9 +451,10 @@ problems the array can be made bigger again with no loss with another
355
.B "\-\-grow \-\-size="
356
command.
357
358
-This value can not be used with
359
+This value cannot be used when creating a
360
.B CONTAINER
361
-metadata such as DDF and IMSM.
362
+such as with DDF and IMSM metadata, though it perfectly valid when
363
+creating an array inside a container.
364
365
.TP
366
.BR \-Z ", " \-\-array\-size=
367
@@ -706,7 +718,7 @@ facts the operator knows.
368
When an array is resized to a larger size with
369
.B "\-\-grow \-\-size="
370
the new space is normally resynced in that same way that the whole
371
-array is resynced at creation. From Linux version 2.6.40,
372
+array is resynced at creation. From Linux version 3.0,
373
.B \-\-assume\-clean
374
can be used with that command to avoid the automatic resync.
375
376
@@ -811,6 +823,11 @@ number, and there is no entry in /dev for that number and with a
377
non-standard name. Names that are not in 'standard' format are only
378
allowed in "/dev/md/".
379
380
+This is meaningful with
381
+.B \-\-create
382
+or
383
+.BR \-\-build .
384
+
385
.ig XX
386
.\".TP
387
.\".BR \-\-symlink = no
388
@@ -835,6 +852,28 @@ allowed in "/dev/md/".
389
.\"
390
.XX
391
392
+.TP
393
+.BR \-a ", " "\-\-add"
394
+This option can be used in Grow mode in two cases.
395
+
396
+If the target array is a Linear array, then
397
+.B \-\-add
398
+can be used to add one or more devices to the array. They
399
+are simply catenated on to the end of the array. Once added, the
400
+devices cannot be removed.
401
+
402
+If the
403
+.B \-\-raid\-disks
404
+option is being used to increase the number of devices in an array,
405
+then
406
+.B \-\-add
407
+can be used to add some extra devices to be included in the array.
408
+In most cases this is not needed as the extra devices can be added as
409
+spares first, and then the number of raid-disks can be changed.
410
+However for RAID0, it is not possible to add spares. So to increase
411
+the number of devices in a RAID0, it is necessary to set the new
412
+number of devices, and to add the new devices, in the same command.
413
+
414
.SH For assemble:
415
416
.TP
417
@@ -912,28 +951,6 @@ not as reliable as you would like.
418
See this option under Create and Build options.
419
420
.TP
421
-.BR \-a ", " "\-\-add"
422
-This option can be used in Grow mode in two cases.
423
-
424
-If the target array is a Linear array, then
425
-.B \-\-add
426
-can be used to add one or more devices to the array. They
427
-are simply catenated on to the end of the array. Once added, the
428
-devices cannot be removed.
429
-
430
-If the
431
-.B \-\-raid\-disks
432
-option is being used to increase the number of devices in an array,
433
-then
434
-.B \-\-add
435
-can be used to add some extra devices to be included in the array.
436
-In most cases this is not needed as the extra devices can be added as
437
-spares first, and then the number of raid-disks can be changed.
438
-However for RAID0, it is not possible to add spares. So to increase
439
-the number of devices in a RAID0, it is necessary to set the new
440
-number of devices, and to add the new devices, in the same command.
441
-
442
-.TP
443
.BR \-b ", " \-\-bitmap=
444
Specify the bitmap file that was given when the array was created. If
445
an array has an
446
@@ -1491,7 +1508,7 @@ the first device given is the md device.
447
In the second usage example, all devices listed are treated as md
448
devices and assembly is attempted.
449
In the third (where no devices are listed) all md devices that are
450
-listed in the configuration file are assembled. If not arrays are
451
+listed in the configuration file are assembled. If no arrays are
452
described by the configuration file, then any arrays that
453
can be found on unused devices will be assembled.
454
455
@@ -1600,7 +1617,7 @@ and no devices are listed,
456
will first attempt to assemble all the arrays listed in the config
457
file.
458
459
-In no array at listed in the config (other than those marked
460
+If no arrays are listed in the config (other than those marked
461
.BR <ignore> )
462
it will look through the available devices for possible arrays and
463
will try to assemble anything that it finds. Arrays which are tagged
464
@@ -2200,22 +2217,24 @@ change the "size" attribute for RAID1, RAID4, RAID5 and RAID6.
465
.IP \(bu 4
466
increase or decrease the "raid\-devices" attribute of RAID0, RAID1, RAID4,
467
RAID5, and RAID6.
468
-.IP \bu 4
469
+.IP \(bu 4
470
change the chunk-size and layout of RAID0, RAID4, RAID5 and RAID6.
471
-.IP \bu 4
472
+.IP \(bu 4
473
convert between RAID1 and RAID5, between RAID5 and RAID6, between
474
-RAID0, RAID5, and RAID5, and between RAID0 and RAID10 (in the near-2 mode).
475
+RAID0, RAID4, and RAID5, and between RAID0 and RAID10 (in the near-2 mode).
476
.IP \(bu 4
477
add a write-intent bitmap to any array which supports these bitmaps, or
478
remove a write-intent bitmap from such an array.
479
.PP
480
481
-Using GROW on containers is currently only support for Intel's IMSM
482
+Using GROW on containers is currently supported only for Intel's IMSM
483
container format. The number of devices in a container can be
484
increased - which affects all arrays in the container - or an array
485
in a container can be converted between levels where those levels are
486
supported by the container, and the conversion is on of those listed
487
-above.
488
+above. Resizing arrays in an IMSM container with
489
+.B "--grow --size"
490
+is not yet supported.
491
492
Grow functionality (e.g. expand a number of raid devices) for Intel's
493
IMSM container format has an experimental status. It is guarded by the
494
@@ -2250,7 +2269,7 @@ space to start being used. If the size is increased in this way, a
495
are synchronised.
496
497
Note that when an array changes size, any filesystem that may be
498
-stored in the array will not automatically grow for shrink to use or
499
+stored in the array will not automatically grow or shrink to use or
500
vacate the space. The
501
filesystem will need to be explicitly told to use the extra space
502
after growing, or to reduce its size
503
@@ -2259,7 +2278,7 @@ to shrinking the array.
504
505
Also the size of an array cannot be changed while it has an active
506
bitmap. If an array has a bitmap, it must be removed before the size
507
-can be changed. Once the change it complete a new bitmap can be created.
508
+can be changed. Once the change is complete a new bitmap can be created.
509
510
.SS RAID\-DEVICES CHANGES
511
512
@@ -2435,8 +2454,8 @@ must match one of the names or patterns in a
513
line.
514
515
.IP +
516
-Does the device have a valid md superblock. If a specific metadata
517
-version is request with
518
+Does the device have a valid md superblock? If a specific metadata
519
+version is requested with
520
.B \-\-metadata
521
or
522
.B \-e
523
@@ -2467,6 +2486,7 @@ is not able to positively identify the array as belonging to the
524
current host, the device will be rejected.
525
..
526
527
+.PP
528
.I mdadm
529
keeps a list of arrays that it has partially assembled in
530
.B /var/run/mdadm/map
531
@@ -2639,7 +2659,7 @@ can be started.
532
Any devices which are components of /dev/md4 will be marked as faulty
533
and then remove from the array.
534
535
-.B " mdadm --grow /dev/md4 --level=6 --backup-file=/root/backup-md4
536
+.B " mdadm --grow /dev/md4 --level=6 --backup-file=/root/backup-md4"
537
.br
538
The array
539
.B /dev/md4
540
@@ -2787,7 +2807,7 @@ configuration file at all.
541
For further information on mdadm usage, MD and the various levels of
542
RAID, see:
543
.IP
544
-.B http://linux\-raid.osdl.org/
545
+.B http://raid.wiki.kernel.org/
546
.PP
547
(based upon Jakob \(/Ostergaard's Software\-RAID.HOWTO)
548
.\".PP
549
diff --git a/mdadm.h b/mdadm.h
550
index e075dd2..8bd0077 100644
551
--- a/mdadm.h
552
+++ b/mdadm.h
553
@@ -1345,3 +1345,5 @@ static inline int xasprintf(char **strp, const char *fmt, ...) {
554
#define PATH_MAX 4096
555
#endif
556
557
+#define PROCESS_DELAYED -2
558
+#define PROCESS_PENDING -3
559
diff --git a/mdmon.8 b/mdmon.8
560
index 7939a99..03b31b8 100644
561
--- a/mdmon.8
562
+++ b/mdmon.8
563
@@ -104,7 +104,7 @@ within those disks. MD metadata in comparison defines a 1:1
564
relationship between a set of block devices and a raid array. For
565
example to create 2 arrays at different raid levels on a single
566
set of disks, MD metadata requires the disks be partitioned and then
567
-each array can created be created with a subset of those partitions. The
568
+each array can be created with a subset of those partitions. The
569
supported external formats perform this disk carving internally.
570
.P
571
Container devices simply hold references to all member disks and allow
572
@@ -172,7 +172,7 @@ Note that
573
is automatically started by
574
.I mdadm
575
when needed and so does not need to be considered when working with
576
-RAID arrays. The only times it is run other that by
577
+RAID arrays. The only times it is run other than by
578
.I mdadm
579
is when the boot scripts need to restart it after mounting the new
580
root filesystem.
581
diff --git a/mdstat.c b/mdstat.c
582
index 3d2edad..abf6bf9 100644
583
--- a/mdstat.c
584
+++ b/mdstat.c
585
@@ -257,10 +257,10 @@ struct mdstat_ent *mdstat_read(int hold, int start)
586
if (strncmp(w, "check", 5)==0)
587
ent->resync = 3;
588
589
- if (l > 8 && strcmp(w+l-8, "=DELAYED"))
590
- ent->percent = 0;
591
- if (l > 8 && strcmp(w+l-8, "=PENDING"))
592
- ent->percent = 0;
593
+ if (l > 8 && strcmp(w+l-8, "=DELAYED") == 0)
594
+ ent->percent = PROCESS_DELAYED;
595
+ if (l > 8 && strcmp(w+l-8, "=PENDING") == 0)
596
+ ent->percent = PROCESS_PENDING;
597
} else if (ent->percent == -1 &&
598
w[0] >= '0' &&
599
w[0] <= '9' &&
600
diff --git a/platform-intel.h b/platform-intel.h
601
index e24ae37..6c094d7 100644
602
--- a/platform-intel.h
603
+++ b/platform-intel.h
604
@@ -167,21 +167,6 @@ static inline int fls(int x)
605
return r;
606
}
607
608
-/**
609
- * imsm_orom_default_chunk - return the largest chunk size supported via orom
610
- * @orom: orom pointer from find_imsm_orom
611
- */
612
-static inline int imsm_orom_default_chunk(const struct imsm_orom *orom)
613
-{
614
- int fs = fls(orom->sss);
615
-
616
- if (!fs)
617
- return 0;
618
-
619
- return min(512, (1 << fs));
620
-}
621
-
622
-
623
enum sys_dev_type {
624
SYS_DEV_UNKNOWN = 0,
625
SYS_DEV_SAS,
626
@@ -189,7 +174,6 @@ enum sys_dev_type {
627
SYS_DEV_MAX
628
};
629
630
-
631
struct sys_dev {
632
enum sys_dev_type type;
633
char *path;
634
diff --git a/raid6check.8 b/raid6check.8
635
new file mode 100644
636
index 0000000..5003343
637
--- /dev/null
638
+++ b/raid6check.8
639
@@ -0,0 +1,96 @@
640
+.\" -*- nroff -*-
641
+.\" Copyright Piergiorgio Sartor and others.
642
+.\" This program is free software; you can redistribute it and/or modify
643
+.\" it under the terms of the GNU General Public License as published by
644
+.\" the Free Software Foundation; either version 2 of the License, or
645
+.\" (at your option) any later version.
646
+.\" See file COPYING in distribution for details.
647
+.TH RAID6CHECK 8 "" v1.0.0
648
+.SH NAME
649
+raid6check \- check MD RAID6 device for errors
650
+.I aka
651
+Linux Software RAID
652
+
653
+.SH SYNOPSIS
654
+
655
+.BI raid6check " <raid6 device> <start stripe> <number of stripes>"
656
+
657
+.SH DESCRIPTION
658
+RAID6 devices in which one single component drive has errors can use
659
+the double parity in order to find out which component drive.
660
+The "raid6check" tool checks, for each stripe, the double parity
661
+consistency, reports mismatches and, if possible, which
662
+component drive has the mismatch.
663
+Since it works at stripe level, it can report different drives with
664
+mismatches at different stripes.
665
+
666
+"raid6check" requires a non-degraded RAID6 MD device as first
667
+parameter, a starting stripe (usually 0) and the number of stripes
668
+to be checked.
669
+If this third parameter is also 0, it will check the array up to
670
+the end.
671
+
672
+"raid6check" will start printing information about the RAID6, then
673
+for each stripe, it will report the parity rotation status.
674
+In case of parity mismatches, "raid6check" reports, if possible,
675
+which component drive could be responsible. Otherwise it reports
676
+that it is not possible to find the component drive.
677
+
678
+If the given MD device is not a RAID6, "raid6check" will, of
679
+course, not continue.
680
+
681
+If the RAID6 MD device is degraded, "raid6check" will report
682
+an error and it will not proceed further.
683
+
684
+No write operations are performed on the array or the components.
685
+Furthermore, the checked array can be online and in use during
686
+the operation of "raid6check".
687
+
688
+.SH EXAMPLES
689
+
690
+.B " raid6check /dev/md0 0 0"
691
+.br
692
+This will check /dev/md0 from start to end.
693
+
694
+.B " raid6check /dev/md3 0 1"
695
+.br
696
+This will check the first stripe of /dev/md3.
697
+
698
+.B " raid6check /dev/md1 1000 0"
699
+.br
700
+This will check /dev/md1 from stripe 1000 up to the end.
701
+
702
+.B " raid6check /dev/m127 128 256"
703
+.br
704
+This will check 256 stripes of /dev/md127 starting from stripe 128.
705
+
706
+.B " raid6check /dev/md0 0 0 | grep -i error > md0_err.log"
707
+.br
708
+This will check /dev/md0 completely and create a log file only
709
+with errors, if any.
710
+
711
+.SH FILES
712
+
713
+"raid6check" uses directly the component drives as found in /dev.
714
+Furthermore, the sysfs interface is needed in order to find out
715
+the RAID6 parameters.
716
+
717
+.SH BUGS
718
+Negative parameters can lead to unexpected results.
719
+
720
+It is not clear what will happen if the RAID6 MD device gets
721
+degraded during the check.
722
+
723
+.PP
724
+The latest version of
725
+.I raid6check
726
+should always be available from
727
+.IP
728
+.B http://www.kernel.org/pub/linux/utils/raid/mdadm/
729
+.PP
730
+Related man pages:
731
+.PP
732
+.IR mdadm (8)
733
+.IR mdmon (8),
734
+.IR mdadm.conf (5),
735
+.IR md (4).
736
diff --git a/super-intel.c b/super-intel.c
737
index 2ef2b3c..ddf4de9 100644
738
--- a/super-intel.c
739
+++ b/super-intel.c
740
@@ -74,14 +74,17 @@
741
742
/* Define all supported attributes that have to be accepted by mdadm
743
*/
744
-#define MPB_ATTRIB_SUPPORTED MPB_ATTRIB_CHECKSUM_VERIFY | \
745
+#define MPB_ATTRIB_SUPPORTED (MPB_ATTRIB_CHECKSUM_VERIFY | \
746
MPB_ATTRIB_2TB | \
747
MPB_ATTRIB_2TB_DISK | \
748
MPB_ATTRIB_RAID0 | \
749
MPB_ATTRIB_RAID1 | \
750
MPB_ATTRIB_RAID10 | \
751
MPB_ATTRIB_RAID5 | \
752
- MPB_ATTRIB_EXP_STRIPE_SIZE
753
+ MPB_ATTRIB_EXP_STRIPE_SIZE)
754
+
755
+/* Define attributes that are unused but not harmful */
756
+#define MPB_ATTRIB_IGNORED (MPB_ATTRIB_NEVER_USE)
757
758
#define MPB_SECTOR_CNT 2210
759
#define IMSM_RESERVED_SECTORS 4096
760
@@ -341,7 +344,7 @@ struct intel_super {
761
struct extent *e; /* for determining freespace @ create */
762
int raiddisk; /* slot to fill in autolayout */
763
enum action action;
764
- } *disks;
765
+ } *disks, *current_disk;
766
struct dl *disk_mgmt_list; /* list of disks to add/remove while mdmon
767
active */
768
struct dl *missing; /* disks removed while we weren't looking */
769
@@ -1141,11 +1144,14 @@ void examine_migr_rec_imsm(struct intel_super *super)
770
static int imsm_check_attributes(__u32 attributes)
771
{
772
int ret_val = 1;
773
- __u32 not_supported = (MPB_ATTRIB_SUPPORTED)^0xffffffff;
774
+ __u32 not_supported = MPB_ATTRIB_SUPPORTED^0xffffffff;
775
+
776
+ not_supported &= ~MPB_ATTRIB_IGNORED;
777
778
not_supported &= attributes;
779
if (not_supported) {
780
- fprintf(stderr, Name "(IMSM): Unsupported attributes : %x\n", not_supported);
781
+ fprintf(stderr, Name "(IMSM): Unsupported attributes : %x\n",
782
+ (unsigned)__le32_to_cpu(not_supported));
783
if (not_supported & MPB_ATTRIB_CHECKSUM_VERIFY) {
784
dprintf("\t\tMPB_ATTRIB_CHECKSUM_VERIFY \n");
785
not_supported ^= MPB_ATTRIB_CHECKSUM_VERIFY;
786
@@ -1518,9 +1524,9 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
787
fd2devname(fd, buf);
788
printf(" Port%d : %s", port, buf);
789
if (imsm_read_serial(fd, NULL, (__u8 *) buf) == 0)
790
- printf(" (%s)\n", buf);
791
+ printf(" (%.*s)\n", MAX_RAID_SERIAL_LEN, buf);
792
else
793
- printf("()\n");
794
+ printf(" ()\n");
795
}
796
close(fd);
797
free(path);
798
@@ -2201,7 +2207,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
799
if (prev_map)
800
map_to_analyse = prev_map;
801
802
- dl = super->disks;
803
+ dl = super->current_disk;
804
805
info->container_member = super->current_vol;
806
info->array.raid_disks = map->num_members;
807
@@ -2263,11 +2269,13 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
808
info->new_chunk = info->array.chunk_size;
809
info->delta_disks = 0;
810
}
811
- info->disk.major = 0;
812
- info->disk.minor = 0;
813
+
814
if (dl) {
815
info->disk.major = dl->major;
816
info->disk.minor = dl->minor;
817
+ info->disk.number = dl->index;
818
+ info->disk.raid_disk = get_imsm_disk_slot(map_to_analyse,
819
+ dl->index);
820
}
821
822
info->data_offset = __le32_to_cpu(map_to_analyse->pba_of_lba0);
823
@@ -2326,7 +2334,9 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
824
825
dprintf("IMSM: General Migration checkpoint : %llu "
826
"(%llu) -> read reshape progress : %llu\n",
827
- units, blocks_per_unit, info->reshape_progress);
828
+ (unsigned long long)units,
829
+ (unsigned long long)blocks_per_unit,
830
+ info->reshape_progress);
831
832
used_disks = imsm_num_data_members(dev, 1);
833
if (used_disks > 0) {
834
@@ -4327,7 +4337,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
835
devname);
836
return 1;
837
}
838
- set_imsm_ord_tbl_ent(map, dk->number, dl->index);
839
+ set_imsm_ord_tbl_ent(map, dk->raid_disk, dl->index);
840
dl->disk.status = CONFIGURED_DISK;
841
842
/* if we are creating the first raid device update the family number */
843
@@ -4347,7 +4357,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
844
mpb->family_num = __cpu_to_le32(sum);
845
mpb->orig_family_num = mpb->family_num;
846
}
847
-
848
+ super->current_disk = dl;
849
return 0;
850
}
851
852
@@ -4912,6 +4922,15 @@ static int is_raid_level_supported(const struct imsm_orom *orom, int level, int
853
return 0;
854
}
855
856
+static int imsm_default_chunk(const struct imsm_orom *orom)
857
+{
858
+ /* up to 512 if the plaform supports it, otherwise the platform max.
859
+ * 128 if no platform detected
860
+ */
861
+ int fs = max(7, orom ? fls(orom->sss) : 0);
862
+
863
+ return min(512, (1 << fs));
864
+}
865
866
#define pr_vrb(fmt, arg...) (void) (verbose && fprintf(stderr, Name fmt, ##arg))
867
/*
868
@@ -4940,15 +4959,16 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
869
level, raiddisks, raiddisks > 1 ? "s" : "");
870
return 0;
871
}
872
- if (super->orom && level != 1) {
873
- if (chunk && (*chunk == 0 || *chunk == UnSet))
874
- *chunk = imsm_orom_default_chunk(super->orom);
875
- else if (chunk && !imsm_orom_has_chunk(super->orom, *chunk)) {
876
- pr_vrb(": platform does not support a chunk size of: "
877
- "%d\n", *chunk);
878
- return 0;
879
- }
880
+
881
+ if (chunk && (*chunk == 0 || *chunk == UnSet))
882
+ *chunk = imsm_default_chunk(super->orom);
883
+
884
+ if (super->orom && chunk && !imsm_orom_has_chunk(super->orom, *chunk)) {
885
+ pr_vrb(": platform does not support a chunk size of: "
886
+ "%d\n", *chunk);
887
+ return 0;
888
}
889
+
890
if (layout != imsm_level_to_layout(level)) {
891
if (level == 5)
892
pr_vrb(": imsm raid 5 only supports the left-asymmetric layout\n");
893
@@ -5298,9 +5318,8 @@ static void default_geometry_imsm(struct supertype *st, int *level, int *layout,
894
if (level && layout && *layout == UnSet)
895
*layout = imsm_level_to_layout(*level);
896
897
- if (chunk && (*chunk == UnSet || *chunk == 0) &&
898
- super && super->orom)
899
- *chunk = imsm_orom_default_chunk(super->orom);
900
+ if (chunk && (*chunk == UnSet || *chunk == 0))
901
+ *chunk = imsm_default_chunk(super->orom);
902
}
903
904
static void handle_missing(struct intel_super *super, struct imsm_dev *dev);
905
@@ -8661,8 +8680,9 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level,
906
dprintf("imsm: info: Volume operation\n");
907
/* find requested device */
908
while (dev) {
909
- imsm_find_array_minor_by_subdev(dev->index, st->container_dev, &devnum);
910
- if (devnum == geo.dev_id)
911
+ if (imsm_find_array_minor_by_subdev(
912
+ dev->index, st->container_dev, &devnum) == 0
913
+ && devnum == geo.dev_id)
914
break;
915
dev = dev->next;
916
}
917
diff --git a/super1.c b/super1.c
918
index 09be351..35e92a3 100644
919
--- a/super1.c
920
+++ b/super1.c
921
@@ -313,7 +313,7 @@ static void examine_super1(struct supertype *st, char *homehost)
922
printf("\n");
923
}
924
if (sb->devflags) {
925
- printf(" Flags :");
926
+ printf(" Flags :");
927
if (sb->devflags & WriteMostly1)
928
printf(" write-mostly");
929
printf("\n");
930
@@ -1056,6 +1056,8 @@ static int write_init_super1(struct supertype *st)
931
sb->dev_number = __cpu_to_le32(di->disk.number);
932
if (di->disk.state & (1<<MD_DISK_WRITEMOSTLY))
933
sb->devflags |= __cpu_to_le32(WriteMostly1);
934
+ else
935
+ sb->devflags &= ~(__cpu_to_le32(WriteMostly1));
936
937
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
938
read(rfd, sb->device_uuid, 16) != 16) {
939
diff --git a/sysfs.c b/sysfs.c
940
index 44314ba..56813b7 100644
941
--- a/sysfs.c
942
+++ b/sysfs.c
943
@@ -470,7 +470,7 @@ int sysfs_fd_get_ll(int fd, unsigned long long *val)
944
lseek(fd, 0, 0);
945
n = read(fd, buf, sizeof(buf));
946
if (n <= 0)
947
- return -1;
948
+ return -2;
949
buf[n] = 0;
950
*val = strtoull(buf, &ep, 0);
951
if (ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' '))
952
diff --git a/udev-md-raid.rules b/udev-md-raid.rules
953
index 1d89833..c2105bc 100644
954
--- a/udev-md-raid.rules
955
+++ b/udev-md-raid.rules
956
@@ -3,9 +3,11 @@
957
SUBSYSTEM!="block", GOTO="md_end"
958
959
# handle potential components of arrays
960
-ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
961
+ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
962
+ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
963
ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
964
-ENV{ID_FS_TYPE}=="isw_raid_member", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
965
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
966
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
967
ENV{ID_FS_TYPE}=="isw_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
968
969
# handle md arrays
970
diff --git a/util.c b/util.c
971
index 10bbe56..ce03239 100644
972
--- a/util.c
973
+++ b/util.c
974
@@ -146,16 +146,16 @@ int get_linux_version()
975
{
976
struct utsname name;
977
char *cp;
978
- int a,b,c;
979
+ int a = 0, b = 0,c = 0;
980
if (uname(&name) <0)
981
return -1;
982
983
cp = name.release;
984
a = strtoul(cp, &cp, 10);
985
- if (*cp != '.') return -1;
986
- b = strtoul(cp+1, &cp, 10);
987
- if (*cp != '.') return -1;
988
- c = strtoul(cp+1, NULL, 10);
989
+ if (*cp == '.')
990
+ b = strtoul(cp+1, &cp, 10);
991
+ if (*cp == '.')
992
+ c = strtoul(cp+1, &cp, 10);
993
994
return (a*1000000)+(b*1000)+c;
995
}
996
@@ -535,6 +535,7 @@ int check_raid(int fd, char *name)
997
struct supertype *st = guess_super(fd);
998
999
if (!st) return 0;
1000
+ st->ignore_hw_compat = 1;
1001
st->ss->load_super(st, fd, name);
1002
/* Looks like a raid array .. */
1003
fprintf(stderr, Name ": %s appears to be part of a raid array:\n",
1004