Module Name: src
Committed By: msaitoh
Date: Tue Nov 4 01:52:53 UTC 2014
Modified Files:
src/lib/libperfuse [netbsd-6]: ops.c
Log Message:
Pull up following revision(s) (requested by manu in ticket #1151):
lib/libperfuse/ops.c: revision 1.74
Avoid a file resize serialization deadlock when writing with
PUFFS_IO_APPEND flag. The symptom was a hang when appending to
a file with a null size.
To generate a diff of this commit:
cvs rdiff -u -r1.50.2.12 -r1.50.2.13 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.12 src/lib/libperfuse/ops.c:1.50.2.13
--- src/lib/libperfuse/ops.c:1.50.2.12 Tue Nov 4 01:50:42 2014
+++ src/lib/libperfuse/ops.c Tue Nov 4 01:52:53 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.50.2.12 2014/11/04 01:50:42 msaitoh Exp $ */
+/* $NetBSD: ops.c,v 1.50.2.13 2014/11/04 01:52:53 msaitoh Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3188,16 +3188,6 @@ perfuse_node_write2(struct puffs_usermou
requeue_request(pu, opc, PCQ_WRITE);
pnd->pnd_flags |= PND_INWRITE;
- /*
- * Serialize size access, see comment in perfuse_node_setattr().
- */
- if ((u_quad_t)offset + *resid > vap->va_size) {
- while (pnd->pnd_flags & PND_INRESIZE)
- requeue_request(pu, opc, PCQ_RESIZE);
- pnd->pnd_flags |= PND_INRESIZE;
- inresize = 1;
- }
-
/*
* append flag: re-read the file size so that
* we get the latest value.
@@ -3209,6 +3199,16 @@ perfuse_node_write2(struct puffs_usermou
offset = vap->va_size;
}
+ /*
+ * Serialize size access, see comment in perfuse_node_setattr().
+ */
+ if ((u_quad_t)offset + *resid > vap->va_size) {
+ while (pnd->pnd_flags & PND_INRESIZE)
+ requeue_request(pu, opc, PCQ_RESIZE);
+ pnd->pnd_flags |= PND_INRESIZE;
+ inresize = 1;
+ }
+
#ifdef PERFUSE_DEBUG
if (perfuse_diagflags & PDF_RESIZE)
DPRINTF(">> %s %p %" PRIu64 "\n", __func__,