Date: Sat, 2 Feb 2008 23:54:31 +0200 (EET) From: Adrian Penisoara <ady@freebsd.ady.ro> To: FreeBSD-gnats-submit@FreeBSD.org Cc: ady@freebsd.ady.ro Subject: conf/120228: [PATCH] Split ZFS volume startup / ease ZFS swap volumes management Message-ID: <200802022154.m12LsVbG070370@enterprisebsd.rofug.ro> Resent-Message-ID: <200802022230.m12MU1Ru040052@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 120228 >Category: conf >Synopsis: [PATCH] Split ZFS volume startup / ease ZFS swap volumes management >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Feb 02 22:30:00 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Adrian Penisoara >Release: FreeBSD 7.0-PRERELEASE >Organization: EnterpriseBSD.info >Environment: FreeBSD fbsd7-devel 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #1: Wed Jan 2 20:25:02 EET 2008 root@fbsd7-devel:/build/obj/build/src/sys/TEST i386 >Description: Management for ZFS swap volumes is "hardcoded" into /etc/rc.d/zfs script. This should be decoupled from ZFS initialization and relinquished back to normal swap init script. Moreover, ZFS volumes should be initialized early in the boot sequence for other services like swapspace to make use of them. >How-To-Repeat: Currently ZFS volumes are started late and ZFS swapspace is managed from the /etc/rc.d/zfs initialization script. >Fix: Split ZFS initialization in half, initializing the ZFS volumes early in the boot sequence. ZFS volume backed swap should be mounted as usual from /etc/fstab using the /dev/zvol/* entries. Care must be taken for the swapspace to be deactivated before taking down the [ZFS] volumes. Patch below -- please use "patch -p3". diff -ruN .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/Makefile .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/Makefile --- .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/Makefile 2007-12-29 22:32:47.960389378 +0200 +++ .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/Makefile 2008-01-06 22:24:39.201293236 +0200 @@ -41,7 +41,7 @@ watchdogd wpa_supplicant \ ypbind yppasswdd ypserv \ ypset ypupdated ypxfrd \ - zfs + zfs zfsvolumes .if ${MK_OPENSSH} != "no" FILES+= sshd diff -ruN .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/swap1 .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/swap1 --- .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/swap1 2007-12-29 22:32:48.145332158 +0200 +++ .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/swap1 2008-01-04 05:28:45.716495161 +0200 @@ -12,7 +12,7 @@ name="swap1" start_cmd='swapon -a' -stop_cmd=':' +stop_cmd='swapoff -a' load_rc_config swap run_rc_command "$1" diff -ruN .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/zfs .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/zfs --- .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/zfs 2007-12-29 22:32:48.170309354 +0200 +++ .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/zfs 2008-01-04 05:29:06.989747209 +0200 @@ -23,21 +23,11 @@ zfs_start_main() { - zfs volinit zfs mount -a zfs share -a if [ ! -r /etc/zfs/exports ]; then touch /etc/zfs/exports fi - # Enable swap on ZVOLs with property org.freebsd:swap=on. - zfs list -H -o org.freebsd:swap,name -t volume | \ - while read state name; do - case "${state}" in - [oO][nN]) - swapon /dev/zvol/${name} - ;; - esac - done } zfs_start() @@ -58,18 +48,8 @@ zfs_stop_main() { - # Disable swap on ZVOLs with property org.freebsd:swap=on. - zfs list -H -o org.freebsd:swap,name -t volume | \ - while read state name; do - case "${state}" in - [oO][nN]) - swapoff /dev/zvol/${name} - ;; - esac - done zfs unshare -a zfs unmount -a - zfs volfini } zfs_stop() diff -ruN .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/zfsvolumes .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/zfsvolumes --- .zfs/snapshot/RELENG_7_01Jan08/etc/rc.d/zfsvolumes 1970-01-01 02:00:00.000000000 +0200 +++ .zfs/snapshot/RELENG_7_01Jan08_6_zfs_rc.d_fixup/etc/rc.d/zfsvolumes 2008-01-04 05:29:10.017642374 +0200 @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $FreeBSD: src/etc/rc.d/zfs,v 1.5 2007/04/22 20:55:08 pjd Exp $ +# + +# PROVIDE: zfsvolumes disks +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="zfs" +rcvar="zfs_enable" +start_cmd="zfs volinit" +stop_cmd="zfs volfini" +required_modules="zfs" + +load_rc_config $name +run_rc_command "$1" >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802022154.m12LsVbG070370>