Untangle VFS_SYNC() from VFS_SUSPENDCTL().

This commit is contained in:
hannken 2017-02-17 08:29:11 +00:00
parent 4f18a321ca
commit 64a4d4bd11
4 changed files with 17 additions and 22 deletions

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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;

View File

@ -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 <sys/cdefs.h>
__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;
}

View File

@ -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 <sys/cdefs.h>
__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.

View File

@ -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 <sys/cdefs.h>
__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;
}