Module Name: src
Committed By: snj
Date: Sat Sep 26 18:38:08 UTC 2009
Modified Files:
src/sys/fs/udf [netbsd-5]: udf_vnops.c
Log Message:
Apply patch (requested by reinoud in ticket #959):
UDF's flushing algorithm was susceptible to interference with genfs.
This patch fixes that and also ensures that there aren't tails around
being allocated later.
To generate a diff of this commit:
cvs rdiff -u -r1.30.4.7 -r1.30.4.8 src/sys/fs/udf/udf_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.30.4.7 src/sys/fs/udf/udf_vnops.c:1.30.4.8
--- src/sys/fs/udf/udf_vnops.c:1.30.4.7 Thu Jul 9 19:44:34 2009
+++ src/sys/fs/udf/udf_vnops.c Sat Sep 26 18:38:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.30.4.7 2009/07/09 19:44:34 snj Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.30.4.8 2009/09/26 18:38:07 snj 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.30.4.7 2009/07/09 19:44:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.30.4.8 2009/09/26 18:38:07 snj Exp $");
#endif /* not lint */
@@ -369,16 +369,14 @@
* flush what we just wrote if necessary.
* XXXUBC simplistic async flushing.
*
- * this one works on page sizes. Directories are excluded
- * since its file data that we want to purge.
+ * Directories are excluded since its file data that we want
+ * to purge.
*/
if (!async && (vp->v_type != VDIR) &&
- (uio->uio_offset - old_offset >= PAGE_SIZE)) {
+ (old_offset >> 16 != uio->uio_offset >> 16)) {
mutex_enter(&vp->v_interlock);
- error = VOP_PUTPAGES(vp,
- ptoa(atop(old_offset)),
- ptoa(atop(uio->uio_offset + PAGE_SIZE-1)),
- PGO_CLEANIT);
+ error = VOP_PUTPAGES(vp, (old_offset >> 16) << 16,
+ (uio->uio_offset >> 16) << 16, PGO_CLEANIT);
old_offset = uio->uio_offset;
}
}
@@ -1344,10 +1342,19 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct udf_node *udf_node = VTOI(vp);
+ int async = vp->v_mount->mnt_flag & MNT_ASYNC;
+ int error;
DPRINTF(CALL, ("udf_close called\n"));
udf_node = udf_node; /* shut up gcc */
+ if (!async && (vp->v_type != VDIR)) {
+ mutex_enter(&vp->v_interlock);
+ error = VOP_PUTPAGES(vp, 0, 0, PGO_CLEANIT);
+ if (error)
+ return error;
+ }
+
mutex_enter(&vp->v_interlock);
if (vp->v_usecount > 1)
udf_itimes(udf_node, NULL, NULL, NULL);