Skip to content

nfs: NFSv4.2 client support for UNCACHEABLE_FILE_DATA and UNCACHEABLE_DIRENT_METADATA

Mike Snitzer linux-nfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest6 patches 0 repliesNew

Changes in v3 from the cover letter

- Patch 1 (nfs4_fattr_bitmap): place FATTR4_WORD2_UNCACHEABLE_FILE_DATA as the first, unconditional word2 entry and OR in FATTR4_WORD2_SECURITY_LABEL under CONFIG_NFS_V4_SECURITY_LABEL, so the word2 initializer no longer begins with a stray '|' (which fails to build) when CONFIG_NFS_V4_SECURITY_LABEL is disabled.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6nfs4.2: add UNCACHEABLE_FILE_DATA attribute supportfs/nfs/inode.c fs/nfs/nfs4proc.c fs/nfs/nfs4trace.h +5 more+88 -100 replies
2/6nfs4.2: request UNCACHEABLE_FILE_DATA only for regular filesfs/nfs/inode.c fs/nfs/nfs4proc.c+38 -50 replies
3/6nfs4.2: open UNCACHEABLE_FILE_DATA files with O_DIRECTfs/nfs/dir.c fs/nfs/nfs4file.c fs/nfs/nfs4proc.c +1 more+17 -00 replies
4/6nfs4.2: add UNCACHEABLE_DIRENT_METADATA attribute supportfs/nfs/inode.c fs/nfs/nfs4proc.c fs/nfs/nfs4trace.h +4 more+59 -40 replies
5/6nfs4.2: request UNCACHEABLE_DIRENT_METADATA only for directoriesfs/nfs/nfs4proc.c+7 -40 replies
6/6nfs4.2: honor UNCACHEABLE_DIRENT_METADATA by refetching readdirfs/nfs/dir.c fs/nfs/nfstrace.h+17 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/6] nfs: NFSv4.2 client support for UNCACHEABLE_FILE_DATA and UNCACHEABLE_DIRENT_METADATA

This series adds Linux NFSv4.2 client support for two companion, per-object "uncacheable" attributes that let a server advise the client to stop caching state that changes faster than client caches can track:

- UNCACHEABLE_FILE_DATA (FATTR4 87, draft-ietf-nfsv4-uncacheable-files [1]) -- a per-regular-file boolean: suppress caching of the file's data, both write-behind and read caching.

- UNCACHEABLE_DIRENT_METADATA (FATTR4 88, draft-ietf-nfsv4-uncacheable-directories [2]) -- a per-directory
boolean: retrieve directory-entry metadata (names and per-entry size and timestamps) from the server on each READDIR rather than serving it from the client's readdir cache.

Both are OPTIONAL, read-write booleans; the two are independent and apply to disjoint object types (a regular file may carry 87, a directory 88). This client honors a server-set attribute; it does not set either (that is left to server/administrator policy). The motivating deployments expose a single namespace concurrently through NFSv4.2, NFSv3, and SMB, plus server-side policy engines, so file data and directory contents can change faster than a typical client cache lifetime -- producing stale reads and read-modify-write "write holes" for file data, and stale size/timestamp listings for directories.

For UNCACHEABLE_FILE_DATA, a marked regular file is opened O_DIRECT, which suppresses read and write-behind caching and satisfies the spec's durability invariant via the existing direct-I/O path.

For UNCACHEABLE_DIRENT_METADATA, readdir on a marked directory bypasses the readdir cache and refetches from the server, forcing READDIRPLUS so the per-entry attributes the attribute governs (size and timestamps) are refreshed rather than served stale from the inode attribute caches.

Each attribute is requested only for the object type it applies to, since a server must reject a query on any other type with NFS4ERR_INVAL.

The series is organized as:

1/6 decode UNCACHEABLE_FILE_DATA, track per-exported-filesystem
support, and record it on the inode.

  2/6  request UNCACHEABLE_FILE_DATA only for regular files.
  3/6  open uncacheable regular files O_DIRECT.
  4/6  decode UNCACHEABLE_DIRENT_METADATA, track per-exported-filesystem

support, and record it on the inode.
5/6 request UNCACHEABLE_DIRENT_METADATA only for directories. 6/6 honor UNCACHEABLE_DIRENT_METADATA: refetch readdir (forcing
READDIRPLUS) on a marked directory.

[1] https://datatracker.ietf.org/doc/draft-ietf-nfsv4-uncacheable-files/
[2] https://datatracker.ietf.org/doc/draft-ietf-nfsv4-uncacheable-directories/

Changes since v2:
- Patch 1 (nfs4_fattr_bitmap): place FATTR4_WORD2_UNCACHEABLE_FILE_DATA as the first, unconditional word2 entry and OR in FATTR4_WORD2_SECURITY_LABEL under CONFIG_NFS_V4_SECURITY_LABEL, so the word2 initializer no longer begins with a stray '|' (which fails to build) when CONFIG_NFS_V4_SECURITY_LABEL is disabled.

Changes since v1:
- Drop the v1 1/4 xdrgen patch that added Documentation/sunrpc/xdr/ nfs4_2.x and a generated <linux/sunrpc/xdrgen/nfs4_2.h>. Instead open-code FATTR4_UNCACHEABLE_FILE_DATA in <linux/nfs4.h> alongside the other hand-defined FATTR4 protocol-extension constants, and drop the generated NFS4_fattr4_uncacheable_file_data_sz macro (its single XDR word is folded into nfs4_fattr_value_maxsz).
- Store the per-inode flag as a bool bitfield (bool uncacheable_file_data : 1) and simplify the sites that record it.
- Remove stray blank lines introduced in nfs4_atomic_open() and the nfs4trace.h attribute-flags list.
- Add client support for the companion UNCACHEABLE_DIRENT_METADATA attribute, attr 88 (patches 4-6).

Mike Snitzer (5):
nfs4.2: request UNCACHEABLE_FILE_DATA only for regular files nfs4.2: open UNCACHEABLE_FILE_DATA files with O_DIRECT nfs4.2: add UNCACHEABLE_DIRENT_METADATA attribute support nfs4.2: request UNCACHEABLE_DIRENT_METADATA only for directories nfs4.2: honor UNCACHEABLE_DIRENT_METADATA by refetching readdir

Tom Haynes (1):
nfs4.2: add UNCACHEABLE_FILE_DATA attribute support

 fs/nfs/dir.c            | 22 +++++++++++--
 fs/nfs/inode.c          | 32 +++++++++++++++++--
 fs/nfs/nfs4file.c       |  2 ++
 fs/nfs/nfs4proc.c       | 69 +++++++++++++++++++++++++++++++++++++----
 fs/nfs/nfs4trace.h      |  4 ++-
 fs/nfs/nfs4xdr.c        | 64 +++++++++++++++++++++++++++++++++++++-
 fs/nfs/nfstrace.h       |  4 ++-
 include/linux/nfs4.h    | 18 +++++++++++
 include/linux/nfs_fs.h  |  5 +++
 include/linux/nfs_xdr.h | 11 ++++++-
 10 files changed, 216 insertions(+), 15 deletions(-)
Signature · 1 line
2.47.3