]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds: fix data race on subvolume_metrics_map in MetricsHandler 67878/head
authorIgor Golikov <igolikov@redhat.com>
Wed, 18 Mar 2026 12:03:56 +0000 (12:03 +0000)
committerIgor Golikov <igolikov@redhat.com>
Wed, 18 Mar 2026 12:11:07 +0000 (12:11 +0000)
commit9a1667f973b94f081b3754deeb409702207f2502
tree75dfb11459af5efd4e54532073ee4fe644147e1a
parent37e572146540e85faa6a66c326f1b1828a0a060e
mds: fix data race on subvolume_metrics_map in MetricsHandler

The UnlockGuard in handle_payload() and update_rank0() had
function-wide scope, causing subvolume_metrics_map to be read
and written without the metrics lock held. This race between the
ms_dispatch thread (handle_payload) and the mds-metrics thread
(update_rank0) led to heap corruption under concurrent client
subvolume I/O.

Narrow the UnlockGuard scope to only the sections that need the
lock dropped (path resolution and rbytes fetch), ensuring
subvolume_metrics_map is always accessed under lock.

Confirmed with TSAN: 8 data races before fix, 0 after.

Fixes: https://tracker.ceph.com/issues/75343
Signed-off-by: Igor Golikov <igolikov@ibm.com>
src/mds/MetricsHandler.cc