mds: Fix SessionMap::is_any_state()
PATCH v2 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.
--- src/mds/SessionMap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/mds/SessionMap.h +1 -1
@@ -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
PATCH v2 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.
---
Changelog v1 -> v2:
- call mdlog->start_new_segment() after adjusting mydir's auth.
--- src/mds/MDCache.cc | 7 +++++++ src/mds/MDCache.h | 1 + src/mds/MDS.cc | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-)
src/mds/MDCache.cc +7 -0
@@ -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
@@ -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 +3 -2
@@ -1229,10 +1229,11 @@ void MDS::starting_done() assert(is_starting()); request_state(MDSMap::STATE_ACTIVE); + mdcache->adjust_mydir_auth(); + mdcache->open_root(); + // start new segment mdlog->start_new_segment(0); - - mdcache->open_root(); }
Signature · 1 line
1.7.11.4
Re: [PATCH V2 2/2] mds: Adjust mydir auth when starting MDS that was stopped cleanly
Quoted 21 lines · Zheng
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.
Signed-off-by Yan, Zheng <[email protected]>---
Changelog v1 -> v2:
- callmdlog->start_new_segment()after adjusting mydir's auth.--- src/mds/MDCache.cc | 7 +++++++ src/mds/MDCache.h | 1 + src/mds/MDS.cc | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-)src/mds/MDCache.cc +0
-0
src/mds/MDCache.cc void MDCache::open_mydir_inode(Context *c) · line 540
Quoted 10 lines
src/mds/MDCache.cc +7
-0@@ -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); +} +
I think it would be simpler to just roll this into open_root(), right after
CDir *mydir = myin->get_or_open_dirfrag(this, frag_t()); assert(mydir);
It makes sense to me to get the auth right when it is populated in teh cache. Also, it looks liek that's what we're doing for the root directory a few lines up.
Thanks!
sage
Quoted 37 lines
src/mds/MDCache.cc +0
-0void MDCache::open_root() { dout(10) << "open_root" << dendl;src/mds/MDCache.h +1
-0@@ -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 +3
-2@@ -1229,10 +1229,11 @@ void MDS::starting_done() assert(is_starting()); request_state(MDSMap::STATE_ACTIVE); + mdcache->adjust_mydir_auth(); + mdcache->open_root(); + // start new segment mdlog->start_new_segment(0); - - mdcache->open_root(); }Signature · 1 line
1.7.11.4
Sage Weil
AppliedApplied, thanks!
Quoted 26 lines · Zheng
From: "Yan, Zheng" <[email protected]>
is_any_state()should return false when theby_statelist is empty.Signed-off-by Yan, Zheng <[email protected]>--- src/mds/SessionMap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/mds/SessionMap.h +1
-1@@ -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