Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osd: DBObjectMap: lock header_lock on sync() #3948

Merged
1 commit merged into from Mar 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/os/DBObjectMap.cc
Expand Up @@ -1042,6 +1042,8 @@ int DBObjectMap::upgrade()
db->submit_transaction(t);
}
state.v = 1;

Mutex::Locker l(header_lock);
KeyValueDB::Transaction t = db->get_transaction();
write_state(t);
db->submit_transaction_sync(t);
Expand Down Expand Up @@ -1083,7 +1085,6 @@ int DBObjectMap::init(bool do_upgrade)
int DBObjectMap::sync(const ghobject_t *oid,
const SequencerPosition *spos) {
KeyValueDB::Transaction t = db->get_transaction();
write_state(t);
if (oid) {
assert(spos);
Header header = lookup_map_header(*oid);
Expand All @@ -1093,11 +1094,18 @@ int DBObjectMap::sync(const ghobject_t *oid,
header->spos = *spos;
set_map_header(*oid, *header, t);
}
Mutex::Locker l(header_lock);
write_state(t);
return db->submit_transaction_sync(t);
} else {
Mutex::Locker l(header_lock);
write_state(t);
return db->submit_transaction_sync(t);
}
return db->submit_transaction_sync(t);
}

int DBObjectMap::write_state(KeyValueDB::Transaction _t) {
assert(header_lock.is_locked_by_me());
dout(20) << "dbobjectmap: seq is " << state.seq << dendl;
KeyValueDB::Transaction t = _t ? _t : db->get_transaction();
bufferlist bl;
Expand Down