Skip to contentSkip to conversation

man2/openat2.2: add RESOLVE_CACHED

PATCH In review Jens Axboe 2 participants 4 messages Feb 21, 2021 – Mar 4, 2021 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH v3 1/1 man2/openat2.2: add RESOLVE_CACHED

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.

---

Since v2:
- Incorporate suggested edits from Michael

man2/openat2.2 +19 -0
index 3bda20620574..a8381c753f0d 100644
@@ -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 .
Signature · 1 line
Jens Axboe
#1 lore raw

Hi Jens,

Quoted 7 lines · Jens Axboe

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.

Is it correct that this feature is now merged?

Cheers,

Michael

Quoted 44 lines

---

Since v2:
- Incorporate suggested edits from Michael

man2/openat2.2 +19 -0
index 3bda20620574..a8381c753f0d 100644
@@ -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 .
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
author
#2 lore raw
Quoted 9 lines · Michael Kerrisk (man-pages)

Hi Jens,

Quoted 6 lines · Jens Axboe

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.

Quoted 3 lines
Quoted 1 line

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

Signature · 1 line
Jens Axboe
#3 lore raw

Hi Jens,

Quoted 10 lines · Jens Axboe
Quoted 9 lines · Michael Kerrisk (man-pages)

Hi Jens,

Quoted 6 lines · Jens Axboe

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.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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

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