Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libperfuse Avoid deadlocks on write errors



details:   https://anonhg.NetBSD.org/src/rev/b51404a106ab
branches:  trunk
changeset: 333384:b51404a106ab
user:      manu <manu%NetBSD.org@localhost>
date:      Fri Oct 31 15:20:08 2014 +0000

description:
Avoid deadlocks on write errors

On write errors, we failed to dequeue some operations, leading to
rare but unpleasant deadlocks

diffstat:

 lib/libperfuse/ops.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (51 lines):

diff -r dca5e8ff20be -r b51404a106ab lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c      Fri Oct 31 15:12:15 2014 +0000
+++ b/lib/libperfuse/ops.c      Fri Oct 31 15:20:08 2014 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.78 2014/10/31 15:12:15 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.79 2014/10/31 15:20:08 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3299,6 +3299,7 @@
        if (*resid != 0)
                error = EFBIG;
 
+out:
 #ifdef PERFUSE_DEBUG
        if (perfuse_diagflags & PDF_RESIZE) {
                if (offset > (off_t)vap->va_size)
@@ -3315,16 +3316,6 @@
        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
         */
@@ -3344,7 +3335,15 @@
                        __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.



Home | Main Index | Thread Index | Old Index