.. | .. |
---|
187 | 187 | return events; |
---|
188 | 188 | } |
---|
189 | 189 | |
---|
190 | | -static void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt) |
---|
| 190 | +void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt) |
---|
191 | 191 | { |
---|
192 | | - *cnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count; |
---|
| 192 | + lockdep_assert_held(&ctx->wqh.lock); |
---|
| 193 | + |
---|
| 194 | + *cnt = ((ctx->flags & EFD_SEMAPHORE) && ctx->count) ? 1 : ctx->count; |
---|
193 | 195 | ctx->count -= *cnt; |
---|
194 | 196 | } |
---|
| 197 | +EXPORT_SYMBOL_GPL(eventfd_ctx_do_read); |
---|
195 | 198 | |
---|
196 | 199 | /** |
---|
197 | 200 | * eventfd_ctx_remove_wait_queue - Read the current counter and removes wait queue. |
---|