From 68125dd01349edf93cfa1af5028c2d438b5ae089 Mon Sep 17 00:00:00 2001 From: Yunchuan Wen Date: Thu, 10 Dec 2015 22:13:38 +0800 Subject: [PATCH] librbd: fix merge-diff for >2GB diff-files from http://tracker.ceph.com/issues/14030 Fixes: #14030 Signed-off-by: Yunchuan Wen --- src/tools/rbd/action/MergeDiff.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/rbd/action/MergeDiff.cc b/src/tools/rbd/action/MergeDiff.cc index 9e08a3729f09..eb3f3a3741a5 100644 --- a/src/tools/rbd/action/MergeDiff.cc +++ b/src/tools/rbd/action/MergeDiff.cc @@ -1,6 +1,10 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab +#define _LARGEFILE64_SOURCE +#include +#include + #include "tools/rbd/ArgumentTypes.h" #include "tools/rbd/Shell.h" #include "tools/rbd/Utils.h" @@ -336,7 +340,8 @@ static int do_merge_diff(const char *first, const char *second, bufferptr bp = buffer::create(delta); r = safe_read_exact(fd, bp.c_str(), delta); } else { - r = lseek(fd, delta, SEEK_CUR); + off64_t l = lseek64(fd, delta, SEEK_CUR); + r = l < 0 ? -errno : 0; } if (r < 0) { std::cerr << "rbd: failed to skip first diff data" << std::endl; -- 2.47.3