From 0d431cf6bd2cb41ec51041f4069711dbf2306d54 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 10 Jul 2022 13:47:33 +0200 Subject: [PATCH] fs: Expand subsection on NFS file delegations. Add some text about leases, the new corteous server feature and directory delegations. --- Filesystems.m4 | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/Filesystems.m4 b/Filesystems.m4 index ca89434..903b0b3 100644 --- a/Filesystems.m4 +++ b/Filesystems.m4 @@ -1316,15 +1316,43 @@ operations. With close-to-open cache consistency the green client is guaranteed to see the write operation of the blue client while there is no such guarantee for the red client.

-SUBSECTION(«Delegations») - -nfs4 introduced a feature called file delegation. A file -delegation allows the client to treat a file temporarily as if no -other client is accessing it. Once a file has been delegated to a -client, the client might cache all write operations for this file, -and only contact the server when memory pressure forces the client -to free memory by writing back file contents. The server notifies -the client if another client attempts to access that file. +SUBSECTION(«File and Directory Delegations») + +

nfs4 introduced a per-file state management feature called +file delegation. Once a file has been delegated to a client, +the server blocks write access to the file for other nfs clients and +for local processes. Therefore the client may assume that the file +does not change unexpectedly. This cache-coherency guarantee can +improve performance because the client may cache all write operations +for this file, and only contact the server when memory pressure forces +the client to free memory by writing back file contents.

+ +

A drawback of file delegations is that they delay conflicting open +requests by other clients because existing delegations must be recalled +before the open request completes. This is particularly important if +an nfs client which is holding a delegation gets disconnected from +the network. To detect this condition, clients report to the server +that they are still alive by periodically sending a RENEW +request. If no such request has arrived for the lease time +(typically 90 seconds), the server may recall any delegations it +has granted to the disconnected client. This allows accesses from +other clients that would normally be prevented because of the +delegation.

+ +

However, the server is not obliged to recall uncontested +delegations for clients whose lease period has expired. In fact, +newer Linux NFS server implementations retain the uncontested +state of unresponsive clients for up to 24 hours. This so-called +courteous server feature was introduced in Linux-5.19 +(released in 2022).

+ +

Let us finally remark that the delegations as discussed above +work only for regular files. NFS versions up to and including 4.0 +do not grant delegations for directories. With nfs4.1 an nfs client +may ask the server to be notified whenever changes are made to the +directory by another client. Among other benefits, this feature allows +for strong directory cache coherency. However, as of 2022, +directory delegations are not yet implemented by Linux.

SUBSECTION(«Silly Renames and Stale File Handles») -- 2.39.2