mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Illumos #2635: 'zfs rename -f' to perform force unmount
Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: George Wilson <George.Wilson@delphix.com> Reviewed by: Bill Pijewski <wdp@joyent.com> Reviewed by: Richard Elling <richard.elling@richardelling.com> Approved by: Richard Lowe <richlowe@richlowe.net> References: https://www.illumos.org/issues/2635 Ported by: Martin Matuska <martin@matuska.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #717
This commit is contained in:
committed by
Brian Behlendorf
parent
e346ec25af
commit
db49968e5c
+11
-7
@@ -22,7 +22,7 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
@@ -243,9 +243,9 @@ get_usage(zfs_help_t idx)
|
||||
"snapshot>\n"
|
||||
"\treceive [-vnFu] [-d | -e] <filesystem>\n"));
|
||||
case HELP_RENAME:
|
||||
return (gettext("\trename <filesystem|volume|snapshot> "
|
||||
return (gettext("\trename [-f] <filesystem|volume|snapshot> "
|
||||
"<filesystem|volume|snapshot>\n"
|
||||
"\trename -p <filesystem|volume> <filesystem|volume>\n"
|
||||
"\trename [-f] -p <filesystem|volume> <filesystem|volume>\n"
|
||||
"\trename -r <snapshot> <snapshot>"));
|
||||
case HELP_ROLLBACK:
|
||||
return (gettext("\trollback [-rRf] <snapshot>\n"));
|
||||
@@ -3069,8 +3069,8 @@ zfs_do_list(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* zfs rename <fs | snap | vol> <fs | snap | vol>
|
||||
* zfs rename -p <fs | vol> <fs | vol>
|
||||
* zfs rename [-f] <fs | snap | vol> <fs | snap | vol>
|
||||
* zfs rename [-f] -p <fs | vol> <fs | vol>
|
||||
* zfs rename -r <snap> <snap>
|
||||
*
|
||||
* Renames the given dataset to another of the same type.
|
||||
@@ -3086,9 +3086,10 @@ zfs_do_rename(int argc, char **argv)
|
||||
int ret = 0;
|
||||
boolean_t recurse = B_FALSE;
|
||||
boolean_t parents = B_FALSE;
|
||||
boolean_t force_unmount = B_FALSE;
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "pr")) != -1) {
|
||||
while ((c = getopt(argc, argv, "prf")) != -1) {
|
||||
switch (c) {
|
||||
case 'p':
|
||||
parents = B_TRUE;
|
||||
@@ -3096,6 +3097,9 @@ zfs_do_rename(int argc, char **argv)
|
||||
case 'r':
|
||||
recurse = B_TRUE;
|
||||
break;
|
||||
case 'f':
|
||||
force_unmount = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
@@ -3146,7 +3150,7 @@ zfs_do_rename(int argc, char **argv)
|
||||
return (1);
|
||||
}
|
||||
|
||||
ret = (zfs_rename(zhp, argv[1], recurse) != 0);
|
||||
ret = (zfs_rename(zhp, argv[1], recurse, force_unmount) != 0);
|
||||
|
||||
zfs_close(zhp);
|
||||
return (ret);
|
||||
|
||||
Reference in New Issue
Block a user