summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvestre Gallon <syl@cvs.openbsd.org>2014-06-04 18:52:54 +0000
committerSylvestre Gallon <syl@cvs.openbsd.org>2014-06-04 18:52:54 +0000
commitb61d3205ee4badd0d107f0a8222e823e2c4d2741 (patch)
tree3565de04b0a11ad282277b33d31a4d1bacc13b74
parent0f0cc8f010c3a67506bb3df9d7b8872a87ff8484 (diff)
In fusefs_unmount() we need to send the FBT_DESTROY fusebuf only if
vflush(9) succeed. Problem reported by Helg Bredow. OK sthen@
-rw-r--r--sys/miscfs/fuse/fuse_vfsops.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/miscfs/fuse/fuse_vfsops.c b/sys/miscfs/fuse/fuse_vfsops.c
index e3ab7e8d347..f35296f69b3 100644
--- a/sys/miscfs/fuse/fuse_vfsops.c
+++ b/sys/miscfs/fuse/fuse_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_vfsops.c,v 1.9 2014/05/20 13:32:22 syl Exp $ */
+/* $OpenBSD: fuse_vfsops.c,v 1.10 2014/06/04 18:52:53 syl Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -138,6 +138,17 @@ fusefs_unmount(struct mount *mp, int mntflags, struct proc *p)
fmp = VFSTOFUSEFS(mp);
+ if (mntflags & MNT_FORCE) {
+ /* fusefs can never be rootfs so don't check for it */
+ if (!doforce)
+ return (EINVAL);
+
+ flags |= FORCECLOSE;
+ }
+
+ if ((error = vflush(mp, NULLVP, flags)))
+ return (error);
+
if (fmp->sess_init) {
fmp->sess_init = 0;
fbuf = fb_setup(0, 0, FBT_DESTROY, p);
@@ -150,17 +161,6 @@ fusefs_unmount(struct mount *mp, int mntflags, struct proc *p)
fb_delete(fbuf);
}
- if (mntflags & MNT_FORCE) {
- /* fusefs can never be rootfs so don't check for it */
- if (!doforce)
- return (EINVAL);
-
- flags |= FORCECLOSE;
- }
-
- if ((error = vflush(mp, 0, flags)))
- return (error);
-
fuse_device_cleanup(fmp->dev, NULL);
fuse_device_set_fmp(fmp, 0);
free(fmp, M_FUSEFS);