RE: [PATCH v4 2/3] fs: openat2: Extend open_how to allow userspace-selected fds
From: David Laight
Date: Sun Apr 19 2020 - 17:18:13 EST
From: Aleksa Sarai
> Sent: 19 April 2020 11:44
>
> On 2020-04-13, Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote:
> > Inspired by the X protocol's handling of XIDs, allow userspace to select
> > the file descriptor opened by openat2, so that it can use the resulting
> > file descriptor in subsequent system calls without waiting for the
> > response to openat2.
> >
> > In io_uring, this allows sequences like openat2/read/close without
> > waiting for the openat2 to complete. Multiple such sequences can
> > overlap, as long as each uses a distinct file descriptor.
>
> I'm not sure I understand this explanation -- how can you trigger a
> syscall with an fd that hasn't yet been registered (unless you're just
> hoping the race goes in your favour)?
I suspect (there are no comments in the io_uring code to say what it does)
that the io_uring code uses a thread of the user process to sequentially
execute IO requests that the main application has added to a queue.
So it might make sense to queue up open/read/close.
But that ought to be within the io_uring code.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)