FreeBSD/sys/kern/vfs_vnops.c
/*
 * Helper loop around vfs_write_suspend() for filesystem unmount VFS
 * methods.
 */
Helper loop around vfs_write_suspend() for filesystem unmount VFS
methods.
Helper loop around vfs_write_suspend () for filesystem unmount VFS methods .
int
vfs_write_suspend_umnt(struct mount *mp)
{
	int error;
	MPASS(vn_suspendable(mp));
	KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0,
	    ("vfs_write_suspend_umnt: recursed"));
	for (;;) {
		vn_finished_write(mp);
		error = vfs_write_suspend(mp, 0);
		if (error != 0) {
			vn_start_write(NULL, &mp, V_WAIT);
			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);
}
int vfs_write_suspend_umnt ( struct mount * mp ) { int error ; MPASS ( vn_suspendable ( mp ) ) ; KASSERT ( ( curthread -> td_pflags & TDP_IGNSUSP ) == 0 , ( " " ) ) ; for ( ; ; ) { vn_finished_write ( mp ) ; error = vfs_write_suspend ( mp , 0 ) ; if ( error != 0 ) { vn_start_write ( NULL , & mp , V_WAIT ) ; 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 ) ; }
Helper loop around vfs_write_suspend() for filesystem unmount VFS
 methods.
Helper loop around vfs_write_suspend () for filesystem unmount VFS methods .
/* dounmount() already called vn_start_write(). */