From 057c5b1610c11ad8cc6d0cde43bee1306228275b Mon Sep 17 00:00:00 2001 From: Zhansong Gao Date: Fri, 26 May 2023 12:20:17 +0800 Subject: [PATCH] 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 --- src/mds/Migrator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 99991f50aa703..d60f8e0b3b688 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); } -- 2.39.5