rpms/zfs-fuse/F-10 zfs-fuse.spec, 1.3, 1.4 .cvsignore, 1.2, 1.3 zfs-fuse.init, 1.2, 1.3

Uwe Kubosch donv at fedoraproject.org
Thu Jan 1 12:33:39 UTC 2009


Author: donv

Update of /cvs/pkgs/rpms/zfs-fuse/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12238/F-10

Modified Files:
	zfs-fuse.spec .cvsignore zfs-fuse.init 
Log Message:
* Sun Dec 28 2008 Uwe Kubosh <uwe at kubosch.no> - 0.5.0-6.20081221
- Updated etc/init.d/zfs-fuse init script after feedback from Rudd-O at
  http://groups.google.com/group/zfs-fuse/browse_thread/thread/da94aa803bceef52
- Adds better wait at startup before mounting filesystems.
- Add OOM kill protection.
- Adds syncing of disks at shutdown.
- Adds pool status when asking for service status.
- Changed to start zfs-fuse at boot as default.
- Changed to start zfs-fise right after installation.
- Cleanup of /var/run/zfs and /var/lock/zfs after uninstall.



Index: zfs-fuse.spec
===================================================================
RCS file: /cvs/pkgs/rpms/zfs-fuse/F-10/zfs-fuse.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- zfs-fuse.spec	21 Dec 2008 22:41:53 -0000	1.3
+++ zfs-fuse.spec	1 Jan 2009 12:33:09 -0000	1.4
@@ -1,7 +1,7 @@
 Summary:          ZFS ported to Linux FUSE
 Name:             zfs-fuse
 Version:          0.5.0
-Release:          4.20081221%{?dist}
+Release:          6.20081221%{?dist}
 Group:            System Environment/Base
 License:          CDDL
 URL:              http://www.wizy.org/wiki/ZFS_on_FUSE
@@ -57,6 +57,8 @@
 %post
 if [ $1 = 1 ] ; then
     /sbin/chkconfig --add %{name}
+    /sbin/chkconfig %{name} on
+    /sbin/service %{name} start >/dev/null 2>&1 || :
 fi
 
 %preun
@@ -68,6 +70,8 @@
 %postun
 if [ $1 -ge 1 ] ; then
     /sbin/service %{name} condrestart >/dev/null 2>&1 || :
+    rm -rf /var/run/zfs
+    rm -rf /var/lock/zfs
 fi
 
 %files
@@ -83,6 +87,20 @@
 %{_sysconfdir}/sysconfig/%{name}
 
 %changelog
+* Sun Dec 28 2008 Uwe Kubosh <uwe at kubosch.no> - 0.5.0-6.20081221
+- Updated etc/init.d/zfs-fuse init script after feedback from Rudd-O at
+  http://groups.google.com/group/zfs-fuse/browse_thread/thread/da94aa803bceef52
+- Adds better wait at startup before mounting filesystems.
+- Add OOM kill protection.
+- Adds syncing of disks at shutdown.
+- Adds pool status when asking for service status.
+- Changed to start zfs-fuse at boot as default.
+- Changed to start zfs-fise right after installation.
+- Cleanup of /var/run/zfs and /var/lock/zfs after uninstall.
+
+* Sun Dec 24 2008 Uwe Kubosh <uwe at kubosch.no> - 0.5.0-5.20081221
+- Development tag.
+
 * Sun Dec 21 2008 Uwe Kubosh <uwe at kubosch.no> - 0.5.0-4.20081221
 - Updated to upstream trunk of 2008-12-21
 - Added config file in /etc/sysconfig/zfs


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/zfs-fuse/F-10/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore	21 Dec 2008 22:41:53 -0000	1.2
+++ .cvsignore	1 Jan 2009 12:33:09 -0000	1.3
@@ -1,2 +1,4 @@
 zfs-fuse-0.5.0.tar.bz2
 i386
+trunk-*
+zfs-fuse-*.src.rpm


Index: zfs-fuse.init
===================================================================
RCS file: /cvs/pkgs/rpms/zfs-fuse/F-10/zfs-fuse.init,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- zfs-fuse.init	21 Dec 2008 22:41:53 -0000	1.2
+++ zfs-fuse.init	1 Jan 2009 12:33:09 -0000	1.3
@@ -20,93 +20,173 @@
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-exec="/usr/bin/zfs-fuse"
 prog="zfs-fuse"
+exec="/usr/bin/$prog"
 config=/etc/sysconfig/$prog
 
 [ -e $config ] && . $config
 
-lockfile=/var/lock/subsys/$prog
+PIDFILE=/var/run/$prog.pid
+
+unset LANG
 
 start() {
-    [ -x $exec ] || exit 5
+    [ -x $exec ] || (echo "$prog binary not present or executable" && exit 5)
+    PID=`pidofproc $prog`
+    start_status=$?
+    case "$start_status" in
+    0)
+        echo "ZFS-FUSE is already running with pid $pid"
+        exit 3
+        ;;
+    1)
+        echo "Cleaning up stale $prog PID file in $PIDFILE"
+        rm -f "$PIDFILE"
+        ;;
+    3)
+        # not running
+        ;;
+    *)
+    	echo "Huh?"
+    	exit 99
+    esac
+
     echo -n $"Starting $prog: "
-    daemon $exec
-    retval=$?
+    daemon $exec -p "$PIDFILE"
+    exec_retval=$?
     echo
-    if [ $retval -eq 0 ] ; then
-    	touch $lockfile
-    	if [ $ZFS_AUTOMOUNT -eq 1 ] ; then
-			echo -n $"Mounting zfs partitions: "
-    		sleep 1
-			zfs mount -a
-			zfs_mount_retval=$?
-			if [ $zfs_mount_retval = 0 ]; then
-				echo_success
-			else
-				echo_warning
-			fi
-			echo
-    	fi
+    [ $exec_retval -ne 0 ] && return $exec_retval
+	
+    for a in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
+        PID=`pidofproc $prog`
+        [ "$PID" != "" ] && break
+        echo -n "."
+        sleep 1
+    done
+
+    if [ "$PID" = "" ] ; then
+        echo "ZFS-FUSE did not start or create $PIDFILE"
+        exit 3
+    fi 
+
+    echo -n "Immunizing $prog against OOM kills"
+    echo -17 > "/proc/$PID/oom_adj"
+    ES_TO_REPORT=$?
+    if [ "$ES_TO_REPORT" -ne 0 ] ; then
+		echo_warning
+        echo "code $ES_TO_REPORT"
+        exit 3
     fi
-    return $retval
+    echo_success
+    echo
+
+	if [ $ZFS_AUTOMOUNT -eq 1 ] ; then
+		echo -n $"Mounting zfs partitions: "
+    	sleep 1
+        rm -f /var/lib/random-seed
+		zfs mount -a
+		zfs_mount_retval=$?
+		if [ $zfs_mount_retval = 0 ]; then
+			echo_success
+		else
+			echo_warning
+			echo zfs mount failed with code $zfs_mount_retval
+		fi
+		echo
+    fi
+    
+    
+#    if [ -x /nonexistent -a -x /usr/bin/renice ] ; then # DISABLED
+#        log_action_begin_msg "Increasing ZFS-FUSE priority"
+#        /usr/bin/renice -15 -g $PID > /dev/null
+#        ES_TO_REPORT=$?
+#        if [ 0 = "$ES_TO_REPORT" ] ; then
+#            log_action_end_msg 0
+#        else
+#            log_action_end_msg 1 "code $ES_TO_REPORT"
+#            exit 3
+#        fi
+#        true
+#    fi 
+        
+    
+    return $exec_retval
 }
 
 stop() {
+    status_quiet || return 0
+    [ -x $exec ] || (echo "$prog binary not present or executable" && exit 5)
+    PID=`pidofproc $prog`
+    if [ "$PID" != "" ] ; then
+        echo -n "Syncing disks"
+        sync
+        echo_success
+        echo
+
+        echo -n "Unmounting ZFS filesystems"
+        zfs unmount -a
+        ES_TO_REPORT=$?
+        if [ 0 = "$ES_TO_REPORT" ] ; then
+            echo_success
+        else
+            echo_warning
+            exit 3
+        fi
+        echo
+    fi
+
     echo -n $"Stopping $prog: "
     killproc $prog
-    retval=$?
-    echo
-    [ $retval -eq 0 ] && rm -f $lockfile
-    return $retval
-}
-
-restart() {
-    stop
-    start 
-}
+    kill_retval=$?
+	echo
+	
+	if [ "$PID" != "" ] ; then
+    	echo -n "Syncing disks again"
+    	sync
+    	echo_success
+    	echo
+    fi
 
-reload() {
-    restart
+    return $kill_retval
 }
 
-force_reload() {
-    restart
+restart() {
+	stop
+	start
 }
 
-rh_status() {
+pool_status() {
     # run checks to determine if the service is running or use generic status
-    status $prog
+    status $prog && /usr/bin/zpool status
 }
 
-rh_status_q() {
-    rh_status >/dev/null 2>&1
+status_quiet() {
+    pool_status >/dev/null 2>&1
 }
 
 case "$1" in
     start)
-        rh_status_q && exit 0
+        status_quiet && exit 0
         $1
         ;;
     stop)
-        rh_status_q || exit 0
         $1
         ;;
     restart)
-        $1
+    	restart 
         ;;
     reload)
-        rh_status_q || exit 7
-        $1
+        status_quiet || exit 7
+	    restart
         ;;
     force-reload)
-        force_reload
+	    restart
         ;;
     status)
-        rh_status
+        pool_status
         ;;
     condrestart|try-restart)
-        rh_status_q || exit 0
+        status_quiet || exit 0
         restart
         ;;
     *)




More information about the scm-commits mailing list