]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore.cc: Fix error in collection_rename
authorSamuel Just <rexludorum@gmail.com>
Thu, 25 Aug 2011 15:41:40 +0000 (08:41 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Tue, 30 Aug 2011 00:42:51 +0000 (17:42 -0700)
Previously, the rename operated on the collection names.  Now, rename
operations on the full paths to the collections.

Signed-off-by: Samuel Just <rexludorum@gmail.com>
src/os/FileStore.cc

index 6ea03cfbb8f228b52c95791e43280b92ea4e26fb..c5d63a5149b39c38ef4b60a429529c60a9d43823 100644 (file)
@@ -3715,8 +3715,11 @@ int FileStore::_collection_setattrs(coll_t cid, map<string,bufferptr>& aset)
 
 int FileStore::_collection_rename(const coll_t &cid, const coll_t &ncid)
 {
+  char new_coll[PATH_MAX], old_coll[PATH_MAX];
+  get_cdir(cid, old_coll, sizeof(old_coll));
+  get_cdir(ncid, new_coll, sizeof(new_coll));
   int ret = 0;
-  if (::rename(cid.c_str(), ncid.c_str())) {
+  if (::rename(old_coll, new_coll)) {
     ret = errno;
   }
   dout(10) << "collection_rename '" << cid << "' to '" << ncid << "'"