io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Victor Stewart <v@nametag.social>
Cc: io-uring <io-uring@vger.kernel.org>
Subject: Re: [BUG? liburing] io_uring_register_files_update with liburing 2.0 on 5.13.17
Date: Sat, 18 Sep 2021 14:26:24 -0600	[thread overview]
Message-ID: <c0de93f7-abf4-d2f9-f64d-376a9c987ac0@kernel.dk> (raw)
In-Reply-To: <CAM1kxwj2Chak===QoOzNBAUMhymyXM3T6o_zwPdwqN7MzQ25zw@mail.gmail.com>

On 9/18/21 2:13 PM, Victor Stewart wrote:
> On Sat, Sep 18, 2021 at 3:41 PM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> On 9/18/21 7:41 AM, Victor Stewart wrote:
>>> just auto updated from 5.13.16 to 5.13.17, and suddenly my fixed
>>> file registrations fail with EOPNOTSUPP using liburing 2.0.
>>>
>>> static inline struct io_uring ring;
>>> static inline int *socketfds;
>>>
>>> // ...
>>>
>>> void enableFD(int fd)
>>> {
>>>    int result = io_uring_register_files_update(&ring, fd,
>>>                       &(socketfds[fd] = fd), 1);
>>>    printf("enableFD, result = %d\n", result);
>>> }
>>>
>>> maybe this is due to the below and related work that
>>> occurred at the end of 5.13 and liburing got out of sync?
>>>
>>> https://github.com/torvalds/linux/commit/992da01aa932b432ef8dc3885fa76415b5dbe43f#diff-79ffab63f24ef28eec3badbc8769e2a23e0475ab1fbe390207269ece944a0824
>>>
>>> and can't use liburing 2.1 because of the api changes since 5.13.
>>
>> That's very strange, the -EOPNOTSUPP should only be possible if you
>> are not passing in the ring fd for the register syscall. You should
>> be able to mix and match liburing versions just fine, the only exception
>> is sometimes between releases (of both liburing and the kernel) where we
>> have the liberty to change the API of something that was added before
>> release.
>>
>> Can you do an strace of it and attach?
> 
> oh ya the EOPNOTSUPP was my bug introduced trying to debug.
> 
> here's the real bug...
> 
> io_uring_register(13, IORING_REGISTER_FILES, [-1, -1, -1, 3, 4, 5, 6, 7,
> 8, 9, 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
> -1, -1, -1, -1, -1,
> -1, ...], 32768) = -1 EMFILE (Too many open files)
> 
> 32,768 is 1U << 15 aka IORING_MAX_FIXED_FILES, but i tried
> 16,000 just to try and same issue.
> 
> maybe you're not allowed to have pre-filled (aka non negative 1)
> entries upon the initial io_uring_register_files call anymore?
> 
> this was working until the 5.13.16 -> 5.13.17 transition.

Ah yes that makes more sense. You need to up RLIMIT_NOFILE, the
registered files are under that protection now too. This is also why it
was brought back to stable. A bit annoying, but it was needed for the
direct file support to have some sanity there.

So use rlimit(RLIMIT_NOFILE,...) from the app or ulimit -n to bump the
limit.

-- 
Jens Axboe


  reply	other threads:[~2021-09-18 20:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18 13:41 [BUG? liburing] io_uring_register_files_update with liburing 2.0 on 5.13.17 Victor Stewart
2021-09-18 14:41 ` Jens Axboe
2021-09-18 20:13   ` Victor Stewart
2021-09-18 20:26     ` Jens Axboe [this message]
2021-09-18 20:38       ` Jens Axboe
2021-09-18 21:55         ` Victor Stewart
2021-09-18 22:21           ` Jens Axboe
2021-09-18 23:19             ` Victor Stewart
2021-09-18 23:23               ` Victor Stewart
2021-09-18 23:37               ` Jens Axboe
2021-09-18 23:40                 ` Jens Axboe
2021-09-19  4:15                   ` Vito Caputo
2021-09-19 14:16                     ` Jens Axboe
2021-09-20 12:51                   ` Victor Stewart
2021-09-20 13:10                     ` Jens Axboe
2021-09-20 13:19                       ` Victor Stewart
2021-09-19 11:56             ` Pavel Begunkov
2021-09-19 14:24               ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0de93f7-abf4-d2f9-f64d-376a9c987ac0@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=v@nametag.social \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).