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.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Jens Axboe 2021-02-21 06:12:31 -07:00 committed by Michael Kerrisk
parent 7f8d77c52b
commit c245512ad0
1 changed files with 19 additions and 0 deletions

View File

@ -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 .