Skip to contentSkip to conversation

mds: Fix SessionMap::is_any_state()

PATCH Superseded Yan, Zheng 1 participant 2 messages Sep 24, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/2 mds: Fix SessionMap::is_any_state()

From: "Yan, Zheng" <[email protected]>

is_any_state() should return false when the by_state list is empty.

---
 ceph-object-corpus   | 2 +-
 src/mds/SessionMap.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ceph-object-corpus +1 -1
index 7f23ee1..4d64c37 160000
@@ -1 +1 @@
-Subproject commit 7f23ee1127101d311ec0c50adb719367a0789fad
+Subproject commit 4d64c3751101141a34beadf74c3e9f013bce550c
src/mds/SessionMap.h +1 -1
index fcd0b47..6bca361 100644
@@ -248,7 +248,7 @@ public:
 
   bool is_any_state(int state) {
     map<int,xlist<Session*>* >::iterator p = by_state.find(state);
-    if (p == by_state.end())
+    if (p == by_state.end() || p->second->empty())
       return false;
     return true;
   }
Signature · 1 line
1.7.11.4
author
#1 lore raw

PATCH 2/2 mds: Adjust mydir auth when starting MDS that was stopped cleanly

From: "Yan, Zheng" <[email protected]>

When starting a MDS that was stopped cleanly, we need manually adjust mydir's auth. This is because MDS log is empty in this case, mydir's auth can not be adjusted during log replay.

---
 src/mds/MDCache.cc | 7 +++++++
 src/mds/MDCache.h  | 1 +
 src/mds/MDS.cc     | 1 +
 3 files changed, 9 insertions(+)
src/mds/MDCache.cc +7 -0
index da3affb..1a0e399 100644
@@ -531,6 +531,13 @@ void MDCache::open_mydir_inode(Context *c)
   in->fetch(c);
 }
 
+void MDCache::adjust_mydir_auth()
+{
+  CDir *mydir = myin->get_or_open_dirfrag(this, frag_t());
+  assert(mydir);
+  adjust_subtree_auth(mydir, mds->whoami);
+}
+
 void MDCache::open_root()
 {
   dout(10) << "open_root" << dendl;
src/mds/MDCache.h +1 -0
index 12bdb03..fffb083 100644
@@ -643,6 +643,7 @@ public:
   void open_root_inode(Context *c);
   void open_root();
   void open_mydir_inode(Context *c);
+  void adjust_mydir_auth();
   void populate_mydir();
 
   void _create_system_file(CDir *dir, const char *name, CInode *in, Context *fin);
src/mds/MDS.cc +1 -0
index d0aac30..d369229 100644
@@ -1232,6 +1232,7 @@ void MDS::starting_done()
   // start new segment
   mdlog->start_new_segment(0);
 
+  mdcache->adjust_mydir_auth();
   mdcache->open_root();
 }
 
Signature · 1 line
1.7.11.4