mdadm.c (mdadm-4.1) | : | mdadm.c (mdadm-4.2) | ||
---|---|---|---|---|
skipping to change at line 162 | skipping to change at line 162 | |||
case 'b': | case 'b': | |||
if (mode == ASSEMBLE || mode == BUILD || | if (mode == ASSEMBLE || mode == BUILD || | |||
mode == CREATE || mode == GROW || | mode == CREATE || mode == GROW || | |||
mode == INCREMENTAL || mode == MANAGE) | mode == INCREMENTAL || mode == MANAGE) | |||
break; /* b means bitmap */ | break; /* b means bitmap */ | |||
case Brief: | case Brief: | |||
c.brief = 1; | c.brief = 1; | |||
continue; | continue; | |||
case NoDevices: | ||||
c.no_devices = 1; | ||||
continue; | ||||
case 'Y': c.export++; | case 'Y': c.export++; | |||
continue; | continue; | |||
case HomeHost: | case HomeHost: | |||
if (strcasecmp(optarg, "<ignore>") == 0) | if (strcasecmp(optarg, "<ignore>") == 0) | |||
c.require_homehost = 0; | c.require_homehost = 0; | |||
else | else | |||
c.homehost = optarg; | c.homehost = optarg; | |||
continue; | continue; | |||
skipping to change at line 549 | skipping to change at line 553 | |||
} | } | |||
switch(s.level) { | switch(s.level) { | |||
default: | default: | |||
pr_err("layout not meaningful for %s arrays.\n", | pr_err("layout not meaningful for %s arrays.\n", | |||
map_num(pers, s.level)); | map_num(pers, s.level)); | |||
exit(2); | exit(2); | |||
case UnSet: | case UnSet: | |||
pr_err("raid level must be given before layout.\n "); | pr_err("raid level must be given before layout.\n "); | |||
exit(2); | exit(2); | |||
case 0: | ||||
s.layout = map_name(r0layout, optarg); | ||||
if (s.layout == UnSet) { | ||||
pr_err("layout %s not understood for raid | ||||
0.\n", | ||||
optarg); | ||||
exit(2); | ||||
} | ||||
break; | ||||
case 5: | case 5: | |||
s.layout = map_name(r5layout, optarg); | s.layout = map_name(r5layout, optarg); | |||
if (s.layout == UnSet) { | if (s.layout == UnSet) { | |||
pr_err("layout %s not understood for raid 5.\n", | pr_err("layout %s not understood for raid 5.\n", | |||
optarg); | optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
break; | break; | |||
case 6: | case 6: | |||
s.layout = map_name(r6layout, optarg); | s.layout = map_name(r6layout, optarg); | |||
skipping to change at line 601 | skipping to change at line 613 | |||
continue; | continue; | |||
case O(GROW,'n'): | case O(GROW,'n'): | |||
case O(CREATE,'n'): | case O(CREATE,'n'): | |||
case O(BUILD,'n'): /* number of raid disks */ | case O(BUILD,'n'): /* number of raid disks */ | |||
if (s.raiddisks) { | if (s.raiddisks) { | |||
pr_err("raid-devices set twice: %d and %s\n", | pr_err("raid-devices set twice: %d and %s\n", | |||
s.raiddisks, optarg); | s.raiddisks, optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
s.raiddisks = parse_num(optarg); | if (parse_num(&s.raiddisks, optarg) != 0 || s.raiddisks < | |||
if (s.raiddisks <= 0) { | = 0) { | |||
pr_err("invalid number of raid devices: %s\n", | pr_err("invalid number of raid devices: %s\n", | |||
optarg); | optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
ident.raid_disks = s.raiddisks; | ident.raid_disks = s.raiddisks; | |||
continue; | continue; | |||
case O(ASSEMBLE, Nodes): | case O(ASSEMBLE, Nodes): | |||
case O(GROW, Nodes): | case O(GROW, Nodes): | |||
case O(CREATE, Nodes): | case O(CREATE, Nodes): | |||
c.nodes = parse_num(optarg); | if (parse_num(&c.nodes, optarg) != 0 || c.nodes < 2) { | |||
if (c.nodes < 2) { | ||||
pr_err("clustered array needs two nodes at least: %s\n", | pr_err("clustered array needs two nodes at least: %s\n", | |||
optarg); | optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
continue; | continue; | |||
case O(CREATE, ClusterName): | case O(CREATE, ClusterName): | |||
case O(ASSEMBLE, ClusterName): | case O(ASSEMBLE, ClusterName): | |||
c.homecluster = optarg; | c.homecluster = optarg; | |||
if (strlen(c.homecluster) > 64) { | if (strlen(c.homecluster) > 64) { | |||
pr_err("Cluster name too big.\n"); | pr_err("Cluster name too big.\n"); | |||
skipping to change at line 638 | skipping to change at line 648 | |||
if (s.sparedisks) { | if (s.sparedisks) { | |||
pr_err("spare-devices set twice: %d and %s\n", | pr_err("spare-devices set twice: %d and %s\n", | |||
s.sparedisks, optarg); | s.sparedisks, optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
if (s.level != UnSet && s.level <= 0 && s.level >= -1) { | if (s.level != UnSet && s.level <= 0 && s.level >= -1) { | |||
pr_err("spare-devices setting is incompatible wit h raid level %d\n", | pr_err("spare-devices setting is incompatible wit h raid level %d\n", | |||
s.level); | s.level); | |||
exit(2); | exit(2); | |||
} | } | |||
s.sparedisks = parse_num(optarg); | if (parse_num(&s.sparedisks, optarg) != 0 || s.sparedisks | |||
if (s.sparedisks < 0) { | < 0) { | |||
pr_err("invalid number of spare-devices: %s\n", | pr_err("invalid number of spare-devices: %s\n", | |||
optarg); | optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
continue; | continue; | |||
case O(CREATE,'a'): | case O(CREATE,'a'): | |||
case O(CREATE,Auto): | case O(CREATE,Auto): | |||
case O(BUILD,'a'): | case O(BUILD,'a'): | |||
case O(BUILD,Auto): | case O(BUILD,Auto): | |||
skipping to change at line 723 | skipping to change at line 732 | |||
continue; | continue; | |||
case O(ASSEMBLE,'m'): /* super-minor for array */ | case O(ASSEMBLE,'m'): /* super-minor for array */ | |||
case O(ASSEMBLE,SuperMinor): | case O(ASSEMBLE,SuperMinor): | |||
if (ident.super_minor != UnSet) { | if (ident.super_minor != UnSet) { | |||
pr_err("super-minor cannot be set twice. Second value: %s.\n", optarg); | pr_err("super-minor cannot be set twice. Second value: %s.\n", optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
if (strcmp(optarg, "dev") == 0) | if (strcmp(optarg, "dev") == 0) | |||
ident.super_minor = -2; | ident.super_minor = -2; | |||
else { | else if (parse_num(&ident.super_minor, optarg) != 0 || id | |||
ident.super_minor = parse_num(optarg); | ent.super_minor < 0) { | |||
if (ident.super_minor < 0) { | pr_err("Bad super-minor number: %s.\n", optarg); | |||
pr_err("Bad super-minor number: %s.\n", o | exit(2); | |||
ptarg); | ||||
exit(2); | ||||
} | ||||
} | } | |||
continue; | continue; | |||
case O(ASSEMBLE,'o'): | case O(ASSEMBLE,'o'): | |||
case O(MANAGE,'o'): | case O(MANAGE,'o'): | |||
case O(CREATE,'o'): | case O(CREATE,'o'): | |||
c.readonly = 1; | c.readonly = 1; | |||
continue; | continue; | |||
case O(ASSEMBLE,'U'): /* update the superblock */ | case O(ASSEMBLE,'U'): /* update the superblock */ | |||
skipping to change at line 770 | skipping to change at line 776 | |||
if (strcmp(c.update, "name") == 0) | if (strcmp(c.update, "name") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "homehost") == 0) | if (strcmp(c.update, "homehost") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "home-cluster") == 0) | if (strcmp(c.update, "home-cluster") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "nodes") == 0) | if (strcmp(c.update, "nodes") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "devicesize") == 0) | if (strcmp(c.update, "devicesize") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "bitmap") == 0) | ||||
continue; | ||||
if (strcmp(c.update, "no-bitmap") == 0) | if (strcmp(c.update, "no-bitmap") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "bbl") == 0) | if (strcmp(c.update, "bbl") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "no-bbl") == 0) | if (strcmp(c.update, "no-bbl") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "force-no-bbl") == 0) | if (strcmp(c.update, "force-no-bbl") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "ppl") == 0) | if (strcmp(c.update, "ppl") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "no-ppl") == 0) | if (strcmp(c.update, "no-ppl") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "metadata") == 0) | if (strcmp(c.update, "metadata") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "revert-reshape") == 0) | if (strcmp(c.update, "revert-reshape") == 0) | |||
continue; | continue; | |||
if (strcmp(c.update, "layout-original") == 0 || | ||||
strcmp(c.update, "layout-alternate") == 0 || | ||||
strcmp(c.update, "layout-unspecified") == 0) | ||||
continue; | ||||
if (strcmp(c.update, "byteorder") == 0) { | if (strcmp(c.update, "byteorder") == 0) { | |||
if (ss) { | if (ss) { | |||
pr_err("must not set metadata type with - -update=byteorder.\n"); | pr_err("must not set metadata type with - -update=byteorder.\n"); | |||
exit(2); | exit(2); | |||
} | } | |||
for(i = 0; !ss && superlist[i]; i++) | for(i = 0; !ss && superlist[i]; i++) | |||
ss = superlist[i]->match_metadata_desc( | ss = superlist[i]->match_metadata_desc( | |||
"0.swap"); | "0.swap"); | |||
if (!ss) { | if (!ss) { | |||
pr_err("INTERNAL ERROR cannot find 0.swap \n"); | pr_err("INTERNAL ERROR cannot find 0.swap \n"); | |||
skipping to change at line 814 | skipping to change at line 826 | |||
fprintf(outf, "%s: ", Name); | fprintf(outf, "%s: ", Name); | |||
} else { | } else { | |||
outf = stderr; | outf = stderr; | |||
fprintf(outf, | fprintf(outf, | |||
"%s: '--update=%s' is invalid. ", | "%s: '--update=%s' is invalid. ", | |||
Name, c.update); | Name, c.update); | |||
} | } | |||
fprintf(outf, "Valid --update options are:\n" | fprintf(outf, "Valid --update options are:\n" | |||
" 'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync ',\n" | " 'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync ',\n" | |||
" 'summaries', 'homehost', 'home-cluster', 'byteorder', 'devi cesize',\n" | " 'summaries', 'homehost', 'home-cluster', 'byteorder', 'devi cesize',\n" | |||
" 'no-bitmap', 'metadata', 'revert-reshape'\n" | " 'bitmap', 'no-bitmap', 'metadata', 'revert-reshape'\n" | |||
" 'bbl', 'no-bbl', 'force-no-bbl', 'ppl', 'no-ppl'\n" | " 'bbl', 'no-bbl', 'force-no-bbl', 'ppl', 'no-ppl'\n" | |||
" 'layout-original', 'layout-alternate', 'layout-unspecified' \n" | ||||
); | ); | |||
exit(outf == stdout ? 0 : 2); | exit(outf == stdout ? 0 : 2); | |||
case O(MANAGE,'U'): | case O(MANAGE,'U'): | |||
/* update=devicesize is allowed with --re-add */ | /* update=devicesize is allowed with --re-add */ | |||
if (devmode != 'A') { | if (devmode != 'A') { | |||
pr_err("--update in Manage mode only allowed with --re-add.\n"); | pr_err("--update in Manage mode only allowed with --re-add.\n"); | |||
exit(1); | exit(1); | |||
} | } | |||
if (c.update) { | if (c.update) { | |||
skipping to change at line 891 | skipping to change at line 904 | |||
case O(MONITOR,ProgramOpt): /* alert program */ | case O(MONITOR,ProgramOpt): /* alert program */ | |||
if (program) | if (program) | |||
pr_err("only specify one alter program. %s ignore d.\n", | pr_err("only specify one alter program. %s ignore d.\n", | |||
optarg); | optarg); | |||
else | else | |||
program = optarg; | program = optarg; | |||
continue; | continue; | |||
case O(MONITOR,'r'): /* rebuild increments */ | case O(MONITOR,'r'): /* rebuild increments */ | |||
case O(MONITOR,Increment): | case O(MONITOR,Increment): | |||
increments = atoi(optarg); | if (parse_num(&increments, optarg) != 0 | |||
if (increments > 99 || increments < 1) { | || increments > 99 || increments < 1) { | |||
pr_err("please specify positive integer between 1 and 99 as rebuild increments.\n"); | pr_err("please specify positive integer between 1 and 99 as rebuild increments.\n"); | |||
exit(2); | exit(2); | |||
} | } | |||
continue; | continue; | |||
case O(MONITOR,'d'): /* delay in seconds */ | case O(MONITOR,'d'): /* delay in seconds */ | |||
case O(GROW, 'd'): | case O(GROW, 'd'): | |||
case O(BUILD,'d'): /* delay for bitmap updates */ | case O(BUILD,'d'): /* delay for bitmap updates */ | |||
case O(CREATE,'d'): | case O(CREATE,'d'): | |||
if (c.delay) | if (c.delay) | |||
pr_err("only specify delay once. %s ignored.\n", | pr_err("only specify delay once. %s ignored.\n", | |||
optarg); | optarg); | |||
else { | else if (parse_num(&c.delay, optarg) != 0 || c.delay < 1) | |||
c.delay = parse_num(optarg); | { | |||
if (c.delay < 1) { | pr_err("invalid delay: %s\n", optarg); | |||
pr_err("invalid delay: %s\n", | exit(2); | |||
optarg); | ||||
exit(2); | ||||
} | ||||
} | } | |||
continue; | continue; | |||
case O(MONITOR,'f'): /* daemonise */ | case O(MONITOR,'f'): /* daemonise */ | |||
case O(MONITOR,Fork): | case O(MONITOR,Fork): | |||
daemonise = 1; | daemonise = 1; | |||
continue; | continue; | |||
case O(MONITOR,'i'): /* pid */ | case O(MONITOR,'i'): /* pid */ | |||
if (pidfile) | if (pidfile) | |||
pr_err("only specify one pid file. %s ignored.\n" , | pr_err("only specify one pid file. %s ignored.\n" , | |||
optarg); | optarg); | |||
skipping to change at line 1193 | skipping to change at line 1201 | |||
s.bitmap_chunk & (s.bitmap_chunk - 1)) { | s.bitmap_chunk & (s.bitmap_chunk - 1)) { | |||
pr_err("invalid bitmap chunksize: %s\n", | pr_err("invalid bitmap chunksize: %s\n", | |||
optarg); | optarg); | |||
exit(2); | exit(2); | |||
} | } | |||
s.bitmap_chunk = s.bitmap_chunk * 512; | s.bitmap_chunk = s.bitmap_chunk * 512; | |||
continue; | continue; | |||
case O(GROW, WriteBehind): | case O(GROW, WriteBehind): | |||
case O(BUILD, WriteBehind): | case O(BUILD, WriteBehind): | |||
case O(CREATE, WriteBehind): /* write-behind mode */ | case O(CREATE, WriteBehind): | |||
s.write_behind = DEFAULT_MAX_WRITE_BEHIND; | s.write_behind = DEFAULT_MAX_WRITE_BEHIND; | |||
if (optarg) { | if (parse_num(&s.write_behind, optarg) != 0 || | |||
s.write_behind = parse_num(optarg); | s.write_behind < 0 || s.write_behind > 16383) { | |||
if (s.write_behind < 0 || | pr_err("Invalid value for maximum outstanding wri | |||
s.write_behind > 16383) { | te-behind writes: %s.\n\tMust be between 0 and 16383.\n", | |||
pr_err("Invalid value for maximum outstan | optarg); | |||
ding write-behind writes: %s.\n\tMust be between 0 and 16383.\n", optarg); | exit(2); | |||
exit(2); | ||||
} | ||||
} | } | |||
continue; | continue; | |||
case O(INCREMENTAL, 'r'): | case O(INCREMENTAL, 'r'): | |||
case O(INCREMENTAL, RebuildMapOpt): | case O(INCREMENTAL, RebuildMapOpt): | |||
rebuild_map = 1; | rebuild_map = 1; | |||
continue; | continue; | |||
case O(INCREMENTAL, IncrementalPath): | case O(INCREMENTAL, IncrementalPath): | |||
remove_path = optarg; | remove_path = optarg; | |||
continue; | continue; | |||
case O(CREATE, WriteJournal): | case O(CREATE, WriteJournal): | |||
if (s.journaldisks) { | if (s.journaldisks) { | |||
pr_err("Please specify only one journal device fo r the array.\n"); | pr_err("Please specify only one journal device fo r the array.\n"); | |||
skipping to change at line 1357 | skipping to change at line 1362 | |||
exit(2); | exit(2); | |||
} | } | |||
if ((int)ident.super_minor == -2 && c.autof) { | if ((int)ident.super_minor == -2 && c.autof) { | |||
pr_err("--super-minor=dev is incompatible with --auto\n") ; | pr_err("--super-minor=dev is incompatible with --auto\n") ; | |||
exit(2); | exit(2); | |||
} | } | |||
if (mode == MANAGE || mode == GROW) { | if (mode == MANAGE || mode == GROW) { | |||
mdfd = open_mddev(devlist->devname, 1); | mdfd = open_mddev(devlist->devname, 1); | |||
if (mdfd < 0) | if (mdfd < 0) | |||
exit(1); | exit(1); | |||
} else | } else { | |||
char *bname = basename(devlist->devname); | ||||
if (strlen(bname) > MD_NAME_MAX) { | ||||
pr_err("Name %s is too long.\n", devlist->devname | ||||
); | ||||
exit(1); | ||||
} | ||||
/* non-existent device is OK */ | /* non-existent device is OK */ | |||
mdfd = open_mddev(devlist->devname, 0); | mdfd = open_mddev(devlist->devname, 0); | |||
} | ||||
if (mdfd == -2) { | if (mdfd == -2) { | |||
pr_err("device %s exists but is not an md array.\n", devl ist->devname); | pr_err("device %s exists but is not an md array.\n", devl ist->devname); | |||
exit(1); | exit(1); | |||
} | } | |||
if ((int)ident.super_minor == -2) { | if ((int)ident.super_minor == -2) { | |||
struct stat stb; | struct stat stb; | |||
if (mdfd < 0) { | if (mdfd < 0) { | |||
pr_err("--super-minor=dev given, and listed devic e %s doesn't exist.\n", | pr_err("--super-minor=dev given, and listed devic e %s doesn't exist.\n", | |||
devlist->devname); | devlist->devname); | |||
exit(1); | exit(1); | |||
skipping to change at line 1420 | skipping to change at line 1432 | |||
if (c.homecluster == NULL && (c.nodes > 0)) { | if (c.homecluster == NULL && (c.nodes > 0)) { | |||
c.homecluster = conf_get_homecluster(); | c.homecluster = conf_get_homecluster(); | |||
if (c.homecluster == NULL) | if (c.homecluster == NULL) | |||
rv = get_cluster_name(&c.homecluster); | rv = get_cluster_name(&c.homecluster); | |||
if (rv) { | if (rv) { | |||
pr_err("The md can't get cluster name\n"); | pr_err("The md can't get cluster name\n"); | |||
exit(1); | exit(1); | |||
} | } | |||
} | } | |||
if (c.update && strcmp(c.update, "nodes") == 0 && c.nodes == 0) { | ||||
pr_err("Please specify nodes number with --nodes\n"); | ||||
exit(1); | ||||
} | ||||
if (c.backup_file && data_offset != INVALID_SECTORS) { | if (c.backup_file && data_offset != INVALID_SECTORS) { | |||
pr_err("--backup-file and --data-offset are incompatible\n"); | pr_err("--backup-file and --data-offset are incompatible\n"); | |||
exit(2); | exit(2); | |||
} | } | |||
if ((mode == MISC && devmode == 'E') || | if ((mode == MISC && devmode == 'E') || | |||
(mode == MONITOR && spare_sharing == 0)) | (mode == MONITOR && spare_sharing == 0)) | |||
/* Anyone may try this */; | /* Anyone may try this */; | |||
else if (geteuid() != 0) { | else if (geteuid() != 0) { | |||
pr_err("must be super-user to perform this action\n"); | pr_err("must be super-user to perform this action\n"); | |||
skipping to change at line 1472 | skipping to change at line 1489 | |||
devlist->next, c.verbose, c.test, | devlist->next, c.verbose, c.test, | |||
c.update, c.force); | c.update, c.force); | |||
if (!rv && c.readonly < 0) | if (!rv && c.readonly < 0) | |||
rv = Manage_ro(devlist->devname, mdfd, c.readonly); | rv = Manage_ro(devlist->devname, mdfd, c.readonly); | |||
if (!rv && c.runstop > 0) | if (!rv && c.runstop > 0) | |||
rv = Manage_run(devlist->devname, mdfd, &c); | rv = Manage_run(devlist->devname, mdfd, &c); | |||
if (!rv && c.runstop < 0) | if (!rv && c.runstop < 0) | |||
rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0); | rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0); | |||
break; | break; | |||
case ASSEMBLE: | case ASSEMBLE: | |||
if (devs_found == 1 && ident.uuid_set == 0 && | if (!c.scan && c.runstop == -1) { | |||
ident.super_minor == UnSet && ident.name[0] == 0 && | pr_err("--no-degraded not meaningful without a --scan ass | |||
!c.scan ) { | embly.\n"); | |||
exit(1); | ||||
} else if (devs_found == 1 && ident.uuid_set == 0 && | ||||
ident.super_minor == UnSet && ident.name[0] == 0 && | ||||
!c.scan) { | ||||
/* Only a device has been given, so get details from conf ig file */ | /* Only a device has been given, so get details from conf ig file */ | |||
struct mddev_ident *array_ident = conf_get_ident(devlist- >devname); | struct mddev_ident *array_ident = conf_get_ident(devlist- >devname); | |||
if (array_ident == NULL) { | if (array_ident == NULL) { | |||
pr_err("%s not identified in config file.\n", | pr_err("%s not identified in config file.\n", | |||
devlist->devname); | devlist->devname); | |||
rv |= 1; | rv |= 1; | |||
if (mdfd >= 0) | if (mdfd >= 0) | |||
close(mdfd); | close(mdfd); | |||
} else { | } else { | |||
if (array_ident->autof == 0) | if (array_ident->autof == 0) | |||
skipping to change at line 1635 | skipping to change at line 1655 | |||
pr_err("Cannot monitor: need --scan or at least one devic e\n"); | pr_err("Cannot monitor: need --scan or at least one devic e\n"); | |||
rv = 1; | rv = 1; | |||
break; | break; | |||
} | } | |||
if (pidfile && !daemonise) { | if (pidfile && !daemonise) { | |||
pr_err("Cannot write a pid file when not in daemon mode\n "); | pr_err("Cannot write a pid file when not in daemon mode\n "); | |||
rv = 1; | rv = 1; | |||
break; | break; | |||
} | } | |||
if (c.delay == 0) { | if (c.delay == 0) { | |||
if (get_linux_version() > 2006016) | c.delay = conf_get_monitor_delay(); | |||
/* mdstat responds to poll */ | if (!c.delay) | |||
c.delay = 1000; | ||||
else | ||||
c.delay = 60; | c.delay = 60; | |||
} | } | |||
rv = Monitor(devlist, mailaddr, program, | rv = Monitor(devlist, mailaddr, program, | |||
&c, daemonise, oneshot, | &c, daemonise, oneshot, | |||
dosyslog, pidfile, increments, | dosyslog, pidfile, increments, | |||
spare_sharing); | spare_sharing); | |||
break; | break; | |||
case GROW: | case GROW: | |||
if (array_size > 0) { | if (array_size > 0) { | |||
skipping to change at line 1762 | skipping to change at line 1780 | |||
c.verbose); | c.verbose); | |||
} else | } else | |||
rv = Incremental(devlist, &c, ss); | rv = Incremental(devlist, &c, ss); | |||
break; | break; | |||
case AUTODETECT: | case AUTODETECT: | |||
autodetect(); | autodetect(); | |||
break; | break; | |||
} | } | |||
if (locked) | if (locked) | |||
cluster_release_dlmlock(); | cluster_release_dlmlock(); | |||
if (mdfd > 0) | close_fd(&mdfd); | |||
close(mdfd); | ||||
exit(rv); | exit(rv); | |||
} | } | |||
static int scan_assemble(struct supertype *ss, | static int scan_assemble(struct supertype *ss, | |||
struct context *c, | struct context *c, | |||
struct mddev_ident *ident) | struct mddev_ident *ident) | |||
{ | { | |||
struct mddev_ident *a, *array_list = conf_get_ident(NULL); | struct mddev_ident *a, *array_list = conf_get_ident(NULL); | |||
struct mddev_dev *devlist = conf_get_devs(); | struct mddev_dev *devlist = conf_get_devs(); | |||
struct map_ent *map = NULL; | struct map_ent *map = NULL; | |||
skipping to change at line 2017 | skipping to change at line 2034 | |||
if (dv->devname[0] == '/' || mdfd < 0) | if (dv->devname[0] == '/' || mdfd < 0) | |||
mdfd = open_mddev(dv->devname, 1); | mdfd = open_mddev(dv->devname, 1); | |||
if (mdfd >= 0) { | if (mdfd >= 0) { | |||
switch(dv->disposition) { | switch(dv->disposition) { | |||
case 'R': | case 'R': | |||
c->runstop = 1; | c->runstop = 1; | |||
rv |= Manage_run(dv->devname, mdfd, c); | rv |= Manage_run(dv->devname, mdfd, c); | |||
break; | break; | |||
case 'S': | case 'S': | |||
if (c->scan) { | ||||
pr_err("--stop not meaningful with both a | ||||
--scan assembly and a device name.\n"); | ||||
rv |= 1; | ||||
break; | ||||
} | ||||
rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0); | rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0); | |||
break; | break; | |||
case 'o': | case 'o': | |||
rv |= Manage_ro(dv->devname, mdfd, 1); | rv |= Manage_ro(dv->devname, mdfd, 1); | |||
break; | break; | |||
case 'w': | case 'w': | |||
rv |= Manage_ro(dv->devname, mdfd, -1); | rv |= Manage_ro(dv->devname, mdfd, -1); | |||
break; | break; | |||
} | } | |||
close(mdfd); | close(mdfd); | |||
End of changes. 22 change blocks. | ||||
45 lines changed or deleted | 75 lines changed or added |