--Sig_/SuCp=xQMD/i.WNumc.Kkx_9
Content-Type: multipart/mixed; boundary="MP_/iVjWT81uZzZ5Lbiaq4SVXk/"
--MP_/iVjWT81uZzZ5Lbiaq4SVXk/
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
On Wed, 12 Dec 2007 03:00:07 +0100
Csaba Henk <csaba@beastie.creo.hu> wrote:
> [This message has also been posted to gmane.os.freebsd.devel.hackers.]
> On 2007-12-11, Alejandro Pulver <alepulver@FreeBSD.org> 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.
>=20
> 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.
>=20
> 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".
>=20
> This was introduced in the following commit (as seen in my HG mirror):
>=20
> http://mercurial.creo.hu/repos/fuse-hg/?rev/a5df6fb4a0e6
>=20
> and it's already included in the current sysutils/fusefs-libs port.
>=20
> And it wouldn't be hard to add kernel side support for FreeBSD. There
> are some questions though:
>=20
> - Do you think it could be actually useful for solving the shutdown
> issue on FreeBSD?
>=20
Hmm, I don't know much of this, but isn't the Linux problem related to
flushing its own block device cache? In FreeBSD it doesn't exist (i.e.
ublio is only user-space), so I wonder if just unmounting before
shutdown solves the issue. I mean, does the kernel still keep
information after a FUSE filesystem is unmounted?
Please correct me if I'm wrong.
At least the currently discussed trick only works because it waits a few
seconds after unmounting to let it flush the cache (but I think it's a
common fact that filesystems get registered/unregistered with a small
delay, and may not be related to that).
> - Some "got hung in unmount" issues are to be sorted out (these
> appeared on Linux, and they might or might not appear on FreeBSD).
>=20
Never seen this, but also never unmounted at shutdown before. I have a
patch for it (see thread). Then we could easily see if it get stalled
at shutdown (or when manually stopping the rc.d script).
> - 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=20
> 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.
>=20
This would depend on the previous point.
Please CC me as I'm not (yet) subscribed.
Best Regards,
Ale
--MP_/iVjWT81uZzZ5Lbiaq4SVXk/
Content-Type: text/x-patch; name=fusefs-kmod.diff
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=fusefs-kmod.diff
? ../fusefs-kmod/fusefs-kmod-0.3.9.p1_3.tbz
Index: ../fusefs-kmod/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/pcvs/ports/sysutils/fusefs-kmod/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- ../fusefs-kmod/Makefile 15 Nov 2007 19:46:42 -0000 1.16
+++ ../fusefs-kmod/Makefile 12 Dec 2007 03:12:14 -0000
@@ -7,7 +7,7 @@
=20
PORTNAME=3D fusefs
DISTVERSION=3D 0.3.9-pre1
-PORTREVISION=3D 2
+PORTREVISION=3D 3
CATEGORIES=3D sysutils kld
MASTER_SITES=3D http://fuse4bsd.creo.hu/downloads/ \
http://am-productions.biz/docs/
Index: ../fusefs-kmod/files/fusefs.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/pcvs/ports/sysutils/fusefs-kmod/files/fusefs.in,v
retrieving revision 1.4
diff -u -r1.4 fusefs.in
--- ../fusefs-kmod/files/fusefs.in 30 Oct 2007 03:10:09 -0000 1.4
+++ ../fusefs-kmod/files/fusefs.in 12 Dec 2007 03:12:14 -0000
@@ -25,13 +25,29 @@
=20
fusefs_start()
{
+ if kldstat | grep -q fuse\\.ko; then
+ echo "${name} is already running."
+ return 0
+ fi
echo "Starting ${name}."
kldload $kmod
}
=20
fusefs_stop()
{
+ if ! kldstat | grep -q fuse\\.ko; then
+ echo "${name} is not running."
+ return 1
+ fi
echo "Stopping ${name}."
+ mount | while read dev d1 mountpoint d2; do
+ case "$dev" in
+ /dev/fuse[0-9]*)
+ echo "fusefs: unmounting ${mountpoint}."
+ umount $mountpoint ; sleep 1
+ ;;
+ esac
+ done
kldunload $kmod
}
load_rc_config $name
Index: ../fusefs-kmod/files/pkg-message.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/pcvs/ports/sysutils/fusefs-kmod/files/pkg-message.in,v
retrieving revision 1.1
diff -u -r1.1 pkg-message.in
--- ../fusefs-kmod/files/pkg-message.in 30 Oct 2007 03:10:09 -0000 1.1
+++ ../fusefs-kmod/files/pkg-message.in 12 Dec 2007 03:12:14 -0000
@@ -12,4 +12,8 @@
/etc/fstab with the "late" parameter. This requires a symlink in /usr/sbin
named "mount_<fstype>", which is not created by all the fusefs ports.
=20
+Note that the rc.d script will unmount all fuse filesystems when called wi=
th
+"stop", so it can unload the kernel module, and to flush cache in drivers =
like
+NTFS-3G (sysutils/fusefs-ntfs) at shutdown.
+
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
--MP_/iVjWT81uZzZ5Lbiaq4SVXk/--
--Sig_/SuCp=xQMD/i.WNumc.Kkx_9
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)
iD8DBQFHYA+kiV05EpRcP2ERAlLwAKC+AMawXVk7G76cuEDVYi+VoKajIgCgkN1y
VDLoPk8On2kodPAddSwKY+0=
=IfDM
-----END PGP SIGNATURE-----
--Sig_/SuCp=xQMD/i.WNumc.Kkx_9--