Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

switch io_msg_ring() to CLASS(fd)

Use CLASS(fd) to get the file for sync message ring requests, rather
than open-code the file retrieval dance.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20241115034902.GP3387508@ZenIV
[axboe: make a more coherent commit message]
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Al Viro and committed by
Jens Axboe
56cec28d b9d69371

+7 -11
+7 -11
io_uring/msg_ring.c
··· 333 333 int io_uring_sync_msg_ring(struct io_uring_sqe *sqe) 334 334 { 335 335 struct io_msg io_msg = { }; 336 - struct fd f; 337 336 int ret; 338 337 339 338 ret = __io_msg_ring_prep(&io_msg, sqe); ··· 346 347 if (io_msg.cmd != IORING_MSG_DATA) 347 348 return -EINVAL; 348 349 349 - ret = -EBADF; 350 - f = fdget(sqe->fd); 351 - if (fd_file(f)) { 352 - ret = -EBADFD; 353 - if (io_is_uring_fops(fd_file(f))) 354 - ret = __io_msg_ring_data(fd_file(f)->private_data, 355 - &io_msg, IO_URING_F_UNLOCKED); 356 - fdput(f); 357 - } 358 - return ret; 350 + CLASS(fd, f)(sqe->fd); 351 + if (fd_empty(f)) 352 + return -EBADF; 353 + if (!io_is_uring_fops(fd_file(f))) 354 + return -EBADFD; 355 + return __io_msg_ring_data(fd_file(f)->private_data, 356 + &io_msg, IO_URING_F_UNLOCKED); 359 357 } 360 358 361 359 void io_msg_cache_free(const void *entry)