Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Change vflushbuf() to return an error if a synchronous write...
details: https://anonhg.NetBSD.org/src/rev/17e1e6a221b2
branches: trunk
changeset: 764528:17e1e6a221b2
user: hannken <hannken%NetBSD.org@localhost>
date: Tue Apr 26 11:32:38 2011 +0000
description:
Change vflushbuf() to return an error if a synchronous write fails.
Welcome to 5.99.51.
diffstat:
share/man/man9/vnode.9 | 6 +++---
sys/fs/msdosfs/msdosfs_vnops.c | 10 ++++------
sys/fs/ntfs/ntfs_vnops.c | 8 +++-----
sys/fs/sysvbfs/sysvbfs_vnops.c | 11 ++++-------
sys/fs/udf/udf_subr.c | 18 ++++++++++--------
sys/fs/udf/udf_vnops.c | 8 +++++---
sys/kern/vfs_subr.c | 19 ++++++++++++-------
sys/miscfs/specfs/spec_vnops.c | 6 +++---
sys/sys/param.h | 4 ++--
sys/sys/vnode.h | 4 ++--
sys/ufs/ext2fs/ext2fs_vnops.c | 12 +++++-------
11 files changed, 53 insertions(+), 53 deletions(-)
diffs (truncated from 360 to 300 lines):
diff -r f9c43c448acc -r 17e1e6a221b2 share/man/man9/vnode.9
--- a/share/man/man9/vnode.9 Tue Apr 26 08:22:17 2011 +0000
+++ b/share/man/man9/vnode.9 Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.51 2010/12/02 12:54:13 wiz Exp $
+.\" $NetBSD: vnode.9,v 1.52 2011/04/26 11:32:38 hannken Exp $
.\"
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 21, 2010
+.Dd April 26, 2011
.Dt VNODE 9
.Os
.Sh NAME
@@ -97,7 +97,7 @@
.Fn vdevgone "int maj" "int minl" "int minh" "enum vtype type"
.Ft void
.Fn vwakeup "struct buf *bp"
-.Ft void
+.Ft int
.Fn vflushbuf "struct vnode *vp" "int sync"
.Ft int
.Fn vinvalbuf "struct vnode *vp" "int flags" "kauth_cred_t cred" "struct lwp *l" "int slpflag" "int slptimeo"
diff -r f9c43c448acc -r 17e1e6a221b2 sys/fs/msdosfs/msdosfs_vnops.c
--- a/sys/fs/msdosfs/msdosfs_vnops.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/fs/msdosfs/msdosfs_vnops.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_vnops.c,v 1.74 2011/03/20 12:21:28 hannken Exp $ */
+/* $NetBSD: msdosfs_vnops.c,v 1.75 2011/04/26 11:32:38 hannken Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.74 2011/03/20 12:21:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.75 2011/04/26 11:32:38 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1800,10 +1800,8 @@
fstrans_start(vp->v_mount, FSTRANS_LAZY);
wait = (ap->a_flags & FSYNC_WAIT) != 0;
- vflushbuf(vp, wait);
- if ((ap->a_flags & FSYNC_DATAONLY) != 0)
- error = 0;
- else
+ error = vflushbuf(vp, wait);
+ if (error == 0 && (ap->a_flags & FSYNC_DATAONLY) == 0)
error = msdosfs_update(vp, NULL, NULL, wait ? UPDATE_WAIT : 0);
if (error == 0 && ap->a_flags & FSYNC_CACHE) {
diff -r f9c43c448acc -r 17e1e6a221b2 sys/fs/ntfs/ntfs_vnops.c
--- a/sys/fs/ntfs/ntfs_vnops.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/fs/ntfs/ntfs_vnops.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntfs_vnops.c,v 1.47 2010/06/24 13:03:10 hannken Exp $ */
+/* $NetBSD: ntfs_vnops.c,v 1.48 2011/04/26 11:32:38 hannken Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.47 2010/06/24 13:03:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vnops.c,v 1.48 2011/04/26 11:32:38 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -756,9 +756,7 @@
}
wait = (ap->a_flags & FSYNC_WAIT) != 0;
- vflushbuf(vp, wait);
-
- return 0;
+ return vflushbuf(vp, wait);
}
/*
diff -r f9c43c448acc -r 17e1e6a221b2 sys/fs/sysvbfs/sysvbfs_vnops.c
--- a/sys/fs/sysvbfs/sysvbfs_vnops.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/fs/sysvbfs/sysvbfs_vnops.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysvbfs_vnops.c,v 1.36 2011/01/31 18:48:50 njoly Exp $ */
+/* $NetBSD: sysvbfs_vnops.c,v 1.37 2011/04/26 11:32:38 hannken Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.36 2011/01/31 18:48:50 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.37 2011/04/26 11:32:38 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -810,11 +810,8 @@
}
wait = (ap->a_flags & FSYNC_WAIT) != 0;
- vflushbuf(vp, wait);
-
- if ((ap->a_flags & FSYNC_DATAONLY) != 0)
- error = 0;
- else
+ error = vflushbuf(vp, wait);
+ if (error == 0 && (ap->a_flags & FSYNC_DATAONLY) == 0)
error = sysvbfs_update(vp, NULL, NULL, wait ? UPDATE_WAIT : 0);
return error;
diff -r f9c43c448acc -r 17e1e6a221b2 sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/fs/udf/udf_subr.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.113 2011/01/22 18:02:18 reinoud Exp $ */
+/* $NetBSD: udf_subr.c,v 1.114 2011/04/26 11:32:39 hannken Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.113 2011/01/22 18:02:18 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.114 2011/04/26 11:32:39 hannken Exp $");
#endif /* not lint */
@@ -1829,10 +1829,10 @@
NULL, NULL);
bitmap_node->i_flags |= IN_MODIFIED;
- vflushbuf(bitmap_node->vnode, 1 /* sync */);
-
- error = VOP_FSYNC(bitmap_node->vnode,
- FSCRED, FSYNC_WAIT, 0, 0);
+ error = vflushbuf(bitmap_node->vnode, 1 /* sync */);
+ if (error == 0)
+ error = VOP_FSYNC(bitmap_node->vnode,
+ FSCRED, FSYNC_WAIT, 0, 0);
if (error)
printf( "Error writing out metadata partition unalloced "
@@ -2833,7 +2833,9 @@
// mutex_exit(&ump->allocate_mutex);
- vflushbuf(ump->vat_node->vnode, 1 /* sync */);
+ error = vflushbuf(ump->vat_node->vnode, 1 /* sync */);
+ if (error)
+ goto out;
error = VOP_FSYNC(ump->vat_node->vnode,
FSCRED, FSYNC_WAIT, 0, 0);
if (error)
@@ -3778,7 +3780,7 @@
/* write out the VAT data and all its descriptors */
DPRINTF(VOLUMES, ("writeout vat_node\n"));
udf_writeout_vat(ump);
- vflushbuf(ump->vat_node->vnode, 1 /* sync */);
+ (void) vflushbuf(ump->vat_node->vnode, 1 /* sync */);
(void) VOP_FSYNC(ump->vat_node->vnode,
FSCRED, FSYNC_WAIT, 0, 0);
diff -r f9c43c448acc -r 17e1e6a221b2 sys/fs/udf/udf_vnops.c
--- a/sys/fs/udf/udf_vnops.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/fs/udf/udf_vnops.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.63 2011/04/24 21:35:30 rmind Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.64 2011/04/26 11:32:39 hannken Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.63 2011/04/24 21:35:30 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.64 2011/04/26 11:32:39 hannken Exp $");
#endif /* not lint */
@@ -2214,7 +2214,9 @@
/* flush data and wait for it when requested */
wait = (ap->a_flags & FSYNC_WAIT) ? UPDATE_WAIT : 0;
- vflushbuf(vp, wait);
+ error = vflushbuf(vp, wait);
+ if (error)
+ return error;
if (udf_node == NULL) {
printf("udf_fsync() called on NULL udf_node!\n");
diff -r f9c43c448acc -r 17e1e6a221b2 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/kern/vfs_subr.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.421 2011/04/02 04:28:56 rmind Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.422 2011/04/26 11:32:39 hannken Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.421 2011/04/02 04:28:56 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.422 2011/04/26 11:32:39 hannken Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@@ -272,11 +272,11 @@
* Called with the underlying vnode locked, which should prevent new dirty
* buffers from being queued.
*/
-void
+int
vflushbuf(struct vnode *vp, int sync)
{
struct buf *bp, *nbp;
- int flags = PGO_CLEANIT | PGO_ALLPAGES | (sync ? PGO_SYNCIO : 0);
+ int error, flags = PGO_CLEANIT | PGO_ALLPAGES | (sync ? PGO_SYNCIO : 0);
bool dirty;
mutex_enter(&vp->v_interlock);
@@ -298,14 +298,17 @@
*/
if (bp->b_vp == vp || sync == 0)
(void) bawrite(bp);
- else
- (void) bwrite(bp);
+ else {
+ error = bwrite(bp);
+ if (error)
+ return error;
+ }
goto loop;
}
mutex_exit(&bufcache_lock);
if (sync == 0)
- return;
+ return 0;
mutex_enter(&vp->v_interlock);
while (vp->v_numoutput != 0)
@@ -317,6 +320,8 @@
vprint("vflushbuf: dirty", vp);
goto loop;
}
+
+ return 0;
}
/*
diff -r f9c43c448acc -r 17e1e6a221b2 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.131 2010/08/21 13:19:40 pgoyette Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.132 2011/04/26 11:32:39 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.131 2010/08/21 13:19:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.132 2011/04/26 11:32:39 hannken Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -869,7 +869,7 @@
if (error != EOPNOTSUPP)
return error;
}
- vflushbuf(vp, (ap->a_flags & FSYNC_WAIT) != 0);
+ return vflushbuf(vp, (ap->a_flags & FSYNC_WAIT) != 0);
}
return (0);
}
diff -r f9c43c448acc -r 17e1e6a221b2 sys/sys/param.h
--- a/sys/sys/param.h Tue Apr 26 08:22:17 2011 +0000
+++ b/sys/sys/param.h Tue Apr 26 11:32:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.387 2011/04/24 21:50:34 rmind Exp $ */
+/* $NetBSD: param.h,v 1.388 2011/04/26 11:32:39 hannken Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
Home |
Main Index |
Thread Index |
Old Index