Source-Changes-HG archive

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

[src/trunk]: src/lib/librefuse FUSE seems to allow short writes without error...



details:   https://anonhg.NetBSD.org/src/rev/88a52f94a600
branches:  trunk
changeset: 783578:88a52f94a600
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Dec 30 10:04:22 2012 +0000

description:
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.

diffstat:

 lib/librefuse/refuse.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 2405398de366 -r 88a52f94a600 lib/librefuse/refuse.c
--- a/lib/librefuse/refuse.c    Sun Dec 30 09:45:05 2012 +0000
+++ b/lib/librefuse/refuse.c    Sun Dec 30 10:04:22 2012 +0000
@@ -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 @@
        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;
 }
 
 



Home | Main Index | Thread Index | Old Index