Skip to content

Commit

Permalink
Merge pull request #12208 from ukernel/wip-18047
Browse files Browse the repository at this point in the history
mds: don't access mdsmap from log submit thread

Reviewed-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Dec 7, 2016
2 parents d6b991a + 96e3d59 commit aa0a0e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mds/MDLog.cc
Expand Up @@ -297,6 +297,7 @@ void MDLog::_submit_entry(LogEvent *le, MDSLogContextBase *c)
le->update_segment();
le->set_stamp(ceph_clock_now(g_ceph_context));

mdsmap_up_features = mds->mdsmap->get_up_features();
pending_events[ls->seq].push_back(PendingEvent(le, c));
num_events++;

Expand Down Expand Up @@ -376,6 +377,7 @@ void MDLog::_submit_thread()
continue;
}

int64_t features = mdsmap_up_features;
PendingEvent data = it->second.front();
it->second.pop_front();

Expand All @@ -386,7 +388,7 @@ void MDLog::_submit_thread()
LogSegment *ls = le->_segment;
// encode it, with event type
bufferlist bl;
le->encode_with_header(bl, mds->mdsmap->get_up_features());
le->encode_with_header(bl, features);

uint64_t write_pos = journaler->get_write_pos();

Expand Down
2 changes: 2 additions & 0 deletions src/mds/MDLog.h
Expand Up @@ -134,6 +134,7 @@ class MDLog {
PendingEvent(LogEvent *e, MDSContext *c, bool f=false) : le(e), fin(c), flush(f) {}
};

int64_t mdsmap_up_features;
map<uint64_t,list<PendingEvent> > pending_events; // log segment -> event list
Mutex submit_mutex;
Cond submit_cond;
Expand Down Expand Up @@ -202,6 +203,7 @@ class MDLog {
already_replayed(false),
recovery_thread(this),
event_seq(0), expiring_events(0), expired_events(0),
mdsmap_up_features(0),
submit_mutex("MDLog::submit_mutex"),
submit_thread(this),
cur_event(NULL) { }
Expand Down

0 comments on commit aa0a0e2

Please sign in to comment.