]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
tools/cephfs_mirror: Fix crash loading persisted sync stats on restart
authorKotresh HR <khiremat@redhat.com>
Fri, 31 Jul 2026 17:53:35 +0000 (23:23 +0530)
committerKotresh HR <khiremat@redhat.com>
Mon, 3 Aug 2026 23:42:30 +0000 (05:12 +0530)
commitd241f68e68cbd2abc5596913b384cd94c3d11715
treef91011d7a350392bb5b50d7417dc078e6bee95c9
parent8482cb11bc58942906e2343ebd87ef2c7a1dd01d
tools/cephfs_mirror: Fix crash loading persisted sync stats on restart

PeerReplayer::apply_persisted_dir_sync_stat() took a reference into
a json_spirit::mValue for last_synced_snap, then reused that same
mValue for nested field lookups. The get_json_value() overwrote the
parent value and left a dangling Object reference, which could abort
the daemon when directories were re-acquired after a mirror daemon
restart or a mgr failover.

The fix is to Copy last_synced_snap before reading nested fields,
add typed JSON helpers (moved to Utils) that check types before
get_* calls, and catch std::exception so unexpected parse failures
are logged instead of taking down cephfs-mirror.

Fixes: https://tracker.ceph.com/issues/78932
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/tools/cephfs_mirror/PeerReplayer.cc
src/tools/cephfs_mirror/Utils.cc
src/tools/cephfs_mirror/Utils.h