diff options
author | mm <mm@FreeBSD.org> | 2012-05-10 08:57:58 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2012-05-10 08:57:58 +0000 |
commit | e290b949d0f602e9af6839f2f35666c98b1470b5 (patch) | |
tree | 69c342a520ee7283a86d49dfe4e46a9e7f06ec86 /cddl/contrib/opensolaris/lib | |
parent | 10f60d496c9e9392a60ebec9350215094cae9472 (diff) | |
download | FreeBSD-src-e290b949d0f602e9af6839f2f35666c98b1470b5.zip FreeBSD-src-e290b949d0f602e9af6839f2f35666c98b1470b5.tar.gz |
Add support for force unmounting ZFS filesystems during "zfs rename"
with the -f flag.
Reimplementation of the illumos changeset 13677:a0cbef703c12
2635 'zfs rename -f' to perform force unmount
References:
https://www.illumos.org/issues/2635
PR: kern/164447
Suggested by: Marcelo Araujo <araujo@FreeBSD.org>
Obtained from: illumos (issue #2635)
MFC after: 1 week
Diffstat (limited to 'cddl/contrib/opensolaris/lib')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h | 4 | ||||
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h index b11356d..fb9e337 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h @@ -26,6 +26,7 @@ * All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. * All rights reserved. + * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved. */ #ifndef _LIBZFS_H @@ -541,6 +542,9 @@ typedef struct renameflags { /* don't unmount file systems */ int nounmount : 1; + + /* force unmount file systems */ + int forceunmount : 1; } renameflags_t; extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags); diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c index dba47ef..c01cffe 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c @@ -25,6 +25,7 @@ * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>. * All rights reserved. + * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved. */ #include <ctype.h> @@ -3721,7 +3722,8 @@ zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags) } else { if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, - flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, 0)) == NULL) { + flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, + flags.forceunmount ? MS_FORCE : 0)) == NULL) { return (-1); } |