diff options
| author | martin <martin@NetBSD.org> | 2019-09-27 09:18:37 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2019-09-27 09:18:37 +0000 |
| commit | ce6ea4ff409f73a84315309cc3253bc12242b0dd (patch) | |
| tree | 03c2acbbf4c4f893af1ae41c6e073e1df897f078 /etc | |
| parent | bbe0dd4762fd2004b99b37e513fe5241d79c9198 (diff) | |
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 (limited to 'etc')
| -rw-r--r-- | etc/defaults/rc.conf | 5 | ||||
| -rwxr-xr-x | etc/rc.d/Makefile | 6 | ||||
| -rwxr-xr-x | etc/rc.d/mountall | 24 | ||||
| -rw-r--r-- | etc/rc.d/zfs | 38 |
4 files changed, 54 insertions, 19 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 2dc271bb458..ad9e40dacc8 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -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 @@ unbound_chrootdir=/var/chroot/unbound nsd=NO nsd_chrootdir=/var/chroot/nsd nsd_flags="-t ${nsd_chrootdir}" + +# ZFS +zfs=NO diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile index 36d0167b623..26a7adb656e 100755 --- a/etc/rc.d/Makefile +++ b/etc/rc.d/Makefile @@ -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 @@ FILESBUILD_fccache= yes ${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.IMPSRC} > ${.TARGET} .endif +.if ${MKZFS} != "no" +CONFIGFILES+= zfs +.endif + .include <bsd.prog.mk> diff --git a/etc/rc.d/mountall b/etc/rc.d/mountall index 85648e45134..616c1ff11d0 100755 --- a/etc/rc.d/mountall +++ b/etc/rc.d/mountall @@ -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 @@ stop_cmd="mountall_stop" 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 --git a/etc/rc.d/zfs b/etc/rc.d/zfs new file mode 100644 index 00000000000..8e1bd69a894 --- /dev/null +++ b/etc/rc.d/zfs @@ -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" |
