Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jun 2008 06:23:38 GMT
From:      Dominic Fandrey <kamikaze@bsdforen.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/124901: [patch] sysutils/fusefs-kmod dataloss on write shortly before shutdown
Message-ID:  <200806230623.m5N6NcZC091413@www.freebsd.org>
Resent-Message-ID: <200806230630.m5N6U1UB085448@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         124901
>Category:       ports
>Synopsis:       [patch] sysutils/fusefs-kmod dataloss on write shortly before shutdown
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 23 06:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Fandrey
>Release:        RELENG_7
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 7.0-STABLE FreeBSD 7.0-STABLE #1: Sat Jun  7 14:00:26 CEST 2008     root@mobileKamikaze.norad:/usr/obj/HP6510b/amd64/usr/src/sys/HP6510b  amd64
>Description:
As described in ports/122907 fusefs keeps a lot of things in memory and only writes them back when a filsystem is unmounted. During shutdown the time to write things back is often not sufficient, hence the shutdown script contains code that is meant to stall shutdown until the writing back is finished (this is detected by trying to unload the fusefs kernel module).

Unfortunately the script is often shot down by the shutdown watchdog (see rc.shutdown).
>How-To-Repeat:
Do some heavy writing on a fusefs file system, like ntfs-3g and shutdown immediately afterwards. You'll see the watchdog kill the shutdown process and some of the files will definitely not be there any more upon the next boot. The file system will be in requirement of a file system check.
>Fix:
diff -Pur ports/sysutils/fusefs-kmod.orig/files/fusefs.in ports/sysutils/fusefs-kmod/files/fusefs.in
--- ports/sysutils/fusefs-kmod.orig/files/fusefs.in	2008-06-22 21:35:27.000000000 +0200
+++ ports/sysutils/fusefs-kmod/files/fusefs.in	2008-06-22 21:44:34.000000000 +0200
@@ -50,9 +50,18 @@
 			;;
 		esac
 	done
+
+	# This is an evil yet necessary hack to give fuse the time to
+	# write all data to the media before the system is shut down.
+	if [ -n "$rcshutdown_timeout" -a -n "$_rcshutdown_watchdog" ]; then
+		/bin/kill -STOP "$_rcshutdown_watchdog"
+	fi
 	until kldunload $kmod; do
 		/bin/sleep 0.25
 	done
+	if [ -n "$rcshutdown_timeout" -a -n "$_rcshutdown_watchdog" ]; then
+		/bin/kill -CONT "$_rcshutdown_watchdog"
+	fi
 }
 load_rc_config $name
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806230623.m5N6NcZC091413>