]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds: fix crash when exporting unlinked dir
author胡玮文 <huww98@outlook.com>
Thu, 16 Dec 2021 14:31:17 +0000 (22:31 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 19 Jul 2022 23:41:22 +0000 (07:41 +0800)
commit1a903b525b4eae93f8efc851b84dfe46f3ff0160
tree1e6953d69f15977a7811c924dd3e779734518af2
parent9d92634df9002745fe71d316b287bb3a51f31ceb
mds: fix crash when exporting unlinked dir

When fetch() an unlinked dir, we set fnode->version = 1, but leave
projected_version = 0. This will trigger the assert
`dir->get_projected_version() == dir->get_version()`
in Migrator::encode_export_dir().

projected_version should equal to `fnode->version` unless this dir is
projected.

Fix this by introducing a new helper CDir::set_fresh_fnode(), which will ensure
versions are correctly set.

Fixes: https://tracker.ceph.com/issues/53597
Signed-off-by: 胡玮文 <huww98@outlook.com>
(cherry picked from commit fcdee486697ca98a44960e6150bfd36dc34e5fe5)
src/mds/CDir.cc
src/mds/CDir.h