@@ -962,15 +962,13 @@ void MDCache::adjust_subtree_auth(CDir *dir, mds_authority_t auth, bool adjust_p
962962 // move items nested beneath me, under me.
963963 set<CDir*>::iterator p = subtrees[root].begin ();
964964 while (p != subtrees[root].end ()) {
965- set<CDir*>::iterator next = p;
966- ++next;
967965 if (get_subtree_root ((*p)->get_parent_dir ()) == dir) {
968966 // move under me
969967 dout (10 ) << " claiming child bound " << **p << dendl;
970968 subtrees[dir].insert (*p);
971- subtrees[root].erase (p);
972- }
973- p = next ;
969+ p = subtrees[root].erase (p);
970+ } else
971+ ++p ;
974972 }
975973
976974 // i am a bound of the parent subtree.
@@ -1115,15 +1113,13 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, const set<CDir*>& bounds, m
11151113 // move items nested beneath me, under me.
11161114 set<CDir*>::iterator p = subtrees[root].begin ();
11171115 while (p != subtrees[root].end ()) {
1118- set<CDir*>::iterator next = p;
1119- ++next;
11201116 if (get_subtree_root ((*p)->get_parent_dir ()) == dir) {
11211117 // move under me
11221118 dout (10 ) << " claiming child bound " << **p << dendl;
11231119 subtrees[dir].insert (*p);
1124- subtrees[root].erase (p);
1125- }
1126- p = next ;
1120+ p = subtrees[root].erase (p);
1121+ } else
1122+ ++p ;
11271123 }
11281124
11291125 // i am a bound of the parent subtree.
@@ -3089,18 +3085,17 @@ void MDCache::handle_mds_failure(mds_rank_t who)
30893085 if (info.notify_ack_waiting .erase (who) &&
30903086 info.notify_ack_waiting .empty ()) {
30913087 fragment_drop_locks (info);
3092- fragment_maybe_finish (p++ );
3088+ p = fragment_maybe_finish (p);
30933089 } else {
30943090 ++p;
30953091 }
30963092 continue ;
30973093 }
30983094
3099- ++p;
31003095 dout (10 ) << " cancelling fragment " << df << " bit " << info.bits << dendl;
31013096 std::vector<CDir*> dirs;
31023097 info.dirs .swap (dirs);
3103- fragments.erase (df );
3098+ p = fragments.erase (p );
31043099 fragment_unmark_unfreeze_dirs (dirs);
31053100 }
31063101
@@ -3285,8 +3280,6 @@ void MDCache::handle_resolve(const cref_t<MMDSResolve> &m)
32853280 // check for any import success/failure (from this node)
32863281 map<dirfrag_t , vector<dirfrag_t > >::iterator p = my_ambiguous_imports.begin ();
32873282 while (p != my_ambiguous_imports.end ()) {
3288- map<dirfrag_t , vector<dirfrag_t > >::iterator next = p;
3289- ++next;
32903283 CDir *dir = get_dirfrag (p->first );
32913284 ceph_assert (dir);
32923285 dout (10 ) << " checking ambiguous import " << *dir << dendl;
@@ -3316,16 +3309,16 @@ void MDCache::handle_resolve(const cref_t<MMDSResolve> &m)
33163309 claimed_by_sender = true ;
33173310 }
33183311
3319- my_ambiguous_imports.erase (p); // no longer ambiguous.
3312+ p = my_ambiguous_imports.erase (p); // no longer ambiguous.
33203313 if (claimed_by_sender) {
33213314 dout (7 ) << " ambiguous import failed on " << *dir << dendl;
33223315 migrator->import_reverse (dir);
33233316 } else {
33243317 dout (7 ) << " ambiguous import succeeded on " << *dir << dendl;
33253318 migrator->import_finish (dir, true );
33263319 }
3327- }
3328- p = next ;
3320+ } else
3321+ ++p ;
33293322 }
33303323 }
33313324
@@ -4079,7 +4072,7 @@ void MDCache::rejoin_send_rejoins()
40794072 ++q;
40804073 } else {
40814074 // remove reconnect with no session
4082- p.second .second .erase (q++ );
4075+ q = p.second .second .erase (q);
40834076 }
40844077 }
40854078 rejoins[target]->cap_exports [p.first ] = p.second .second ;
@@ -5568,7 +5561,7 @@ bool MDCache::process_imported_caps()
55685561 }
55695562 }
55705563 }
5571- cap_imports.erase (p++ ); // remove and move on
5564+ p = cap_imports.erase (p); // remove and move on
55725565 }
55735566 } else {
55745567 trim_non_auth ();
@@ -5956,7 +5949,7 @@ void MDCache::open_snaprealms()
59565949 }
59575950 }
59585951
5959- rejoin_pending_snaprealms.erase (it++ );
5952+ it = rejoin_pending_snaprealms.erase (it);
59605953 in->put (CInode::PIN_OPENINGSNAPPARENTS);
59615954
59625955 send_snaps (splits);
@@ -11631,7 +11624,7 @@ void MDCache::adjust_dir_fragments(CInode *diri,
1163111624 set<CDir*>::iterator r = q->second .begin ();
1163211625 while (r != subtrees[dir].end ()) {
1163311626 new_bounds.insert (*r);
11634- subtrees[dir].erase (r++ );
11627+ r = subtrees[dir].erase (r);
1163511628 }
1163611629 subtrees.erase (q);
1163711630
@@ -12402,12 +12395,12 @@ void MDCache::fragment_drop_locks(fragment_info_t& info)
1240212395 // info.mdr.reset();
1240312396}
1240412397
12405- void MDCache::fragment_maybe_finish (const fragment_info_iterator it)
12398+ MDCache::fragment_info_iterator MDCache::fragment_maybe_finish (const fragment_info_iterator it)
1240612399{
1240712400 ceph_assert (kill_dirfrag_at != dirfrag_killpoint::FRAGMENT_MAYBE_FINISH);
1240812401
1240912402 if (!it->second .finishing )
12410- return ;
12403+ return it ;
1241112404
1241212405 // unmark & auth_unpin
1241312406 for (const auto &dir : it->second .resultfrags ) {
@@ -12421,7 +12414,7 @@ void MDCache::fragment_maybe_finish(const fragment_info_iterator it)
1242112414 mds->balancer ->maybe_fragment (dir, false );
1242212415 }
1242312416
12424- fragments.erase (it);
12417+ return fragments.erase (it);
1242512418}
1242612419
1242712420
0 commit comments