/*
* mdadm - manage Linux "md" devices aka RAID arrays.
*
- * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
*
* If !uuidset and scan, look in conf-file for uuid
* If not found, give up
- * If !devlist and scan and uuidset, get list of devs from conf-file
+ * If !devlist and scan and uuidset, get list of devs from conf-file
*
* For each device:
* Check superblock - discard if bad
int chosen_drive;
int change = 0;
int inargv = 0;
- int start_partial_ok = force || devlist==NULL;
+ int start_partial_ok = (runstop >= 0) && (force || devlist==NULL);
unsigned int num_devs;
mddev_dev_t tmpdev;
struct mdinfo info;
st->ss->update_super(&info, super, update, devname, verbose);
dfd = dev_open(devname, O_RDWR|O_EXCL);
- if (dfd < 0)
+ if (dfd < 0)
fprintf(stderr, Name ": Cannot open %s for superblock update\n",
devname);
else if (st->ss->store_super(st, dfd, super))
> devices[most_recent].events)
most_recent = devcnt;
}
- if (info.array.level == -4)
+ if (info.array.level == -4)
/* with multipath, the raid_disk from the superblock is meaningless */
i = devcnt;
else
}
if (force && okcnt == info.array.raid_disks-1) {
/* FIXME check event count */
- change += st->ss->update_super(&info, super, "force",
+ change += st->ss->update_super(&info, super, "force",
devices[chosen_drive].devname, verbose);
}
inf.major_version = st->ss->major;
inf.minor_version = st->minor_version;
rv = ioctl(mdfd, SET_ARRAY_INFO, &inf);
- } else
+ } else
rv = ioctl(mdfd, SET_ARRAY_INFO, NULL);
if (rv) {
}
if (runstop == 1 ||
- (runstop == 0 &&
+ (runstop <= 0 &&
( enough(info.array.level, info.array.raid_disks, info.array.layout, avail, okcnt) &&
(okcnt >= req_cnt || start_partial_ok)
))) {
if (verbose >= 0) {
fprintf(stderr, Name ": %s has been started with %d drive%s",
mddev, okcnt, okcnt==1?"":"s");
- if (okcnt < info.array.raid_disks)
+ if (okcnt < info.array.raid_disks)
fprintf(stderr, " (out of %d)", info.array.raid_disks);
if (sparecnt)
fprintf(stderr, " and %d spare%s", sparecnt, sparecnt==1?"":"s");
return 1;
}
if (runstop == -1) {
- fprintf(stderr, Name ": %s assembled from %d drive%s, but not started.\n",
+ fprintf(stderr, Name ": %s assembled from %d drive%s",
mddev, okcnt, okcnt==1?"":"s");
+ if (okcnt != info.array.raid_disks)
+ fprintf(stderr, " (out of %d)", info.array.raid_disks);
+ fprintf(stderr, ", but not started.\n");
return 0;
}
if (verbose >= 0) {