From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 12 11:35:19 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA65216A418 for ; Wed, 12 Dec 2007 11:35:19 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 393B613C457 for ; Wed, 12 Dec 2007 11:35:19 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from root by ciao.gmane.org with local (Exim 4.43) id 1J2Pri-0008Kf-HQ for freebsd-hackers@freebsd.org; Wed, 12 Dec 2007 11:35:02 +0000 Received: from www.creo.hu ([217.113.62.14]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Dec 2007 11:35:02 +0000 Received: from csaba-ml by www.creo.hu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Dec 2007 11:35:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Csaba Henk Date: Wed, 12 Dec 2007 02:00:14 +0000 (UTC) Lines: 47 Message-ID: References: <20071211001828.54e1da6b@deimos.mars.bsd> X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: www.creo.hu User-Agent: slrn/0.9.8.1 (FreeBSD) Sender: news Subject: Re: Disk sync at shutdown and fusefs filesystems X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2007 11:35:19 -0000 On 2007-12-11, Alejandro Pulver wrote: > The problem with NTFS-3G (and all other FUSE based drivers maybe) is > that it doesn't flush the cache data to the disk at shutdown, but it > does when unmounted (and I guess this doesn't happen automatically). I > noticed this when files I write before manually unmounting persist, and > otherwise sometimes they don't. I just happen to discuss this issue with Szaka (ntfs-3g developer) and Miklos Szeredi (FUSE developer). At least, we're discussing something which might have a relevance here. They have already discovered issues with system shutdown on Linux, and Miklos has implemented a solution for this dubbed as "synchronous umount". According to this, the protocol is enhanced with a new message called DESTROY. Upon unmounting the fs, the kernel sends a DESTROY to the daemon and waits for answer. That is, unmount(2) won't complete until the fs says to the kernel "OK, I'm done". This was introduced in the following commit (as seen in my HG mirror): http://mercurial.creo.hu/repos/fuse-hg/?rev/a5df6fb4a0e6 and it's already included in the current sysutils/fusefs-libs port. And it wouldn't be hard to add kernel side support for FreeBSD. There are some questions though: - Do you think it could be actually useful for solving the shutdown issue on FreeBSD? - Some "got hung in unmount" issues are to be sorted out (these appeared on Linux, and they might or might not appear on FreeBSD). - Security issue: with synch unmount, any user who can mount (w/ synch unmount), is capable of making the unmount stuck (which is easy to fix when the system is up -- just kill the fs daemon -- but can make the shutdown process hopelessly stuck). So we'd have to decide who/when shall be able to do mounts for which the unmount is synchronous. (The current criteria for this on Linux -- ie., is the fuseblk fs variant being used? -- is N/A to FreeBSD for reasons which are OT here. However, Miklos decided to change this so that sych unmount will be tied to the "allow_other" option, which is tied to root privileges, and does make sense on FreeBSD, too. I'd be happy to hear more suitable criteria. Regards, Csaba