Skip to content

Commit b98bb86

Browse files
committed
mds: relax divergent backtrace scrub failures for replicated ancestor inodes
scrub could be verifying backtrace for an inode for which some of its ancestors might be replicas, e.g. (from a custom debug build) some ancestors of an inode with divergent backtrace were replicas: ``` [inode 0x3000000502f [...122,head] /volumes/qa/sv_0/b98de6ea-ed40-40d0-8e1a-9433a337a387/client.0/tmp/payload.2/multiple_rsync_payload.190107/firmware/ [email protected] fragtree_t(*^3) v6663 f(v493 m2024-05-01T06:38:16.403080+0000 388=289+99) n(v139 rc2024-05-01T06:55:35.239345+0000 b467915716 4880=4534+346) old_inodes=24 (inest mix) (ifile mix) | lock=0 importing=0 dirfrag=1 0x55a85d244680] ``` In such cases, the backpointer version (inode_backpointer_t::version) of the in-memory (cache) inode can fall behind the on-disk version causing scrub to consider the inode backtrace as divergent (memory version < on-disk version). Sample: ``` "ondisk_value":"(2)0x30000005bba: [<0x3000000502f/mwl8k v2126>, <0x30000005026/firmware v6663>, <0x30000005025/multiple_rsync_payload.190107 v3041>, <0x10000005894/payload.2 v4873>, <0x10000000005/tmp v6193>,<0x10000000003/client.0 v5964>, <0x10000000002/b98de6ea-ed40-40d0-8e1a-9433a337a387 v5817> ,<0x10000000001/sv_0 v5837>, <0x10000000000/qa v6241>, <0x1/volumes v4036>] "memoryvalue":"(2)0x30000005bba: [<0x3000000502f/mwl8k v2126>, <0x30000005026/firmware v6663>, <0x30000005025/multiple_rsync_payload.190107 v3041>, <0x10000005894/payload.2 v4873>, <0x10000000005/tmp v6081>, <0x10000000003/client.0 v5942>, <0x10000000002/b98de6ea-ed40-40d0-8e1a-9433a337a387 v5709>, <0x10000000001/sv_0 v5819>, <0x10000000000/qa v6121>, <0x1/volumes v4022>] ``` Fixes: http://tracker.ceph.com/issues/64730 Signed-off-by: Venky Shankar <[email protected]>
1 parent 720f8e9 commit b98bb86

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/mds/CInode.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,19 @@ bool CInode::is_ancestor_of(const CInode *other, std::unordered_map<CInode const
10051005
return false;
10061006
}
10071007

1008+
bool CInode::is_any_ancestor_inode_a_replica() {
1009+
CDentry *pdn = get_parent_dn();
1010+
while (pdn) {
1011+
CInode *diri = pdn->get_dir()->get_inode();
1012+
if (!diri->is_auth()) {
1013+
return true;
1014+
}
1015+
pdn = diri->get_parent_dn();
1016+
}
1017+
1018+
return false;
1019+
}
1020+
10081021
bool CInode::is_projected_ancestor_of(const CInode *other) const
10091022
{
10101023
while (other) {
@@ -4842,7 +4855,11 @@ void CInode::validate_disk_state(CInode::validated_data *results,
48424855
dout(20) << "divergent backtraces are acceptable when dn "
48434856
"is being purged or has been renamed or moved to a "
48444857
"different directory " << *in << dendl;
4845-
}
4858+
} else if (in->is_any_ancestor_inode_a_replica()) {
4859+
results->backtrace.passed = true;
4860+
dout(20) << "divergent backtraces are acceptable when some "
4861+
"ancestor inodes are replicas " << *in << dendl;
4862+
}
48464863
} else {
48474864
results->backtrace.passed = true;
48484865
}

src/mds/CInode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,8 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
706706
const CDir *get_projected_parent_dir() const;
707707
CDir *get_projected_parent_dir();
708708
CInode *get_parent_inode();
709+
710+
bool is_any_ancestor_inode_a_replica();
709711

710712
bool is_lt(const MDSCacheObject *r) const override {
711713
const CInode *o = static_cast<const CInode*>(r);

0 commit comments

Comments
 (0)