diff options
author | grog <grog@FreeBSD.org> | 1999-03-28 08:51:10 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 1999-03-28 08:51:10 +0000 |
commit | 08adea2ee5cc02715a3d01ed8c8b680f7ea45c18 (patch) | |
tree | 9f8fe4e0d1d5a76d4c7cb2fe2c12625d132bb300 /sbin/vinum/commands.c | |
parent | e0c069f119cafb0f0e5f744d3b8e19f8f03a7d7d (diff) | |
download | FreeBSD-src-08adea2ee5cc02715a3d01ed8c8b680f7ea45c18.zip FreeBSD-src-08adea2ee5cc02715a3d01ed8c8b680f7ea45c18.tar.gz |
vinum_start: Allow user to specify a plex. In this case, revive all
subdisks in need of revival.
vinum_stop: sleep for a second before unloading. This solves a race
condition with a potential daemon when the stop command
is specified on the command line.
Diffstat (limited to 'sbin/vinum/commands.c')
-rw-r--r-- | sbin/vinum/commands.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sbin/vinum/commands.c b/sbin/vinum/commands.c index 192f3ac..c516b62 100644 --- a/sbin/vinum/commands.c +++ b/sbin/vinum/commands.c @@ -504,8 +504,33 @@ vinum_start(int argc, char *argv[], char *arg0[]) case plex_object: if (plex.state == plex_up) /* already up */ fprintf(stderr, "%s is already up\n", plex.name); - else - doit = 1; + else { + int sdno; + + for (sdno = 0; sdno < plex.subdisks; sdno++) { + get_plex_sd_info(&sd, object, sdno); + if ((sd.state >= sd_empty) + && (sd.state <= sd_stale)) { /* candidate for init */ + message->index = sd.sdno; /* pass object number */ + message->type = sd_object; /* it's a subdisk */ + message->state = object_up; + message->force = 0; /* don't force it, use a larger hammer */ + ioctl(superdev, VINUM_SETSTATE, message); + if (reply.error != 0) { + if (reply.error == EAGAIN) /* we're reviving */ + continue_revive(sd.sdno); + else + fprintf(stderr, + "Can't start %s: %s (%d)\n", + argv[index], + reply.msg[0] ? reply.msg : strerror(reply.error), + reply.error); + } + if (Verbose) + vinum_lsi(sd.sdno, 0); + } + } + } break; case volume_object: @@ -555,6 +580,7 @@ vinum_stop(int argc, char *argv[], char *arg0[]) int fileid = 0; /* ID of Vinum kld */ close(superdev); /* we can't stop if we have vinum open */ + sleep(1); /* wait for the daemon to let go */ fileid = kldfind(VINUMMOD); if ((fileid < 0) /* no go */ ||(kldunload(fileid) < 0)) |