From: Zhansong Gao Date: Fri, 26 May 2023 04:20:17 +0000 (+0800) Subject: mds: session in the importing state cannot be cleared if an export subtree task is... X-Git-Tag: testing/wip-jcollin-testing-20251203.125108-squid^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bcbed3092b72f6e4d6f6b207b4c78c30ceb48ee4;p=ceph-ci.git mds: session in the importing state cannot be cleared if an export subtree task is interrupted while the state of importer is acking 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 (cherry picked from commit 057c5b1610c11ad8cc6d0cde43bee1306228275b) --- diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 6c8b7f19738..472a3c8c0d4 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -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 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); }