Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src Pull up following revision(s) (requested by brad in ticke...



details:   https://anonhg.NetBSD.org/src/rev/5cdbbad5f75f
branches:  netbsd-9
changeset: 462575:5cdbbad5f75f
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Sep 27 09:18:37 2019 +0000

description:
Pull up following revision(s) (requested by brad in ticket #250):

        external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.2
        external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.3
        external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.4
        external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.5
        distrib/sets/lists/man/mi: revision 1.1652
        distrib/sets/lists/man/mi: revision 1.1653
        distrib/sets/lists/etc/mi: revision 1.259
        etc/rc.d/mountall: revision 1.11
        external/cddl/osnet/sbin/zfs/Makefile: revision 1.5
        external/cddl/osnet/dist/cmd/zfs/zfs_main.c: revision 1.7
        etc/rc.d/Makefile: revision 1.105
        distrib/sets/lists/base/mi: revision 1.1217
        etc/rc.d/Makefile: revision 1.106
        etc/rc.d/zfs: revision 1.1
        etc/defaults/rc.conf: revision 1.152
        external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.1

Add support for legacy ZFS filesystems, specified by mountpoint=legacy
in the ZFS properties of the dataset and a simple man page for
mount_zfs.  With this, it is possible to put ZFS filesystems in
/etc/fstab as file system type zfs.

Add a rc.d script that kicks the module ZFS load mostly before
mountall runs simular to what LVM does.  This allows for any legacy
mounts to be specified in critical_local_filesystems and allows for
ZFS pools on top of cgd (probably among other things).  Introduce a
rc.conf variable called zfs which needs to be set to YES, in the usual
manor of things, to get zvols and ZFS dataset support rather then just
assume that 'zfs mount' does that in mountall.  Fix a problem in
mountall if ZFS is not compiled into the system.
mount_zfs.8: add xref to fstab(5)

Use more markup.

Include mount_zfs man pages only for MKZFS builds.

Moved zfs out of MKX11 block.

Fix build failure without X11.

Add a copyright to the man page and a bit of history.
Use Pa macro for path
new sentence, new line

diffstat:

 distrib/sets/lists/base/mi                  |   3 +-
 distrib/sets/lists/etc/mi                   |   3 +-
 distrib/sets/lists/man/mi                   |   5 ++-
 etc/defaults/rc.conf                        |   5 ++-
 etc/rc.d/Makefile                           |   6 ++-
 etc/rc.d/mountall                           |  24 +++---------
 etc/rc.d/zfs                                |  38 ++++++++++++++++++++
 external/cddl/osnet/dist/cmd/zfs/zfs_main.c |   7 +++-
 external/cddl/osnet/sbin/zfs/Makefile       |   6 ++-
 external/cddl/osnet/sbin/zfs/mount_zfs.8    |  54 +++++++++++++++++++++++++++++
 10 files changed, 126 insertions(+), 25 deletions(-)

diffs (296 lines):

diff -r 8831f396fc54 -r 5cdbbad5f75f distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Thu Sep 26 19:16:40 2019 +0000
+++ b/distrib/sets/lists/base/mi        Fri Sep 27 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1209.2.3 2019/09/26 19:04:00 martin Exp $
+# $NetBSD: mi,v 1.1209.2.4 2019/09/27 09:18:37 martin Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -567,6 +567,7 @@
 ./sbin/mount_umap                              base-miscfs-root
 ./sbin/mount_union                             base-miscfs-root
 ./sbin/mount_v7fs                              base-sysutil-root
+./sbin/mount_zfs                               base-zfs-root           zfs
 ./sbin/mountd                                  base-obsolete           obsolete
 ./sbin/newbtconf                               base-sysutil-root
 ./sbin/newfs                                   base-sysutil-root
diff -r 8831f396fc54 -r 5cdbbad5f75f distrib/sets/lists/etc/mi
--- a/distrib/sets/lists/etc/mi Thu Sep 26 19:16:40 2019 +0000
+++ b/distrib/sets/lists/etc/mi Fri Sep 27 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.258 2019/05/11 19:31:03 maxv Exp $
+# $NetBSD: mi,v 1.258.2.1 2019/09/27 09:18:37 martin Exp $
 #
 # Note: end-user configuration files that are moved to another location
 #      should not be marked "obsolete"; they should just be removed from
@@ -323,6 +323,7 @@
 ./etc/rc.d/yppasswdd                           etc-nis-rc              yp
 ./etc/rc.d/ypserv                              etc-nis-rc              yp
 ./etc/rc.d/ypset                               etc-obsolete            obsolete
+./etc/rc.d/zfs                                 etc-sys-rc              zfs
 ./etc/rc.lkm                                   etc-obsolete            obsolete
 ./etc/rc.local                                 etc-sys-rc
 ./etc/rc.shutdown                              etc-sys-rc
diff -r 8831f396fc54 -r 5cdbbad5f75f distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Thu Sep 26 19:16:40 2019 +0000
+++ b/distrib/sets/lists/man/mi Fri Sep 27 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1649.2.1 2019/09/23 07:04:40 martin Exp $
+# $NetBSD: mi,v 1.1649.2.2 2019/09/27 09:18:37 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2794,6 +2794,7 @@
 ./usr/share/man/cat8/mount_umap.0              man-miscfs-catman       .cat
 ./usr/share/man/cat8/mount_union.0             man-miscfs-catman       .cat
 ./usr/share/man/cat8/mount_v7fs.0              man-sysutil-catman      .cat
+./usr/share/man/cat8/mount_zfs.0               man-sysutil-catman      zfs,.cat
 ./usr/share/man/cat8/mountd.0                  man-nfsserver-catman    .cat
 ./usr/share/man/cat8/moused.0                  man-sysutil-catman      .cat
 ./usr/share/man/cat8/mrinfo.0                  man-netutil-catman      .cat
@@ -5759,6 +5760,7 @@
 ./usr/share/man/html8/mount_umap.html          man-miscfs-htmlman      html
 ./usr/share/man/html8/mount_union.html         man-miscfs-htmlman      html
 ./usr/share/man/html8/mount_v7fs.html          man-sysutil-htmlman     html
+./usr/share/man/html8/mount_zfs.html           man-sysutil-htmlman     zfs,html
 ./usr/share/man/html8/mountd.html              man-nfsserver-htmlman   html
 ./usr/share/man/html8/moused.html              man-sysutil-htmlman     html
 ./usr/share/man/html8/mrinfo.html              man-netutil-htmlman     html
@@ -8906,6 +8908,7 @@
 ./usr/share/man/man8/mount_umap.8              man-miscfs-man          .man
 ./usr/share/man/man8/mount_union.8             man-miscfs-man          .man
 ./usr/share/man/man8/mount_v7fs.8              man-sysutil-man         .man
+./usr/share/man/man8/mount_zfs.8               man-sysutil-man         zfs,.man
 ./usr/share/man/man8/mountd.8                  man-nfsserver-man       .man
 ./usr/share/man/man8/moused.8                  man-sysutil-man         .man
 ./usr/share/man/man8/mrinfo.8                  man-netutil-man         .man
diff -r 8831f396fc54 -r 5cdbbad5f75f etc/defaults/rc.conf
--- a/etc/defaults/rc.conf      Thu Sep 26 19:16:40 2019 +0000
+++ b/etc/defaults/rc.conf      Fri Sep 27 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.conf,v 1.151 2019/07/24 02:37:17 msaitoh Exp $
+#      $NetBSD: rc.conf,v 1.151.2.1 2019/09/27 09:18:38 martin Exp $
 #
 # /etc/defaults/rc.conf --
 #      default configuration of /etc/rc.conf
@@ -405,3 +405,6 @@
 nsd=NO
 nsd_chrootdir=/var/chroot/nsd
 nsd_flags="-t ${nsd_chrootdir}"
+
+# ZFS
+zfs=NO
diff -r 8831f396fc54 -r 5cdbbad5f75f etc/rc.d/Makefile
--- a/etc/rc.d/Makefile Thu Sep 26 19:16:40 2019 +0000
+++ b/etc/rc.d/Makefile Fri Sep 27 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.104 2019/05/12 01:50:14 kre Exp $
+# $NetBSD: Makefile,v 1.104.2.1 2019/09/27 09:18:37 martin Exp $
 
 .include <bsd.own.mk>
 
@@ -60,4 +60,8 @@
        ${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.IMPSRC} > ${.TARGET}
 .endif
 
+.if ${MKZFS} != "no"
+CONFIGFILES+=  zfs
+.endif
+
 .include <bsd.prog.mk>
diff -r 8831f396fc54 -r 5cdbbad5f75f etc/rc.d/mountall
--- a/etc/rc.d/mountall Thu Sep 26 19:16:40 2019 +0000
+++ b/etc/rc.d/mountall Fri Sep 27 09:18:37 2019 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: mountall,v 1.10 2018/06/08 14:44:21 sevan Exp $
+# $NetBSD: mountall,v 1.10.4.1 2019/09/27 09:18:37 martin Exp $
 #
 
 # REQUIRE: mountcritremote named ypbind
@@ -15,33 +15,23 @@
 mountall_start()
 {
        echo 'Mounting all file systems...'
-       if [ -f /etc/zfs/zpool.cache ]; then
-               # Get ZFS module loaded (and thereby, zvols created).
-               zfs list > /dev/null 2>&1
-               # Mount file systems noted in fstab.
-               mount -a
+       # Mount file systems noted in fstab.
+       mount -a
+       if checkyesno zfs && [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
                # Mount ZFS file systems.
                zfs mount -a
-       else
-               # Mount file systems noted in fstab.
-               mount -a
        fi
 }
 
 mountall_stop()
 {
        echo 'Unmounting all file systems...'
-       if [ -f /etc/zfs/zpool.cache ]; then
+       if checkyesno zfs && [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
                # Unmount ZFS file systems.
                zfs unmount -a
-               # Unmount file systems noted in fstab.
-               umount -a
-               # Unload ZFS module, so disk devices are closed.
-               modunload zfs
-       else
-               # Otherwise, just deal with fstab.
-               umount -a
        fi
+       # Unmount file systems noted in fstab.
+       umount -a
 }
 
 load_rc_config $name
diff -r 8831f396fc54 -r 5cdbbad5f75f etc/rc.d/zfs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/rc.d/zfs      Fri Sep 27 09:18:37 2019 +0000
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $NetBSD: zfs,v 1.1.2.2 2019/09/27 09:18:37 martin Exp $
+#
+
+# PROVIDE: zfs
+# REQUIRE: root
+# BEFORE:  DISKS
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="zfs"
+start_cmd="zfs_start"
+stop_cmd="zfs_stop"
+
+zfs_start()
+{
+       if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
+               # Get ZFS module loaded (and thereby, zvols created).
+               /sbin/zfs list > /dev/null 2>&1
+               if [ $? -ne 0 ]; then
+                       warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
+                       return 1;
+               fi
+       fi
+}
+
+zfs_stop()
+{
+       if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
+               zfs unmount -a
+               modunload zfs
+       fi
+       return 0;
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -r 8831f396fc54 -r 5cdbbad5f75f external/cddl/osnet/dist/cmd/zfs/zfs_main.c
--- a/external/cddl/osnet/dist/cmd/zfs/zfs_main.c       Thu Sep 26 19:16:40 2019 +0000
+++ b/external/cddl/osnet/dist/cmd/zfs/zfs_main.c       Fri Sep 27 09:18:37 2019 +0000
@@ -7135,8 +7135,13 @@
         * This command also doubles as the /etc/fs mount and unmount program.
         * Determine if we should take this behavior based on argv[0].
         */
+#ifdef __NetBSD__
+#define LEGACYPROGNAME "mount_zfs"
+#else
+#define LEGACYPROGNAME "mount"
+#endif
        progname = basename(argv[0]);
-       if (strcmp(progname, "mount") == 0) {
+       if (strcmp(progname, LEGACYPROGNAME) == 0) {
                ret = manual_mount(argc, argv);
        } else if (strcmp(progname, "umount") == 0) {
                ret = manual_unmount(argc, argv);
diff -r 8831f396fc54 -r 5cdbbad5f75f external/cddl/osnet/sbin/zfs/Makefile
--- a/external/cddl/osnet/sbin/zfs/Makefile     Thu Sep 26 19:16:40 2019 +0000
+++ b/external/cddl/osnet/sbin/zfs/Makefile     Fri Sep 27 09:18:37 2019 +0000
@@ -1,11 +1,12 @@
-#      $NetBSD: Makefile,v 1.4 2018/05/28 21:05:09 chs Exp $
+#      $NetBSD: Makefile,v 1.4.4.1 2019/09/27 09:18:37 martin Exp $
 
 .include "../../Makefile.zfs"
 
 PROG=  zfs
-MAN=   zfs.8
+MAN=   zfs.8 mount_zfs.8
 USETBL=        yes
 SRCS=  zfs_main.c zfs_iter.c
+LINKS= ${BINDIR}/zfs ${BINDIR}/mount_zfs
 
 DPADD= ${LIBZFS} ${LIBM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUTIL}
 
@@ -26,6 +27,7 @@
 
 LDADD+= -lm -lutil -lpthread
 
+.PATH: ${.CURDIR}
 .PATH: ${ZFSDIR}/dist/cmd/zfs
 
 .include <bsd.prog.mk>
diff -r 8831f396fc54 -r 5cdbbad5f75f external/cddl/osnet/sbin/zfs/mount_zfs.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/cddl/osnet/sbin/zfs/mount_zfs.8  Fri Sep 27 09:18:37 2019 +0000
@@ -0,0 +1,54 @@
+.\"    $NetBSD: mount_zfs.8,v 1.5.2.2 2019/09/27 09:18:37 martin Exp $
+.\"
+.\" Copyright (c) 2012, Martin Matuska <mm%FreeBSD.org@localhost>.
+.\" Copyright (c) 2013-2014, Xin Li <delphij%FreeBSD.org@localhost>.
+.\" All Rights Reserved.
+.\"
+.\" 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]
+.\"
+.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
+.\" Copyright (c) 2011, Justin T. Gibbs <gibbs%FreeBSD.org@localhost>
+.\" Copyright (c) 2013 by Delphix. All Rights Reserved.
+.\" Copyright (c) 2012, Glen Barber <gjb%FreeBSD.org@localhost>
+.\"
+.Dd September 15, 2019
+.Dt MOUNT_ZFS 8
+.Os
+.Sh NAME
+.Nm mount_zfs
+.Nd helper utility for mounting legacy ZFS mounts
+.Sh SYNOPSIS
+.Nm
+.Ar ZFS_dataset
+.Ar mount_point
+.Sh DESCRIPTION
+The
+.Nm
+utility supports mounting ZFS filesystems via
+.Pa /etc/fstab
+where the ZFS property is
+.Cm mountpoint=legacy .
+.Sh SEE ALSO
+.Xr fstab 5 ,
+.Xr zfs 8
+.Sh HISTORY
+A command to manage legacy ZFS mounts appeared in Solaris as
+.Pa /etc/fs/zfs/mount .
+The
+.Nm
+utility first appeared in
+.Nx 9.0 .



Home | Main Index | Thread Index | Old Index