All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
To: Louvian Lyndal <louvianlyndal@gmail.com>,
	Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>
Cc: Ammar Faizi <ammarfaizi2@gmail.com>,
	io-uring Mailing List <io-uring@vger.kernel.org>,
	Bedirhan KURT <windowz414@gnuweeb.org>
Subject: Re: [PATCH v3 RFC liburing 2/4] src/{queue,register,setup}: Don't use `__sys_io_uring*`
Date: Sat,  2 Oct 2021 16:04:48 +0700	[thread overview]
Message-ID: <20211002090448.205625-1-ammar.faizi@students.amikom.ac.id> (raw)
In-Reply-To: <d760c684-8175-6647-01c5-f0107b6685c6@gmail.com>

On Sat, Oct 2, 2021 at 3:12 PM Louvian Lyndal <louvianlyndal@gmail.com> wrote:
>
> On 10/2/21 8:48 AM, Ammar Faizi wrote:
> > @@ -158,7 +142,7 @@ int io_uring_register_files_tags(struct io_uring *ring,
> >               break;
> >       } while (1);
> >  
> > -     return ret < 0 ? -errno : ret;
> > +     return (ret < 0) ? ret : 0;
> >   }
>
> This is wrong, you changed the logic, should've been "return ret;".
> Not all successful call returns 0.
>
> >  
> >   int io_uring_register_files(struct io_uring *ring, const int *files,
> > @@ -167,12 +151,12 @@ int io_uring_register_files(struct io_uring *ring, const int *files,
> >       int ret, did_increase = 0;
> >  
> >       do {
> > -             ret = __sys_io_uring_register(ring->ring_fd,
> > -                                           IORING_REGISTER_FILES, files,
> > -                                           nr_files);
> > +             ret = ____sys_io_uring_register(ring->ring_fd,
> > +                                             IORING_REGISTER_FILES, files,
> > +                                             nr_files);
> >               if (ret >= 0)
> >                       break;
> > -             if (errno == EMFILE && !did_increase) {
> > +             if (ret == -EMFILE && !did_increase) {
> >                       did_increase = 1;
> >                       increase_rlimit_nofile(nr_files);
> >                       continue;
> > @@ -180,55 +164,44 @@ int io_uring_register_files(struct io_uring *ring, const int *files,
> >               break;
> >       } while (1);
> >  
> > -     return ret < 0 ? -errno : ret;
> > +     return (ret < 0) ? ret : 0;
> >   }
>
> The same thing here!
>
> --
> Louvian Lyndal

Ack, that changed the logic. I missed that, will fix this for v4.

Not an excuse, but the test did not fail from my end.

Looking at test/test_update_multiring.c:71 on test_update_multiring():
```
  if (io_uring_register_files(r1, fds, 10) ||
      io_uring_register_files(r2, fds, 10) ||
      io_uring_register_files(r3, fds, 10)) {
        fprintf(stderr, "%s: register files failed\n", __FUNCTION__);
        goto err;
  }
```
Based on this one, this function is expected to return 0. When it
returns non zero value, it will go to err. So it won't really change
the situation.

In anyway, it's a fact that I changed the logic, I admit that and will
get it fixed.

Thanks!

-- 
Ammar Faizi

  reply	other threads:[~2021-10-02  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02  1:48 [PATCHSET v3 RFC liburing 0/4] Implement the kernel style return value Ammar Faizi
2021-10-02  1:48 ` [PATCH v3 RFC liburing 1/4] src/syscall: " Ammar Faizi
2021-10-02  1:48 ` [PATCH v3 RFC liburing 2/4] src/{queue,register,setup}: Don't use `__sys_io_uring*` Ammar Faizi
2021-10-02  8:12   ` Louvian Lyndal
2021-10-02  9:04     ` Ammar Faizi [this message]
2021-10-02  1:48 ` [PATCH v3 RFC liburing 3/4] Wrap all syscalls in a kernel style return value Ammar Faizi
2021-10-02  1:48 ` [PATCH v3 RFC liburing 4/4] src/{queue,register,setup}: Remove `#include <errno.h>` Ammar Faizi

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=20211002090448.205625-1-ammar.faizi@students.amikom.ac.id \
    --to=ammar.faizi@students.amikom.ac.id \
    --cc=ammarfaizi2@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=louvianlyndal@gmail.com \
    --cc=windowz414@gnuweeb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.