Package: fusedav Version: 0.2-3 Severity: normal Tags: upstream patch [PATCH] filecache: file_cache_sync_unlocked properly syncs entire file
When file_cache_sync_unlocked() calls load_up_to_unlocked(fi, -1) the (l <= fi->present) check will incorrectly short-circuit us out of loading the entire file. So instead, we will will use fi->length instead. If we want to pass -1 to range.end for neon, we need to be careful and not set range.end to any other negative value because current versions of neon require (range.end == -1 (not: range.end < 0)) to indicate we want to read until the end-of-file.
>From 80275948b43eca7b30c3f715886ffd907da42b84 Mon Sep 17 00:00:00 2001 From: Eric Wong <normalper...@yhbt.net> Date: Wed, 24 Oct 2012 22:39:10 +0000 Subject: [PATCH 08/13] filecache: file_cache_sync_unlocked properly syncs entire file When file_cache_sync_unlocked() calls load_up_to_unlocked(fi, -1) the (l <= fi->present) check will incorrectly short-circuit us out of loading the entire file. So instead, we will will use fi->length instead. If we want to pass -1 to range.end for neon, we need to be careful and not set range.end to any other negative value because current versions of neon require (range.end == -1 (not: range.end < 0)) to indicate we want to read until the end-of-file. --- src/filecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filecache.c b/src/filecache.c index aed4b62..59e1a9c 100644 --- a/src/filecache.c +++ b/src/filecache.c @@ -359,7 +359,7 @@ int file_cache_sync_unlocked(struct file_info *fi) { goto finish; } - if (load_up_to_unlocked(fi, (off_t) -1) < 0) + if (load_up_to_unlocked(fi, fi->length) < 0) goto finish; if (lseek(fi->fd, 0, SEEK_SET) == (off_t)-1) -- 1.8.0.3.gdd57fab.dirty