]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
HashIndex: sync top directory during start_split,merge,col_split
authorSamuel Just <sam.just@inktank.com>
Tue, 28 May 2013 18:10:05 +0000 (11:10 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 28 May 2013 19:47:51 +0000 (12:47 -0700)
Otherwise, the links might be ordered after the in progress
operation tag write.  We need the in progress operation tag to
correctly recover from an interrupted merge, split, or col_split.

Fixes: #5180
Backport: cuttlefish, bobtail
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/os/HashIndex.cc

index d5f2d74080c57f87d392d6c07f647c6d070cdb98..216f53ce72b0d1e4eb282e72c9875c0bbade9f32 100644 (file)
@@ -368,21 +368,30 @@ int HashIndex::start_col_split(const vector<string> &path) {
   bufferlist bl;
   InProgressOp op_tag(InProgressOp::COL_SPLIT, path);
   op_tag.encode(bl);
-  return add_attr_path(vector<string>(), IN_PROGRESS_OP_TAG, bl); 
+  int r = add_attr_path(vector<string>(), IN_PROGRESS_OP_TAG, bl);
+  if (r < 0)
+    return r;
+  return fsync_dir(vector<string>());
 }
 
 int HashIndex::start_split(const vector<string> &path) {
   bufferlist bl;
   InProgressOp op_tag(InProgressOp::SPLIT, path);
   op_tag.encode(bl);
-  return add_attr_path(vector<string>(), IN_PROGRESS_OP_TAG, bl); 
+  int r = add_attr_path(vector<string>(), IN_PROGRESS_OP_TAG, bl);
+  if (r < 0)
+    return r;
+  return fsync_dir(vector<string>());
 }
 
 int HashIndex::start_merge(const vector<string> &path) {
   bufferlist bl;
   InProgressOp op_tag(InProgressOp::MERGE, path);
   op_tag.encode(bl);
-  return add_attr_path(vector<string>(), IN_PROGRESS_OP_TAG, bl); 
+  int r = add_attr_path(vector<string>(), IN_PROGRESS_OP_TAG, bl);
+  if (r < 0)
+    return r;
+  return fsync_dir(vector<string>());
 }
 
 int HashIndex::end_split_or_merge(const vector<string> &path) {