-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/file-exit-unreg: check defer tw file exit unregistration
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 <axboe@kernel.dk>
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |