]>
git.ipfire.org Git - thirdparty/mdadm.git/blob - Incremental.c
2 * Incremental.c - support --incremental. Part of:
3 * mdadm - manage Linux "md" devices aka RAID arrays.
5 * Copyright (C) 2006 Neil Brown <neilb@suse.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Email: <neilb@suse.de>
27 * QVB Post Office, NSW 1230
33 static int count_active(struct supertype
*st
, int mdfd
, char **availp
,
35 static void find_reject(int mdfd
, struct supertype
*st
, struct mdinfo
*sra
,
36 int number
, __u64 events
, int verbose
,
39 int Incremental(char *devname
, int verbose
, int runstop
,
40 struct supertype
*st
, char *homehost
, int autof
)
42 /* Add this device to an array, creating the array if necessary
43 * and starting the array if sensible or - if runstop>0 - if possible.
45 * This has several steps:
47 * 1/ Check if device is permitted by mdadm.conf, reject if not.
48 * 2/ Find metadata, reject if none appropriate (check
49 * version/name from args)
50 * 3/ Check if there is a match in mdadm.conf
51 * 3a/ if not, check for homehost match. If no match, reject.
52 * 4/ Determine device number.
53 * - If in mdadm.conf with std name, use that
54 * - UUID in /var/run/mdadm.map use that
55 * - If name is suggestive, use that. unless in use with different uuid.
56 * - Choose a free, high number.
57 * - Use a partitioned device unless strong suggestion not to.
59 * Don't choose partitioned for containers.
60 * 5/ Find out if array already exists
62 * - choose a name, from mdadm.conf or 'name' field in array.
66 * - check one drive in array to make sure metadata is a reasonably
67 * close match. Reject if not (e.g. different type)
69 * 6/ Make sure /var/run/mdadm.map contains this array.
70 * 7/ Is there enough devices to possibly start the array?
71 * For a container, this means running Incremental_container.
72 * 7a/ if not, finish with success.
74 * - read all metadata and arrange devices like -A does
75 * - if number of OK devices match expected, or -R and there are enough,
76 * start the array (auto-readonly).
80 struct mddev_ident_s
*array_list
, *match
;
81 char chosen_name
[1024];
84 struct map_ent
*mp
, *map
= NULL
;
88 int uuid_for_name
= 0;
92 struct createinfo
*ci
= conf_get_create_info();
95 /* 1/ Check if device is permitted by mdadm.conf */
97 if (!conf_test_dev(devname
)) {
100 ": %s not permitted by mdadm.conf.\n",
105 /* 2/ Find metadata, reject if none appropriate (check
106 * version/name from args) */
108 dfd
= dev_open(devname
, O_RDONLY
|O_EXCL
);
111 fprintf(stderr
, Name
": cannot open %s: %s.\n",
112 devname
, strerror(errno
));
115 if (fstat(dfd
, &stb
) < 0) {
117 fprintf(stderr
, Name
": fstat failed for %s: %s.\n",
118 devname
, strerror(errno
));
122 if ((stb
.st_mode
& S_IFMT
) != S_IFBLK
) {
124 fprintf(stderr
, Name
": %s is not a block device.\n",
130 if (st
== NULL
&& (st
= guess_super(dfd
)) == NULL
) {
133 ": no recognisable superblock on %s.\n",
138 if (st
->ss
->load_super(st
, dfd
, NULL
)) {
140 fprintf(stderr
, Name
": no RAID superblock on %s.\n",
147 if (st
->ss
->container_content
&& st
->loaded_container
) {
148 /* This is a pre-built container array, so we do something
151 return Incremental_container(st
, devname
, verbose
, runstop
,
155 memset(&info
, 0, sizeof(info
));
156 st
->ss
->getinfo_super(st
, &info
);
157 /* 3/ Check if there is a match in mdadm.conf */
159 array_list
= conf_get_ident(NULL
);
161 for (; array_list
; array_list
= array_list
->next
) {
162 if (array_list
->uuid_set
&&
163 same_uuid(array_list
->uuid
, info
.uuid
, st
->ss
->swapuuid
)
167 ": UUID differs from %s.\n",
168 array_list
->devname
);
171 if (array_list
->name
[0] &&
172 strcasecmp(array_list
->name
, info
.name
) != 0) {
175 ": Name differs from %s.\n",
176 array_list
->devname
);
179 if (array_list
->devices
&&
180 !match_oneof(array_list
->devices
, devname
)) {
183 ": Not a listed device for %s.\n",
184 array_list
->devname
);
187 if (array_list
->super_minor
!= UnSet
&&
188 array_list
->super_minor
!= info
.array
.md_minor
) {
191 ": Different super-minor to %s.\n",
192 array_list
->devname
);
195 if (!array_list
->uuid_set
&&
196 !array_list
->name
[0] &&
197 !array_list
->devices
&&
198 array_list
->super_minor
== UnSet
) {
201 ": %s doesn't have any identifying information.\n",
202 array_list
->devname
);
205 /* FIXME, should I check raid_disks and level too?? */
210 ": we match both %s and %s - cannot decide which to use.\n",
211 match
->devname
, array_list
->devname
);
217 /* 3a/ if not, check for homehost match. If no match, continue
218 * but don't trust the 'name' in the array. Thus a 'random' minor
219 * number will be assigned, and the device name will be based
222 if (homehost
== NULL
||
223 st
->ss
->match_home(st
, homehost
) != 1)
226 /* 4/ Determine device number. */
227 /* - If in mdadm.conf with std name, get number from name. */
228 /* - UUID in /var/run/mdadm.map get number from mapping */
229 /* - If name is suggestive, use that. unless in use with */
230 /* different uuid. */
231 /* - Choose a free, high number. */
232 /* - Use a partitioned device unless strong suggestion not to. */
234 mp
= map_by_uuid(&map
, info
.uuid
);
236 if (uuid_for_name
&& ! mp
) {
237 name_to_use
= fname_from_uuid(st
, &info
, nbuf
, '-');
240 ": not found in mdadm.conf and not identified by homehost"
241 " - using uuid based name\n");
243 name_to_use
= info
.name
;
245 /* There are three possible sources for 'autof': command line,
246 * ARRAY line in mdadm.conf, or CREATE line in mdadm.conf.
247 * ARRAY takes precedence, then command line, then
250 if (match
&& match
->autof
)
251 autof
= match
->autof
;
255 if (match
&& (rv
= is_standard(match
->devname
, &devnum
))) {
256 devnum
= (rv
> 0) ? (-1-devnum
) : devnum
;
257 } else if (mp
!= NULL
)
260 /* Have to guess a bit. */
261 int use_partitions
= 1;
263 char *nm
, nbuf
[1024];
266 if ((autof
&7) == 3 || (autof
&7) == 5)
268 if (st
->ss
->external
)
270 np
= strchr(name_to_use
, ':');
275 devnum
= strtoul(np
, &ep
, 10);
276 if (ep
> np
&& *ep
== 0) {
277 /* This is a number. Let check that it is unused. */
278 if (mddev_busy(use_partitions
? (-1-devnum
) : devnum
))
286 sprintf(nbuf
, "/dev/md/%s", np
);
289 if (stat(nm
, &stb2
) == 0 &&
290 S_ISBLK(stb2
.st_mode
) &&
291 major(stb2
.st_rdev
) == (use_partitions
?
292 get_mdp_major() : MD_MAJOR
)) {
294 devnum
= minor(stb2
.st_rdev
) >> MdpMinorShift
;
296 devnum
= minor(stb2
.st_rdev
);
297 if (mddev_busy(use_partitions
? (-1-devnum
) : devnum
))
302 /* Haven't found anything yet, choose something free */
303 devnum
= find_free_devnum(use_partitions
);
305 if (devnum
== NoMdDev
) {
307 ": No spare md devices!!\n");
311 devnum
= use_partitions
? (-1-devnum
) : devnum
;
314 mdfd
= open_mddev_devnum(match
? match
->devname
: mp
? mp
->path
: NULL
,
317 chosen_name
, autof
>> 3);
319 fprintf(stderr
, Name
": failed to open %s: %s.\n",
320 chosen_name
, strerror(errno
));
323 sysfs_init(&info
, mdfd
, 0);
325 /* 5/ Find out if array already exists */
326 if (! mddev_busy(devnum
)) {
327 /* 5a/ if it does not */
328 /* - choose a name, from mdadm.conf or 'name' field in array. */
329 /* - create the array */
330 /* - add the device */
334 if (set_array_info(mdfd
, st
, &info
) != 0) {
335 fprintf(stderr
, Name
": failed to set array info for %s: %s\n",
336 chosen_name
, strerror(errno
));
342 dinfo
.disk
.major
= major(stb
.st_rdev
);
343 dinfo
.disk
.minor
= minor(stb
.st_rdev
);
344 if (add_disk(mdfd
, st
, &info
, &dinfo
) != 0) {
345 fprintf(stderr
, Name
": failed to add %s to %s: %s.\n",
346 devname
, chosen_name
, strerror(errno
));
347 ioctl(mdfd
, STOP_ARRAY
, 0);
351 sra
= sysfs_read(mdfd
, devnum
, GET_DEVS
);
352 if (!sra
|| !sra
->devs
|| sra
->devs
->disk
.raid_disk
>= 0) {
353 /* It really should be 'none' - must be old buggy
354 * kernel, and mdadm -I may not be able to complete.
357 ioctl(mdfd
, STOP_ARRAY
, NULL
);
359 ": You have an old buggy kernel which cannot support\n"
360 " --incremental reliably. Aborting.\n");
365 info
.array
.working_disks
= 1;
369 /* - check one drive in array to make sure metadata is a reasonably */
370 /* close match. Reject if not (e.g. different type) */
371 /* - add the device */
376 struct supertype
*st2
;
377 struct mdinfo info2
, *d
;
378 sra
= sysfs_read(mdfd
, devnum
, (GET_DEVS
| GET_STATE
));
380 sprintf(dn
, "%d:%d", sra
->devs
->disk
.major
,
381 sra
->devs
->disk
.minor
);
382 dfd2
= dev_open(dn
, O_RDONLY
);
384 if (st2
->ss
->load_super(st2
, dfd2
, NULL
) ||
385 st
->ss
->compare_super(st
, st2
) != 0) {
387 ": metadata mismatch between %s and "
389 devname
, chosen_name
);
395 memset(&info2
, 0, sizeof(info2
));
396 st2
->ss
->getinfo_super(st2
, &info2
);
397 st2
->ss
->free_super(st2
);
398 if (info
.array
.level
!= info2
.array
.level
||
399 memcmp(info
.uuid
, info2
.uuid
, 16) != 0 ||
400 info
.array
.raid_disks
!= info2
.array
.raid_disks
) {
402 ": unexpected difference between %s and %s.\n",
403 chosen_name
, devname
);
407 info2
.disk
.major
= major(stb
.st_rdev
);
408 info2
.disk
.minor
= minor(stb
.st_rdev
);
409 /* add disk needs to know about containers */
410 if (st
->ss
->external
)
411 sra
->array
.level
= LEVEL_CONTAINER
;
412 err
= add_disk(mdfd
, st2
, sra
, &info2
);
413 if (err
< 0 && errno
== EBUSY
) {
414 /* could be another device present with the same
415 * disk.number. Find and reject any such
417 find_reject(mdfd
, st
, sra
, info
.disk
.number
,
418 info
.events
, verbose
, chosen_name
);
419 err
= add_disk(mdfd
, st2
, sra
, &info2
);
422 fprintf(stderr
, Name
": failed to add %s to %s: %s.\n",
423 devname
, chosen_name
, strerror(errno
));
427 info
.array
.working_disks
= 0;
428 for (d
= sra
->devs
; d
; d
=d
->next
)
429 info
.array
.working_disks
++;
432 /* 6/ Make sure /var/run/mdadm.map contains this array. */
433 map_update(&map
, devnum
,
435 info
.uuid
, chosen_name
);
437 /* 7/ Is there enough devices to possibly start the array? */
438 /* 7a/ if not, finish with success. */
439 if (info
.array
.level
== LEVEL_CONTAINER
) {
440 /* Try to assemble within the container */
444 ": container %s now has %d devices\n",
445 chosen_name
, info
.array
.working_disks
);
446 return Incremental(chosen_name
, verbose
, runstop
,
447 NULL
, homehost
, autof
);
450 active_disks
= count_active(st
, mdfd
, &avail
, &info
);
451 if (enough(info
.array
.level
, info
.array
.raid_disks
,
452 info
.array
.layout
, info
.array
.state
& 1,
453 avail
, active_disks
) == 0) {
457 ": %s attached to %s, not enough to start (%d).\n",
458 devname
, chosen_name
, active_disks
);
465 /* - if number of OK devices match expected, or -R and there */
467 /* + add any bitmap file */
468 /* + start the array (auto-readonly). */
470 mdu_array_info_t ainf
;
472 if (ioctl(mdfd
, GET_ARRAY_INFO
, &ainf
) == 0) {
475 ": %s attached to %s which is already active.\n",
476 devname
, chosen_name
);
481 if (runstop
> 0 || active_disks
>= info
.array
.working_disks
) {
483 /* Let's try to start it */
484 if (match
&& match
->bitmap_file
) {
485 int bmfd
= open(match
->bitmap_file
, O_RDWR
);
488 ": Could not open bitmap file %s.\n",
493 if (ioctl(mdfd
, SET_BITMAP_FILE
, bmfd
) != 0) {
496 ": Failed to set bitmapfile for %s.\n",
503 sra
= sysfs_read(mdfd
, devnum
, 0);
504 if ((sra
== NULL
|| active_disks
>= info
.array
.working_disks
)
505 && uuid_for_name
== 0)
506 rv
= ioctl(mdfd
, RUN_ARRAY
, NULL
);
508 rv
= sysfs_set_str(sra
, NULL
,
509 "array_state", "read-auto");
513 ": %s attached to %s, which has been started.\n",
514 devname
, chosen_name
);
518 ": %s attached to %s, but failed to start: %s.\n",
519 devname
, chosen_name
, strerror(errno
));
525 ": %s attached to %s, not enough to start safely.\n",
526 devname
, chosen_name
);
533 static void find_reject(int mdfd
, struct supertype
*st
, struct mdinfo
*sra
,
534 int number
, __u64 events
, int verbose
,
537 /* Find a device attached to this array with a disk.number of number
538 * and events less than the passed events, and remove the device.
543 if (ioctl(mdfd
, GET_ARRAY_INFO
, &ra
) == 0)
544 return; /* not safe to remove from active arrays
545 * without thinking more */
547 for (d
= sra
->devs
; d
; d
= d
->next
) {
551 sprintf(dn
, "%d:%d", d
->disk
.major
, d
->disk
.minor
);
552 dfd
= dev_open(dn
, O_RDONLY
);
555 if (st
->ss
->load_super(st
, dfd
, NULL
)) {
559 st
->ss
->getinfo_super(st
, &info
);
560 st
->ss
->free_super(st
);
563 if (info
.disk
.number
!= number
||
564 info
.events
>= events
)
567 if (d
->disk
.raid_disk
> -1)
568 sysfs_set_str(sra
, d
, "slot", "none");
569 if (sysfs_set_str(sra
, d
, "state", "remove") == 0)
572 ": removing old device %s from %s\n",
573 d
->sys_name
+4, array_name
);
577 static int count_active(struct supertype
*st
, int mdfd
, char **availp
,
578 struct mdinfo
*bestinfo
)
580 /* count how many devices in sra think they are active */
582 int cnt
= 0, cnt1
= 0;
583 __u64 max_events
= 0;
584 struct mdinfo
*sra
= sysfs_read(mdfd
, -1, GET_DEVS
| GET_STATE
);
587 for (d
= sra
->devs
; d
; d
= d
->next
) {
593 sprintf(dn
, "%d:%d", d
->disk
.major
, d
->disk
.minor
);
594 dfd
= dev_open(dn
, O_RDONLY
);
597 ok
= st
->ss
->load_super(st
, dfd
, NULL
);
601 st
->ss
->getinfo_super(st
, &info
);
603 avail
= malloc(info
.array
.raid_disks
);
605 fprintf(stderr
, Name
": out of memory.\n");
608 memset(avail
, 0, info
.array
.raid_disks
);
612 if (info
.disk
.state
& (1<<MD_DISK_SYNC
))
616 max_events
= info
.events
;
617 avail
[info
.disk
.raid_disk
] = 2;
618 st
->ss
->getinfo_super(st
, bestinfo
);
619 } else if (info
.events
== max_events
) {
621 avail
[info
.disk
.raid_disk
] = 2;
622 } else if (info
.events
== max_events
-1) {
624 avail
[info
.disk
.raid_disk
] = 1;
625 } else if (info
.events
< max_events
- 1)
627 else if (info
.events
== max_events
+1) {
631 max_events
= info
.events
;
632 for (i
=0; i
<info
.array
.raid_disks
; i
++)
635 avail
[info
.disk
.raid_disk
] = 2;
636 st
->ss
->getinfo_super(st
, bestinfo
);
637 } else { /* info.events much bigger */
639 memset(avail
, 0, info
.disk
.raid_disk
);
640 max_events
= info
.events
;
641 st
->ss
->getinfo_super(st
, bestinfo
);
644 st
->ss
->free_super(st
);
649 void RebuildMap(void)
651 struct mdstat_ent
*mdstat
= mdstat_read(0, 0);
652 struct mdstat_ent
*md
;
653 struct map_ent
*map
= NULL
;
654 int mdp
= get_mdp_major();
656 for (md
= mdstat
; md
; md
= md
->next
) {
657 struct mdinfo
*sra
= sysfs_read(-1, md
->devnum
, GET_DEVS
);
660 for (sd
= sra
->devs
; sd
; sd
= sd
->next
) {
664 struct supertype
*st
;
668 sprintf(dn
, "%d:%d", sd
->disk
.major
, sd
->disk
.minor
);
669 dfd
= dev_open(dn
, O_RDONLY
);
672 st
= guess_super(dfd
);
676 ok
= st
->ss
->load_super(st
, dfd
, NULL
);
680 st
->ss
->getinfo_super(st
, &info
);
682 path
= map_dev(MD_MAJOR
, md
->devnum
, 0);
684 path
= map_dev(mdp
, (-1-md
->devnum
)<< 6, 0);
685 map_add(&map
, md
->devnum
,
687 info
.uuid
, path
? : "/unknown");
688 st
->ss
->free_super(st
);
696 int IncrementalScan(int verbose
)
698 /* look at every device listed in the 'map' file.
699 * If one is found that is not running then:
700 * look in mdadm.conf for bitmap file.
701 * if one exists, but array has none, add it.
702 * try to start array in auto-readonly mode
704 struct map_ent
*mapl
= NULL
;
706 mddev_ident_t devs
, mddev
;
710 devs
= conf_get_ident(NULL
);
712 for (me
= mapl
; me
; me
= me
->next
) {
714 mdu_array_info_t array
;
715 mdu_bitmap_file_t bmf
;
717 int mdfd
= open_mddev_devnum(me
->path
, me
->devnum
,
721 if (ioctl(mdfd
, GET_ARRAY_INFO
, &array
) == 0 ||
726 /* Ok, we can try this one. Maybe it needs a bitmap */
727 for (mddev
= devs
; mddev
; mddev
= mddev
->next
)
728 if (strcmp(mddev
->devname
, me
->path
) == 0)
730 if (mddev
&& mddev
->bitmap_file
) {
732 * Note: early kernels will wrongly fail this, so it
736 if (ioctl(mdfd
, GET_ARRAY_INFO
, &bmf
) < 0) {
737 int bmfd
= open(mddev
->bitmap_file
, O_RDWR
);
739 added
= ioctl(mdfd
, SET_BITMAP_FILE
,
747 ": Added bitmap %s to %s\n",
748 mddev
->bitmap_file
, me
->path
);
749 else if (errno
!= EEXIST
)
751 ": Failed to add bitmap to %s: %s\n",
752 me
->path
, strerror(errno
));
755 sra
= sysfs_read(mdfd
, 0, 0);
757 if (sysfs_set_str(sra
, NULL
,
758 "array_state", "read-auto") == 0) {
761 ": started array %s\n",
765 ": failed to start array %s: %s\n",
766 me
->path
, strerror(errno
));
774 int Incremental_container(struct supertype
*st
, char *devname
, int verbose
,
775 int runstop
, int autof
)
777 /* Collect the contents of this container and for each
778 * array, choose a device name and assemble the array.
781 struct mdinfo
*list
= st
->ss
->container_content(st
);
784 for (ra
= list
; ra
; ra
= ra
->next
) {
785 struct mdinfo
*dev
, *sra
;
788 char chosen_name
[1024];
791 int working
= 0, preexist
= 0;
792 struct map_ent
*mp
, *map
= NULL
;
795 struct mddev_ident_s
*match
= NULL
;
797 if ((autof
&7) == 3 || (autof
&7) == 5)
800 mp
= map_by_uuid(&map
, ra
->uuid
);
802 name_to_use
= ra
->name
;
805 (*devname
!= '/' || strncmp("UUID-", strrchr(devname
,'/')+1,5) == 0)
807 name_to_use
= fname_from_uuid(st
, ra
, nbuf
, '-');
811 /* Check in mdadm.conf for devices == devname and
812 * member == ra->text_version after second slash.
814 char *sub
= strchr(ra
->text_version
+1, '/');
815 struct mddev_ident_s
*array_list
;
818 array_list
= conf_get_ident(NULL
);
821 for(; array_list
; array_list
= array_list
->next
) {
824 if (array_list
->member
== NULL
||
825 array_list
->container
== NULL
)
827 if (strcmp(array_list
->member
, sub
) != 0)
829 if (array_list
->uuid_set
&&
830 !same_uuid(ra
->uuid
, array_list
->uuid
, st
->ss
->swapuuid
))
832 fd
= open(array_list
->container
, O_RDONLY
);
835 dn
= devnum2devname(fd2devnum(fd
));
837 if (strncmp(dn
, ra
->text_version
+1,
839 ra
->text_version
[strlen(dn
)+1] != '/') {
844 /* we have a match */
847 fprintf(stderr
, Name
": match found for member %s\n",
853 if (match
&& is_standard(match
->devname
, &devnum
))
854 /* we have devnum now */;
857 else if (is_standard(name_to_use
, &devnum
))
863 if (*n
&& devnum
< 0) {
864 devnum
= strtoul(n
, &n
, 10);
865 if (devnum
>= 0 && (*n
== 0 || *n
== ' ')) {
866 /* Use this devnum */
867 usepart
= (name_to_use
[0] == 'd');
868 if (mddev_busy(usepart
? (-1-devnum
) : devnum
))
875 char *nm
= name_to_use
;
879 nm
= strchr(nm
, ':')+1;
880 sprintf(nbuf
, "/dev/md/%s", nm
);
882 if (stat(nbuf
, &stb
) == 0 &&
883 S_ISBLK(stb
.st_mode
) &&
884 major(stb
.st_rdev
) == (usepart
?
885 get_mdp_major() : MD_MAJOR
)){
887 devnum
= minor(stb
.st_rdev
)
890 devnum
= minor(stb
.st_rdev
);
891 if (mddev_busy(usepart
? (-1-devnum
) : devnum
))
897 devnum
= usepart
? (-1-devnum
) : devnum
;
899 devnum
= find_free_devnum(usepart
);
901 mdfd
= open_mddev_devnum(mp
? mp
->path
: match
? match
->devname
: NULL
,
903 chosen_name
, autof
>>3);
906 fprintf(stderr
, Name
": failed to open %s: %s.\n",
907 chosen_name
, strerror(errno
));
912 sysfs_init(ra
, mdfd
, 0);
914 sra
= sysfs_read(mdfd
, 0, GET_VERSION
);
915 if (sra
== NULL
|| strcmp(sra
->text_version
, ra
->text_version
) != 0)
916 if (sysfs_set_array(ra
, md_get_version(mdfd
)) != 0)
921 for (dev
= ra
->devs
; dev
; dev
= dev
->next
)
922 if (sysfs_add_disk(ra
, dev
) == 0)
924 else if (errno
== EEXIST
)
927 /* Nothing new, don't try to start */ ;
928 else if (runstop
> 0 ||
929 (working
+ preexist
) >= ra
->array
.working_disks
) {
930 switch(ra
->array
.level
) {
932 case LEVEL_MULTIPATH
:
934 sysfs_set_str(ra
, NULL
, "array_state",
938 sysfs_set_str(ra
, NULL
, "array_state",
940 /* start mdmon if needed. */
941 if (!mdmon_running(st
->container_dev
))
942 start_mdmon(st
->container_dev
);
943 ping_monitor(devnum2devname(st
->container_dev
));
946 sysfs_set_safemode(ra
, ra
->safe_mode_delay
);
949 ": Started %s with %d devices",
950 chosen_name
, working
+ preexist
);
952 fprintf(stderr
, " (%d new)", working
);
953 fprintf(stderr
, "\n");
955 /* FIXME should have an O_EXCL and wait for read-auto */
959 ": %s assembled with %d devices but "
961 chosen_name
, working
);
963 map_update(&map
, devnum
,
965 ra
->uuid
, chosen_name
);