diff --git a/sys/dev/fss.c b/sys/dev/fss.c index 151e93021f51..56f8389c7cd2 100644 --- a/sys/dev/fss.c +++ b/sys/dev/fss.c @@ -1,4 +1,4 @@ -/* $NetBSD: fss.c,v 1.95 2016/07/31 12:17:36 hannken Exp $ */ +/* $NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.95 2016/07/31 12:17:36 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $"); #include #include @@ -851,7 +851,9 @@ fss_create_snapshot(struct fss_softc *sc, struct fss_set *fss, struct lwp *l) microtime(&sc->sc_time); - error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc); + error = VFS_SYNC(sc->sc_mount, MNT_WAIT, curlwp->l_cred); + if (error == 0) + error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc); if (error == 0) sc->sc_flags |= FSS_ACTIVE; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 3519267c5b48..d9b27ecf74ab 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $ */ +/* $NetBSD: msdosfs_vfsops.c,v 1.121 2017/02/17 08:29:11 hannken Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.121 2017/02/17 08:29:11 hannken Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -1120,10 +1120,7 @@ msdosfs_suspendctl(struct mount *mp, int cmd) case SUSPEND_SUSPEND: if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0) return error; - error = msdosfs_sync(mp, MNT_WAIT, l->l_proc->p_cred); - if (error == 0) - error = fstrans_setstate(mp, FSTRANS_SUSPENDED); - if (error != 0) { + if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDED)) != 0) { (void) fstrans_setstate(mp, FSTRANS_NORMAL); return error; } diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index f4efc712f245..1bc2e0eae3dc 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.143 2016/10/28 20:38:12 jdolecek Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.143 2016/10/28 20:38:12 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -254,10 +254,13 @@ ffs_snapshot(struct mount *mp, struct vnode *vp, struct timespec *ctime) * All allocations are done, so we can now suspend the filesystem. */ error = vfs_suspend(vp->v_mount, 0); + if (error == 0) { + suspended = true; + error = VFS_SYNC(vp->v_mount, MNT_WAIT, curlwp->l_cred); + } vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (error) goto out; - suspended = true; getmicrotime(&starttime); /* * First, copy all the cylinder group maps that have changed. diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 2258d72fb5c6..e6ba28f65a3a 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.344 2017/02/17 08:29:11 hannken Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.344 2017/02/17 08:29:11 hannken Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -2408,14 +2408,7 @@ ffs_suspendctl(struct mount *mp, int cmd) case SUSPEND_SUSPEND: if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0) return error; - error = ffs_sync(mp, MNT_WAIT, l->l_proc->p_cred); - if (error == 0) - error = fstrans_setstate(mp, FSTRANS_SUSPENDED); -#ifdef WAPBL - if (error == 0 && mp->mnt_wapbl) - error = wapbl_flush(mp->mnt_wapbl, 1); -#endif - if (error != 0) { + if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDED)) != 0) { (void) fstrans_setstate(mp, FSTRANS_NORMAL); return error; }