Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f38987f0
Commit
f38987f0
authored
May 24, 2022
by
Jens Axboe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
io_uring: convert cancel path to use io_cmd_type
Signed-off-by:
Jens Axboe
<
axboe@kernel.dk
>
parent
e4a71006
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
io_uring/io_uring.c
io_uring/io_uring.c
+13
-11
No files found.
io_uring/io_uring.c
View file @
f38987f0
...
@@ -979,7 +979,6 @@ struct io_kiocb {
...
@@ -979,7 +979,6 @@ struct io_kiocb {
*/
*/
struct
file
*
file
;
struct
file
*
file
;
struct
io_cmd_data
cmd
;
struct
io_cmd_data
cmd
;
struct
io_cancel
cancel
;
struct
io_timeout
timeout
;
struct
io_timeout
timeout
;
struct
io_timeout_rem
timeout_rem
;
struct
io_timeout_rem
timeout_rem
;
struct
io_open
open
;
struct
io_open
open
;
...
@@ -7699,19 +7698,21 @@ static int io_try_cancel(struct io_kiocb *req, struct io_cancel_data *cd)
...
@@ -7699,19 +7698,21 @@ static int io_try_cancel(struct io_kiocb *req, struct io_cancel_data *cd)
static
int
io_async_cancel_prep
(
struct
io_kiocb
*
req
,
static
int
io_async_cancel_prep
(
struct
io_kiocb
*
req
,
const
struct
io_uring_sqe
*
sqe
)
const
struct
io_uring_sqe
*
sqe
)
{
{
struct
io_cancel
*
cancel
=
io_kiocb_to_cmd
(
req
);
if
(
unlikely
(
req
->
flags
&
REQ_F_BUFFER_SELECT
))
if
(
unlikely
(
req
->
flags
&
REQ_F_BUFFER_SELECT
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
sqe
->
off
||
sqe
->
len
||
sqe
->
splice_fd_in
)
if
(
sqe
->
off
||
sqe
->
len
||
sqe
->
splice_fd_in
)
return
-
EINVAL
;
return
-
EINVAL
;
req
->
cancel
.
addr
=
READ_ONCE
(
sqe
->
addr
);
cancel
->
addr
=
READ_ONCE
(
sqe
->
addr
);
req
->
cancel
.
flags
=
READ_ONCE
(
sqe
->
cancel_flags
);
cancel
->
flags
=
READ_ONCE
(
sqe
->
cancel_flags
);
if
(
req
->
cancel
.
flags
&
~
CANCEL_FLAGS
)
if
(
cancel
->
flags
&
~
CANCEL_FLAGS
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
req
->
cancel
.
flags
&
IORING_ASYNC_CANCEL_FD
)
{
if
(
cancel
->
flags
&
IORING_ASYNC_CANCEL_FD
)
{
if
(
req
->
cancel
.
flags
&
IORING_ASYNC_CANCEL_ANY
)
if
(
cancel
->
flags
&
IORING_ASYNC_CANCEL_ANY
)
return
-
EINVAL
;
return
-
EINVAL
;
req
->
cancel
.
fd
=
READ_ONCE
(
sqe
->
fd
);
cancel
->
fd
=
READ_ONCE
(
sqe
->
fd
);
}
}
return
0
;
return
0
;
...
@@ -7753,20 +7754,21 @@ static int __io_async_cancel(struct io_cancel_data *cd, struct io_kiocb *req,
...
@@ -7753,20 +7754,21 @@ static int __io_async_cancel(struct io_cancel_data *cd, struct io_kiocb *req,
static
int
io_async_cancel
(
struct
io_kiocb
*
req
,
unsigned
int
issue_flags
)
static
int
io_async_cancel
(
struct
io_kiocb
*
req
,
unsigned
int
issue_flags
)
{
{
struct
io_cancel
*
cancel
=
io_kiocb_to_cmd
(
req
);
struct
io_cancel_data
cd
=
{
struct
io_cancel_data
cd
=
{
.
ctx
=
req
->
ctx
,
.
ctx
=
req
->
ctx
,
.
data
=
req
->
cancel
.
addr
,
.
data
=
cancel
->
addr
,
.
flags
=
req
->
cancel
.
flags
,
.
flags
=
cancel
->
flags
,
.
seq
=
atomic_inc_return
(
&
req
->
ctx
->
cancel_seq
),
.
seq
=
atomic_inc_return
(
&
req
->
ctx
->
cancel_seq
),
};
};
int
ret
;
int
ret
;
if
(
cd
.
flags
&
IORING_ASYNC_CANCEL_FD
)
{
if
(
cd
.
flags
&
IORING_ASYNC_CANCEL_FD
)
{
if
(
req
->
flags
&
REQ_F_FIXED_FILE
)
if
(
req
->
flags
&
REQ_F_FIXED_FILE
)
req
->
file
=
io_file_get_fixed
(
req
,
req
->
cancel
.
fd
,
req
->
file
=
io_file_get_fixed
(
req
,
cancel
->
fd
,
issue_flags
);
issue_flags
);
else
else
req
->
file
=
io_file_get_normal
(
req
,
req
->
cancel
.
fd
);
req
->
file
=
io_file_get_normal
(
req
,
cancel
->
fd
);
if
(
!
req
->
file
)
{
if
(
!
req
->
file
)
{
ret
=
-
EBADF
;
ret
=
-
EBADF
;
goto
done
;
goto
done
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment