]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: session in the importing state cannot be cleared if an export subtree task is...
authorZhansong Gao <zhsgao@hotmail.com>
Fri, 26 May 2023 04:20:17 +0000 (12:20 +0800)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Fri, 21 Nov 2025 12:16:01 +0000 (19:16 +0700)
The related sessions in the importer are in the importing state(`Session::is_importing` return true) when the state of importer is `acking`,
`Migrator::import_reverse` called by `MDCache::handle_resolve` should reverse the process to clear the importing state if the exporter restarts
at this time, but it doesn't do that actually because of its bug. And it will cause these sessions to not be cleared when the client is
unmounted(evicted or timeout) until the mds is restarted.

The bug in `import_reverse` is that it contains the code to handle state `IMPORT_ACKING` but it will never be executed because
the state is modified to `IMPORT_ABORTING` at the beginning. Move `stat.state = IMPORT_ABORTING` to the end of import_reverse
so that it can handle the state `IMPORT_ACKING`.

Fixes: https://tracker.ceph.com/issues/61459
Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
(cherry picked from commit 057c5b1610c11ad8cc6d0cde43bee1306228275b)

src/mds/Migrator.cc

index 6c8b7f19738451167483b4de7740a86514b46139..472a3c8c0d4482b81aac3d6dd17a5e2b7c62d241 100644 (file)
@@ -2844,7 +2844,6 @@ void Migrator::import_reverse(CDir *dir)
   dout(7) << *dir << dendl;
 
   import_state_t& stat = import_state[dir->dirfrag()];
-  stat.state = IMPORT_ABORTING;
 
   set<CDir*> bounds;
   mdcache->get_subtree_bounds(dir, bounds);
@@ -2962,6 +2961,7 @@ void Migrator::import_reverse(CDir *dir)
   mdcache->trim(num_dentries); // try trimming dentries
 
   // notify bystanders; wait in aborting state
+  stat.state = IMPORT_ABORTING;
   import_notify_abort(dir, bounds);
 }