From 7ed9d87a5b7a5c05f3cb33274700b80016874a4a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 25 Jun 2011 12:23:52 +1000 Subject: [PATCH] redo the previous patch to instead initialize max_offset correctly before we invoke the chunks. this is the correct way to fix this bug. --- lib/libnfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/libnfs.c b/lib/libnfs.c index d1f4f0e..8d27a81 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -889,11 +889,8 @@ static void nfs_pread_mcb(struct rpc_context *rpc _U_, int status, void *command } data->nfsfh->offset = data->max_offset; - if (data->max_offset - data->start_offset >= 0) { - data->cb(data->max_offset - data->start_offset, nfs, data->buffer, data->private_data); - } else { - data->cb(0, nfs, data->buffer, data->private_data); - } + data->cb(data->max_offset - data->start_offset, nfs, data->buffer, data->private_data); + free_nfs_cb_data(data); free(mdata); } @@ -929,6 +926,7 @@ int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, * reads and collect into a reassembly buffer. * we send all reads in parallell so that performance is still good. */ + data->max_offset = offset; data->start_offset = offset; data->buffer = malloc(count); -- 2.34.1