summaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-09-01 19:14:16 -0400
committerGitHub <[email protected]>2020-09-01 16:14:16 -0700
commit7b4e27232dec4595ef842ce7c0e31aafd255a20a (patch)
treee96bac7203b11fa82a0c2dad1177dfc78540ddcc /include/sys
parent88d19d7cc2586fbb4fe917b16763e88bcdf62d98 (diff)
Add 'zfs rename -u' to rename without remounting
Allow to rename file systems without remounting if it is possible. It is possible for file systems with 'mountpoint' property set to 'legacy' or 'none' - we don't have to change mount directory for them. Currently such file systems are unmounted on rename and not even mounted back. This introduces layering violation, as we need to update 'f_mntfromname' field in statfs structure related to mountpoint (for the dataset we are renaming and all its children). In my opinion it is worth it, as it allow to update FreeBSD in even cleaner way - in ZFS-only configuration root file system is ZFS file system with 'mountpoint' property set to 'legacy'. If root dataset is named system/rootfs, we can snapshot it (system/rootfs@upgrade), clone it (system/oldrootfs), update FreeBSD and if it doesn't boot we can boot back from system/oldrootfs and rename it back to system/rootfs while it is mounted as /. Before it was not possible, because unmounting / was not possible. Authored by: Pawel Jakub Dawidek <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported by: Matt Macy <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10839
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/Makefile.am1
-rw-r--r--include/sys/zfs_vfsops.h35
2 files changed, 36 insertions, 0 deletions
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index c2bc3be03..75727b93a 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -115,6 +115,7 @@ COMMON_H = \
zfs_sa.h \
zfs_stat.h \
zfs_sysfs.h \
+ zfs_vfsops.h \
zfs_znode.h \
zil.h \
zil_impl.h \
diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h
new file mode 100644
index 000000000..a438c86f0
--- /dev/null
+++ b/include/sys/zfs_vfsops.h
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Portions Copyright 2020 iXsystems, Inc.
+ */
+
+#ifndef _SYS_ZFS_VFSOPS_H
+#define _SYS_ZFS_VFSOPS_H
+
+#ifdef _KERNEL
+#include <sys/zfs_vfsops_os.h>
+#endif
+
+extern void zfsvfs_update_fromname(const char *, const char *);
+
+#endif /* _SYS_ZFS_VFSOPS_H */