Skip to content

Commit

Permalink
test/file-exit-unreg: check defer tw file exit unregistration
Browse files Browse the repository at this point in the history
With the resource node rewrite for kernel 6.13, the punt of defer
tw at fail time over the normal task_work can trigger a lockdep
complaint. Check that this proceeds without warnings.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Nov 5, 2024
1 parent 56276a5 commit 03726b4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ test_srcs := \
fd-pass.c \
fdinfo.c \
fifo-nonblock-read.c \
file-exit-unreg.c \
file-register.c \
files-exit-hang-poll.c \
files-exit-hang-timeout.c \
Expand Down
48 changes: 48 additions & 0 deletions test/file-exit-unreg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* SPDX-License-Identifier: MIT */
/*
* Description: test that a defer task_work file with tags unregistration
* doesn't trigger a lockdep violation
*
*/
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>

#include "liburing.h"
#include "helpers.h"

int main(int argc, char *argv[])
{
__u64 tags[2] = { 1, 2 };
struct io_uring ring;
int fds[2], ret;

if (argc > 1)
return T_EXIT_SKIP;

if (pipe(fds) < 0) {
perror("pipe");
return 1;
}

ret = io_uring_queue_init(4, &ring, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_DEFER_TASKRUN);
if (ret == -EINVAL) {
return T_EXIT_SKIP;
} else if (ret < 0) {
fprintf(stderr, "queue_init: %d\n", ret);
return T_EXIT_FAIL;
}

ret = io_uring_register_files_tags(&ring, fds, tags, 2);
if (ret == -EINVAL) {
return T_EXIT_SKIP;
} else {
fprintf(stderr, "file_register_init: %d\n", ret);
return T_EXIT_FAIL;
}

io_uring_queue_exit(&ring);
sleep(1);
return 0;
}

0 comments on commit 03726b4

Please sign in to comment.