io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Victor Stewart <v@nametag.social>
To: Jens Axboe <axboe@kernel.dk>
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: Mon, 20 Sep 2021 13:51:10 +0100	[thread overview]
Message-ID: <CAM1kxwgayosM7YgPo=OWOG=+RcuYZ7xksUQcd03uOw-RKhxTwQ@mail.gmail.com> (raw)
In-Reply-To: <3df95a9f-7a5a-14bd-13e4-cef8a3f58dbd@kernel.dk>

On Sun, Sep 19, 2021 at 12:40 AM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 9/18/21 5:37 PM, Jens Axboe wrote:
> >> and it failed with the same as before...
> >>
> >> 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)
> >>
> >> if you want i can debug it for you tomorrow? (in london)
> >
> > Nah that's fine, I think it's just because you have other files opened
> > too. We bump the cur limit _to_ 'nr', but that leaves no room for anyone
> > else. Would be my guess. It works fine for the test case I ran here, but
> > your case may be different. Does it work if you just make it:
> >
> > rlim.rlim_cur += nr;
> >
> > instead?
>
> Specifically, just something like the below incremental. If rlim_cur
> _seems_ big enough, leave it alone. If not, add the amount we need to
> cur. And don't do any error checking here, let's leave failure to the
> kernel.
>
> diff --git a/src/register.c b/src/register.c
> index bab42d0..7597ec1 100644
> --- a/src/register.c
> +++ b/src/register.c
> @@ -126,9 +126,7 @@ static int bump_rlimit_nofile(unsigned nr)
>         if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
>                 return -errno;
>         if (rlim.rlim_cur < nr) {
> -               if (nr > rlim.rlim_max)
> -                       return -EMFILE;
> -               rlim.rlim_cur = nr;
> +               rlim.rlim_cur += nr;
>                 setrlimit(RLIMIT_NOFILE, &rlim);
>         }
>

i just tried this patch and same failure. if you intend for this to remain
in the code i can debug what's going on?

>
> --
> Jens Axboe
>

  parent reply	other threads:[~2021-09-20 12:51 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
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 [this message]
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='CAM1kxwgayosM7YgPo=OWOG=+RcuYZ7xksUQcd03uOw-RKhxTwQ@mail.gmail.com' \
    --to=v@nametag.social \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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).