summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-05-28 11:10:05 -0700
committerSamuel Just <sam.just@inktank.com>2013-05-28 12:56:32 -0700
commitfca54bfbb35f0c200fac52963cd2d1780467f59a (patch)
tree57e9f392ecde811e6201af0f39de1cefdedecd31
parentac6c77830ad9182c7345f10943ea4f537c1629b0 (diff)
downloadceph-fca54bfbb35f0c200fac52963cd2d1780467f59a.tar.gz
HashIndex: sync top directory during start_split,merge,col_split
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> (cherry picked from commit 5bca9c38ef5187c7a97916970a7fa73b342755ac)
-rw-r--r--src/os/HashIndex.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/os/HashIndex.cc b/src/os/HashIndex.cc
index 5e880e1e30a..5dd5e4392c0 100644
--- a/src/os/HashIndex.cc
+++ b/src/os/HashIndex.cc
@@ -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) {