From 917f4b334c3141a3e1bd5df1456d40b010dfe65f Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Mon, 29 Mar 2021 15:44:27 -0400 Subject: [PATCH] Atomically check and set dropped zevent count ratelimit_dropped isn't protected by a lock and is expected to be updated atomically. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #11822 --- module/zfs/fm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/zfs/fm.c b/module/zfs/fm.c index 3070cab1e4..c79d291ab1 100644 --- a/module/zfs/fm.c +++ b/module/zfs/fm.c @@ -657,8 +657,7 @@ zfs_zevent_next(zfs_zevent_t *ze, nvlist_t **event, uint64_t *event_size, #ifdef _KERNEL /* Include events dropped due to rate limiting */ - *dropped += ratelimit_dropped; - ratelimit_dropped = 0; + *dropped += atomic_swap_64(&ratelimit_dropped, 0); #endif ze->ze_dropped = 0; out: