Disk sync at shutdown and fusefs filesystems
Alejandro Pulver
alepulver at FreeBSD.org
Tue Dec 11 13:02:27 PST 2007
On Tue, 11 Dec 2007 12:22:35 -0800 (PST)
Doug Barton <dougb at FreeBSD.org> wrote:
> On Tue, 11 Dec 2007, Alejandro Pulver wrote:
>
> > Thanks, here is what I've got so far: it seems /dev/fuse[0-9]* devices
> > aren't removed after the corresponding filesystem is unmounted (I guess
> > they are reused), so instead of listing /dev the list has to be taken
> > from 'mount'.
>
> Yeah, I think that's better than using fstab anyway, since this way we get
> them all with limited processing. Wish I'd thought of it. :)
>
Actually, I tried first with "umount -a -t {fusefs,ntfs-3g,fuse,...}"
but didn't work.
> > Also there should be a delay between the 'umount' and
> > 'kldunload' commands. What do you think about the following
> > (replacement for fusefs_stop function)?
>
> I suppose this is mostly a style difference, but I like to avoid all those
> subshells if we can. I also think it might be a good idea to wait a second
> between unmounts, just to be paranoid. How about:
>
> mount | while read dev d1 mountpoint d2; do
> case "$dev" in
> /dev/fuse[0-9]*) umount $mountpoint ; sleep 1 ;;
> esac
> done
> sleep 1
>
It looks fine to me. And what about echoing the mountpoints as they are
unmounted?
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
Also this checks would avoid kldload/kldunload errors:
In fusefs_start:
if kldstat | grep -q fuse\\.ko; then
echo "${name} is already running."
return 0
fi
In fusefs_stop:
if ! kldstat | grep -q fuse\\.ko; then
echo "${name} is not running."
return 1
fi
Well, the word "loaded" instead of "running" would be better. Also a
status command could be added, but I don't think it's needed.
Also
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20071211/47e02a51/signature.pgp
More information about the freebsd-hackers
mailing list