]>
git.ipfire.org Git - thirdparty/mdadm.git/blob - Manage.c
2 * mdadm - manage Linux "md" devices aka RAID arrays.
4 * Copyright (C) 2001-2013 Neil Brown <neilb@suse.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Email: <neilb@suse.de>
30 #define REGISTER_DEV _IO (MD_MAJOR, 1)
31 #define START_MD _IO (MD_MAJOR, 2)
32 #define STOP_MD _IO (MD_MAJOR, 3)
34 int Manage_ro(char *devname
, int fd
, int readonly
)
36 /* switch to readonly or rw
39 * first check that array is runing
40 * use RESTART_ARRAY_RW or STOP_ARRAY_RO
46 /* If this is an externally-managed array, we need to modify the
47 * metadata_version so that mdmon doesn't undo our change.
49 mdi
= sysfs_read(fd
, NULL
, GET_LEVEL
|GET_VERSION
);
51 mdi
->array
.major_version
== -1 &&
52 is_subarray(mdi
->text_version
)) {
54 strcpy(vers
, "external:");
55 strcat(vers
, mdi
->text_version
);
58 /* We set readonly ourselves. */
60 sysfs_set_str(mdi
, NULL
, "metadata_version", vers
);
63 rv
= sysfs_set_str(mdi
, NULL
, "array_state", "readonly");
66 pr_err("failed to set readonly for %s: %s\n",
67 devname
, strerror(errno
));
69 vers
[9] = mdi
->text_version
[0];
70 sysfs_set_str(mdi
, NULL
, "metadata_version", vers
);
76 /* We cannot set read/write - must signal mdmon */
78 sysfs_set_str(mdi
, NULL
, "metadata_version", vers
);
80 cp
= strchr(vers
+10, '/');
83 ping_monitor(vers
+10);
84 if (mdi
->array
.level
<= 0)
85 sysfs_set_str(mdi
, NULL
, "array_state", "active");
90 if (!md_array_active(fd
)) {
91 pr_err("%s does not appear to be active.\n", devname
);
97 if (ioctl(fd
, STOP_ARRAY_RO
, NULL
)) {
98 pr_err("failed to set readonly for %s: %s\n",
99 devname
, strerror(errno
));
103 } else if (readonly
< 0) {
104 if (ioctl(fd
, RESTART_ARRAY_RW
, NULL
)) {
105 pr_err("failed to set writable for %s: %s\n",
106 devname
, strerror(errno
));
116 static void remove_devices(char *devnm
, char *path
)
119 * Remove names at 'path' - possibly with
120 * partition suffixes - which link to the 'standard'
121 * name for devnm. These were probably created
122 * by mdadm when the array was assembled.
135 sprintf(base
, "/dev/%s", devnm
);
136 be
= base
+ strlen(base
);
138 path2
= xmalloc(strlen(path
)+20);
140 pe
= path2
+ strlen(path2
);
142 for (part
= 0; part
< 16; part
++) {
144 sprintf(be
, "p%d", part
);
147 sprintf(pe
, "p%d", part
);
149 sprintf(pe
, "%d", part
);
151 n
= readlink(path2
, link
, sizeof(link
));
152 if (n
> 0 && (int)strlen(base
) == n
&&
153 strncmp(link
, base
, n
) == 0)
159 int Manage_run(char *devname
, int fd
, struct context
*c
)
161 /* Run the array. Array must already be configured
168 pr_err("Cannot find %s in sysfs!!\n", devname
);
172 return IncrementalScan(c
, nm
);
175 int Manage_stop(char *devname
, int fd
, int verbose
, int will_retry
)
177 /* Stop the array. Array must already be configured
178 * 'will_retry' means that error messages are not wanted.
181 struct map_ent
*map
= NULL
;
188 unsigned long long rd1
, rd2
;
190 if (will_retry
&& verbose
== 0)
193 strcpy(devnm
, fd2devnm(fd
));
194 /* Get EXCL access first. If this fails, then attempting
195 * to stop is probably a bad idea.
197 mdi
= sysfs_read(fd
, NULL
, GET_LEVEL
|GET_COMPONENT
|GET_VERSION
);
198 if (mdi
&& is_subarray(mdi
->text_version
)) {
200 strncpy(container
, mdi
->text_version
+1, sizeof(container
));
201 container
[sizeof(container
)-1] = 0;
202 sl
= strchr(container
, '/');
209 while (((fd
= ((devname
[0] == '/')
210 ?open(devname
, O_RDONLY
|O_EXCL
)
211 :open_dev_flags(devnm
, O_RDONLY
|O_EXCL
))) < 0
212 || strcmp(fd2devnm(fd
), devnm
) != 0)
214 && mdmon_running(container
)
216 /* Can't open, so something might be wrong. However it
217 * is a container, so we might be racing with mdmon, so
222 flush_mdmon(container
);
225 if (fd
< 0 || strcmp(fd2devnm(fd
), devnm
) != 0) {
229 pr_err("Cannot get exclusive access to %s:Perhaps a running process, mounted filesystem or active volume group?\n",
233 /* If this is an mdmon managed array, just write 'inactive'
234 * to the array state and let mdmon clear up.
237 mdi
->array
.level
> 0 &&
238 is_subarray(mdi
->text_version
)) {
240 /* This is mdmon managed. */
243 /* As we had an O_EXCL open, any use of the device
244 * which blocks STOP_ARRAY is probably a transient use,
245 * so it is reasonable to retry for a while - 5 seconds.
249 (err
= sysfs_set_str(mdi
, NULL
,
258 pr_err("failed to stop array %s: %s\n",
259 devname
, strerror(errno
));
264 /* Give monitor a chance to act */
265 ping_monitor(mdi
->text_version
);
267 fd
= open_dev_excl(devnm
);
270 pr_err("failed to completely stop %s: Device is busy\n",
276 mdi
->array
.major_version
== -1 &&
277 mdi
->array
.minor_version
== -2 &&
278 !is_subarray(mdi
->text_version
)) {
279 struct mdstat_ent
*mds
, *m
;
280 /* container, possibly mdmon-managed.
281 * Make sure mdmon isn't opening it, which
282 * would interfere with the 'stop'
284 ping_monitor(mdi
->sys_name
);
286 /* now check that there are no existing arrays
287 * which are members of this array
289 mds
= mdstat_read(0, 0);
290 for (m
= mds
; m
; m
= m
->next
)
291 if (m
->metadata_version
&&
292 strncmp(m
->metadata_version
, "external:", 9)==0 &&
293 metadata_container_matches(m
->metadata_version
+9,
296 pr_err("Cannot stop container %s: member %s still active\n",
304 /* If the array is undergoing a reshape which changes the number
305 * of devices, then it would be nice to stop it at a point where
306 * it has completed a full number of stripes in both old and
307 * new layouts as this will allow the reshape to be reverted.
308 * So if 'sync_action' is "reshape" and 'raid_disks' shows two
309 * different numbers, then
311 * - set sync_max to next multiple of both data_disks and
312 * chunk sizes (or next but one)
314 * - wait on 'sync_completed' for that point to be reached.
316 if (mdi
&& (mdi
->array
.level
>= 4 && mdi
->array
.level
<= 6) &&
317 sysfs_attribute_available(mdi
, NULL
, "sync_action") &&
318 sysfs_attribute_available(mdi
, NULL
, "reshape_direction") &&
319 sysfs_get_str(mdi
, NULL
, "sync_action", buf
, 20) > 0 &&
320 strcmp(buf
, "reshape\n") == 0 &&
321 sysfs_get_two(mdi
, NULL
, "raid_disks", &rd1
, &rd2
) == 2) {
322 unsigned long long position
, curr
;
323 unsigned long long chunk1
, chunk2
;
324 unsigned long long rddiv
, chunkdiv
;
325 unsigned long long sectors
;
326 unsigned long long sync_max
, old_sync_max
;
327 unsigned long long completed
;
333 while (rd1
> rd2
&& delay
> 0 &&
334 sysfs_get_ll(mdi
, NULL
, "sync_max", &old_sync_max
) == 0) {
335 /* must be in the critical section - wait a bit */
340 if (sysfs_set_str(mdi
, NULL
, "sync_action", "frozen") != 0)
342 /* Array is frozen */
344 rd1
-= mdi
->array
.level
== 6 ? 2 : 1;
345 rd2
-= mdi
->array
.level
== 6 ? 2 : 1;
346 sysfs_get_str(mdi
, NULL
, "reshape_direction", buf
, sizeof(buf
));
347 if (strncmp(buf
, "back", 4) == 0)
349 if (sysfs_get_ll(mdi
, NULL
, "reshape_position", &position
) != 0) {
350 /* reshape must have finished now */
351 sysfs_set_str(mdi
, NULL
, "sync_action", "idle");
354 sysfs_get_two(mdi
, NULL
, "chunk_size", &chunk1
, &chunk2
);
357 rddiv
= GCD(rd1
, rd2
);
358 chunkdiv
= GCD(chunk1
, chunk2
);
359 sectors
= (chunk1
/chunkdiv
) * chunk2
* (rd1
/rddiv
) * rd2
;
362 /* Need to subtract 'reshape_position' from
363 * array size to get equivalent of sync_max.
364 * Size calculation based on raid5_size in kernel.
366 unsigned long long size
= mdi
->component_size
;
369 /* rd1 must be smaller */
370 /* Reshape may have progressed further backwards than
371 * recorded, so target even further back (hence "-1")
373 position
= (position
/ sectors
- 1) * sectors
;
374 /* rd1 is always the conversion factor between 'sync'
375 * position and 'reshape' position.
376 * We read 1 "new" stripe worth of data from where-ever,
377 * and when write out that full stripe.
379 sync_max
= size
- position
/rd1
;
381 /* Reshape will very likely be beyond position, and it may
382 * be too late to stop at '+1', so aim for '+2'
384 position
= (position
/ sectors
+ 2) * sectors
;
385 sync_max
= position
/rd1
;
387 if (sysfs_get_ll(mdi
, NULL
, "sync_max", &old_sync_max
) < 0)
388 old_sync_max
= mdi
->component_size
;
389 /* Must not advance sync_max as that could confuse
390 * the reshape monitor */
391 if (sync_max
< old_sync_max
)
392 sysfs_set_num(mdi
, NULL
, "sync_max", sync_max
);
393 sysfs_set_str(mdi
, NULL
, "sync_action", "idle");
395 /* That should have set things going again. Now we
396 * wait a little while (3 second max) for sync_completed
397 * to reach the target.
398 * The reshape process can block for 500msec if
399 * the sync speed limit is hit, so we need to wait
400 * a lot longer than that. 1 second is usually
404 scfd
= sysfs_open(mdi
->sys_name
, NULL
, "sync_completed");
405 while (scfd
>= 0 && delay
> 0 && old_sync_max
> 0) {
406 unsigned long long max_completed
;
407 sysfs_get_ll(mdi
, NULL
, "reshape_position", &curr
);
408 sysfs_fd_get_str(scfd
, buf
, sizeof(buf
));
409 if (strncmp(buf
, "none", 4) == 0) {
410 /* Either reshape has aborted, or hasn't
411 * quite started yet. Wait a bit and
412 * check 'sync_action' to see.
415 sysfs_get_str(mdi
, NULL
, "sync_action", buf
, sizeof(buf
));
416 if (strncmp(buf
, "reshape", 7) != 0)
420 if (sysfs_fd_get_two(scfd
, &completed
,
421 &max_completed
) == 2 &&
422 /* 'completed' sometimes reads as max-uulong */
423 completed
< max_completed
&&
424 (completed
> sync_max
||
425 (completed
== sync_max
&& curr
!= position
))) {
426 while (completed
> sync_max
) {
427 sync_max
+= sectors
/ rd1
;
433 if (sync_max
< old_sync_max
)
434 sysfs_set_num(mdi
, NULL
, "sync_max", sync_max
);
437 if (!backwards
&& curr
>= position
)
439 if (backwards
&& curr
<= position
)
441 sysfs_wait(scfd
, &delay
);
449 /* As we have an O_EXCL open, any use of the device
450 * which blocks STOP_ARRAY is probably a transient use,
451 * so it is reasonable to retry for a while - 5 seconds.
454 while (count
&& fd
>= 0
455 && (err
= ioctl(fd
, STOP_ARRAY
, NULL
)) < 0
460 if (fd
>= 0 && err
) {
462 pr_err("failed to stop array %s: %s\n",
463 devname
, strerror(errno
));
465 cont_err("Perhaps a running process, mounted filesystem or active volume group?\n");
471 if (get_linux_version() < 2006028) {
472 /* prior to 2.6.28, KOBJ_CHANGE was not sent when an md array
473 * was stopped, so We'll do it here just to be sure. Drop any
474 * partitions as well...
477 ioctl(fd
, BLKRRPART
, 0);
479 sysfs_uevent(mdi
, "change");
482 if (devnm
[0] && use_udev()) {
483 struct map_ent
*mp
= map_by_devnm(&map
, devnm
);
484 remove_devices(devnm
, mp
? mp
->path
: NULL
);
488 pr_err("stopped %s\n", devname
);
490 map_remove(&map
, devnm
);
498 static struct mddev_dev
*add_one(struct mddev_dev
*dv
, char *name
, char disp
)
500 struct mddev_dev
*new;
501 new = xmalloc(sizeof(*new));
502 memset(new, 0, sizeof(*new));
503 new->devname
= xstrdup(name
);
504 new->disposition
= disp
;
505 new->next
= dv
->next
;
510 static void add_faulty(struct mddev_dev
*dv
, int fd
, char disp
)
512 mdu_array_info_t array
;
513 mdu_disk_info_t disk
;
517 if (md_get_array_info(fd
, &array
) != 0)
520 remaining_disks
= array
.nr_disks
;
521 for (i
= 0; i
< MAX_DISKS
&& remaining_disks
> 0; i
++) {
524 if (md_get_disk_info(fd
, &disk
) != 0)
526 if (disk
.major
== 0 && disk
.minor
== 0)
529 if ((disk
.state
& 1) == 0) /* not faulty */
531 sprintf(buf
, "%d:%d", disk
.major
, disk
.minor
);
532 dv
= add_one(dv
, buf
, disp
);
536 static void add_detached(struct mddev_dev
*dv
, int fd
, char disp
)
538 mdu_array_info_t array
;
539 mdu_disk_info_t disk
;
543 if (md_get_array_info(fd
, &array
) != 0)
546 remaining_disks
= array
.nr_disks
;
547 for (i
= 0; i
< MAX_DISKS
&& remaining_disks
> 0; i
++) {
551 if (md_get_disk_info(fd
, &disk
) != 0)
553 if (disk
.major
== 0 && disk
.minor
== 0)
556 if (disp
== 'f' && (disk
.state
& 1) != 0) /* already faulty */
558 sprintf(buf
, "%d:%d", disk
.major
, disk
.minor
);
559 sfd
= dev_open(buf
, O_RDONLY
);
566 /* Probably not detached */
568 dv
= add_one(dv
, buf
, disp
);
572 static void add_set(struct mddev_dev
*dv
, int fd
, char set_char
)
574 mdu_array_info_t array
;
575 mdu_disk_info_t disk
;
580 if (md_get_array_info(fd
, &array
) != 0)
582 if (array
.level
!= 10)
584 copies
= ((array
.layout
& 0xff) *
585 ((array
.layout
>> 8) & 0xff));
586 if (array
.raid_disks
% copies
)
589 remaining_disks
= array
.nr_disks
;
590 for (i
= 0; i
< MAX_DISKS
&& remaining_disks
> 0; i
++) {
593 if (md_get_disk_info(fd
, &disk
) != 0)
595 if (disk
.major
== 0 && disk
.minor
== 0)
598 set
= disk
.raid_disk
% copies
;
599 if (set_char
!= set
+ 'A')
601 sprintf(buf
, "%d:%d", disk
.major
, disk
.minor
);
602 dv
= add_one(dv
, buf
, dv
->disposition
);
606 int attempt_re_add(int fd
, int tfd
, struct mddev_dev
*dv
,
607 struct supertype
*dev_st
, struct supertype
*tst
,
609 char *update
, char *devname
, int verbose
,
610 mdu_array_info_t
*array
)
616 dev_st
->ss
->getinfo_super(dev_st
, &mdi
, NULL
);
617 dev_st
->ss
->uuid_from_super(dev_st
, ouuid
);
619 tst
->ss
->uuid_from_super(tst
, duuid
);
621 /* Assume uuid matches: kernel will check */
622 memcpy(duuid
, ouuid
, sizeof(ouuid
));
623 if ((mdi
.disk
.state
& (1<<MD_DISK_ACTIVE
)) &&
624 !(mdi
.disk
.state
& (1<<MD_DISK_FAULTY
)) &&
625 memcmp(duuid
, ouuid
, sizeof(ouuid
))==0) {
626 /* Looks like it is worth a
627 * try. Need to make sure
628 * kernel will accept it
631 mdu_disk_info_t disc
;
632 /* re-add doesn't work for version-1 superblocks
635 if (array
->major_version
== 1 &&
636 get_linux_version() <= 2006018)
638 disc
.number
= mdi
.disk
.number
;
639 if (md_get_disk_info(fd
, &disc
) != 0 ||
640 disc
.major
!= 0 || disc
.minor
!= 0)
642 disc
.major
= major(rdev
);
643 disc
.minor
= minor(rdev
);
644 disc
.number
= mdi
.disk
.number
;
645 disc
.raid_disk
= mdi
.disk
.raid_disk
;
646 disc
.state
= mdi
.disk
.state
;
647 if (array
->state
& (1 << MD_SB_CLUSTERED
)) {
648 /* extra flags are needed when adding to a cluster as
649 * there are two cases to distinguish
651 if (dv
->disposition
== 'c')
652 disc
.state
|= (1 << MD_DISK_CANDIDATE
);
654 disc
.state
|= (1 << MD_DISK_CLUSTER_ADD
);
656 if (dv
->writemostly
== FlagSet
)
657 disc
.state
|= 1 << MD_DISK_WRITEMOSTLY
;
658 if (dv
->writemostly
== FlagClear
)
659 disc
.state
&= ~(1 << MD_DISK_WRITEMOSTLY
);
660 if (dv
->failfast
== FlagSet
)
661 disc
.state
|= 1 << MD_DISK_FAILFAST
;
662 if (dv
->failfast
== FlagClear
)
663 disc
.state
&= ~(1 << MD_DISK_FAILFAST
);
664 remove_partitions(tfd
);
665 if (update
|| dv
->writemostly
!= FlagDefault
666 || dv
->failfast
!= FlagDefault
) {
668 tfd
= dev_open(dv
->devname
, O_RDWR
);
670 pr_err("failed to open %s for superblock update during re-add\n", dv
->devname
);
674 if (dv
->writemostly
== FlagSet
)
675 rv
= dev_st
->ss
->update_super(
676 dev_st
, NULL
, "writemostly",
677 devname
, verbose
, 0, NULL
);
678 if (dv
->writemostly
== FlagClear
)
679 rv
= dev_st
->ss
->update_super(
680 dev_st
, NULL
, "readwrite",
681 devname
, verbose
, 0, NULL
);
682 if (dv
->failfast
== FlagSet
)
683 rv
= dev_st
->ss
->update_super(
684 dev_st
, NULL
, "failfast",
685 devname
, verbose
, 0, NULL
);
686 if (dv
->failfast
== FlagClear
)
687 rv
= dev_st
->ss
->update_super(
688 dev_st
, NULL
, "nofailfast",
689 devname
, verbose
, 0, NULL
);
691 rv
= dev_st
->ss
->update_super(
692 dev_st
, NULL
, update
,
693 devname
, verbose
, 0, NULL
);
695 rv
= dev_st
->ss
->store_super(dev_st
, tfd
);
698 pr_err("failed to update superblock during re-add\n");
702 /* don't even try if disk is marked as faulty */
704 if (ioctl(fd
, ADD_NEW_DISK
, &disc
) == 0) {
706 pr_err("re-added %s\n", dv
->devname
);
709 if (errno
== ENOMEM
|| errno
== EROFS
) {
710 pr_err("add new device failed for %s: %s\n",
711 dv
->devname
, strerror(errno
));
712 if (dv
->disposition
== 'M')
721 int Manage_add(int fd
, int tfd
, struct mddev_dev
*dv
,
722 struct supertype
*tst
, mdu_array_info_t
*array
,
723 int force
, int verbose
, char *devname
,
724 char *update
, unsigned long rdev
, unsigned long long array_size
,
727 unsigned long long ldsize
;
728 struct supertype
*dev_st
;
730 mdu_disk_info_t disc
;
732 if (!get_dev_size(tfd
, dv
->devname
, &ldsize
)) {
733 if (dv
->disposition
== 'M')
739 if (tst
->ss
== &super0
&& ldsize
> 4ULL*1024*1024*1024*1024) {
740 /* More than 4TB is wasted on v0.90 */
742 pr_err("%s is larger than %s can effectively use.\n"
743 " Add --force is you really want to add this device.\n",
744 dv
->devname
, devname
);
747 pr_err("%s is larger than %s can effectively use.\n"
748 " Adding anyway as --force was given.\n",
749 dv
->devname
, devname
);
751 if (!tst
->ss
->external
&& array
->major_version
== 0) {
752 if (ioctl(fd
, HOT_ADD_DISK
, rdev
)==0) {
754 pr_err("hot added %s\n",
759 pr_err("hot add failed for %s: %s\n",
760 dv
->devname
, strerror(errno
));
764 if (array
->not_persistent
== 0 || tst
->ss
->external
) {
766 /* need to find a sample superblock to copy, and
767 * a spare slot to use.
768 * For 'external' array (well, container based),
769 * We can just load the metadata for the array->
773 /* already loaded */;
774 else if (tst
->ss
->external
) {
775 tst
->ss
->load_container(tst
, fd
, NULL
);
776 } else for (j
= 0; j
< tst
->max_devs
; j
++) {
780 if (md_get_disk_info(fd
, &disc
))
782 if (disc
.major
==0 && disc
.minor
==0)
784 if ((disc
.state
& 4)==0) /* sync */
786 /* Looks like a good device to try */
787 dev
= map_dev(disc
.major
, disc
.minor
, 1);
790 dfd
= dev_open(dev
, O_RDONLY
);
793 if (tst
->ss
->load_super(tst
, dfd
,
801 /* FIXME this is a bad test to be using */
802 if (!tst
->sb
&& (dv
->disposition
!= 'a'
803 && dv
->disposition
!= 'S')) {
804 /* we are re-adding a device to a
805 * completely dead array - have to depend
808 } else if (!tst
->sb
) {
809 pr_err("cannot load array metadata from %s\n", devname
);
813 /* Make sure device is large enough */
814 if (dv
->disposition
!= 'j' && /* skip size check for Journal */
816 tst
->ss
->avail_size(tst
, ldsize
/512, INVALID_SECTORS
) <
818 if (dv
->disposition
== 'M')
820 pr_err("%s not large enough to join array\n",
825 /* Possibly this device was recently part of
826 * the array and was temporarily removed, and
827 * is now being re-added. If so, we can
831 if (array
->not_persistent
== 0) {
832 dev_st
= dup_super(tst
);
833 dev_st
->ss
->load_super(dev_st
, tfd
, NULL
);
834 if (dev_st
->sb
&& dv
->disposition
!= 'S') {
837 rv
= attempt_re_add(fd
, tfd
, dv
, dev_st
, tst
,
838 rdev
, update
, devname
,
840 dev_st
->ss
->free_super(dev_st
);
845 if (dv
->disposition
== 'M') {
847 pr_err("--re-add for %s to %s is not possible\n",
848 dv
->devname
, devname
);
851 if (dv
->disposition
== 'A') {
852 pr_err("--re-add for %s to %s is not possible\n",
853 dv
->devname
, devname
);
856 if (array
->active_disks
< array
->raid_disks
) {
857 char *avail
= xcalloc(array
->raid_disks
, 1);
861 for (d
= 0; d
< MAX_DISKS
&& found
< array
->nr_disks
; d
++) {
863 if (md_get_disk_info(fd
, &disc
))
865 if (disc
.major
== 0 && disc
.minor
== 0)
867 if (!(disc
.state
& (1<<MD_DISK_SYNC
)))
869 avail
[disc
.raid_disk
] = 1;
872 array_failed
= !enough(array
->level
, array
->raid_disks
,
873 array
->layout
, 1, avail
);
878 pr_err("%s has failed so using --add cannot work and might destroy\n",
880 pr_err("data on %s. You should stop the array and re-assemble it.\n",
885 /* non-persistent. Must ensure that new drive
886 * is at least array->size big.
888 if (ldsize
/512 < array_size
) {
889 pr_err("%s not large enough to join array\n",
894 /* committed to really trying this device now*/
895 remove_partitions(tfd
);
897 /* in 2.6.17 and earlier, version-1 superblocks won't
898 * use the number we write, but will choose a free number.
899 * we must choose the same free number, which requires
900 * starting at 'raid_disks' and counting up
902 for (j
= array
->raid_disks
; j
< tst
->max_devs
; j
++) {
904 if (md_get_disk_info(fd
, &disc
))
906 if (disc
.major
==0 && disc
.minor
==0)
908 if (disc
.state
& 8) /* removed */
911 disc
.major
= major(rdev
);
912 disc
.minor
= minor(rdev
);
916 disc
.number
= raid_slot
;
919 /* only add journal to array that supports journaling */
920 if (dv
->disposition
== 'j') {
924 mdp
= sysfs_read(fd
, NULL
, GET_ARRAY_STATE
);
926 pr_err("%s unable to read array state.\n", devname
);
930 if (mdp
->array_state
!= ARRAY_READONLY
) {
932 pr_err("%s is not readonly, cannot add journal.\n", devname
);
938 tst
->ss
->getinfo_super(tst
, &mdi
, NULL
);
939 if (mdi
.journal_device_required
== 0) {
940 pr_err("%s does not support journal device.\n", devname
);
946 if (array
->not_persistent
==0) {
948 if (dv
->disposition
== 'j')
949 disc
.state
|= (1 << MD_DISK_JOURNAL
) | (1 << MD_DISK_SYNC
);
950 if (dv
->writemostly
== FlagSet
)
951 disc
.state
|= 1 << MD_DISK_WRITEMOSTLY
;
952 if (dv
->failfast
== FlagSet
)
953 disc
.state
|= 1 << MD_DISK_FAILFAST
;
954 dfd
= dev_open(dv
->devname
, O_RDWR
| O_EXCL
|O_DIRECT
);
955 if (tst
->ss
->add_to_super(tst
, &disc
, dfd
,
956 dv
->devname
, INVALID_SECTORS
))
958 if (tst
->ss
->write_init_super(tst
))
960 } else if (dv
->disposition
== 'A') {
961 /* this had better be raid1.
962 * As we are "--re-add"ing we must find a spare slot
965 char *used
= xcalloc(array
->raid_disks
, 1);
966 for (j
= 0; j
< tst
->max_devs
; j
++) {
967 mdu_disk_info_t disc2
;
969 if (md_get_disk_info(fd
, &disc2
))
971 if (disc2
.major
==0 && disc2
.minor
==0)
973 if (disc2
.state
& 8) /* removed */
975 if (disc2
.raid_disk
< 0)
977 if (disc2
.raid_disk
> array
->raid_disks
)
979 used
[disc2
.raid_disk
] = 1;
981 for (j
= 0 ; j
< array
->raid_disks
; j
++)
984 disc
.state
|= (1<<MD_DISK_SYNC
);
990 if (array
->state
& (1 << MD_SB_CLUSTERED
)) {
991 if (dv
->disposition
== 'c')
992 disc
.state
|= (1 << MD_DISK_CANDIDATE
);
994 disc
.state
|= (1 << MD_DISK_CLUSTER_ADD
);
997 if (dv
->writemostly
== FlagSet
)
998 disc
.state
|= (1 << MD_DISK_WRITEMOSTLY
);
999 if (dv
->failfast
== FlagSet
)
1000 disc
.state
|= (1 << MD_DISK_FAILFAST
);
1001 if (tst
->ss
->external
) {
1003 * to an external metadata container */
1004 struct mdinfo new_mdi
;
1010 strcpy(devnm
, fd2devnm(fd
));
1012 container_fd
= open_dev_excl(devnm
);
1013 if (container_fd
< 0) {
1014 pr_err("add failed for %s: could not get exclusive access to container\n",
1016 tst
->ss
->free_super(tst
);
1020 Kill(dv
->devname
, NULL
, 0, -1, 0);
1021 dfd
= dev_open(dv
->devname
, O_RDWR
| O_EXCL
|O_DIRECT
);
1022 if (mdmon_running(tst
->container_devnm
))
1023 tst
->update_tail
= &tst
->updates
;
1024 if (tst
->ss
->add_to_super(tst
, &disc
, dfd
,
1025 dv
->devname
, INVALID_SECTORS
)) {
1027 close(container_fd
);
1030 if (tst
->update_tail
)
1031 flush_metadata_updates(tst
);
1033 tst
->ss
->sync_metadata(tst
);
1035 sra
= sysfs_read(container_fd
, NULL
, 0);
1037 pr_err("add failed for %s: sysfs_read failed\n",
1039 close(container_fd
);
1040 tst
->ss
->free_super(tst
);
1043 sra
->array
.level
= LEVEL_CONTAINER
;
1044 /* Need to set data_offset and component_size */
1045 tst
->ss
->getinfo_super(tst
, &new_mdi
, NULL
);
1046 new_mdi
.disk
.major
= disc
.major
;
1047 new_mdi
.disk
.minor
= disc
.minor
;
1048 new_mdi
.recovery_start
= 0;
1049 /* Make sure fds are closed as they are O_EXCL which
1050 * would block add_disk */
1051 tst
->ss
->free_super(tst
);
1052 if (sysfs_add_disk(sra
, &new_mdi
, 0) != 0) {
1053 pr_err("add new device to external metadata failed for %s\n", dv
->devname
);
1054 close(container_fd
);
1058 ping_monitor(devnm
);
1060 close(container_fd
);
1062 tst
->ss
->free_super(tst
);
1063 if (ioctl(fd
, ADD_NEW_DISK
, &disc
)) {
1064 if (dv
->disposition
== 'j')
1065 pr_err("Failed to hot add %s as journal, "
1066 "please try restart %s.\n", dv
->devname
, devname
);
1068 pr_err("add new device failed for %s as %d: %s\n",
1069 dv
->devname
, j
, strerror(errno
));
1072 if (dv
->disposition
== 'j') {
1073 pr_err("Journal added successfully, making %s read-write\n", devname
);
1074 if (Manage_ro(devname
, fd
, -1))
1075 pr_err("Failed to make %s read-write\n", devname
);
1080 pr_err("added %s\n", dv
->devname
);
1084 int Manage_remove(struct supertype
*tst
, int fd
, struct mddev_dev
*dv
,
1085 int sysfd
, unsigned long rdev
, int force
, int verbose
, char *devname
)
1090 if (tst
->ss
->external
) {
1091 /* To remove a device from a container, we must
1092 * check that it isn't in use in an array.
1093 * This involves looking in the 'holders'
1094 * directory - there must be just one entry,
1096 * To ensure that it doesn't get used as a
1097 * hot spare while we are checking, we
1098 * get an O_EXCL open on the container
1102 strcpy(devnm
, fd2devnm(fd
));
1103 lfd
= open_dev_excl(devnm
);
1105 pr_err("Cannot get exclusive access to container - odd\n");
1108 /* We may not be able to check on holders in
1109 * sysfs, either because we don't have the dev num
1110 * (rdev == 0) or because the device has been detached
1111 * and the 'holders' directory no longer exists
1112 * (ret == -1). In that case, assume it is OK to
1119 * The drive has already been set to 'faulty', however
1120 * monitor might not have had time to process it and the
1121 * drive might still have an entry in the 'holders'
1122 * directory. Try a few times to avoid a false error
1127 ret
= sysfs_unique_holder(devnm
, rdev
);
1130 usleep(100 * 1000); /* 100ms */
1131 } while (--count
> 0);
1134 pr_err("%s is not a member, cannot remove.\n",
1140 pr_err("%s is still in use, cannot remove.\n",
1147 /* FIXME check that it is a current member */
1149 /* device has been removed and we don't know
1150 * the major:minor number
1152 err
= sys_hot_remove_disk(sysfd
, force
);
1154 err
= hot_remove_disk(fd
, rdev
, force
);
1155 if (err
&& errno
== ENODEV
) {
1156 /* Old kernels rejected this if no personality
1158 struct mdinfo
*sra
= sysfs_read(fd
, NULL
, GET_DEVS
);
1159 struct mdinfo
*dv
= NULL
;
1162 for ( ; dv
; dv
=dv
->next
)
1163 if (dv
->disk
.major
== (int)major(rdev
) &&
1164 dv
->disk
.minor
== (int)minor(rdev
))
1167 err
= sysfs_set_str(sra
, dv
,
1175 pr_err("hot remove failed for %s: %s\n", dv
->devname
,
1181 if (tst
->ss
->external
) {
1183 * Before dropping our exclusive open we make an
1184 * attempt at preventing mdmon from seeing an
1185 * 'add' event before reconciling this 'remove'
1188 char *devnm
= fd2devnm(fd
);
1191 pr_err("unable to get container name\n");
1195 ping_manager(devnm
);
1200 pr_err("hot removed %s from %s\n",
1201 dv
->devname
, devname
);
1205 int Manage_replace(struct supertype
*tst
, int fd
, struct mddev_dev
*dv
,
1206 unsigned long rdev
, int verbose
, char *devname
)
1208 struct mdinfo
*mdi
, *di
;
1209 if (tst
->ss
->external
) {
1210 pr_err("--replace only supported for native metadata (0.90 or 1.x)\n");
1213 /* Need to find the device in sysfs and add 'want_replacement' to the
1216 mdi
= sysfs_read(fd
, NULL
, GET_DEVS
);
1217 if (!mdi
|| !mdi
->devs
) {
1218 pr_err("Cannot find status of %s to enable replacement - strange\n",
1222 for (di
= mdi
->devs
; di
; di
= di
->next
)
1223 if (di
->disk
.major
== (int)major(rdev
) &&
1224 di
->disk
.minor
== (int)minor(rdev
))
1228 if (di
->disk
.raid_disk
< 0) {
1229 pr_err("%s is not active and so cannot be replaced.\n",
1234 rv
= sysfs_set_str(mdi
, di
,
1235 "state", "want_replacement");
1238 pr_err("Failed to request replacement for %s\n",
1243 pr_err("Marked %s (device %d in %s) for replacement\n",
1244 dv
->devname
, di
->disk
.raid_disk
, devname
);
1245 /* If there is a matching 'with', we need to tell it which
1248 while (dv
&& dv
->disposition
!= 'W')
1251 dv
->disposition
= 'w';
1252 dv
->used
= di
->disk
.raid_disk
;
1257 pr_err("%s not found in %s so cannot --replace it\n",
1258 dv
->devname
, devname
);
1262 int Manage_with(struct supertype
*tst
, int fd
, struct mddev_dev
*dv
,
1263 unsigned long rdev
, int verbose
, char *devname
)
1265 struct mdinfo
*mdi
, *di
;
1266 /* try to set 'slot' for 'rdev' in 'fd' to 'dv->used' */
1267 mdi
= sysfs_read(fd
, NULL
, GET_DEVS
|GET_STATE
);
1268 if (!mdi
|| !mdi
->devs
) {
1269 pr_err("Cannot find status of %s to enable replacement - strange\n",
1273 for (di
= mdi
->devs
; di
; di
= di
->next
)
1274 if (di
->disk
.major
== (int)major(rdev
) &&
1275 di
->disk
.minor
== (int)minor(rdev
))
1279 if (di
->disk
.state
& (1<<MD_DISK_FAULTY
)) {
1280 pr_err("%s is faulty and cannot be a replacement\n",
1285 if (di
->disk
.raid_disk
>= 0) {
1286 pr_err("%s is active and cannot be a replacement\n",
1291 rv
= sysfs_set_num(mdi
, di
,
1295 pr_err("Failed to set %s as preferred replacement.\n",
1300 pr_err("Marked %s in %s as replacement for device %d\n",
1301 dv
->devname
, devname
, dv
->used
);
1305 pr_err("%s not found in %s so cannot make it preferred replacement\n",
1306 dv
->devname
, devname
);
1310 int Manage_subdevs(char *devname
, int fd
,
1311 struct mddev_dev
*devlist
, int verbose
, int test
,
1312 char *update
, int force
)
1314 /* Do something to each dev.
1316 * 'a' - add the device
1318 * If that fails EINVAL, try ADD_NEW_DISK
1319 * 'S' - add the device as a spare - don't try re-add
1320 * 'j' - add the device as a journal device
1321 * 'A' - re-add the device
1322 * 'r' - remove the device: HOT_REMOVE_DISK
1323 * device can be 'faulty' or 'detached' in which case all
1324 * matching devices are removed.
1325 * 'f' - set the device faulty SET_DISK_FAULTY
1326 * device can be 'detached' in which case any device that
1327 * is inaccessible will be marked faulty.
1328 * 'R' - mark this device as wanting replacement.
1329 * 'W' - this device is added if necessary and activated as
1330 * a replacement for a previous 'R' device.
1332 * 'w' - 'W' will be changed to 'w' when it is paired with
1333 * a 'R' device. If a 'W' is found while walking the list
1334 * it must be unpaired, and is an error.
1335 * 'M' - this is created by a 'missing' target. It is a slight
1337 * 'F' - Another variant of 'A', where the device was faulty
1338 * so must be removed from the array first.
1339 * 'c' - confirm the device as found (for clustered environments)
1341 * For 'f' and 'r', the device can also be a kernel-internal
1342 * name such as 'sdb'.
1344 mdu_array_info_t array
;
1345 unsigned long long array_size
;
1346 struct mddev_dev
*dv
;
1348 struct supertype
*tst
;
1349 char *subarray
= NULL
;
1351 int count
= 0; /* number of actions taken */
1353 struct mdinfo devinfo
;
1358 if (sysfs_init(&info
, fd
, NULL
)) {
1359 pr_err("sysfs not availabile for %s\n", devname
);
1363 if (md_get_array_info(fd
, &array
)) {
1364 pr_err("Cannot get array info for %s\n", devname
);
1367 /* array.size is only 32 bits and may be truncated.
1368 * So read from sysfs if possible, and record number of sectors
1371 array_size
= get_component_size(fd
);
1372 if (array_size
<= 0)
1373 array_size
= array
.size
* 2;
1375 tst
= super_by_fd(fd
, &subarray
);
1377 pr_err("unsupport array - version %d.%d\n",
1378 array
.major_version
, array
.minor_version
);
1382 for (dv
= devlist
; dv
; dv
= dv
->next
) {
1383 unsigned long rdev
= 0; /* device to add/remove etc */
1388 if (dv
->disposition
== 'c') {
1389 rv
= parse_cluster_confirm_arg(dv
->devname
,
1393 pr_err("Could not get the devname of cluster\n");
1398 if (strcmp(dv
->devname
, "failed") == 0 ||
1399 strcmp(dv
->devname
, "faulty") == 0) {
1400 if (dv
->disposition
!= 'A'
1401 && dv
->disposition
!= 'r') {
1402 pr_err("%s only meaningful with -r or --re-add, not -%c\n",
1403 dv
->devname
, dv
->disposition
);
1406 add_faulty(dv
, fd
, (dv
->disposition
== 'A'
1410 if (strcmp(dv
->devname
, "detached") == 0) {
1411 if (dv
->disposition
!= 'r' && dv
->disposition
!= 'f') {
1412 pr_err("%s only meaningful with -r of -f, not -%c\n",
1413 dv
->devname
, dv
->disposition
);
1416 add_detached(dv
, fd
, dv
->disposition
);
1420 if (strcmp(dv
->devname
, "missing") == 0) {
1421 struct mddev_dev
*add_devlist
;
1422 struct mddev_dev
**dp
;
1423 if (dv
->disposition
== 'c') {
1424 rv
= ioctl(fd
, CLUSTERED_DISK_NACK
, NULL
);
1428 if (dv
->disposition
!= 'A') {
1429 pr_err("'missing' only meaningful with --re-add\n");
1432 add_devlist
= conf_get_devs();
1433 if (add_devlist
== NULL
) {
1434 pr_err("no devices to scan for missing members.");
1437 for (dp
= &add_devlist
; *dp
; dp
= & (*dp
)->next
)
1438 /* 'M' (for 'missing') is like 'A' without errors */
1439 (*dp
)->disposition
= 'M';
1441 dv
->next
= add_devlist
;
1445 if (strncmp(dv
->devname
, "set-", 4) == 0 &&
1446 strlen(dv
->devname
) == 5) {
1449 if (dv
->disposition
!= 'r' &&
1450 dv
->disposition
!= 'f') {
1451 pr_err("'%s' only meaningful with -r or -f\n",
1455 if (array
.level
!= 10) {
1456 pr_err("'%s' only meaningful with RAID10 arrays\n",
1460 copies
= ((array
.layout
& 0xff) *
1461 ((array
.layout
>> 8) & 0xff));
1462 if (array
.raid_disks
% copies
!= 0 ||
1463 dv
->devname
[4] < 'A' ||
1464 dv
->devname
[4] >= 'A' + copies
||
1466 pr_err("'%s' not meaningful with this array\n",
1470 add_set(dv
, fd
, dv
->devname
[4]);
1474 if (strchr(dv
->devname
, '/') == NULL
&&
1475 strchr(dv
->devname
, ':') == NULL
&&
1476 strlen(dv
->devname
) < 50) {
1477 /* Assume this is a kernel-internal name like 'sda1' */
1480 if (dv
->disposition
!= 'r' && dv
->disposition
!= 'f') {
1481 pr_err("%s only meaningful with -r or -f, not -%c\n",
1482 dv
->devname
, dv
->disposition
);
1486 sprintf(dname
, "dev-%s", dv
->devname
);
1487 sysfd
= sysfs_open(fd2devnm(fd
), dname
, "block/dev");
1490 if (sysfs_fd_get_str(sysfd
, dn
, 20) > 0 &&
1491 sscanf(dn
, "%d:%d", &mj
,&mn
) == 2) {
1492 rdev
= makedev(mj
,mn
);
1499 sysfd
= sysfs_open(fd2devnm(fd
), dname
, "state");
1501 pr_err("%s does not appear to be a component of %s\n",
1502 dv
->devname
, devname
);
1506 } else if ((dv
->disposition
== 'r' || dv
->disposition
== 'f')
1507 && get_maj_min(dv
->devname
, &mj
, &mn
)) {
1508 /* for 'fail' and 'remove', the device might
1511 rdev
= makedev(mj
, mn
);
1514 tfd
= dev_open(dv
->devname
, O_RDONLY
);
1519 int open_err
= errno
;
1520 if (stat(dv
->devname
, &stb
) != 0) {
1521 pr_err("Cannot find %s: %s\n",
1522 dv
->devname
, strerror(errno
));
1525 if ((stb
.st_mode
& S_IFMT
) != S_IFBLK
) {
1526 if (dv
->disposition
== 'M')
1527 /* non-fatal. Also improbable */
1529 pr_err("%s is not a block device.\n",
1533 if (dv
->disposition
== 'r')
1534 /* Be happy, the stat worked, that is
1535 * enough for --remove
1539 if (dv
->disposition
== 'M')
1542 pr_err("Cannot open %s: %s\n",
1543 dv
->devname
, strerror(open_err
));
1549 switch(dv
->disposition
){
1551 pr_err("internal error - devmode[%s]=%d\n",
1552 dv
->devname
, dv
->disposition
);
1555 case 'S': /* --add-spare */
1556 case 'j': /* --add-journal */
1558 case 'M': /* --re-add missing */
1559 case 'F': /* --re-add faulty */
1560 case 'c': /* --cluster-confirm */
1561 /* add the device */
1563 pr_err("Cannot add disks to a \'member\' array, perform this operation on the parent container\n");
1567 /* Let's first try to write re-add to sysfs */
1569 (dv
->disposition
== 'A' || dv
->disposition
== 'F')) {
1570 sysfs_init_dev(&devinfo
, rdev
);
1571 if (sysfs_set_str(&info
, &devinfo
, "state", "re-add") == 0) {
1572 pr_err("re-add %s to %s succeed\n",
1573 dv
->devname
, info
.sys_name
);
1578 if (dv
->disposition
== 'F')
1579 /* Need to remove first */
1580 hot_remove_disk(fd
, rdev
, force
);
1581 /* Make sure it isn't in use (in 2.6 or later) */
1582 tfd
= dev_open(dv
->devname
, O_RDONLY
|O_EXCL
);
1584 /* We know no-one else is using it. We'll
1585 * need non-exclusive access to add it, so
1589 tfd
= dev_open(dv
->devname
, O_RDONLY
);
1592 if (dv
->disposition
== 'M')
1594 pr_err("Cannot open %s: %s\n",
1595 dv
->devname
, strerror(errno
));
1599 if (sysfs_freeze_array(&info
) == 1)
1604 rv
= Manage_add(fd
, tfd
, dv
, tst
, &array
,
1605 force
, verbose
, devname
, update
,
1606 rdev
, array_size
, raid_slot
);
1618 pr_err("Cannot remove disks from a \'member\' array, perform this operation on the parent container\n");
1621 rv
= Manage_remove(tst
, fd
, dv
, sysfd
,
1622 rdev
, verbose
, force
,
1633 case 'f': /* set faulty */
1634 /* FIXME check current member */
1635 if ((sysfd
>= 0 && write(sysfd
, "faulty", 6) != 6) ||
1636 (sysfd
< 0 && ioctl(fd
, SET_DISK_FAULTY
,
1640 pr_err("set device faulty failed for %s: %s\n",
1641 dv
->devname
, strerror(errno
));
1651 pr_err("set %s faulty in %s\n",
1652 dv
->devname
, devname
);
1654 case 'R': /* Mark as replaceable */
1656 pr_err("Cannot replace disks in a \'member\' array, perform this operation on the parent container\n");
1660 if (sysfs_freeze_array(&info
) == 1)
1665 rv
= Manage_replace(tst
, fd
, dv
,
1674 case 'W': /* --with device that doesn't match */
1675 pr_err("No matching --replace device for --with %s\n",
1678 case 'w': /* --with device which was matched */
1679 rv
= Manage_with(tst
, fd
, dv
,
1680 rdev
, verbose
, devname
);
1687 sysfs_set_str(&info
, NULL
, "sync_action","idle");
1688 if (test
&& count
== 0)
1694 sysfs_set_str(&info
, NULL
, "sync_action","idle");
1695 return !test
&& busy
? 2 : 1;
1698 int autodetect(void)
1700 /* Open any md device, and issue the RAID_AUTORUN ioctl */
1702 int fd
= dev_open("9:0", O_RDONLY
);
1704 if (ioctl(fd
, RAID_AUTORUN
, 0) == 0)
1711 int Update_subarray(char *dev
, char *subarray
, char *update
, struct mddev_ident
*ident
, int verbose
)
1713 struct supertype supertype
, *st
= &supertype
;
1716 memset(st
, 0, sizeof(*st
));
1718 fd
= open_subarray(dev
, subarray
, st
, verbose
< 0);
1722 if (!st
->ss
->update_subarray
) {
1724 pr_err("Operation not supported for %s metadata\n",
1729 if (mdmon_running(st
->devnm
))
1730 st
->update_tail
= &st
->updates
;
1732 rv
= st
->ss
->update_subarray(st
, subarray
, update
, ident
);
1736 pr_err("Failed to update %s of subarray-%s in %s\n",
1737 update
, subarray
, dev
);
1738 } else if (st
->update_tail
)
1739 flush_metadata_updates(st
);
1741 st
->ss
->sync_metadata(st
);
1743 if (rv
== 0 && strcmp(update
, "name") == 0 && verbose
>= 0)
1744 pr_err("Updated subarray-%s name from %s, UUIDs may have changed\n",
1748 st
->ss
->free_super(st
);
1754 /* Move spare from one array to another If adding to destination array fails
1755 * add back to original array.
1756 * Returns 1 on success, 0 on failure */
1757 int move_spare(char *from_devname
, char *to_devname
, dev_t devid
)
1759 struct mddev_dev devlist
;
1762 /* try to remove and add */
1763 int fd1
= open(to_devname
, O_RDONLY
);
1764 int fd2
= open(from_devname
, O_RDONLY
);
1766 if (fd1
< 0 || fd2
< 0) {
1767 if (fd1
>=0) close(fd1
);
1768 if (fd2
>=0) close(fd2
);
1772 devlist
.next
= NULL
;
1774 devlist
.writemostly
= FlagDefault
;
1775 devlist
.failfast
= FlagDefault
;
1776 devlist
.devname
= devname
;
1777 sprintf(devname
, "%d:%d", major(devid
), minor(devid
));
1779 devlist
.disposition
= 'r';
1780 if (Manage_subdevs(from_devname
, fd2
, &devlist
, -1, 0, NULL
, 0) == 0) {
1781 devlist
.disposition
= 'a';
1782 if (Manage_subdevs(to_devname
, fd1
, &devlist
, -1, 0, NULL
, 0) == 0) {
1783 /* make sure manager is aware of changes */
1784 ping_manager(to_devname
);
1785 ping_manager(from_devname
);
1790 else Manage_subdevs(from_devname
, fd2
, &devlist
, -1, 0, NULL
, 0);