--- linux-7.3/fs/ceph/debugfs.c 2026-10-19 07:14:58.000000000 +0800 +++ linux-7.3-cephv/fs/ceph/debugfs.c 2026-11-16 19:45:10.959628684 +0800 @@ -20,6 +20,8 @@ #include "super.h" +#include "race_verify.h" + #ifdef CONFIG_DEBUG_FS #include "mds_client.h" @@ -64,6 +66,7 @@ if (!fsc->mdsc || !fsc->mdsc->mdsmap) return 0; mdsmap = fsc->mdsc->mdsmap; + ceph_race_verify_pause(fsc->mdsc, mdsmap); seq_printf(s, "epoch %d\n", mdsmap->m_epoch); seq_printf(s, "root %d\n", mdsmap->m_root); seq_printf(s, "max_mds %d\n", mdsmap->m_max_mds); @@ -531,6 +534,15 @@ } DEFINE_SHOW_ATTRIBUTE(mdsmap); + +#ifdef CONFIG_CEPH_RACE_VERIFY +/* TEST ONLY: expose the real mdsmap_show() fops on a harness directory. */ +void ceph_race_create_mdsmap_file(struct ceph_fs_client *fsc, + struct dentry *parent) +{ + debugfs_create_file("mdsmap", 0400, parent, fsc, &mdsmap_fops); +} +#endif DEFINE_SHOW_ATTRIBUTE(mdsc); DEFINE_SHOW_ATTRIBUTE(caps); DEFINE_SHOW_ATTRIBUTE(mds_sessions); --- linux-7.3/fs/ceph/Makefile 2026-10-19 07:14:58.000000000 +0800 +++ linux-7.3-cephv/fs/ceph/Makefile 2026-11-16 19:45:10.961629014 +0800 @@ -13,3 +13,4 @@ ceph-$(CONFIG_CEPH_FSCACHE) += cache.o ceph-$(CONFIG_CEPH_FS_POSIX_ACL) += acl.o ceph-$(CONFIG_FS_ENCRYPTION) += crypto.o +ceph-$(CONFIG_CEPH_RACE_VERIFY) += race_verify.o --- linux-7.3/fs/ceph/Kconfig 2026-10-19 07:14:58.000000000 +0800 +++ linux-7.3-cephv/fs/ceph/Kconfig 2026-11-16 19:45:10.963629343 +0800 @@ -47,3 +47,12 @@ If you are not using a security module that requires using extended attributes for file security labels, say N. + +config CEPH_RACE_VERIFY + bool "Ceph mdsmap lifetime race verification harness (TEST ONLY)" + depends on CEPH_FS && DEBUG_FS + help + Test-only instrumentation used to dynamically verify mdsmap + lifetime races (publish+destroy vs. lockless readers). Not for + production kernels. +