]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/filestore: fix coll_t handling for CLONERANGE[2]
authorManali Kulkarni <Manali.Kulkarni@sandisk.com>
Tue, 27 Sep 2016 14:22:23 +0000 (10:22 -0400)
committerSage Weil <sage@redhat.com>
Tue, 27 Sep 2016 15:56:43 +0000 (11:56 -0400)
Signed-off-by: Manali Kulkarni <Manali.Kulkarni@sandisk.com>
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h

index ff928314861995d4c13eadf87a2c6ec2be8d5c6e..b09efc91a276442e8caf7db93b7e27c0a76407a9 100644 (file)
@@ -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;
 }
index dca849f280131ed265fb7f1648c53d6ff6732cd0..60718115957fe24ab562227c903e05757aadc6b4 100644 (file)
@@ -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);