From 67819ea28d4997a75eab96fa9ee32079b02a10da 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 a5003f85d..7da5bc035 100644 --- a/module/zfs/fm.c +++ b/module/zfs/fm.c @@ -658,8 +658,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: