0001-injection_points-Fix-incrementation-of-variable-numb.patch
text/x-diff
Filename: 0001-injection_points-Fix-incrementation-of-variable-numb.patch
Type: text/x-diff
Part: 0
Patch
Format: format-patch
Series: patch 0001
Subject: injection_points: Fix incrementation of variable-numbered stats
| File | + | − |
|---|---|---|
| src/test/modules/injection_points/injection_stats.c | 4 | 6 |
From 3c0740039c07d2e7bd4ad101ea15f4630a0c4efa Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 16 Sep 2025 11:28:18 +0900
Subject: [PATCH] injection_points: Fix incrementation of variable-numbered
stats
The pending entry was not used when incrementing its data, the code was
directly manipulating the shared memory pointer, without even locking
it.
---
src/test/modules/injection_points/injection_stats.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/test/modules/injection_points/injection_stats.c b/src/test/modules/injection_points/injection_stats.c
index e3947b23ba57..ca8df4ad217a 100644
--- a/src/test/modules/injection_points/injection_stats.c
+++ b/src/test/modules/injection_points/injection_stats.c
@@ -164,8 +164,7 @@ void
pgstat_report_inj(const char *name)
{
PgStat_EntryRef *entry_ref;
- PgStatShared_InjectionPoint *shstatent;
- PgStat_StatInjEntry *statent;
+ PgStat_StatInjEntry *pending;
/* leave if disabled */
if (!inj_stats_loaded || !inj_stats_enabled)
@@ -174,11 +173,10 @@ pgstat_report_inj(const char *name)
entry_ref = pgstat_prep_pending_entry(PGSTAT_KIND_INJECTION, InvalidOid,
PGSTAT_INJ_IDX(name), NULL);
- shstatent = (PgStatShared_InjectionPoint *) entry_ref->shared_stats;
- statent = &shstatent->stats;
+ pending = (PgStat_StatInjEntry *) entry_ref->pending;
- /* Update the injection point statistics */
- statent->numcalls++;
+ /* Update the injection point pending statistics */
+ pending->numcalls++;
}
/*
--
2.51.0