From: Manali Kulkarni Date: Tue, 27 Sep 2016 14:22:23 +0000 (-0400) Subject: os/filestore: fix coll_t handling for CLONERANGE[2] X-Git-Tag: v11.1.0~652^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50ae9a3cf667792214fc4d99353fc7c7b6c94e8a;p=ceph.git os/filestore: fix coll_t handling for CLONERANGE[2] Signed-off-by: Manali Kulkarni --- diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index ff9283148619..b09efc91a276 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -2669,13 +2669,14 @@ void FileStore::_do_transaction( { coll_t cid = i.get_cid(op->cid); ghobject_t oid = i.get_oid(op->oid); - _kludge_temp_object_collection(cid, oid); + coll_t ncid = cid; ghobject_t noid = i.get_oid(op->dest_oid); - _kludge_temp_object_collection(cid, noid); + _kludge_temp_object_collection(cid, oid); + _kludge_temp_object_collection(ncid, noid); uint64_t off = op->off; uint64_t len = op->len; tracepoint(objectstore, clone_range_enter, osr_name, len); - r = _clone_range(cid, oid, noid, off, len, off, spos); + r = _clone_range(cid, oid, ncid, noid, off, len, off, spos); tracepoint(objectstore, clone_range_exit, r); } break; @@ -2684,14 +2685,15 @@ void FileStore::_do_transaction( { coll_t cid = i.get_cid(op->cid); ghobject_t oid = i.get_oid(op->oid); - _kludge_temp_object_collection(cid, oid); + coll_t ncid = cid; ghobject_t noid = i.get_oid(op->dest_oid); - _kludge_temp_object_collection(cid, noid); + _kludge_temp_object_collection(cid, oid); + _kludge_temp_object_collection(ncid, noid); uint64_t srcoff = op->off; uint64_t len = op->len; uint64_t dstoff = op->dest_off; tracepoint(objectstore, clone_range2_enter, osr_name, len); - r = _clone_range(cid, oid, noid, srcoff, len, dstoff, spos); + r = _clone_range(cid, oid, ncid, noid, srcoff, len, dstoff, spos); tracepoint(objectstore, clone_range2_exit, r); } break; @@ -3709,22 +3711,22 @@ int FileStore::_do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, u return r; } -int FileStore::_clone_range(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid, +int FileStore::_clone_range(const coll_t& oldcid, const ghobject_t& oldoid, const coll_t& newcid, const ghobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff, const SequencerPosition& spos) { - dout(15) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << dendl; + dout(15) << "clone_range " << oldcid << "/" << oldoid << " -> " << newcid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << dendl; - if (_check_replay_guard(cid, newoid, spos) < 0) + if (_check_replay_guard(newcid, newoid, spos) < 0) return 0; int r; FDRef o, n; - r = lfn_open(cid, oldoid, false, &o); + r = lfn_open(oldcid, oldoid, false, &o); if (r < 0) { goto out2; } - r = lfn_open(cid, newoid, true, &n); + r = lfn_open(newcid, newoid, true, &n); if (r < 0) { goto out; } @@ -3741,7 +3743,7 @@ int FileStore::_clone_range(const coll_t& cid, const ghobject_t& oldoid, const g out: lfn_close(o); out2: - dout(10) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " " + dout(10) << "clone_range " << oldcid << "/" << oldoid << " -> " << newcid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << " = " << r << dendl; return r; } diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index dca849f28013..60718115957f 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -557,7 +557,7 @@ public: int _truncate(const coll_t& cid, const ghobject_t& oid, uint64_t size); int _clone(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid, const SequencerPosition& spos); - int _clone_range(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid, + int _clone_range(const coll_t& oldcid, const ghobject_t& oldoid, const coll_t& newcid, const ghobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff, const SequencerPosition& spos); int _do_clone_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff);