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 6613ea3b33
commit 917f4b334c
1 changed files with 1 additions and 2 deletions

View File

@ -657,8 +657,7 @@ zfs_zevent_next(zfs_zevent_t *ze, nvlist_t **event, uint64_t *event_size,
#ifdef _KERNEL #ifdef _KERNEL
/* Include events dropped due to rate limiting */ /* Include events dropped due to rate limiting */
*dropped += ratelimit_dropped; *dropped += atomic_swap_64(&ratelimit_dropped, 0);
ratelimit_dropped = 0;
#endif #endif
ze->ze_dropped = 0; ze->ze_dropped = 0;
out: out: