From 3ba10f9a6ae3c1b339fb7ff78a6bc9c314e3e08c 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: