All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] man2/openat2.2: add RESOLVE_CACHED
@ 2021-02-21 13:12 Jens Axboe
  2021-02-22 20:01 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2021-02-21 13:12 UTC (permalink / raw
  To: linux-man, Michael Kerrisk-manpages

RESOLVE_CACHED allows an application to attempt a cache-only open
of a file. If this isn't possible, the request will fail with
-1/EAGAIN and the caller should retry without RESOLVE_CACHED set.
This will generally happen from a different context, where a slower
open operation can be performed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

Since v2:
	- Incorporate suggested edits from Michael

diff --git a/man2/openat2.2 b/man2/openat2.2
index 3bda20620574..a8381c753f0d 100644
--- a/man2/openat2.2
+++ b/man2/openat2.2
@@ -385,6 +385,17 @@ This may occur if, for example,
 a system pathname that is used by an application is modified
 (e.g., in a new distribution release)
 so that a pathname component (now) contains a bind mount.
+.TP
+.B RESOLVE_CACHED
+Make the open operation fail unless all path components are already present
+in the kernel's lookup cache.
+If any kind of revalidation or I/O is needed to satisfy the lookup,
+.BR openat2 ()
+fails with the error
+.B EAGAIN .
+This is useful in providing a fast-path open that can be performed without
+resorting to thread offload, or other mechanisms that an application might
+use to offload slower operations.
 .RE
 .IP
 If any bits other than those listed above are set in
@@ -421,6 +432,14 @@ The caller may choose to retry the
 .BR openat2 ()
 call.
 .TP
+.B EAGAIN
+.BR RESOLVE_CACHED
+was set, and the open operation cannot be performed using only cached
+information. The caller should retry without
+.B RESOLVE_CACHED
+set in
+.I how.resolve .
+.TP
 .B EINVAL
 An unknown flag or invalid value was specified in
 .IR how .

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] man2/openat2.2: add RESOLVE_CACHED
  2021-02-21 13:12 [PATCH v3] man2/openat2.2: add RESOLVE_CACHED Jens Axboe
@ 2021-02-22 20:01 ` Michael Kerrisk (man-pages)
  2021-02-22 20:05   ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-02-22 20:01 UTC (permalink / raw
  To: Jens Axboe, linux-man; +Cc: mtk.manpages

Hi Jens,

On 2/21/21 2:12 PM, Jens Axboe wrote:
> RESOLVE_CACHED allows an application to attempt a cache-only open
> of a file. If this isn't possible, the request will fail with
> -1/EAGAIN and the caller should retry without RESOLVE_CACHED set.
> This will generally happen from a different context, where a slower
> open operation can be performed.
> 
> Signed-off-by: Jens Axboe <axboe@kernel.dk>

Is it correct that this feature is now merged?

Cheers,

Michael

> 
> ---
> 
> Since v2:
> 	- Incorporate suggested edits from Michael
> 
> diff --git a/man2/openat2.2 b/man2/openat2.2
> index 3bda20620574..a8381c753f0d 100644
> --- a/man2/openat2.2
> +++ b/man2/openat2.2
> @@ -385,6 +385,17 @@ This may occur if, for example,
>  a system pathname that is used by an application is modified
>  (e.g., in a new distribution release)
>  so that a pathname component (now) contains a bind mount.
> +.TP
> +.B RESOLVE_CACHED
> +Make the open operation fail unless all path components are already present
> +in the kernel's lookup cache.
> +If any kind of revalidation or I/O is needed to satisfy the lookup,
> +.BR openat2 ()
> +fails with the error
> +.B EAGAIN .
> +This is useful in providing a fast-path open that can be performed without
> +resorting to thread offload, or other mechanisms that an application might
> +use to offload slower operations.
>  .RE
>  .IP
>  If any bits other than those listed above are set in
> @@ -421,6 +432,14 @@ The caller may choose to retry the
>  .BR openat2 ()
>  call.
>  .TP
> +.B EAGAIN
> +.BR RESOLVE_CACHED
> +was set, and the open operation cannot be performed using only cached
> +information. The caller should retry without
> +.B RESOLVE_CACHED
> +set in
> +.I how.resolve .
> +.TP
>  .B EINVAL
>  An unknown flag or invalid value was specified in
>  .IR how .
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] man2/openat2.2: add RESOLVE_CACHED
  2021-02-22 20:01 ` Michael Kerrisk (man-pages)
@ 2021-02-22 20:05   ` Jens Axboe
  2021-03-03 21:09     ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2021-02-22 20:05 UTC (permalink / raw
  To: Michael Kerrisk (man-pages), linux-man

On 2/22/21 1:01 PM, Michael Kerrisk (man-pages) wrote:
> Hi Jens,
> 
> On 2/21/21 2:12 PM, Jens Axboe wrote:
>> RESOLVE_CACHED allows an application to attempt a cache-only open
>> of a file. If this isn't possible, the request will fail with
>> -1/EAGAIN and the caller should retry without RESOLVE_CACHED set.
>> This will generally happen from a different context, where a slower
>> open operation can be performed.
>>
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> Is it correct that this feature is now merged?

Yes, it's in Linus's tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/open.c?id=99668f618062816ca7ba639b007eb145b9d3d41e


-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] man2/openat2.2: add RESOLVE_CACHED
  2021-02-22 20:05   ` Jens Axboe
@ 2021-03-03 21:09     ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-03-03 21:09 UTC (permalink / raw
  To: Jens Axboe, linux-man; +Cc: mtk.manpages

Hi Jens,

On 2/22/21 9:05 PM, Jens Axboe wrote:
> On 2/22/21 1:01 PM, Michael Kerrisk (man-pages) wrote:
>> Hi Jens,
>>
>> On 2/21/21 2:12 PM, Jens Axboe wrote:
>>> RESOLVE_CACHED allows an application to attempt a cache-only open
>>> of a file. If this isn't possible, the request will fail with
>>> -1/EAGAIN and the caller should retry without RESOLVE_CACHED set.
>>> This will generally happen from a different context, where a slower
>>> open operation can be performed.
>>>
>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>> Is it correct that this feature is now merged?
> 
> Yes, it's in Linus's tree:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/open.c?id=99668f618062816ca7ba639b007eb145b9d3d41e

Thanks. Patch applied.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-04  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-21 13:12 [PATCH v3] man2/openat2.2: add RESOLVE_CACHED Jens Axboe
2021-02-22 20:01 ` Michael Kerrisk (man-pages)
2021-02-22 20:05   ` Jens Axboe
2021-03-03 21:09     ` Michael Kerrisk (man-pages)

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.