for-7.2/io_uring-epoll-20260616

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmoxQDoQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgphm7EADQ7UmRhQGFQCbykRQ2joI0T4FGBgiRQaEa
 Rkpcob8xeqzkX16G00TzXeiM4K76QVaIHG6bDpXNwpHeL/2flsMLSpD0XuQONzAC
 g3OZQsaPyZqXwUZ+3mLKEgd830LgTeIC0iiVm6hnxNhTo29O1v1ueU/K0LgaE0AG
 40q2NSpzxMbnFM/c3UVpepLsZ9XwGwE10xzZJTgnX5VhVxXwlNlT0scmEaHbfeJ3
 hh9fn6KqW0LqnrK7Pq3UBKNxxoiVM5sruFDWPevXgw+LyEBykPiNR3+zzRoXFurx
 cIwavXR9tVnTFFdfSpZ/YWA11TuOlIyELxb50R3cN4ks8y7nVTNbv6vF7fVCJDIO
 iHylAsAHEvkLaCt8X4qZsZQwO/10ZeaUA4gNPnT15gs8jxvk5SWEQOX74tZHps4S
 eBPB9zyxfRXs6KZWRfONEHpYQnkfQH5/jIYGjycenWlyZ2jHqwZYcOWQcn9lqHzF
 UWWblfp8JfRegmp5i5vwJNUSRq3FUVDiifVSYkSrYpeVztIbSz8E36pes8GKVSZe
 gKKw1qgEcqio72dmprZFVAuG3YhAD6ebXAI5KWQ3XZcwJCKnaw16H4ObjBXrqOgH
 69jzB4xlwvHlbyFnBQpYFdtfge0ziD0DbMVYT701TCUwsA7CItBEiOe5ZQ6N8u2/
 QME4m1sg8A==
 =yyaO
 -----END PGP SIGNATURE-----

Merge tag 'for-7.2/io_uring-epoll-20260616' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull io_uring epoll update from Jens Axboe:
 "As discussed a few months ago, this pull request gets rid of allowing
  nested epoll notification contexts via io_uring.

  Nested contexts have been a source of issues on the epoll side, and
  there should not be a need to support them from io_uring. The epoll
  io_uring side exists mainly to facilitate a gradual migration from a
  notification based epoll setup to an io_uring ditto"

* tag 'for-7.2/io_uring-epoll-20260616' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  io_uring/epoll: disallow adding an epoll file to an epoll context
  io_uring/epoll: switch to using do_epoll_ctl_file() interface
This commit is contained in:
Linus Torvalds 2026-06-18 08:09:57 -07:00
commit 2f9f5887b4

View File

@ -51,10 +51,24 @@ int io_epoll_ctl_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
int io_epoll_ctl(struct io_kiocb *req, unsigned int issue_flags)
{
struct io_epoll *ie = io_kiocb_to_cmd(req, struct io_epoll);
int ret;
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
struct epoll_key key;
int ret;
ret = do_epoll_ctl(ie->epfd, ie->op, ie->fd, &ie->event, force_nonblock);
CLASS(fd, f)(ie->epfd);
if (fd_empty(f))
return -EBADF;
CLASS(fd, tf)(ie->fd);
if (fd_empty(tf))
return -EBADF;
/* disallow adding an epoll context to another epoll context */
if (ie->op == EPOLL_CTL_ADD && is_file_epoll(fd_file(tf)))
return -EINVAL;
key.file = fd_file(tf);
key.fd = ie->fd;
ret = do_epoll_ctl_file(fd_file(f), ie->op, &key, &ie->event, force_nonblock);
if (force_nonblock && ret == -EAGAIN)
return -EAGAIN;