aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2014-07-14 09:10:00 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2014-07-14 09:10:00 +0000
commit895b3782c67ca4b44be5c42986ba33596e08c2c3 (patch)
tree8fdfd6d0bd986e36dac198fddbf48d889ec64752 /sys/kern/vfs_vnops.c
parent7a41bc2f41d08744615460f6248c3f42b8adb8ca (diff)
downloadsrc-895b3782c67ca4b44be5c42986ba33596e08c2c3.tar.gz
src-895b3782c67ca4b44be5c42986ba33596e08c2c3.zip
Extract the code to put a filesystem into the suspended state (at the
unmount time) in the helper vfs_write_suspend_umnt(). Use it instead of two inline copies in FFS. Fix the bug in the FFS unmount, when suspension failed, the ufs extattrs were not reinitialized. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=268612
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index e7e0f9ecde29..f1d19acbca04 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1830,6 +1830,37 @@ vfs_write_resume(struct mount *mp, int flags)
}
/*
+ * Helper loop around vfs_write_suspend() for filesystem unmount VFS
+ * methods.
+ */
+int
+vfs_write_suspend_umnt(struct mount *mp)
+{
+ int error;
+
+ KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0,
+ ("vfs_write_suspend_umnt: recursed"));
+
+ /* dounmount() already called vn_start_write(). */
+ for (;;) {
+ vn_finished_write(mp);
+ error = vfs_write_suspend(mp, 0);
+ if (error != 0)
+ return (error);
+ MNT_ILOCK(mp);
+ if ((mp->mnt_kern_flag & MNTK_SUSPENDED) != 0)
+ break;
+ MNT_IUNLOCK(mp);
+ vn_start_write(NULL, &mp, V_WAIT);
+ }
+ mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | MNTK_SUSPEND2);
+ wakeup(&mp->mnt_flag);
+ MNT_IUNLOCK(mp);
+ curthread->td_pflags |= TDP_IGNSUSP;
+ return (0);
+}
+
+/*
* Implement kqueues for files by translating it to vnode operation.
*/
static int