Module Name: src
Committed By: tron
Date: Sun Dec 30 10:04:22 UTC 2012
Modified Files:
src/lib/librefuse: refuse.c
Log Message:
FUSE seems to allow short writes without errors but PUFFS doesn't. Work
around this by returning ENOSPC in case of a short write to avoid protocol
errors. This change is based on problem analysis provided by Antti Kantee.
This fixes PR lib/45129 by myself.
To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/lib/librefuse/refuse.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/librefuse/refuse.c
diff -u src/lib/librefuse/refuse.c:1.95 src/lib/librefuse/refuse.c:1.96
--- src/lib/librefuse/refuse.c:1.95 Thu Nov 24 01:56:22 2011
+++ src/lib/librefuse/refuse.c Sun Dec 30 10:04:22 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: refuse.c,v 1.95 2011/11/24 01:56:22 manu Exp $ */
+/* $NetBSD: refuse.c,v 1.96 2012/12/30 10:04:22 tron Exp $ */
/*
* Copyright � 2007 Alistair Crooks. All rights reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: refuse.c,v 1.95 2011/11/24 01:56:22 manu Exp $");
+__RCSID("$NetBSD: refuse.c,v 1.96 2012/12/30 10:04:22 tron Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -1083,14 +1083,16 @@ puffs_fuse_node_write(struct puffs_userm
ret = (*fuse->op.write)(path, (char *)buf, *resid, offset,
&rn->file_info);
- if (ret > 0) {
+ if (ret >= 0) {
if ((uint64_t)(offset + ret) > pn->pn_va.va_size)
pn->pn_va.va_size = offset + ret;
*resid -= ret;
- ret = 0;
+ ret = (*resid == 0) ? 0 : ENOSPC;
+ } else {
+ ret = -ret;
}
- return -ret;
+ return ret;
}