mds: fix 'if there is lock cache on dir' check
When invalidating lock cache, current code detach lock cache from all
its locks immediately. So diri->filelock.is_cached() only tells us if
there is active (not being invalidated) lock cache on a dir.
But MDCache::path_traverse() and Server::_dir_is_nonempty_unlocked() use
diri->filelock.is_cached() to check if there is any lock cache on a dir.
This bug can result in processing async requests and normal requests out
of order.
The fix is detaching lock cache from its locks when lock cache is
completely invalidated .
Fixes: https://tracker.ceph.com/issues/44448
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit
20d21cff89e1bb2bd6d7af311b4cc3272ce5fe65)