diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/beadm/beadm.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libbe/common/be_mount.c | 21 | ||||
-rw-r--r-- | usr/src/man/man1m/beadm.1m | 9 |
3 files changed, 27 insertions, 7 deletions
diff --git a/usr/src/cmd/beadm/beadm.c b/usr/src/cmd/beadm/beadm.c index ff986563ce..7222b968ee 100644 --- a/usr/src/cmd/beadm/beadm.c +++ b/usr/src/cmd/beadm/beadm.c @@ -133,8 +133,8 @@ usage(void) "\tbeadm destroy [-F] beName@snapshot \n" "\tbeadm list [[-a] | [-d] [-s]] [-H] [beName]\n" "\tbeadm mount [-s ro|rw] beName [mountpoint]\n" - "\tbeadm unmount [-f] beName\n" - "\tbeadm umount [-f] beName\n" + "\tbeadm unmount [-f] beName | mountpoint\n" + "\tbeadm umount [-f] beName | mountpoint\n" "\tbeadm rename origBeName newBeName\n" "\tbeadm rollback beName snapshot\n" "\tbeadm rollback beName@snapshot\n")); diff --git a/usr/src/lib/libbe/common/be_mount.c b/usr/src/lib/libbe/common/be_mount.c index bacb5d4ab4..6c631da67d 100644 --- a/usr/src/lib/libbe/common/be_mount.c +++ b/usr/src/lib/libbe/common/be_mount.c @@ -22,6 +22,9 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + */ /* * System includes @@ -167,6 +170,8 @@ int be_unmount(nvlist_t *be_attrs) { char *be_name = NULL; + char *be_name_mnt = NULL; + char *ds = NULL; uint16_t flags = 0; int ret = BE_SUCCESS; @@ -182,6 +187,20 @@ be_unmount(nvlist_t *be_attrs) return (BE_ERR_INVAL); } + /* Check if we have mountpoint argument instead of BE name */ + if (be_name[0] == '/') { + if ((ds = be_get_ds_from_dir(be_name)) != NULL) { + if ((be_name_mnt = strrchr(ds, '/')) != NULL) { + free(be_name); + be_name = be_name_mnt + 1; + } + } else { + be_print_err(gettext("be_unmount: no datasets mounted " + "at '%s'\n"), be_name); + return (BE_ERR_INVAL); + } + } + /* Validate original BE name */ if (!be_valid_be_name(be_name)) { be_print_err(gettext("be_unmount: invalid BE name %s\n"), @@ -449,7 +468,7 @@ _be_unmount(char *be_name, int flags) } ZFS_CLOSE(zhp); - return (BE_SUCCESS); + return (BE_ERR_NOTMOUNTED); } /* diff --git a/usr/src/man/man1m/beadm.1m b/usr/src/man/man1m/beadm.1m index d5747d3c4f..33203152f3 100644 --- a/usr/src/man/man1m/beadm.1m +++ b/usr/src/man/man1m/beadm.1m @@ -1,5 +1,5 @@ '\" te -.\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. +.\" Copyright 2012 Nexenta Systems, Inc. All rights reserved. .TH BEADM 1M "Feb 26, 2011" .SH NAME beadm \- utility for managing zfs boot environments @@ -33,7 +33,7 @@ beadm \- utility for managing zfs boot environments .LP .nf -\fBbeadm\fR \fBunmount\fR [\fB-f\fR] \fIbeName\fR +\fBbeadm\fR \fBunmount\fR [\fB-f\fR] \fIbeName\fR | \fImountpoint\fR .fi .LP @@ -374,11 +374,12 @@ already existing empty directory. .sp .ne 2 .na -\fBbeadm\fR \fBunmount\fR [\fB-f\fR] \fIbeName\fR +\fBbeadm\fR \fBunmount\fR [\fB-f\fR] \fIbeName\fR | \fImountpoint\fR .ad .sp .6 .RS 4n -Unmounts the boot environment named beName. +Unmounts the boot environment named beName. The command can also be given a path to a +beName mount point on the system. .sp .ne 2 .na |