]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/user_events: Wait for deferred event teardown after unregister
authorMichael Bommarito <michael.bommarito@gmail.com>
Tue, 7 Jul 2026 18:02:40 +0000 (14:02 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 8 Jul 2026 13:33:22 +0000 (09:33 -0400)
commit42e74d8f21ce448fe12ba3dd59db817b3e977f49
treeab08ba4db2c17f52ce5fbce829ffafda9ad4e3bf
parent05074bb90af94f2acbbc8f8ffaa507f914c273c8
selftests/user_events: Wait for deferred event teardown after unregister

Unregistering a user event now defers the drop of the enabler's event
reference (and the freeing of the enabler) past an RCU grace period. As a
result DIAG_IOCSDEL can transiently fail with -EBUSY while that last
reference is still being dropped, where it previously succeeded
immediately.

Two tests assumed the delete takes effect the instant the unregister
returns:

  - abi_test "flags" deletes the event right after disabling it.
  - perf_test's fixture teardown clear() deletes __test_event before the
    next test registers the same name; a stale event makes the following
    registration fail with -EADDRINUSE.

Retry the delete until it succeeds (or the event is already gone) with a
bounded wait, matching the existing wait_for_delete() idiom in the same
suite, so the tests are robust to the deferred teardown.

Link: https://patch.msgid.link/20260707180240.2887081-1-michael.bommarito@gmail.com
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/selftests/user_events/abi_test.c
tools/testing/selftests/user_events/perf_test.c