Module Name:    src
Committed By:   msaitoh
Date:           Sun Nov  9 07:53:39 UTC 2014

Modified Files:
        src/lib/libperfuse [netbsd-6]: ops.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1185):
        lib/libperfuse/ops.c: revision 1.79
Avoid deadlocks on write errors
On write errors, we failed to dequeue some operations, leading to
rare but unpleasant deadlocks


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.16 -r1.50.2.17 src/lib/libperfuse/ops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.50.2.16 src/lib/libperfuse/ops.c:1.50.2.17
--- src/lib/libperfuse/ops.c:1.50.2.16	Sun Nov  9 07:02:57 2014
+++ src/lib/libperfuse/ops.c	Sun Nov  9 07:53:39 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.50.2.16 2014/11/09 07:02:57 msaitoh Exp $ */
+/*  $NetBSD: ops.c,v 1.50.2.17 2014/11/09 07:53:39 msaitoh Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3289,6 +3289,7 @@ perfuse_node_write2(struct puffs_usermou
 	if (*resid != 0)
 		error = EFBIG;
 
+out:
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_RESIZE) {
 		if (offset > (off_t)vap->va_size)
@@ -3305,16 +3306,6 @@ perfuse_node_write2(struct puffs_usermou
 	if (offset > (off_t)vap->va_size) 
 		vap->va_size = offset;
 
-	if (inresize) {
-#ifdef PERFUSE_DEBUG
-		if (!(pnd->pnd_flags & PND_INRESIZE))
-			DERRX(EX_SOFTWARE, "file write grow without resize");
-#endif
-		pnd->pnd_flags &= ~PND_INRESIZE;
-		(void)dequeue_requests(opc, PCQ_RESIZE, DEQUEUE_ALL);
-	}
-
-
 	/*
 	 * Statistics
 	 */
@@ -3334,7 +3325,15 @@ perfuse_node_write2(struct puffs_usermou
 			__func__, (void*)opc, perfuse_node_path(ps, opc));
 #endif
 
-out:
+	if (inresize) {
+#ifdef PERFUSE_DEBUG
+		if (!(pnd->pnd_flags & PND_INRESIZE))
+			DERRX(EX_SOFTWARE, "file write grow without resize");
+#endif
+		pnd->pnd_flags &= ~PND_INRESIZE;
+		(void)dequeue_requests(opc, PCQ_RESIZE, DEQUEUE_ALL);
+	}
+
 	/*
 	 * VOP_PUTPAGE causes FAF write where kernel does not 
 	 * check operation result. At least warn if it failed.

Reply via email to