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 <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11822
This commit is contained in:
Ryan Moeller 2021-03-29 15:44:27 -04:00 committed by Brian Behlendorf
parent 9f9e1b5425
commit 3ba10f9a6a

View File

@ -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: