nfs_client_open() implicitly converts the uint64_t value of qemu_opt_get_number() to int64_t, then clamps it to range. The clamping is broken for negative values.
Fix by making NFSClient members @readahead and @pagecache uint64_t. Signed-off-by: Markus Armbruster <arm...@redhat.com> --- block/nfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index d8db419..2776788 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -58,7 +58,8 @@ typedef struct NFSClient { bool cache_used; NFSServer *server; char *path; - int64_t uid, gid, tcp_syncnt, readahead, pagecache, debug; + int64_t uid, gid, tcp_syncnt, debug; + uint64_t readahead, pagecache; } NFSClient; typedef struct NFSRPC { @@ -856,10 +857,10 @@ static void nfs_refresh_filename(BlockDriverState *bs, QDict *options) qdict_put_int(opts, "tcp-syn-cnt", client->tcp_syncnt); } if (client->readahead) { - qdict_put_int(opts, "readahead-size", client->readahead); + qdict_put_uint(opts, "readahead-size", client->readahead); } if (client->pagecache) { - qdict_put_int(opts, "page-cache-size", client->pagecache); + qdict_put_uint(opts, "page-cache-size", client->pagecache); } if (client->debug) { qdict_put_int(opts, "debug", client->debug); -- 2.7.5