]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't access mdsmap from log submit thread 12208/head
authorYan, Zheng <zyan@redhat.com>
Tue, 29 Nov 2016 08:15:48 +0000 (16:15 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 29 Nov 2016 14:44:06 +0000 (22:44 +0800)
the log submit thread does not hold the big mds_lock.

Fixes: http://tracker.ceph.com/issues/18047
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDLog.cc
src/mds/MDLog.h

index 972b9612d92a964d01aee4e37e4aecabe666b4f8..64ebda23ea0f09d40705bae2539ca45fc7d22450 100644 (file)
@@ -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++;
 
@@ -376,6 +377,7 @@ void MDLog::_submit_thread()
       continue;
     }
 
+    int64_t features = mdsmap_up_features;
     PendingEvent data = it->second.front();
     it->second.pop_front();
 
@@ -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();
 
index d2fb7d54c12f5495e5c8433542e5fa99985a2828..0060c3a2364ef553d514d8539da5fe76ce5943b1 100644 (file)
@@ -134,6 +134,7 @@ protected:
     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;
@@ -202,6 +203,7 @@ public:
                       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) { }