draft-ietf-nfsv4-rfc3010bis-01.txt   draft-ietf-nfsv4-rfc3010bis-02.txt 
NFS Version 4 Working Group S. Shepler NFS version 4 Working Group S. Shepler
INTERNET-DRAFT Sun Microsystems, Inc. INTERNET-DRAFT Sun Microsystems, Inc.
Document: draft-ietf-nfsv4-rfc3010bis-01.txt C. Beame Document: draft-ietf-nfsv4-rfc3010bis-02.txt C. Beame
Hummingbird Ltd. Hummingbird Ltd.
B. Callaghan B. Callaghan
Sun Microsystems, Inc. Sun Microsystems, Inc.
M. Eisler M. Eisler
Zambeel, Inc. Network Appliance, Inc.
D. Noveck D. Noveck
Network Appliance, Inc. Network Appliance, Inc.
D. Robinson D. Robinson
Sun Microsystems, Inc. Sun Microsystems, Inc.
R. Thurlow R. Thurlow
Sun Microsystems, Inc. Sun Microsystems, Inc.
July 2002 August 2002
NFS version 4 Protocol NFS version 4 Protocol
Status of this Memo Status of this Memo
This document is an Internet-Draft and is in full conformance with This document is an Internet-Draft and is in full conformance with
all provisions of Section 10 of RFC2026. all provisions of Section 10 of RFC2026.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
skipping to change at page 2, line 5 skipping to change at page 2, line 5
http://www.ietf.org/ietf/1id-abstracts.txt http://www.ietf.org/ietf/1id-abstracts.txt
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
Abstract Abstract
NFS version 4 is a distributed file system protocol which owes NFS version 4 is a distributed file system protocol which owes
heritage to NFS protocol versions 2 [RFC1094] and 3 [RFC1813]. heritage to NFS protocol versions 2 [RFC1094] and 3 [RFC1813].
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
Unlike earlier versions, the NFS version 4 protocol supports Unlike earlier versions, the NFS version 4 protocol supports
traditional file access while integrating support for file locking traditional file access while integrating support for file locking
and the mount protocol. In addition, support for strong security and the mount protocol. In addition, support for strong security
(and its negotiation), compound operations, client caching, and (and its negotiation), compound operations, client caching, and
internationalization have been added. Of course, attention has been internationalization have been added. Of course, attention has been
applied to making NFS version 4 operate well in an Internet applied to making NFS version 4 operate well in an Internet
environment. environment.
Copyright Copyright
Copyright (C) The Internet Society (2000-2002). All Rights Reserved. Copyright (C) The Internet Society (2000-2002). All Rights Reserved.
Key Words Key Words
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119. document are to be interpreted as described in [RFC2119].
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1. Overview of NFS Version 4 Features . . . . . . . . . . . . 7 1.1. Inconsistencies of this Document with Section 18 . . . . . 7
1.1.1. RPC and Security . . . . . . . . . . . . . . . . . . . . 8 1.2. Overview of NFS version 4 Features . . . . . . . . . . . . 8
1.1.2. Procedure and Operation Structure . . . . . . . . . . . 8 1.2.1. RPC and Security . . . . . . . . . . . . . . . . . . . . 8
1.1.3. File System Model . . . . . . . . . . . . . . . . . . . 9 1.2.2. Procedure and Operation Structure . . . . . . . . . . . 8
1.1.3.1. Filehandle Types . . . . . . . . . . . . . . . . . . . 9 1.2.3. Filesystem Model . . . . . . . . . . . . . . . . . . . . 9
1.1.3.2. Attribute Types . . . . . . . . . . . . . . . . . . . 9 1.2.3.1. Filehandle Types . . . . . . . . . . . . . . . . . . . 9
1.1.3.3. File System Replication and Migration . . . . . . . 10 1.2.3.2. Attribute Types . . . . . . . . . . . . . . . . . . 10
1.1.4. OPEN and CLOSE . . . . . . . . . . . . . . . . . . . . 10 1.2.3.3. Filesystem Replication and Migration . . . . . . . . 10
1.1.5. File locking . . . . . . . . . . . . . . . . . . . . . 10 1.2.4. OPEN and CLOSE . . . . . . . . . . . . . . . . . . . . 11
1.1.6. Client Caching and Delegation . . . . . . . . . . . . 11 1.2.5. File locking . . . . . . . . . . . . . . . . . . . . . 11
1.2. General Definitions . . . . . . . . . . . . . . . . . . 12 1.2.6. Client Caching and Delegation . . . . . . . . . . . . 11
1.3. General Definitions . . . . . . . . . . . . . . . . . . 12
2. Protocol Data Types . . . . . . . . . . . . . . . . . . . 14 2. Protocol Data Types . . . . . . . . . . . . . . . . . . . 14
2.1. Basic Data Types . . . . . . . . . . . . . . . . . . . . 14 2.1. Basic Data Types . . . . . . . . . . . . . . . . . . . . 14
2.2. Structured Data Types . . . . . . . . . . . . . . . . . 15 2.2. Structured Data Types . . . . . . . . . . . . . . . . . 15
3. RPC and Security Flavor . . . . . . . . . . . . . . . . . 20 3. RPC and Security Flavor . . . . . . . . . . . . . . . . . 21
3.1. Ports and Transports . . . . . . . . . . . . . . . . . . 20 3.1. Ports and Transports . . . . . . . . . . . . . . . . . . 21
3.2. Security Flavors . . . . . . . . . . . . . . . . . . . . 20 3.1.1. Client Retransmission Behavior . . . . . . . . . . . . 21
3.2.1. Security mechanisms for NFS version 4 . . . . . . . . 20 3.2. Security Flavors . . . . . . . . . . . . . . . . . . . . 22
3.2.1.1. Kerberos V5 as security triple . . . . . . . . . . . 21 3.2.1. Security mechanisms for NFS version 4 . . . . . . . . 22
3.2.1.2. LIPKEY as a security triple . . . . . . . . . . . . 21 3.2.1.1. Kerberos V5 as a security triple . . . . . . . . . . 22
3.2.1.3. SPKM-3 as a security triple . . . . . . . . . . . . 22 3.2.1.2. LIPKEY as a security triple . . . . . . . . . . . . 23
3.3. Security Negotiation . . . . . . . . . . . . . . . . . . 23 3.2.1.3. SPKM-3 as a security triple . . . . . . . . . . . . 24
3.3.1. Security Error . . . . . . . . . . . . . . . . . . . . 23 3.3. Security Negotiation . . . . . . . . . . . . . . . . . . 24
3.3.2. SECINFO . . . . . . . . . . . . . . . . . . . . . . . 23 3.3.1. SECINFO . . . . . . . . . . . . . . . . . . . . . . . 25
3.4. Callback RPC Authentication . . . . . . . . . . . . . . 23 3.3.2. Security Error . . . . . . . . . . . . . . . . . . . . 25
4. Filehandles . . . . . . . . . . . . . . . . . . . . . . . 26 3.4. Callback RPC Authentication . . . . . . . . . . . . . . 25
4.1. Obtaining the First Filehandle . . . . . . . . . . . . . 26 4. Filehandles . . . . . . . . . . . . . . . . . . . . . . . 28
4.1.1. Root Filehandle . . . . . . . . . . . . . . . . . . . 26 4.1. Obtaining the First Filehandle . . . . . . . . . . . . . 28
4.1.2. Public Filehandle . . . . . . . . . . . . . . . . . . 27 4.1.1. Root Filehandle . . . . . . . . . . . . . . . . . . . 28
4.2. Filehandle Types . . . . . . . . . . . . . . . . . . . . 27 4.1.2. Public Filehandle . . . . . . . . . . . . . . . . . . 28
4.2.1. General Properties of a Filehandle . . . . . . . . . . 27 4.2. Filehandle Types . . . . . . . . . . . . . . . . . . . . 29
4.2.2. Persistent Filehandle . . . . . . . . . . . . . . . . 28 4.2.1. General Properties of a Filehandle . . . . . . . . . . 29
4.2.3. Volatile Filehandle . . . . . . . . . . . . . . . . . 28 4.2.2. Persistent Filehandle . . . . . . . . . . . . . . . . 30
4.2.4. One Method of Constructing a Volatile Filehandle . . . 30 4.2.3. Volatile Filehandle . . . . . . . . . . . . . . . . . 30
4.3. Client Recovery from Filehandle Expiration . . . . . . . 30 4.2.4. One Method of Constructing a Volatile Filehandle . . . 31
5. File Attributes . . . . . . . . . . . . . . . . . . . . . 32 4.3. Client Recovery from Filehandle Expiration . . . . . . . 32
5.1. Mandatory Attributes . . . . . . . . . . . . . . . . . . 33 5. File Attributes . . . . . . . . . . . . . . . . . . . . . 34
5.2. Recommended Attributes . . . . . . . . . . . . . . . . . 33 5.1. Mandatory Attributes . . . . . . . . . . . . . . . . . . 35
5.3. Named Attributes . . . . . . . . . . . . . . . . . . . . 33 5.2. Recommended Attributes . . . . . . . . . . . . . . . . . 35
5.4. Mandatory Attributes - Definitions . . . . . . . . . . . 35 5.3. Named Attributes . . . . . . . . . . . . . . . . . . . . 35
5.5. Recommended Attributes - Definitions . . . . . . . . . . 37 5.4. Classification of Attributes . . . . . . . . . . . . . . 36
5.6. Interpreting owner and owner_group . . . . . . . . . . . 41 5.5. Mandatory Attributes - Definitions . . . . . . . . . . . 38
5.7. Character Case Attributes . . . . . . . . . . . . . . . 43 5.6. Recommended Attributes - Definitions . . . . . . . . . . 40
5.8. Quota Attributes . . . . . . . . . . . . . . . . . . . . 43 5.7. Time Access . . . . . . . . . . . . . . . . . . . . . . 45
5.9. Access Control Lists . . . . . . . . . . . . . . . . . . 44 5.8. Interpreting owner and owner_group . . . . . . . . . . . 45
5.9.1. ACE type . . . . . . . . . . . . . . . . . . . . . . . 45 5.9. Character Case Attributes . . . . . . . . . . . . . . . 47
5.9.2. ACE flag . . . . . . . . . . . . . . . . . . . . . . . 45 5.10. Quota Attributes . . . . . . . . . . . . . . . . . . . 47
5.9.3. ACE Access Mask . . . . . . . . . . . . . . . . . . . 47 5.11. Access Control Lists . . . . . . . . . . . . . . . . . 48
5.9.4. ACE who . . . . . . . . . . . . . . . . . . . . . . . 48
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
6. File System Migration and Replication . . . . . . . . . . 49 5.11.1. ACE type . . . . . . . . . . . . . . . . . . . . . . 49
6.1. Replication . . . . . . . . . . . . . . . . . . . . . . 49 5.11.2. ACE Access Mask . . . . . . . . . . . . . . . . . . . 50
6.2. Migration . . . . . . . . . . . . . . . . . . . . . . . 49 5.11.3. ACE flag . . . . . . . . . . . . . . . . . . . . . . 52
6.3. Interpretation of the fs_locations Attribute . . . . . . 50 5.11.4. ACE who . . . . . . . . . . . . . . . . . . . . . . . 53
6.4. Filehandle Recovery for Migration or Replication . . . . 51 5.11.5. Mode Attribute . . . . . . . . . . . . . . . . . . . 54
7. NFS Server Name Space . . . . . . . . . . . . . . . . . . 52 5.11.6. Mode and ACL Attribute . . . . . . . . . . . . . . . 55
7.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 52 5.11.7. mounted_on_fileid . . . . . . . . . . . . . . . . . . 55
7.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 52 6. Filesystem Migration and Replication . . . . . . . . . . . 57
7.3. Server Pseudo File System . . . . . . . . . . . . . . . 52 6.1. Replication . . . . . . . . . . . . . . . . . . . . . . 57
7.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 53 6.2. Migration . . . . . . . . . . . . . . . . . . . . . . . 57
7.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 53 6.3. Interpretation of the fs_locations Attribute . . . . . . 58
7.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 53 6.4. Filehandle Recovery for Migration or Replication . . . . 59
7.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 54 7. NFS Server Name Space . . . . . . . . . . . . . . . . . . 60
7.8. Security Policy and Name Space Presentation . . . . . . 54 7.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 60
8. File Locking and Share Reservations . . . . . . . . . . . 55 7.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 60
8.1. Locking . . . . . . . . . . . . . . . . . . . . . . . . 55 7.3. Server Pseudo Filesystem . . . . . . . . . . . . . . . . 60
8.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . . 55 7.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 61
8.1.2. Server Release of Clientid . . . . . . . . . . . . . . 57 7.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 61
8.1.3. nfs_lockowner and stateid Definition . . . . . . . . . 58 7.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 61
8.1.4. Use of the stateid . . . . . . . . . . . . . . . . . . 59 7.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 62
8.1.5. Sequencing of Lock Requests . . . . . . . . . . . . . 60 7.8. Security Policy and Name Space Presentation . . . . . . 62
8.1.6. Recovery from Replayed Requests . . . . . . . . . . . 61 8. File Locking and Share Reservations . . . . . . . . . . . 64
8.1.7. Releasing nfs_lockowner State . . . . . . . . . . . . 61 8.1. Locking . . . . . . . . . . . . . . . . . . . . . . . . 64
8.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 62 8.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . . 64
8.3. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 62 8.1.2. Server Release of Clientid . . . . . . . . . . . . . . 67
8.4. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 63 8.1.3. lock_owner and stateid Definition . . . . . . . . . . 68
8.5. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 64 8.1.4. Use of the stateid and Locking . . . . . . . . . . . . 69
8.5.1. Client Failure and Recovery . . . . . . . . . . . . . 64 8.1.5. Sequencing of Lock Requests . . . . . . . . . . . . . 71
8.5.2. Server Failure and Recovery . . . . . . . . . . . . . 65 8.1.6. Recovery from Replayed Requests . . . . . . . . . . . 72
8.5.3. Network Partitions and Recovery . . . . . . . . . . . 66 8.1.7. Releasing lock_owner State . . . . . . . . . . . . . . 72
8.6. Recovery from a Lock Request Timeout or Abort . . . . . 67 8.1.8. Use of Open Confirmation . . . . . . . . . . . . . . . 73
8.7. Server Revocation of Locks . . . . . . . . . . . . . . . 68 8.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 74
8.8. Share Reservations . . . . . . . . . . . . . . . . . . . 69 8.3. Upgrading and Downgrading Locks . . . . . . . . . . . . 74
8.9. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 69 8.4. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 75
8.10. Open Upgrade and Downgrade . . . . . . . . . . . . . . 70 8.5. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 75
8.11. Short and Long Leases . . . . . . . . . . . . . . . . . 71 8.6. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 76
8.12. Clocks and Calculating Lease Expiration . . . . . . . . 71 8.6.1. Client Failure and Recovery . . . . . . . . . . . . . 76
8.13. Migration, Replication and State . . . . . . . . . . . 71 8.6.2. Server Failure and Recovery . . . . . . . . . . . . . 77
8.13.1. Migration and State . . . . . . . . . . . . . . . . . 72 8.6.3. Network Partitions and Recovery . . . . . . . . . . . 79
8.13.2. Replication and State . . . . . . . . . . . . . . . . 72 8.7. Recovery from a Lock Request Timeout or Abort . . . . . 80
8.13.3. Notification of Migrated Lease . . . . . . . . . . . 73 8.8. Server Revocation of Locks . . . . . . . . . . . . . . . 80
9. Client-Side Caching . . . . . . . . . . . . . . . . . . . 74 8.9. Share Reservations . . . . . . . . . . . . . . . . . . . 81
9.1. Performance Challenges for Client-Side Caching . . . . . 74 8.10. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 82
9.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 75 8.10.1. Close and Retention of State Information . . . . . . 83
9.2.1. Delegation Recovery . . . . . . . . . . . . . . . . . 76 8.11. Open Upgrade and Downgrade . . . . . . . . . . . . . . 83
9.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 78 8.12. Short and Long Leases . . . . . . . . . . . . . . . . . 84
9.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . . 78 8.13. Clocks, Propagation Delay, and Calculating Lease
9.3.2. Data Caching and File Locking . . . . . . . . . . . . 79 Expiration . . . . . . . . . . . . . . . . . . . . . . 84
9.3.3. Data Caching and Mandatory File Locking . . . . . . . 80 8.14. Migration, Replication and State . . . . . . . . . . . 85
9.3.4. Data Caching and File Identity . . . . . . . . . . . . 81 8.14.1. Migration and State . . . . . . . . . . . . . . . . . 85
9.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 82 8.14.2. Replication and State . . . . . . . . . . . . . . . . 86
9.4.1. Open Delegation and Data Caching . . . . . . . . . . . 84 8.14.3. Notification of Migrated Lease . . . . . . . . . . . 86
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
9.4.2. Open Delegation and File Locks . . . . . . . . . . . . 85 8.14.4. Migration and the Lease_time Attribute . . . . . . . 87
9.4.3. Recall of Open Delegation . . . . . . . . . . . . . . 85 9. Client-Side Caching . . . . . . . . . . . . . . . . . . . 88
9.4.4. Delegation Revocation . . . . . . . . . . . . . . . . 87 9.1. Performance Challenges for Client-Side Caching . . . . . 88
9.5. Data Caching and Revocation . . . . . . . . . . . . . . 87 9.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 89
9.5.1. Revocation Recovery for Write Open Delegation . . . . 88 9.2.1. Delegation Recovery . . . . . . . . . . . . . . . . . 90
9.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 89 9.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 92
9.7. Name Caching . . . . . . . . . . . . . . . . . . . . . . 90 9.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . . 92
9.8. Directory Caching . . . . . . . . . . . . . . . . . . . 91 9.3.2. Data Caching and File Locking . . . . . . . . . . . . 93
10. Minor Versioning . . . . . . . . . . . . . . . . . . . . 93 9.3.3. Data Caching and Mandatory File Locking . . . . . . . 95
11. Internationalization . . . . . . . . . . . . . . . . . . 96 9.3.4. Data Caching and File Identity . . . . . . . . . . . . 95
11.1. Universal Versus Local Character Sets . . . . . . . . . 96 9.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 96
11.2. Overview of Universal Character Set Standards . . . . . 97 9.4.1. Open Delegation and Data Caching . . . . . . . . . . . 99
11.3. Difficulties with UCS-4, UCS-2, Unicode . . . . . . . . 98 9.4.2. Open Delegation and File Locks . . . . . . . . . . . . 100
11.4. UTF-8 and its solutions . . . . . . . . . . . . . . . . 98 9.4.3. Handling of CB_GETATTR . . . . . . . . . . . . . . . . 100
11.5. Normalization . . . . . . . . . . . . . . . . . . . . . 99 9.4.4. Recall of Open Delegation . . . . . . . . . . . . . . 102
12. Error Definitions . . . . . . . . . . . . . . . . . . . . 100 9.4.5. Delegation Revocation . . . . . . . . . . . . . . . . 104
13. NFS Version 4 Requests . . . . . . . . . . . . . . . . . 105 9.5. Data Caching and Revocation . . . . . . . . . . . . . . 104
13.1. Compound Procedure . . . . . . . . . . . . . . . . . . 105 9.5.1. Revocation Recovery for Write Open Delegation . . . . 104
13.2. Evaluation of a Compound Request . . . . . . . . . . . 106 9.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 105
13.3. Synchronous Modifying Operations . . . . . . . . . . . 106 9.7. Name Caching . . . . . . . . . . . . . . . . . . . . . . 107
13.4. Operation Values . . . . . . . . . . . . . . . . . . . 107 9.8. Directory Caching . . . . . . . . . . . . . . . . . . . 108
14. NFS Version 4 Procedures . . . . . . . . . . . . . . . . 108 10. Minor Versioning . . . . . . . . . . . . . . . . . . . . 110
14.1. Procedure 0: NULL - No Operation . . . . . . . . . . . 108 11. Internationalization . . . . . . . . . . . . . . . . . . 113
14.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 109 11.1. Universal Versus Local Character Sets . . . . . . . . . 113
14.2.1. Operation 3: ACCESS - Check Access Rights . . . . . . 112 11.2. Overview of Universal Character Set Standards . . . . . 114
14.2.2. Operation 4: CLOSE - Close File . . . . . . . . . . . 115 11.3. Difficulties with UCS-4, UCS-2, Unicode . . . . . . . . 115
14.2.3. Operation 5: COMMIT - Commit Cached Data . . . . . . 117 11.4. UTF-8 and its solutions . . . . . . . . . . . . . . . . 115
14.2.4. Operation 6: CREATE - Create a Non-Regular File Object 120 11.5. Normalization . . . . . . . . . . . . . . . . . . . . . 116
11.6. UTF-8 Related Errors . . . . . . . . . . . . . . . . . 116
12. Error Definitions . . . . . . . . . . . . . . . . . . . . 118
13. NFS version 4 Requests . . . . . . . . . . . . . . . . . 124
13.1. Compound Procedure . . . . . . . . . . . . . . . . . . 124
13.2. Evaluation of a Compound Request . . . . . . . . . . . 125
13.3. Synchronous Modifying Operations . . . . . . . . . . . 125
13.4. Operation Values . . . . . . . . . . . . . . . . . . . 126
14. NFS version 4 Procedures . . . . . . . . . . . . . . . . 127
14.1. Procedure 0: NULL - No Operation . . . . . . . . . . . 127
14.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 128
14.2.1. Operation 3: ACCESS - Check Access Rights . . . . . . 131
14.2.2. Operation 4: CLOSE - Close File . . . . . . . . . . . 134
14.2.3. Operation 5: COMMIT - Commit Cached Data . . . . . . 136
14.2.4. Operation 6: CREATE - Create a Non-Regular File Object 139
14.2.5. Operation 7: DELEGPURGE - Purge Delegations Awaiting 14.2.5. Operation 7: DELEGPURGE - Purge Delegations Awaiting
Recovery . . . . . . . . . . . . . . . . . . . . . . 123 Recovery . . . . . . . . . . . . . . . . . . . . . . 142
14.2.6. Operation 8: DELEGRETURN - Return Delegation . . . . 124 14.2.6. Operation 8: DELEGRETURN - Return Delegation . . . . 143
14.2.7. Operation 9: GETATTR - Get Attributes . . . . . . . . 125 14.2.7. Operation 9: GETATTR - Get Attributes . . . . . . . . 144
14.2.8. Operation 10: GETFH - Get Current Filehandle . . . . 127 14.2.8. Operation 10: GETFH - Get Current Filehandle . . . . 146
14.2.9. Operation 11: LINK - Create Link to a File . . . . . 129 14.2.9. Operation 11: LINK - Create Link to a File . . . . . 148
14.2.10. Operation 12: LOCK - Create Lock . . . . . . . . . . 131 14.2.10. Operation 12: LOCK - Create Lock . . . . . . . . . . 150
14.2.11. Operation 13: LOCKT - Test For Lock . . . . . . . . 134 14.2.11. Operation 13: LOCKT - Test For Lock . . . . . . . . 154
14.2.12. Operation 14: LOCKU - Unlock File . . . . . . . . . 136 14.2.12. Operation 14: LOCKU - Unlock File . . . . . . . . . 156
14.2.13. Operation 15: LOOKUP - Lookup Filename . . . . . . . 138 14.2.13. Operation 15: LOOKUP - Lookup Filename . . . . . . . 158
14.2.14. Operation 16: LOOKUPP - Lookup Parent Directory . . 141
14.2.15. Operation 17: NVERIFY - Verify Difference in
Attributes . . . . . . . . . . . . . . . . . . . . . 143
14.2.16. Operation 18: OPEN - Open a Regular File . . . . . . 145
14.2.17. Operation 19: OPENATTR - Open Named Attribute
Directory . . . . . . . . . . . . . . . . . . . . . 154
14.2.18. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . 156
14.2.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access159
14.2.20. Operation 22: PUTFH - Set Current Filehandle . . . . 161
14.2.21. Operation 23: PUTPUBFH - Set Public Filehandle . . . 162
14.2.22. Operation 24: PUTROOTFH - Set Root Filehandle . . . 164
14.2.23. Operation 25: READ - Read from File . . . . . . . . 165
14.2.24. Operation 26: READDIR - Read Directory . . . . . . . 168
14.2.25. Operation 27: READLINK - Read Symbolic Link . . . . 172
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
14.2.26. Operation 28: REMOVE - Remove Filesystem Object . . 174 14.2.14. Operation 16: LOOKUPP - Lookup Parent Directory . . 161
14.2.27. Operation 29: RENAME - Rename Directory Entry . . . 176 14.2.15. Operation 17: NVERIFY - Verify Difference in
14.2.28. Operation 30: RENEW - Renew a Lease . . . . . . . . 179 Attributes . . . . . . . . . . . . . . . . . . . . . 162
14.2.29. Operation 31: RESTOREFH - Restore Saved Filehandle . 180 14.2.16. Operation 18: OPEN - Open a Regular File . . . . . . 164
14.2.30. Operation 32: SAVEFH - Save Current Filehandle . . . 182 14.2.17. Operation 19: OPENATTR - Open Named Attribute
14.2.31. Operation 33: SECINFO - Obtain Available Security . 183 Directory . . . . . . . . . . . . . . . . . . . . . 174
14.2.32. Operation 34: SETATTR - Set Attributes . . . . . . . 186 14.2.18. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . 176
14.2.33. Operation 35: SETCLIENTID - Negotiate Clientid . . . 189 14.2.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access179
14.2.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Clientid 191 14.2.20. Operation 22: PUTFH - Set Current Filehandle . . . . 181
14.2.35. Operation 37: VERIFY - Verify Same Attributes . . . 192 14.2.21. Operation 23: PUTPUBFH - Set Public Filehandle . . . 182
14.2.36. Operation 38: WRITE - Write to File . . . . . . . . 194 14.2.22. Operation 24: PUTROOTFH - Set Root Filehandle . . . 184
14.2.23. Operation 25: READ - Read from File . . . . . . . . 185
14.2.24. Operation 26: READDIR - Read Directory . . . . . . . 188
14.2.25. Operation 27: READLINK - Read Symbolic Link . . . . 192
14.2.26. Operation 28: REMOVE - Remove Filesystem Object . . 194
14.2.27. Operation 29: RENAME - Rename Directory Entry . . . 197
14.2.28. Operation 30: RENEW - Renew a Lease . . . . . . . . 200
14.2.29. Operation 31: RESTOREFH - Restore Saved Filehandle . 201
14.2.30. Operation 32: SAVEFH - Save Current Filehandle . . . 203
14.2.31. Operation 33: SECINFO - Obtain Available Security . 204
14.2.32. Operation 34: SETATTR - Set Attributes . . . . . . . 208
14.2.33. Operation 35: SETCLIENTID - Negotiate Clientid . . . 211
14.2.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Clientid 215
14.2.35. Operation 37: VERIFY - Verify Same Attributes . . . 219
14.2.36. Operation 38: WRITE - Write to File . . . . . . . . 221
14.2.37. Operation 39: RELEASE_LOCKOWNER - Release Lockowner 14.2.37. Operation 39: RELEASE_LOCKOWNER - Release Lockowner
State . . . . . . . . . . . . . . . . . . . . . . . 198 State . . . . . . . . . . . . . . . . . . . . . . . 226
15. NFS Version 4 Callback Procedures . . . . . . . . . . . . 199 14.2.38. Operation 10044: ILLEGAL - Illegal operation . . . . 228
15.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 199 15. NFS version 4 Callback Procedures . . . . . . . . . . . . 229
15.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . 200 15.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 229
15.2.1. Operation 3: CB_GETATTR - Get Attributes . . . . . . 202 15.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . 230
15.2.2. Operation 4: CB_RECALL - Recall an Open Delegation . 203 15.2.1. Operation 3: CB_GETATTR - Get Attributes . . . . . . 232
16. Security Considerations . . . . . . . . . . . . . . . . . 205 15.2.2. Operation 4: CB_RECALL - Recall an Open Delegation . 234
17. IANA Considerations . . . . . . . . . . . . . . . . . . . 206 15.2.3. Operation 10044: CB_ILLEGAL - Illegal Callback
17.1. Named Attribute Definition . . . . . . . . . . . . . . 206 Operation . . . . . . . . . . . . . . . . . . . . . . 236
18. RPC definition file . . . . . . . . . . . . . . . . . . . 207 16. Security Considerations . . . . . . . . . . . . . . . . . 237
19. Bibliography . . . . . . . . . . . . . . . . . . . . . . 238 17. IANA Considerations . . . . . . . . . . . . . . . . . . . 238
20. Authors . . . . . . . . . . . . . . . . . . . . . . . . . 243 17.1. Named Attribute Definition . . . . . . . . . . . . . . 238
20.1. Editor's Address . . . . . . . . . . . . . . . . . . . 243 17.2. ONC RPC Network Identifiers (netids) . . . . . . . . . 238
20.2. Authors' Addresses . . . . . . . . . . . . . . . . . . 243 18. RPC definition file . . . . . . . . . . . . . . . . . . . 239
20.3. Acknowledgements . . . . . . . . . . . . . . . . . . . 244 19. Bibliography . . . . . . . . . . . . . . . . . . . . . . 271
21. Full Copyright Statement . . . . . . . . . . . . . . . . 245 20. Authors . . . . . . . . . . . . . . . . . . . . . . . . . 277
20.1. Editor's Address . . . . . . . . . . . . . . . . . . . 277
20.2. Authors' Addresses . . . . . . . . . . . . . . . . . . 277
20.3. Acknowledgements . . . . . . . . . . . . . . . . . . . 278
21. Full Copyright Statement . . . . . . . . . . . . . . . . 279
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
1. Introduction 1. Introduction
The NFS version 4 protocol is a further revision of the NFS protocol The NFS version 4 protocol is a further revision of the NFS protocol
defined already by versions 2 [RFC1094] and 3 [RFC1813]. It retains defined already by versions 2 [RFC1094] and 3 [RFC1813]. It retains
the essential characteristics of previous versions: design for easy the essential characteristics of previous versions: design for easy
recovery, independent of transport protocols, operating systems and recovery, independent of transport protocols, operating systems and
filesystems, simplicity, and good performance. The NFS version 4 filesystems, simplicity, and good performance. The NFS version 4
revision has the following goals: revision has the following goals:
skipping to change at page 7, line 32 skipping to change at page 7, line 32
o Strong security with negotiation built into the protocol. o Strong security with negotiation built into the protocol.
The protocol builds on the work of the ONCRPC working group in The protocol builds on the work of the ONCRPC working group in
supporting the RPCSEC_GSS protocol. Additionally, the NFS supporting the RPCSEC_GSS protocol. Additionally, the NFS
version 4 protocol provides a mechanism to allow clients and version 4 protocol provides a mechanism to allow clients and
servers the ability to negotiate security and require clients servers the ability to negotiate security and require clients
and servers to support a minimal set of security schemes. and servers to support a minimal set of security schemes.
o Good cross-platform interoperability. o Good cross-platform interoperability.
The protocol features a file system model that provides a The protocol features a filesystem model that provides a useful,
useful, common set of features that does not unduly favor one common set of features that does not unduly favor one filesystem
file system or operating system over another. or operating system over another.
o Designed for protocol extensions. o Designed for protocol extensions.
The protocol is designed to accept standard extensions that do The protocol is designed to accept standard extensions that do
not compromise backward compatibility. not compromise backward compatibility.
1.1. Overview of NFS Version 4 Features 1.1. Inconsistencies of this Document with Section 18
Section 18, RPC Definition File, contains the definitions in XDR
description language of the constructs used by the protocol. Prior
to Section 18, several of the constructs are reproduced for purposes
of explanation. The reader is warned of the possibility of errors in
the reproduced constructs outside of Section 18. For any part of the
document that is inconsistent with Section 18, Section 18 is to be
considered authoritative.
Draft Specification NFS version 4 Protocol August 2002
1.2. Overview of NFS version 4 Features
To provide a reasonable context for the reader, the major features of To provide a reasonable context for the reader, the major features of
NFS version 4 protocol will be reviewed in brief. This will be done NFS version 4 protocol will be reviewed in brief. This will be done
to provide an appropriate context for both the reader who is familiar to provide an appropriate context for both the reader who is familiar
with the previous versions of the NFS protocol and the reader that is with the previous versions of the NFS protocol and the reader that is
new to the NFS protocols. For the reader new to the NFS protocols, new to the NFS protocols. For the reader new to the NFS protocols,
there is still a fundamental knowledge that is expected. The reader there is still a fundamental knowledge that is expected. The reader
should be familiar with the XDR and RPC protocols as described in should be familiar with the XDR and RPC protocols as described in
[RFC1831] and [RFC1832]. A basic knowledge of file systems and [RFC1831] and [RFC1832]. A basic knowledge of file systems and
distributed file systems is expected as well. distributed file systems is expected as well.
Draft Specification NFS version 4 Protocol July 2002 1.2.1. RPC and Security
1.1.1. RPC and Security
As with previous versions of NFS, the External Data Representation As with previous versions of NFS, the External Data Representation
(XDR) and Remote Procedure Call (RPC) mechanisms used for the NFS (XDR) and Remote Procedure Call (RPC) mechanisms used for the NFS
version 4 protocol are those defined in [RFC1831] and [RFC1832]. To version 4 protocol are those defined in [RFC1831] and [RFC1832]. To
meet end to end security requirements, the RPCSEC_GSS framework meet end to end security requirements, the RPCSEC_GSS framework
[RFC2203] will be used to extend the basic RPC security. With the [RFC2203] will be used to extend the basic RPC security. With the
use of RPCSEC_GSS, various mechanisms can be provided to offer use of RPCSEC_GSS, various mechanisms can be provided to offer
authentication, integrity, and privacy to the NFS version 4 protocol. authentication, integrity, and privacy to the NFS version 4 protocol.
Kerberos V5 will be used as described in [RFC1964] to provide one Kerberos V5 will be used as described in [RFC1964] to provide one
security framework. The LIPKEY GSS-API mechanism described in security framework. The LIPKEY GSS-API mechanism described in
skipping to change at page 8, line 31 skipping to change at page 8, line 43
version 4 security. version 4 security.
To enable in-band security negotiation, the NFS version 4 protocol To enable in-band security negotiation, the NFS version 4 protocol
has added a new operation which provides the client a method of has added a new operation which provides the client a method of
querying the server about its policies regarding which security querying the server about its policies regarding which security
mechanisms must be used for access to the server's file system mechanisms must be used for access to the server's file system
resources. With this, the client can securely match the security resources. With this, the client can securely match the security
mechanism that meets the policies specified at both the client and mechanism that meets the policies specified at both the client and
server. server.
1.1.2. Procedure and Operation Structure 1.2.2. Procedure and Operation Structure
A significant departure from the previous versions of the NFS A significant departure from the previous versions of the NFS
protocol is the introduction of the COMPOUND procedure. For the NFS protocol is the introduction of the COMPOUND procedure. For the NFS
version 4 protocol, there are two RPC procedures, NULL and COMPOUND. version 4 protocol, there are two RPC procedures, NULL and COMPOUND.
The COMPOUND procedure is defined in terms of operations and these The COMPOUND procedure is defined in terms of operations and these
operations correspond more closely to the traditional NFS procedures. operations correspond more closely to the traditional NFS procedures.
With the use of the COMPOUND procedure, the client is able to build With the use of the COMPOUND procedure, the client is able to build
simple or complex requests. These COMPOUND requests allow for a simple or complex requests. These COMPOUND requests allow for a
reduction in the number of RPCs needed for logical file system reduction in the number of RPCs needed for logical file system
operations. For example, without previous contact with a server a operations. For example, without previous contact with a server a
client will be able to read data from a file in one request by client will be able to read data from a file in one request by
combining LOOKUP, OPEN, and READ operations in a single COMPOUND RPC. combining LOOKUP, OPEN, and READ operations in a single COMPOUND RPC.
With previous versions of the NFS protocol, this type of single With previous versions of the NFS protocol, this type of single
Draft Specification NFS version 4 Protocol August 2002
request was not possible. request was not possible.
The model used for COMPOUND is very simple. There is no logical OR The model used for COMPOUND is very simple. There is no logical OR
or ANDing of operations. The operations combined within a COMPOUND or ANDing of operations. The operations combined within a COMPOUND
request are evaluated in order by the server. Once an operation request are evaluated in order by the server. Once an operation
returns a failing result, the evaluation ends and the results of all returns a failing result, the evaluation ends and the results of all
evaluated operations are returned to the client. evaluated operations are returned to the client.
The NFS version 4 protocol continues to have the client refer to a The NFS version 4 protocol continues to have the client refer to a
file or directory at the server by a "filehandle". The COMPOUND file or directory at the server by a "filehandle". The COMPOUND
procedure has a method of passing a filehandle from one operation to procedure has a method of passing a filehandle from one operation to
another within the sequence of operations. There is a concept of a another within the sequence of operations. There is a concept of a
"current filehandle" and "saved filehandle". Most operations use the "current filehandle" and "saved filehandle". Most operations use the
Draft Specification NFS version 4 Protocol July 2002
"current filehandle" as the file system object to operate upon. The "current filehandle" as the file system object to operate upon. The
"saved filehandle" is used as temporary filehandle storage within a "saved filehandle" is used as temporary filehandle storage within a
COMPOUND procedure as well as an additional operand for certain COMPOUND procedure as well as an additional operand for certain
operations. operations.
1.1.3. File System Model 1.2.3. Filesystem Model
The general file system model used for the NFS version 4 protocol is The general file system model used for the NFS version 4 protocol is
the same as previous versions. The server file system is the same as previous versions. The server filesystem is hierarchical
hierarchical with the regular files contained within being treated as with the regular files contained within being treated as opaque byte
opaque byte streams. In a slight departure, file and directory names streams. In a slight departure, file and directory names are encoded
are encoded with UTF-8 to deal with the basics of with UTF-8 to deal with the basics of internationalization.
internationalization.
The NFS version 4 protocol does not require a separate protocol to The NFS version 4 protocol does not require a separate protocol to
provide for the initial mapping between path name and filehandle. provide for the initial mapping between path name and filehandle.
Instead of using the older MOUNT protocol for this mapping, the Instead of using the older MOUNT protocol for this mapping, the
server provides a ROOT filehandle that represents the logical root or server provides a ROOT filehandle that represents the logical root or
top of the file system tree provided by the server. The server top of the file system tree provided by the server. The server
provides multiple file systems by glueing them together with pseudo provides multiple file systems by glueing them together with pseudo
file systems. These pseudo file systems provide for potential gaps filesystems. These pseudo filesystems provide for potential gaps in
in the path names between real file systems. the path names between real filesystems.
1.1.3.1. Filehandle Types 1.2.3.1. Filehandle Types
In previous versions of the NFS protocol, the filehandle provided by In previous versions of the NFS protocol, the filehandle provided by
the server was guaranteed to be valid or persistent for the lifetime the server was guaranteed to be valid or persistent for the lifetime
of the file system object to which it referred. For some server of the file system object to which it referred. For some server
implementations, this persistence requirement has been difficult to implementations, this persistence requirement has been difficult to
meet. For the NFS version 4 protocol, this requirement has been meet. For the NFS version 4 protocol, this requirement has been
relaxed by introducing another type of filehandle, volatile. With relaxed by introducing another type of filehandle, volatile. With
persistent and volatile filehandle types, the server implementation persistent and volatile filehandle types, the server implementation
can match the abilities of the file system at the server along with can match the abilities of the file system at the server along with
the operating environment. The client will have knowledge of the the operating environment. The client will have knowledge of the
type of filehandle being provided by the server and can be prepared type of filehandle being provided by the server and can be prepared
to deal with the semantics of each. to deal with the semantics of each.
1.1.3.2. Attribute Types Draft Specification NFS version 4 Protocol August 2002
1.2.3.2. Attribute Types
The NFS version 4 protocol introduces three classes of file system or The NFS version 4 protocol introduces three classes of file system or
file attributes. Like the additional filehandle type, the file attributes. Like the additional filehandle type, the
classification of file attributes has been done to ease server classification of file attributes has been done to ease server
implementations along with extending the overall functionality of the implementations along with extending the overall functionality of the
NFS protocol. This attribute model is structured to be extensible NFS protocol. This attribute model is structured to be extensible
such that new attributes can be introduced in minor revisions of the such that new attributes can be introduced in minor revisions of the
protocol without requiring significant rework. protocol without requiring significant rework.
The three classifications are: mandatory, recommended and named The three classifications are: mandatory, recommended and named
attributes. This is a significant departure from the previous attributes. This is a significant departure from the previous
Draft Specification NFS version 4 Protocol July 2002
attribute model used in the NFS protocol. Previously, the attributes attribute model used in the NFS protocol. Previously, the attributes
for the file system and file objects were a fixed set of mainly Unix for the filesystem and file objects were a fixed set of mainly UNIX
attributes. If the server or client did not support a particular attributes. If the server or client did not support a particular
attribute, it would have to simulate the attribute the best it could. attribute, it would have to simulate the attribute the best it could.
Mandatory attributes are the minimal set of file or file system Mandatory attributes are the minimal set of file or file system
attributes that must be provided by the server and must be properly attributes that must be provided by the server and must be properly
represented by the server. Recommended attributes represent represented by the server. Recommended attributes represent
different file system types and operating environments. The different file system types and operating environments. The
recommended attributes will allow for better interoperability and the recommended attributes will allow for better interoperability and the
inclusion of more operating environments. The mandatory and inclusion of more operating environments. The mandatory and
recommended attribute sets are traditional file or file system recommended attribute sets are traditional file or file system
skipping to change at page 10, line 31 skipping to change at page 10, line 43
directory or file and referred to by a string name. Named attributes directory or file and referred to by a string name. Named attributes
are meant to be used by client applications as a method to associate are meant to be used by client applications as a method to associate
application specific data with a regular file or directory. application specific data with a regular file or directory.
One significant addition to the recommended set of file attributes is One significant addition to the recommended set of file attributes is
the Access Control List (ACL) attribute. This attribute provides for the Access Control List (ACL) attribute. This attribute provides for
directory and file access control beyond the model used in previous directory and file access control beyond the model used in previous
versions of the NFS protocol. The ACL definition allows for versions of the NFS protocol. The ACL definition allows for
specification of user and group level access control. specification of user and group level access control.
1.1.3.3. File System Replication and Migration 1.2.3.3. Filesystem Replication and Migration
With the use of a special file attribute, the ability to migrate or With the use of a special file attribute, the ability to migrate or
replicate server file systems is enabled within the protocol. The replicate server file systems is enabled within the protocol. The
file system locations attribute provides a method for the client to file system locations attribute provides a method for the client to
probe the server about the location of a file system. In the event probe the server about the location of a filesystem. In the event of
of a migration of a file system, the client will receive an error a migration of a filesystem, the client will receive an error when
when operating on the file system and it can then query as to the new operating on the filesystem and it can then query as to the new file
file system location. Similar steps are used for replication, the system location. Similar steps are used for replication, the client
client is able to query the server for the multiple available is able to query the server for the multiple available locations of a
locations of a particular file system. From this information, the particular filesystem. From this information, the client can use its
client can use its own policies to access the appropriate file system own policies to access the appropriate filesystem location.
location.
1.1.4. OPEN and CLOSE Draft Specification NFS version 4 Protocol August 2002
1.2.4. OPEN and CLOSE
The NFS version 4 protocol introduces OPEN and CLOSE operations. The The NFS version 4 protocol introduces OPEN and CLOSE operations. The
OPEN operation provides a single point where file lookup, creation, OPEN operation provides a single point where file lookup, creation,
and share semantics can be combined. The CLOSE operation also and share semantics can be combined. The CLOSE operation also
provides for the release of state accumulated by OPEN. provides for the release of state accumulated by OPEN.
1.1.5. File locking 1.2.5. File locking
With the NFS version 4 protocol, the support for byte range file With the NFS version 4 protocol, the support for byte range file
locking is part of the NFS protocol. The file locking support is locking is part of the NFS protocol. The file locking support is
Draft Specification NFS version 4 Protocol July 2002
structured so that an RPC callback mechanism is not required. This structured so that an RPC callback mechanism is not required. This
is a departure from the previous versions of the NFS file locking is a departure from the previous versions of the NFS file locking
protocol, Network Lock Manager (NLM). The state associated with file protocol, Network Lock Manager (NLM). The state associated with file
locks is maintained at the server under a lease-based model. The locks is maintained at the server under a lease-based model. The
server defines a single lease period for all state held by a NFS server defines a single lease period for all state held by a NFS
client. If the client does not renew its lease within the defined client. If the client does not renew its lease within the defined
period, all state associated with the client's lease may be released period, all state associated with the client's lease may be released
by the server. The client may renew its lease with use of the RENEW by the server. The client may renew its lease with use of the RENEW
operation or implicitly by use of other operations (primarily READ). operation or implicitly by use of other operations (primarily READ).
1.1.6. Client Caching and Delegation 1.2.6. Client Caching and Delegation
The file, attribute, and directory caching for the NFS version 4 The file, attribute, and directory caching for the NFS version 4
protocol is similar to previous versions. Attributes and directory protocol is similar to previous versions. Attributes and directory
information are cached for a duration determined by the client. At information are cached for a duration determined by the client. At
the end of a predefined timeout, the client will query the server to the end of a predefined timeout, the client will query the server to
see if the related file system object has been updated. see if the related file system object has been updated.
For file data, the client checks its cache validity when the file is For file data, the client checks its cache validity when the file is
opened. A query is sent to the server to determine if the file has opened. A query is sent to the server to determine if the file has
been changed. Based on this information, the client determines if been changed. Based on this information, the client determines if
skipping to change at page 11, line 46 skipping to change at page 12, line 5
client. When the server grants a delegation for a file to a client, client. When the server grants a delegation for a file to a client,
the client is guaranteed certain semantics with respect to the the client is guaranteed certain semantics with respect to the
sharing of that file with other clients. At OPEN, the server may sharing of that file with other clients. At OPEN, the server may
provide the client either a read or write delegation for the file. provide the client either a read or write delegation for the file.
If the client is granted a read delegation, it is assured that no If the client is granted a read delegation, it is assured that no
other client has the ability to write to the file for the duration of other client has the ability to write to the file for the duration of
the delegation. If the client is granted a write delegation, the the delegation. If the client is granted a write delegation, the
client is assured that no other client has read or write access to client is assured that no other client has read or write access to
the file. the file.
Draft Specification NFS version 4 Protocol August 2002
Delegations can be recalled by the server. If another client Delegations can be recalled by the server. If another client
requests access to the file in such a way that the access conflicts requests access to the file in such a way that the access conflicts
with the granted delegation, the server is able to notify the initial with the granted delegation, the server is able to notify the initial
client and recall the delegation. This requires that a callback path client and recall the delegation. This requires that a callback path
exist between the server and client. If this callback path does not exist between the server and client. If this callback path does not
exist, then delegations can not be granted. The essence of a exist, then delegations can not be granted. The essence of a
delegation is that it allows the client to locally service operations delegation is that it allows the client to locally service operations
such as OPEN, CLOSE, LOCK, LOCKU, READ, WRITE without immediate such as OPEN, CLOSE, LOCK, LOCKU, READ, WRITE without immediate
interaction with the server. interaction with the server.
Draft Specification NFS version 4 Protocol July 2002 1.3. General Definitions
1.2. General Definitions
The following definitions are provided for the purpose of providing The following definitions are provided for the purpose of providing
an appropriate context for the reader. an appropriate context for the reader.
Client The "client" is the entity that accesses the NFS server's Client The "client" is the entity that accesses the NFS server's
resources. The client may be an application which contains resources. The client may be an application which contains
the logic to access the NFS server directly. The client the logic to access the NFS server directly. The client
may also be the traditional operating system client remote may also be the traditional operating system client remote
file system services for a set of applications. file system services for a set of applications.
skipping to change at page 12, line 42 skipping to change at page 12, line 52
lease period the lock may be revoked if the lease has not lease period the lock may be revoked if the lease has not
been extended. The lock must be revoked if a conflicting been extended. The lock must be revoked if a conflicting
lock has been granted after the lease interval. lock has been granted after the lease interval.
All leases granted by a server have the same fixed All leases granted by a server have the same fixed
interval. Note that the fixed interval was chosen to interval. Note that the fixed interval was chosen to
alleviate the expense a server would have in maintaining alleviate the expense a server would have in maintaining
state about variable length leases across server failures. state about variable length leases across server failures.
Lock The term "lock" is used to refer to both record (byte- Lock The term "lock" is used to refer to both record (byte-
range) locks as well as file (share) locks unless range) locks as well as share reservations unless
specifically stated otherwise. specifically stated otherwise.
Server The "Server" is the entity responsible for coordinating Server The "Server" is the entity responsible for coordinating
client access to a set of file systems. client access to a set of file systems.
Draft Specification NFS version 4 Protocol August 2002
Stable Storage Stable Storage
NFS version 4 servers must be able to recover without data NFS version 4 servers must be able to recover without data
loss from multiple power failures (including cascading loss from multiple power failures (including cascading
power failures, that is, several power failures in quick power failures, that is, several power failures in quick
succession), operating system failures, and hardware succession), operating system failures, and hardware
failure of components other than the storage medium itself failure of components other than the storage medium itself
(for example, disk, nonvolatile RAM). (for example, disk, nonvolatile RAM).
Some examples of stable storage that are allowable for an Some examples of stable storage that are allowable for an
NFS server include: NFS server include:
Draft Specification NFS version 4 Protocol July 2002
1. Media commit of data, that is, the modified data has 1. Media commit of data, that is, the modified data has
been successfully written to the disk media, been successfully written to the disk media,
for example, the disk platter. for example, the disk platter.
2. An immediate reply disk drive with battery-backed 2. An immediate reply disk drive with battery-backed
on-drive intermediate storage or uninterruptible power on-drive intermediate storage or uninterruptible power
system (UPS). system (UPS).
3. Server commit of data with battery-backed intermediate 3. Server commit of data with battery-backed intermediate
storage and recovery software. storage and recovery software.
skipping to change at page 14, line 5 skipping to change at page 14, line 5
defines the open and locking state provided by the server defines the open and locking state provided by the server
for a specific open or lock owner for a specific file. for a specific open or lock owner for a specific file.
Stateids composed of all bits 0 or all bits 1 have special Stateids composed of all bits 0 or all bits 1 have special
meaning and are reserved values. meaning and are reserved values.
Verifier A 64-bit quantity generated by the client that the server Verifier A 64-bit quantity generated by the client that the server
can use to determine if the client has restarted and lost can use to determine if the client has restarted and lost
all previous lock state. all previous lock state.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
2. Protocol Data Types 2. Protocol Data Types
The syntax and semantics to describe the data types of the NFS The syntax and semantics to describe the data types of the NFS
version 4 protocol are defined in the XDR [RFC1832] and RPC [RFC1831] version 4 protocol are defined in the XDR [RFC1832] and RPC [RFC1831]
documents. The next sections build upon the XDR data types to define documents. The next sections build upon the XDR data types to define
types and structures specific to this protocol. types and structures specific to this protocol.
2.1. Basic Data Types 2.1. Basic Data Types
skipping to change at page 15, line 5 skipping to change at page 15, line 5
mode4 typedef uint32_t mode4; mode4 typedef uint32_t mode4;
Mode attribute data type Mode attribute data type
nfs_cookie4 typedef uint64_t nfs_cookie4; nfs_cookie4 typedef uint64_t nfs_cookie4;
Opaque cookie value for READDIR Opaque cookie value for READDIR
nfs_fh4 typedef opaque nfs_fh4<NFS4_FHSIZE>; nfs_fh4 typedef opaque nfs_fh4<NFS4_FHSIZE>;
Filehandle definition; NFS4_FHSIZE is defined as 128 Filehandle definition; NFS4_FHSIZE is defined as 128
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
nfs_ftype4 enum nfs_ftype4; nfs_ftype4 enum nfs_ftype4;
Various defined file types Various defined file types
nfsstat4 enum nfsstat4; nfsstat4 enum nfsstat4;
Return value for operations Return value for operations
offset4 typedef uint64_t offset4; offset4 typedef uint64_t offset4;
Various offset designations (READ, WRITE, LOCK, COMMIT) Various offset designations (READ, WRITE, LOCK, COMMIT)
skipping to change at page 15, line 27 skipping to change at page 15, line 27
Represents path name for LOOKUP, OPEN and others Represents path name for LOOKUP, OPEN and others
qop4 typedef uint32_t qop4; qop4 typedef uint32_t qop4;
Quality of protection designation in SECINFO Quality of protection designation in SECINFO
sec_oid4 typedef opaque sec_oid4<>; sec_oid4 typedef opaque sec_oid4<>;
Security Object Identifier Security Object Identifier
The sec_oid4 data type is not really opaque. The sec_oid4 data type is not really opaque.
Instead contains an ASN.1 OBJECT IDENTIFIER as used Instead contains an ASN.1 OBJECT IDENTIFIER as used
by GSS-API in the mech_type argument to by GSS-API in the mech_type argument to
GSS_Init_sec_context. See [RFC2078] for details. GSS_Init_sec_context. See [RFC2743] for details.
seqid4 typedef uint32_t seqid4; seqid4 typedef uint32_t seqid4;
Sequence identifier used for file locking Sequence identifier used for file locking
utf8string typedef opaque utf8string<>; utf8string typedef opaque utf8string<>;
UTF-8 encoding for strings UTF-8 encoding for strings
verifier4 typedef opaque verifier4[NFS4_VERIFIER_SIZE]; verifier4 typedef opaque verifier4[NFS4_VERIFIER_SIZE];
Verifier used for various operations (COMMIT, CREATE, Verifier used for various operations (COMMIT, CREATE,
OPEN, READDIR, SETCLIENTID, WRITE) OPEN, READDIR, SETCLIENTID, SETCLIENTID_CONFIRM, WRITE)
NFS4_VERIFIER_SIZE is defined as 8 NFS4_VERIFIER_SIZE is defined as 8
2.2. Structured Data Types 2.2. Structured Data Types
nfstime4 nfstime4
struct nfstime4 { struct nfstime4 {
int64_t seconds; int64_t seconds;
uint32_t nseconds; uint32_t nseconds;
} }
The nfstime4 structure gives the number of seconds and The nfstime4 structure gives the number of seconds and
nanoseconds since midnight or 0 hour January 1, 1970 Coordinated nanoseconds since midnight or 0 hour January 1, 1970 Coordinated
Universal Time (UTC). Values greater than zero for the seconds Universal Time (UTC). Values greater than zero for the seconds
field denote dates after the 0 hour January 1, 1970. Values field denote dates after the 0 hour January 1, 1970. Values
less than zero for the seconds field denote dates before the 0 less than zero for the seconds field denote dates before the 0
hour January 1, 1970. In both cases, the nseconds field is to hour January 1, 1970. In both cases, the nseconds field is to
be added to the seconds field for the final time representation. be added to the seconds field for the final time representation.
For example, if the time to be represented is one-half second For example, if the time to be represented is one-half second
before 0 hour January 1, 1970, the seconds field would have a
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
before 0 hour January 1, 1970, the seconds field would have a
value of negative one (-1) and the nseconds fields would have a value of negative one (-1) and the nseconds fields would have a
value of one-half second (500000000). Values greater than value of one-half second (500000000). Values greater than
999,999,999 for nseconds are considered invalid. 999,999,999 for nseconds are considered invalid.
This data type is used to pass time and date information. A This data type is used to pass time and date information. A
server converts to and from its local representation of time server converts to and from its local representation of time
when processing time values, preserving as much accuracy as when processing time values, preserving as much accuracy as
possible. If the precision of timestamps stored for a file possible. If the precision of timestamps stored for a filesystem
system object is less than defined, loss of precision can occur. object is less than defined, loss of precision can occur. An
An adjunct time maintenance protocol is recommended to reduce adjunct time maintenance protocol is recommended to reduce
client and server time skew. client and server time skew.
time_how4 time_how4
enum time_how4 { enum time_how4 {
SET_TO_SERVER_TIME4 = 0, SET_TO_SERVER_TIME4 = 0,
SET_TO_CLIENT_TIME4 = 1 SET_TO_CLIENT_TIME4 = 1
}; };
settime4 settime4
skipping to change at page 16, line 42 skipping to change at page 16, line 43
void; void;
}; };
The above definitions are used as the attribute definitions to The above definitions are used as the attribute definitions to
set time values. If set_it is SET_TO_SERVER_TIME4, then the set time values. If set_it is SET_TO_SERVER_TIME4, then the
server uses its local representation of time for the time value. server uses its local representation of time for the time value.
specdata4 specdata4
struct specdata4 { struct specdata4 {
uint32_t specdata1; uint32_t specdata1; /* major device number */
uint32_t specdata2; uint32_t specdata2; /* minor device number */
}; };
This data type represents additional information for the device This data type represents additional information for the device
file types NF4CHR and NF4BLK. file types NF4CHR and NF4BLK.
fsid4 fsid4
struct fsid4 { struct fsid4 {
uint64_t major; uint64_t major;
uint64_t minor; uint64_t minor;
};
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
};
This type is the file system identifier that is used as a This type is the file system identifier that is used as a
mandatory attribute. mandatory attribute.
fs_location4 fs_location4
struct fs_location4 { struct fs_location4 {
utf8string server<>; utf8string server<>;
pathname4 rootpath; pathname4 rootpath;
}; };
skipping to change at page 17, line 53 skipping to change at page 18, line 4
0 1 0 1
+-----------+-----------+-----------+-- +-----------+-----------+-----------+--
| count | 31 .. 0 | 63 .. 32 | | count | 31 .. 0 | 63 .. 32 |
+-----------+-----------+-----------+-- +-----------+-----------+-----------+--
change_info4 change_info4
struct change_info4 { struct change_info4 {
bool atomic; bool atomic;
changeid4 before; changeid4 before;
Draft Specification NFS version 4 Protocol August 2002
changeid4 after; changeid4 after;
}; };
Draft Specification NFS version 4 Protocol July 2002
This structure is used with the CREATE, LINK, REMOVE, RENAME This structure is used with the CREATE, LINK, REMOVE, RENAME
operations to let the client know the value of the change operations to let the client know the value of the change
attribute for the directory in which the target file system attribute for the directory in which the target file system
object resides. object resides.
clientaddr4 clientaddr4
struct clientaddr4 { struct clientaddr4 {
/* see struct rpcb in RFC 1833 */ /* see struct rpcb in RFC 1833 */
string r_netid<>; /* network id */ string r_netid<>; /* network id */
string r_addr<>; /* universal address */ string r_addr<>; /* universal address */
}; };
The clientaddr4 structure is used as part of the SETCLIENT The clientaddr4 structure is used as part of the SETCLIENTID
operation to either specify the address of the client that is operation to either specify the address of the client that is
using a clientid or as part of the call back registration. using a clientid or as part of the callback registration. The
r_netid and r_addr fields are specified in [RFC1833], but they
are underspecified in [RFC1833] as far as what they should look
like for specific protocols.
For TCP over IPv4 and for UDP over IPv4, the format of r_addr is
the US-ASCII string:
h1.h2.h3.h4.p1.p2
The prefix, "h1.h2.h3.h4", is the standard textual form for
representing an IPv4 address, which is always four octets long.
Assuming big-endian ordering, h1, h2, h3, and h4, are
respectively, the first through fourth octets each converted to
ASCII-decimal. Assuming big-endian ordering, p1 and p2 are,
respectively, the first and second octets each converted to
ASCII-decimal. For example, if a host, in big-endian order, has
an address of 0x0A010307 and there is a service listening on, in
big endian order, port 0x020F (decimal 527), then complete
universal address is "10.1.3.7.2.15".
For TCP over IPv4 the value of r_netid is the string "tcp". For
UDP over IPv4 the value of r_netid is the string "udp".
For TCP over IPv4 and for UDP over IPv6, the format of r_addr is
the US-ASCII string:
x1:x2:x3:x4:x5:x6:x7:x8.p1.p2
The suffix "p1.p2" is the service port, and is computed the same
way as with univeral addresses for TCP and UDP over IPv4. The
prefix, "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form
for representing an IPv6 address as defined in Section 2.2 of
Draft Specification NFS version 4 Protocol August 2002
[RFC1884]. Additionally, the two alternative forms specified in
Section 2.2 of [RFC1884] are also acceptable.
For TCP over IPv6 the value of r_netid is the string "tcp6".
For UDP over IPv6 the value of r_netid is the string "udp6".
cb_client4 cb_client4
struct cb_client4 { struct cb_client4 {
unsigned int cb_program; unsigned int cb_program;
clientaddr4 cb_location; clientaddr4 cb_location;
}; };
This structure is used by the client to inform the server of its This structure is used by the client to inform the server of its
call back address; includes the program number and client call back address; includes the program number and client
skipping to change at page 19, line 5 skipping to change at page 19, line 44
open_owner4 open_owner4
struct open_owner4 { struct open_owner4 {
clientid4 clientid; clientid4 clientid;
opaque owner<NFS4_OPAQUE_LIMIT>; opaque owner<NFS4_OPAQUE_LIMIT>;
}; };
This structure is used to identify the owner of open state. This structure is used to identify the owner of open state.
NFS4_OPAQUE_LIMIT is defined as 1024. NFS4_OPAQUE_LIMIT is defined as 1024.
Draft Specification NFS version 4 Protocol July 2002
lock_owner4 lock_owner4
struct nfs_lockowner4 { struct lock_owner4 {
clientid4 clientid; clientid4 clientid;
opaque owner<NFS4_OPAQUE_LIMIT>; opaque owner<NFS4_OPAQUE_LIMIT>;
}; };
This structure is used to identify the owner of file locking This structure is used to identify the owner of file locking
state. NFS4_OPAQUE_LIMIT is defined as 1024. state. NFS4_OPAQUE_LIMIT is defined as 1024.
Draft Specification NFS version 4 Protocol August 2002
open_to_lock_owner4
struct open_to_lock_owner4 {
seqid4 open_seqid;
stateid4 open_stateid;
seqid4 lock_seqid;
lock_owner4 lock_owner;
};
This structure is used for the first LOCK operation done for an
open_owner4. It provides both the open_stateid and lock_owner
such that the transition is made from a valid open_stateid
sequence to that of the new lock_stateid sequence. Using this
mechanism avoids the confirmation of the lock_owner/lock_seqid
pair since it is tied to established state in the form of the
open_stateid/open_seqid.
stateid4 stateid4
struct stateid4 { struct stateid4 {
uint32_t seqid; uint32_t seqid;
opaque other[12]; opaque other[12];
}; };
This strucutre is used for the various state sharing mechanisms This structure is used for the various state sharing mechanisms
between the client and server. For the client, this data between the client and server. For the client, this data
structure is read-only. The seqid value is the only field that structure is read-only. The starting value of the seqid field
the client should interpret. See the section for the OPEN is undefined. The server is required to increment the seqid
operation for further description of how the seqid field is to field monotonically at each transition of the stateid. This is
be interpreted. important since the client will inspect the seqid in OPEN
stateids to determine the order of OPEN processing done by the
server.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
3. RPC and Security Flavor 3. RPC and Security Flavor
The NFS version 4 protocol is a Remote Procedure Call (RPC) The NFS version 4 protocol is a Remote Procedure Call (RPC)
application that uses RPC version 2 and the corresponding eXternal application that uses RPC version 2 and the corresponding eXternal
Data Representation (XDR) as defined in [RFC1831] and [RFC1832]. The Data Representation (XDR) as defined in [RFC1831] and [RFC1832]. The
RPCSEC_GSS security flavor as defined in [RFC2203] MUST be used as RPCSEC_GSS security flavor as defined in [RFC2203] MUST be used as
the mechanism to deliver stronger security for the NFS version 4 the mechanism to deliver stronger security for the NFS version 4
protocol. protocol.
skipping to change at page 20, line 29 skipping to change at page 21, line 29
port 2049. The registered port 2049 [RFC1700] for the NFS protocol port 2049. The registered port 2049 [RFC1700] for the NFS protocol
should be the default configuration. Using the registered port for should be the default configuration. Using the registered port for
NFS services means the NFS client will not need to use the RPC NFS services means the NFS client will not need to use the RPC
binding protocols as described in [RFC1833]; this will allow NFS to binding protocols as described in [RFC1833]; this will allow NFS to
transit firewalls. transit firewalls.
The transport used by the RPC service for the NFS version 4 protocol The transport used by the RPC service for the NFS version 4 protocol
MUST provide congestion control comparable to that defined for TCP in MUST provide congestion control comparable to that defined for TCP in
[RFC2581]. If the operating environment implements TCP, the NFS [RFC2581]. If the operating environment implements TCP, the NFS
version 4 protocol SHOULD be supported over TCP. The NFS client and version 4 protocol SHOULD be supported over TCP. The NFS client and
server may use other transports if they support congestion control as server MAY use other transports if they support congestion control as
defined above and in those cases a mechanism may be provided to defined above and in those cases a mechanism may be provided to
override TCP usage in favor of another transport. override TCP usage in favor of another transport.
If TCP is used as the transport, the client and server SHOULD use If TCP is used as the transport, the client and server SHOULD use
persistent connections. This will prevent the weakening of TCP's persistent connections. This will prevent the weakening of TCP's
congestion control via short lived connections and will improve congestion control via short lived connections and will improve
performance for the WAN environment by eliminating the need for SYN performance for the WAN environment by eliminating the need for SYN
handshakes. handshakes.
Note that for various timers, the client and server should avoid Note that for various timers, the client and server should avoid
inadvertent synchronization of those timers. For further discussion inadvertent synchronization of those timers. For further discussion
of the general issue refer to [Floyd]. of the general issue refer to [Floyd].
3.1.1. Client Retransmission Behavior
When processing a request received over a reliable transport such as
TCP, the NFS version 4 server MUST NOT silently drop the request,
except if the transport connection has been broken. Given such a
contract between NFS version 4 clients and servers, clients MUST NOT
retry a request unless one or both of the following are true:
o The transport connection has been broken
o The procedure being retried is the NULL procedure
Since transports, including TCP, do not always synchronously inform a
peer when the other peer has broken the connection (for example, when
Draft Specification NFS version 4 Protocol August 2002
an NFS server reboots), so the NFS version 4 client may want to
actively "probe" the connection to see if has been broken. Use of
the NULL procedure is one recommended way to do so. So, when a
client experiences a remote procedure call timeout (of some arbitrary
implementation specific amount), rather than retrying the remote
procedure call, it could instead issue a NULL procedure call to the
server. If the server has died, the transport connection break will
eventually be indicated to the NFS version 4 client. The client can
then reconnect, and then retry the original request. If the NULL
procedure call gets a response, the connection has not broken. The
client can decide to wait longer for the original request's response,
or it can break the transport connection and reconnect before re-
sending the original request.
For callbacks from the server to the client, the same rules apply,
but the server doing the callback becomes the client, and the client
receiving the callback becomes the server.
3.2. Security Flavors 3.2. Security Flavors
Traditional RPC implementations have included AUTH_NONE, AUTH_SYS, Traditional RPC implementations have included AUTH_NONE, AUTH_SYS,
AUTH_DH, and AUTH_KRB4 as security flavors. With [RFC2203] an AUTH_DH, and AUTH_KRB4 as security flavors. With [RFC2203] an
additional security flavor of RPCSEC_GSS has been introduced which additional security flavor of RPCSEC_GSS has been introduced which
uses the functionality of GSS-API [RFC2078]. This allows for the use uses the functionality of GSS-API [RFC2743]. This allows for the use
of varying security mechanisms by the RPC layer without the of various security mechanisms by the RPC layer without the
additional implementation overhead of adding RPC security flavors. additional implementation overhead of adding RPC security flavors.
For NFS version 4, the RPCSEC_GSS security flavor MUST be used to For NFS version 4, the RPCSEC_GSS security flavor MUST be used to
enable the mandatory security mechanism. Other flavors, such as, enable the mandatory security mechanism. Other flavors, such as,
AUTH_NONE, AUTH_SYS, and AUTH_DH MAY be implemented as well. AUTH_NONE, AUTH_SYS, and AUTH_DH MAY be implemented as well.
3.2.1. Security mechanisms for NFS version 4 3.2.1. Security mechanisms for NFS version 4
The use of RPCSEC_GSS requires selection of: mechanism, quality of The use of RPCSEC_GSS requires selection of: mechanism, quality of
Draft Specification NFS version 4 Protocol July 2002
protection, and service (authentication, integrity, privacy). The protection, and service (authentication, integrity, privacy). The
remainder of this document will refer to these three parameters of remainder of this document will refer to these three parameters of
the RPCSEC_GSS security as the security triple. the RPCSEC_GSS security as the security triple.
3.2.1.1. Kerberos V5 as security triple 3.2.1.1. Kerberos V5 as a security triple
The Kerberos V5 GSS-API mechanism as described in [RFC1964] MUST be The Kerberos V5 GSS-API mechanism as described in [RFC1964] MUST be
implemented and provide the following security triples. implemented and provide the following security triples.
column descriptions: column descriptions:
1 == number of pseudo flavor 1 == number of pseudo flavor
2 == name of pseudo flavor 2 == name of pseudo flavor
3 == mechanism's OID 3 == mechanism's OID
4 == mechanism's algorithm(s) 4 == mechanism's algorithm(s)
5 == RPCSEC_GSS service 5 == RPCSEC_GSS service
1 2 3 4 5 1 2 3 4 5
Draft Specification NFS version 4 Protocol August 2002
----------------------------------------------------------------------- -----------------------------------------------------------------------
390003 krb5 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_none 390003 krb5 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_none
390004 krb5i 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_integrity 390004 krb5i 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_integrity
390005 krb5p 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_privacy 390005 krb5p 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_privacy
for integrity, for integrity,
and 56 bit DES and 56 bit DES
for privacy. for privacy.
Note that the pseudo flavor is presented here as a mapping aid to the Note that the pseudo flavor is presented here as a mapping aid to the
implementor. Because this NFS protocol includes a method to implementor. Because this NFS protocol includes a method to
skipping to change at page 22, line 4 skipping to change at page 23, line 40
V5 as security triple" V5 as security triple"
1 2 3 4 5 1 2 3 4 5
----------------------------------------------------------------------- -----------------------------------------------------------------------
390006 lipkey 1.3.6.1.5.5.9 negotiated rpc_gss_svc_none 390006 lipkey 1.3.6.1.5.5.9 negotiated rpc_gss_svc_none
390007 lipkey-i 1.3.6.1.5.5.9 negotiated rpc_gss_svc_integrity 390007 lipkey-i 1.3.6.1.5.5.9 negotiated rpc_gss_svc_integrity
390008 lipkey-p 1.3.6.1.5.5.9 negotiated rpc_gss_svc_privacy 390008 lipkey-p 1.3.6.1.5.5.9 negotiated rpc_gss_svc_privacy
The mechanism algorithm is listed as "negotiated". This is because The mechanism algorithm is listed as "negotiated". This is because
LIPKEY is layered on SPKM-3 and in SPKM-3 [RFC2847] the LIPKEY is layered on SPKM-3 and in SPKM-3 [RFC2847] the
Draft Specification NFS version 4 Protocol July 2002
confidentiality and integrity algorithms are negotiated. Since confidentiality and integrity algorithms are negotiated. Since
SPKM-3 specifies HMAC-MD5 for integrity as MANDATORY, 128 bit SPKM-3 specifies HMAC-MD5 for integrity as MANDATORY, 128 bit
cast5CBC for confidentiality for privacy as MANDATORY, and further cast5CBC for confidentiality for privacy as MANDATORY, and further
specifies that HMAC-MD5 and cast5CBC MUST be listed first before specifies that HMAC-MD5 and cast5CBC MUST be listed first before
weaker algorithms, specifying "negotiated" in column 4 does not weaker algorithms, specifying "negotiated" in column 4 does not
impair interoperability. In the event an SPKM-3 peer does not impair interoperability. In the event an SPKM-3 peer does not
support the mandatory algorithms, the other peer is free to accept or support the mandatory algorithms, the other peer is free to accept or
reject the GSS-API context creation. reject the GSS-API context creation.
Because SPKM-3 negotiates the algorithms, subsequent calls to Because SPKM-3 negotiates the algorithms, subsequent calls to
LIPKEY's GSS_Wrap() and GSS_GetMIC() by RPCSEC_GSS will use a quality LIPKEY's GSS_Wrap() and GSS_GetMIC() by RPCSEC_GSS will use a quality
of protection value of 0 (zero). See section 5.2 of [RFC2025] for an of protection value of 0 (zero). See section 5.2 of [RFC2025] for an
explanation. explanation.
LIPKEY uses SPKM-3 to create a secure channel in which to pass a user LIPKEY uses SPKM-3 to create a secure channel in which to pass a user
name and password from the client to the server. Once the user name name and password from the client to the server. Once the user name
and password have been accepted by the server, calls to the LIPKEY and password have been accepted by the server, calls to the LIPKEY
context are redirected to the SPKM-3 context. See [RFC2847] for more context are redirected to the SPKM-3 context. See [RFC2847] for more
Draft Specification NFS version 4 Protocol August 2002
details. details.
3.2.1.3. SPKM-3 as a security triple 3.2.1.3. SPKM-3 as a security triple
The SPKM-3 GSS-API mechanism as described in [RFC2847] MUST be The SPKM-3 GSS-API mechanism as described in [RFC2847] MUST be
implemented and provide the following security triples. The implemented and provide the following security triples. The
definition of the columns matches the previous subsection "Kerberos definition of the columns matches the previous subsection "Kerberos
V5 as security triple". V5 as security triple".
1 2 3 4 5 1 2 3 4 5
skipping to change at page 23, line 5 skipping to change at page 24, line 38
explanation. explanation.
Even though LIPKEY is layered over SPKM-3, SPKM-3 is specified as a Even though LIPKEY is layered over SPKM-3, SPKM-3 is specified as a
mandatory set of triples to handle the situations where the initiator mandatory set of triples to handle the situations where the initiator
(the client) is anonymous or where the initiator has its own (the client) is anonymous or where the initiator has its own
certificate. If the initiator is anonymous, there will not be a user certificate. If the initiator is anonymous, there will not be a user
name and password to send to the target (the server). If the name and password to send to the target (the server). If the
initiator has its own certificate, then using passwords is initiator has its own certificate, then using passwords is
superfluous. superfluous.
Draft Specification NFS version 4 Protocol July 2002
3.3. Security Negotiation 3.3. Security Negotiation
With the NFS version 4 server potentially offering multiple security With the NFS version 4 server potentially offering multiple security
mechanisms, the client needs a method to determine or negotiate which mechanisms, the client needs a method to determine or negotiate which
mechanism is to be used for its communication with the server. The mechanism is to be used for its communication with the server. The
NFS server may have multiple points within its file system name space NFS server may have multiple points within its file system name space
that are available for use by NFS clients. In turn the NFS server that are available for use by NFS clients. In turn the NFS server
may be configured such that each of these entry points may have may be configured such that each of these entry points may have
different or multiple security mechanisms in use. different or multiple security mechanisms in use.
The security negotiation between client and server must be done with The security negotiation between client and server must be done with
a secure channel to eliminate the possibility of a third party a secure channel to eliminate the possibility of a third party
intercepting the negotiation sequence and forcing the client and intercepting the negotiation sequence and forcing the client and
server to choose a lower level of security than required or desired. server to choose a lower level of security than required or desired.
See the section "Security Considerations" for further discussion.
3.3.1. Security Error Draft Specification NFS version 4 Protocol August 2002
3.3.1. SECINFO
The new SECINFO operation will allow the client to determine, on a
per filehandle basis, what security triple is to be used for server
access. In general, the client will not have to use the SECINFO
operation except during initial communication with the server or when
the client crosses policy boundaries at the server. It is possible
that the server's policies change during the client's interaction
therefore forcing the client to negotiate a new security triple.
3.3.2. Security Error
Based on the assumption that each NFS version 4 client and server Based on the assumption that each NFS version 4 client and server
must support a minimum set of security (i.e. LIPKEY, SPKM-3, and must support a minimum set of security (i.e. LIPKEY, SPKM-3, and
Kerberos-V5 all under RPCSEC_GSS), the NFS client will start its Kerberos-V5 all under RPCSEC_GSS), the NFS client will start its
communication with the server with one of the minimal security communication with the server with one of the minimal security
triples. During communication with the server, the client may triples. During communication with the server, the client may
receive an NFS error of NFS4ERR_WRONGSEC. This error allows the receive an NFS error of NFS4ERR_WRONGSEC. This error allows the
server to notify the client that the security triple currently being server to notify the client that the security triple currently being
used is not appropriate for access to the server's file system used is not appropriate for access to the server's file system
resources. The client is then responsible for determining what resources. The client is then responsible for determining what
security triples are available at the server and choose one which is security triples are available at the server and choose one which is
appropriate for the client. appropriate for the client. See the section for the "SECINFO"
operation for further discussion of how the client will respond to
3.3.2. SECINFO the NFS4ERR_WRONGSEC error and use SECINFO.
The new SECINFO operation will allow the client to determine, on a
per filehandle basis, what security triple is to be used for server
access. In general, the client will not have to use the SECINFO
procedure except during initial communication with the server or when
the client crosses policy boundaries at the server. It is possible
that the server's policies change during the client's interaction
therefore forcing the client to negotiate a new security triple.
3.4. Callback RPC Authentication 3.4. Callback RPC Authentication
The callback RPC (described later) must mutually authenticate the NFS Except as noted elsewhere in this section, the callback RPC
server to the principal that acquired the clientid (also described (described later) MUST mutually authenticate the NFS server to the
later), using the same security flavor the original SETCLIENTID principal that acquired the clientid (also described later), using
operation used. Because LIPKEY is layered over SPKM-3, it is the security flavor the original SETCLIENTID operation used.
permissible for the server to use SPKM-3 and not LIPKEY for the
callback even if the client used LIPKEY for SETCLIENTID.
For AUTH_NONE, there are no principals, so this is a non-issue. For AUTH_NONE, there are no principals, so this is a non-issue.
Draft Specification NFS version 4 Protocol July 2002 AUTH_SYS has no notions of mutual authentation or a server principal,
so the callback from the server simply uses the AUTH_SYS credential
For AUTH_SYS, the server simply uses the AUTH_SYS credential that the that the user used when he set up the delegation.
user used when it set up the delegation.
For AUTH_DH, one commonly used convention is that the server uses the For AUTH_DH, one commonly used convention is that the server uses the
credential corresponding to this AUTH_DH principal: credential corresponding to this AUTH_DH principal:
unix.host@domain unix.host@domain
where host and domain are variables corresponding to the name of where host and domain are variables corresponding to the name of
server host and directory services domain in which it lives such as a server host and directory services domain in which it lives such as a
Network Information System domain or a DNS domain. Network Information System domain or a DNS domain.
Because LIPKEY is layered over SPKM-3, it is permissible for the
server to use SPKM-3 and not LIPKEY for the callback even if the
Draft Specification NFS version 4 Protocol August 2002
client used LIPKEY for SETCLIENTID.
Regardless of what security mechanism under RPCSEC_GSS is being used, Regardless of what security mechanism under RPCSEC_GSS is being used,
the NFS server, MUST identify itself in GSS-API via a the NFS server, MUST identify itself in GSS-API via a
GSS_C_NT_HOSTBASED_SERVICE name type. GSS_C_NT_HOSTBASED_SERVICE GSS_C_NT_HOSTBASED_SERVICE name type. GSS_C_NT_HOSTBASED_SERVICE
names are of the form: names are of the form:
service@hostname service@hostname
For NFS, the "service" element is For NFS, the "service" element is
nfs nfs
skipping to change at page 24, line 47 skipping to change at page 26, line 37
Kerberos Key Distribution Center database. For LIPKEY, this would be Kerberos Key Distribution Center database. For LIPKEY, this would be
the username passed to the target (the NFS version 4 client that the username passed to the target (the NFS version 4 client that
receives the callback). receives the callback).
It should be noted that LIPKEY may not work for callbacks, since the It should be noted that LIPKEY may not work for callbacks, since the
LIPKEY client uses a user id/password. If the NFS client receiving LIPKEY client uses a user id/password. If the NFS client receiving
the callback can authenticate the NFS server's user name/password the callback can authenticate the NFS server's user name/password
pair, and if the user that the NFS server is authenticating to has a pair, and if the user that the NFS server is authenticating to has a
public key certificate, then it works. public key certificate, then it works.
In situations where NFS client uses LIPKEY and uses a per-host In situations where the NFS client uses LIPKEY and uses a per-host
principal for the SETCLIENTID operation, instead of using LIPKEY for principal for the SETCLIENTID operation, instead of using LIPKEY for
SETCLIENTID, it is RECOMMENDED that SPKM-3 with mutual authentication SETCLIENTID, it is RECOMMENDED that SPKM-3 with mutual authentication
be used. This effectively means that the client will use a be used. This effectively means that the client will use a
certificate to authenticate and identify the initiator to the target certificate to authenticate and identify the initiator to the target
on the NFS server. Using SPKM-3 and not LIPKEY has the following on the NFS server. Using SPKM-3 and not LIPKEY has the following
advantages: advantages:
o When the server does a callback, it must authenticate to the o When the server does a callback, it must authenticate to the
principal used in the SETCLIENTID. Even if LIPKEY is used, principal used in the SETCLIENTID. Even if LIPKEY is used,
because LIPKEY is layered over SPKM-3, the NFS client will need because LIPKEY is layered over SPKM-3, the NFS client will need
to have a certificate that corresponds to the principal used in to have a certificate that corresponds to the principal used in
Draft Specification NFS version 4 Protocol July 2002
the SETCLIENTID operation. From an administrative perspective, the SETCLIENTID operation. From an administrative perspective,
having a user name, password, and certificate for both the having a user name, password, and certificate for both the
client and server is redundant. client and server is redundant.
o LIPKEY was intended to minimize additional infrastructure o LIPKEY was intended to minimize additional infrastructure
requirements beyond a certificate for the target, and the requirements beyond a certificate for the target, and the
expectation is that existing password infrastructure can be expectation is that existing password infrastructure can be
leveraged for the initiator. In some environments, a per-host leveraged for the initiator. In some environments, a per-host
password does not exist yet. If certificates are used for any password does not exist yet. If certificates are used for any
per-host principals, then additional password infrastructure is per-host principals, then additional password infrastructure is
Draft Specification NFS version 4 Protocol August 2002
not needed. not needed.
o In cases when a host is both an NFS client and server, it can o In cases when a host is both an NFS client and server, it can
share the same per-host certificate. share the same per-host certificate.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
4. Filehandles 4. Filehandles
The filehandle in the NFS protocol is a per server unique identifier The filehandle in the NFS protocol is a per server unique identifier
for a file system object. The contents of the filehandle are opaque for a file system object. The contents of the filehandle are opaque
to the client. Therefore, the server is responsible for translating to the client. Therefore, the server is responsible for translating
the filehandle to an internal representation of the file system the filehandle to an internal representation of the file system
object. Since the filehandle is the client's reference to an object object.
and the client may cache this reference, the server SHOULD not reuse
a filehandle for another file system object. If the server needs to
reuse a filehandle value, the time elapsed before reuse SHOULD be
large enough such that it is unlikely the client has a cached copy of
the reused filehandle value. Note that a client may cache a
filehandle for a very long time. For example, a client may cache NFS
data to local storage as a method to expand its effective cache size
and as a means to survive client restarts. Therefore, the lifetime
of a cached filehandle may be extended.
4.1. Obtaining the First Filehandle 4.1. Obtaining the First Filehandle
The operations of the NFS protocol are defined in terms of one or The operations of the NFS protocol are defined in terms of one or
more filehandles. Therefore, the client needs a filehandle to more filehandles. Therefore, the client needs a filehandle to
initiate communication with the server. With the NFS version 2 initiate communication with the server. With the NFS version 2
protocol [RFC1094] and the NFS version 3 protocol [RFC1813], there protocol [RFC1094] and the NFS version 3 protocol [RFC1813], there
exists an ancillary protocol to obtain this first filehandle. The exists an ancillary protocol to obtain this first filehandle. The
MOUNT protocol, RPC program number 100005, provides the mechanism of MOUNT protocol, RPC program number 100005, provides the mechanism of
translating a string based file system path name to a filehandle translating a string based filesystem path name to a filehandle which
which can then be used by the NFS protocols. can then be used by the NFS protocols.
The MOUNT protocol has deficiencies in the area of security and use The MOUNT protocol has deficiencies in the area of security and use
via firewalls. This is one reason that the use of the public via firewalls. This is one reason that the use of the public
filehandle was introduced in [RFC2054] and [RFC2055]. With the use filehandle was introduced in [RFC2054] and [RFC2055]. With the use
of the public filehandle in combination with the LOOKUP procedure in of the public filehandle in combination with the LOOKUP operation in
the NFS version 2 and 3 protocols, it has been demonstrated that the the NFS version 2 and 3 protocols, it has been demonstrated that the
MOUNT protocol is unnecessary for viable interaction between NFS MOUNT protocol is unnecessary for viable interaction between NFS
client and server. client and server.
Therefore, the NFS version 4 protocol will not use an ancillary Therefore, the NFS version 4 protocol will not use an ancillary
protocol for translation from string based path names to a protocol for translation from string based path names to a
filehandle. Two special filehandles will be used as starting points filehandle. Two special filehandles will be used as starting points
for the NFS client. for the NFS client.
4.1.1. Root Filehandle 4.1.1. Root Filehandle
The first of the special filehandles is the ROOT filehandle. The The first of the special filehandles is the ROOT filehandle. The
ROOT filehandle is the "conceptual" root of the file system name ROOT filehandle is the "conceptual" root of the filesystem name space
space at the NFS server. The client uses or starts with the ROOT at the NFS server. The client uses or starts with the ROOT
filehandle by employing the PUTROOTFH operation. The PUTROOTFH filehandle by employing the PUTROOTFH operation. The PUTROOTFH
operation instructs the server to set the "current" filehandle to the operation instructs the server to set the "current" filehandle to the
ROOT of the server's file tree. Once this PUTROOTFH operation is ROOT of the server's file tree. Once this PUTROOTFH operation is
used, the client can then traverse the entirety of the server's file used, the client can then traverse the entirety of the server's file
tree with the LOOKUP operation. A complete discussion of the server
Draft Specification NFS version 4 Protocol July 2002
tree with the LOOKUP procedure. A complete discussion of the server
name space is in the section "NFS Server Name Space". name space is in the section "NFS Server Name Space".
4.1.2. Public Filehandle 4.1.2. Public Filehandle
The second special filehandle is the PUBLIC filehandle. Unlike the The second special filehandle is the PUBLIC filehandle. Unlike the
ROOT filehandle, the PUBLIC filehandle may be bound or represent an ROOT filehandle, the PUBLIC filehandle may be bound or represent an
arbitrary file system object at the server. The server is arbitrary filesystem object at the server. The server is responsible
responsible for this binding. It may be that the PUBLIC filehandle
and the ROOT filehandle refer to the same file system object. Draft Specification NFS version 4 Protocol August 2002
However, it is up to the administrative software at the server and
the policies of the server administrator to define the binding of the for this binding. It may be that the PUBLIC filehandle and the ROOT
PUBLIC filehandle and server file system object. The client may not filehandle refer to the same filesystem object. However, it is up to
make any assumptions about this binding. the administrative software at the server and the policies of the
server administrator to define the binding of the PUBLIC filehandle
and server filesystem object. The client may not make any
assumptions about this binding. The client uses the PUBLIC filehandle
via the PUTPUBFH operation.
4.2. Filehandle Types 4.2. Filehandle Types
In the NFS version 2 and 3 protocols, there was one type of In the NFS version 2 and 3 protocols, there was one type of
filehandle with a single set of semantics. The NFS version 4 filehandle with a single set of semantics. This type of filehandle
protocol introduces a new type of filehandle in an attempt to is termed "persistent" in NFS Version 4. The semantics of a
accommodate certain server environments. The first type of persistent filehandle remain the same as before. A new type of
filehandle is 'persistent'. The semantics of a persistent filehandle filehandle introduced in NFS Version 4 is the "volatile" filehandle,
are the same as the filehandles of the NFS version 2 and 3 protocols. which attempts to accommodate certain server environments.
The second or new type of filehandle is the "volatile" filehandle.
The volatile filehandle type is being introduced to address server The volatile filehandle type was introduced to address server
functionality or implementation issues which make correct functionality or implementation issues which make correct
implementation of a persistent filehandle infeasible. Some server implementation of a persistent filehandle infeasible. Some server
environments do not provide a file system level invariant that can be environments do not provide a file system level invariant that can be
used to construct a persistent filehandle. The underlying server used to construct a persistent filehandle. The underlying server
file system may not provide the invariant or the server's file system file system may not provide the invariant or the server's file system
programming interfaces may not provide access to the needed programming interfaces may not provide access to the needed
invariant. Volatile filehandles may ease the implementation of invariant. Volatile filehandles may ease the implementation of
server functionality such as hierarchical storage management or file server functionality such as hierarchical storage management or
system reorganization or migration. However, the volatile filehandle filesystem reorganization or migration. However, the volatile
increases the implementation burden for the client. However this filehandle increases the implementation burden for the client.
increased burden is deemed acceptable based on the overall gains
achieved by the protocol.
Since the client will need to handle persistent and volatile Since the client will need to handle persistent and volatile
filehandle differently, a file attribute is defined which may be used filehandles differently, a file attribute is defined which may be
by the client to determine the filehandle types being returned by the used by the client to determine the filehandle types being returned
server. by the server.
4.2.1. General Properties of a Filehandle 4.2.1. General Properties of a Filehandle
The filehandle contains all the information the server needs to The filehandle contains all the information the server needs to
distinguish an individual file. To the client, the filehandle is distinguish an individual file. To the client, the filehandle is
opaque. The client stores filehandles for use in a later request and opaque. The client stores filehandles for use in a later request and
Draft Specification NFS version 4 Protocol July 2002
can compare two filehandles from the same server for equality by can compare two filehandles from the same server for equality by
doing a byte-by-byte comparison. However, the client MUST NOT doing a byte-by-byte comparison. However, the client MUST NOT
otherwise interpret the contents of filehandles. If two filehandles otherwise interpret the contents of filehandles. If two filehandles
from the same server are equal, they MUST refer to the same file. If from the same server are equal, they MUST refer to the same file.
they are not equal, the client may use information provided by the Servers SHOULD try to maintain a one-to-one correspondence between
server, in the form of file attributes, to determine whether they filehandles and files but this is not required. Clients MUST use
denote the same files or different files. The client would do this filehandle comparisons only to improve performance, not for correct
as necessary for client side caching. Servers SHOULD try to maintain behavior. All clients need to be prepared for situations in which it
a one-to-one correspondence between filehandles and files but this is cannot be determined whether two filehandles denote the same object
not required. Clients MUST use filehandle comparisons only to and in such cases, avoid making invalid assumpions which might cause
improve performance, not for correct behavior. All clients need to incorrect behavior. Further discussion of filehandle and attribute
be prepared for situations in which it cannot be determined whether
two filehandles denote the same object and in such cases, avoid Draft Specification NFS version 4 Protocol August 2002
making invalid assumpions which might cause incorrect behavior.
Further discussion of filehandle and attribute comparison in the comparison in the context of data caching is presented in the section
context of data caching is presented in the section "Data Caching and "Data Caching and File Identity".
File Identity".
As an example, in the case that two different path names when As an example, in the case that two different path names when
traversed at the server terminate at the same file system object, the traversed at the server terminate at the same file system object, the
server SHOULD return the same filehandle for each path. This can server SHOULD return the same filehandle for each path. This can
occur if a hard link is used to create two file names which refer to occur if a hard link is used to create two file names which refer to
the same underlying file object and associated data. For example, if the same underlying file object and associated data. For example, if
paths /a/b/c and /a/d/c refer to the same file, the server SHOULD paths /a/b/c and /a/d/c refer to the same file, the server SHOULD
return the same filehandle for both path names traversals. return the same filehandle for both path names traversals.
4.2.2. Persistent Filehandle 4.2.2. Persistent Filehandle
A persistent filehandle is defined as having a fixed value for the A persistent filehandle is defined as having a fixed value for the
lifetime of the file system object to which it refers. Once the lifetime of the file system object to which it refers. Once the
server creates the filehandle for a file system object, the server server creates the filehandle for a file system object, the server
MUST accept the same filehandle for the object for the lifetime of MUST accept the same filehandle for the object for the lifetime of
the object. If the server restarts or reboots the NFS server must the object. If the server restarts or reboots the NFS server must
honor the same filehandle value as it did in the server's previous honor the same filehandle value as it did in the server's previous
instantiation. Similarly, if the file system is migrated, the new instantiation. Similarly, if the filesystem is migrated, the new NFS
NFS server must honor the same file handle as the old NFS server. server must honor the same filehandle as the old NFS server.
The persistent filehandle will be become stale or invalid when the The persistent filehandle will be become stale or invalid when the
file system object is removed. When the server is presented with a file system object is removed. When the server is presented with a
persistent filehandle that refers to a deleted object, it MUST return persistent filehandle that refers to a deleted object, it MUST return
an error of NFS4ERR_STALE. A filehandle may become stale when the an error of NFS4ERR_STALE. A filehandle may become stale when the
file system containing the object is no longer available. The file file system containing the object is no longer available. The file
system may become unavailable if it exists on removable media and the system may become unavailable if it exists on removable media and the
media is no longer available at the server or the file system in media is no longer available at the server or the filesystem in whole
whole has been destroyed or the file system has simply been removed has been destroyed or the filesystem has simply been removed from the
from the server's name space (i.e. unmounted in a Unix environment). server's name space (i.e. unmounted in a UNIX environment).
4.2.3. Volatile Filehandle 4.2.3. Volatile Filehandle
A volatile filehandle does not share the same longevity A volatile filehandle does not share the same longevity
Draft Specification NFS version 4 Protocol July 2002
characteristics of a persistent filehandle. The server may determine characteristics of a persistent filehandle. The server may determine
that a volatile filehandle is no longer valid at many different that a volatile filehandle is no longer valid at many different
points in time. If the server can definitively determine that a points in time. If the server can definitively determine that a
volatile filehandle refers to an object that has been removed, the volatile filehandle refers to an object that has been removed, the
server should return NFS4ERR_STALE to the client (as is the case for server should return NFS4ERR_STALE to the client (as is the case for
persistent filehandles). In all other cases where the server persistent filehandles). In all other cases where the server
determines that a volatile filehandle can no longer be used, it determines that a volatile filehandle can no longer be used, it
should return an error of NFS4ERR_FHEXPIRED. should return an error of NFS4ERR_FHEXPIRED.
The mandatory attribute "fh_expire_type" is used by the client to The mandatory attribute "fh_expire_type" is used by the client to
determine what type of filehandle the server is providing for a determine what type of filehandle the server is providing for a
particular file system. This attribute is a bitmask with the particular file system. This attribute is a bitmask with the
following values: following values:
Draft Specification NFS version 4 Protocol August 2002
FH4_PERSISTENT FH4_PERSISTENT
The value of FH4_PERSISTENT is used to indicate a persistent The value of FH4_PERSISTENT is used to indicate a persistent
filehandle, which is valid until the object is removed from the filehandle, which is valid until the object is removed from the
file system. The server will not return NFS4ERR_FHEXPIRED for file system. The server will not return NFS4ERR_FHEXPIRED for
this filehandle. FH4_PERSISTENT is defined as a value in which this filehandle. FH4_PERSISTENT is defined as a value in which
none of the bits specified below are set. none of the bits specified below are set.
FH4_NOEXPIRE_WITH_OPEN
The filehandle will not expire while client has the file open.
If this bit is set, then the values FH4_VOLATILE_ANY or
FH4_VOL_RENAME do not impact expiration while the file is open.
Once the file is closed or if the FH4_NOEXPIRE_WITH_OPEN bit is
false, the rest of the volatile related bits apply.
FH4_VOLATILE_ANY FH4_VOLATILE_ANY
The filehandle may expire at any time and will expire during The filehandle may expire at any time, except as specifically
system migration and rename. excluded (i.e. FH4_NO_EXPIRE_WITH_OPEN).
FH4_NOEXPIRE_WITH_OPEN
May only be set when FH4_VOLATILE_ANY is set. If this bit is
set, then the meaning of FH4_VOLATILE_ANY is qualified to
exclude any expiration of the filehandle when it is open.
FH4_VOL_MIGRATION FH4_VOL_MIGRATION
The filehandle will expire during file system migration. May The filehandle will expire as a result of migration. If
only be set if FH4_VOLATILE_ANY is not set. FH4_VOL_ANY is set, FH4_VOL_MIGRATION is redundant.
FH4_VOL_RENAME FH4_VOL_RENAME
The filehandle may expire due to a rename. This includes a The filehandle will expire during rename. This includes a
rename by the requesting client or a rename by another client. rename by the requesting client or a rename by any other client.
May only be set if FH4_VOLATILE_ANY is not set. If FH4_VOL_ANY is set, FH4_VOL_RENAME is redundant.
Servers which provide volatile filehandles should deny a RENAME or
REMOVE that would affect an OPEN file or any of the components
leading to the OPEN file. In addition, the server should deny all
RENAME or REMOVE requests during the grace or lease period upon
server restart.
The reader may be wondering why there are three FH4_VOL* bits and why
FH4_VOLATILE_ANY is exclusive of FH4_VOL_MIGRATION and
FH4_VOL_RENAME. If the a filehandle is normally persistent but
cannot persist across a file set migration, then the presence of the
Draft Specification NFS version 4 Protocol July 2002 Servers which provide volatile filehandles that may expire while
open (i.e. if FH4_VOL_MIGRATION or FH4_VOL_RENAME is set or if
FH4_VOLATILE_ANY is set and FH4_NOEXPIRE_WITH_OPEN not set),
should deny a RENAME or REMOVE that would affect an OPEN file of
any of the components leading to the OPEN file. In addition,
the server should deny all RENAME or REMOVE requests during the
grace period upon server restart.
FH4_VOL_MIGRATION or FH4_VOL_RENAME tells the client that it can Note that the bits FH4_VOL_MIGRATION and FH4_VOL_RENAME allow
treat the file handle as persistent for purposes of maintaining a the client to determine that expiration has occurred whenever a
file name to file handle cache, except for the specific event specific event occurs, without an explicit filehandle expiration
described by the bit. However, FH4_VOLATILE_ANY tells the client error from the server. FH4_VOL_ANY does not provide this form
that it should not maintain such a cache for unopened files. A of information. In situations where the server will expire many,
server MUST not present FH4_VOLATILE_ANY with FH4_VOL_MIGRATION or but not all filehandles upon migration (e.g. all but those that
FH4_VOL_RENAME as this will lead to confusion. FH4_VOLATILE_ANY are open), FH4_VOLATILE_ANY (in this case with
implies that the file handle will expire upon migration or rename, in FH4_NOEXPIRE_WITH_OPEN) is a better choice since the client may
addition to other events. not assume that all filehandles will expire when migration
occurs, and it is likely that additional expirations will occur
(as a result of file CLOSE) that are separated in time from the
migration event itself.
4.2.4. One Method of Constructing a Volatile Filehandle 4.2.4. One Method of Constructing a Volatile Filehandle
As mentioned, in some instances a filehandle is stale (no longer As mentioned, in some instances a filehandle is stale (no longer
valid; perhaps because the file was removed from the server) or it is valid; perhaps because the file was removed from the server) or it is
expired (the underlying file is valid but since the filehandle is expired (the underlying file is valid but since the filehandle is
Draft Specification NFS version 4 Protocol August 2002
volatile, it may have expired). Thus the server needs to be able to volatile, it may have expired). Thus the server needs to be able to
return NFS4ERR_STALE in the former case and NFS4ERR_FHEXPIRED in the return NFS4ERR_STALE in the former case and NFS4ERR_FHEXPIRED in the
latter case. This can be done by careful construction of the volatile latter case. This can be done by careful construction of the volatile
filehandle. One possible implementation follows. filehandle. One possible implementation follows.
A volatile filehandle, while opaque to the client could contain: A volatile filehandle, while opaque to the client could contain:
[volatile bit = 1 | server boot time | slot | generation number] [volatile bit = 1 | server boot time | slot | generation number]
o slot is an index in the server volatile filehandle table o slot is an index in the server volatile filehandle table
skipping to change at page 31, line 5 skipping to change at page 32, line 40
4.3. Client Recovery from Filehandle Expiration 4.3. Client Recovery from Filehandle Expiration
If possible, the client SHOULD recover from the receipt of an If possible, the client SHOULD recover from the receipt of an
NFS4ERR_FHEXPIRED error. The client must take on additional NFS4ERR_FHEXPIRED error. The client must take on additional
responsibility so that it may prepare itself to recover from the responsibility so that it may prepare itself to recover from the
expiration of a volatile filehandle. If the server returns expiration of a volatile filehandle. If the server returns
persistent filehandles, the client does not need these additional persistent filehandles, the client does not need these additional
steps. steps.
Draft Specification NFS version 4 Protocol July 2002
For volatile filehandles, most commonly the client will need to store For volatile filehandles, most commonly the client will need to store
the component names leading up to and including the file system the component names leading up to and including the filesystem object
object in question. With these names, the client should be able to in question. With these names, the client should be able to recover
recover by finding a filehandle in the name space that is still by finding a filehandle in the name space that is still available or
available or by starting at the root of the server's file system name by starting at the root of the server's filesystem name space.
space.
If the expired filehandle refers to an object that has been removed If the expired filehandle refers to an object that has been removed
from the file system, obviously the client will not be able to from the filesystem, obviously the client will not be able to recover
recover from the expired filehandle. from the expired filehandle.
It is also possible that the expired filehandle refers to a file that It is also possible that the expired filehandle refers to a file that
has been renamed. If the file was renamed by another client, again has been renamed. If the file was renamed by another client, again
it is possible that the original client will not be able to recover. it is possible that the original client will not be able to recover.
However, in the case that the client itself is renaming the file and However, in the case that the client itself is renaming the file and
the file is open, it is possible that the client may be able to the file is open, it is possible that the client may be able to
recover. The client can determine the new path name based on the recover. The client can determine the new path name based on the
processing of the rename request. The client can then regenerate the processing of the rename request. The client can then regenerate the
Draft Specification NFS version 4 Protocol August 2002
new filehandle based on the new path name. The client could also use new filehandle based on the new path name. The client could also use
the compound operation mechanism to construct a set of operations the compound operation mechanism to construct a set of operations
like: like:
RENAME A B RENAME A B
LOOKUP B LOOKUP B
GETFH GETFH
Note that the COMPOUND procedure does not provide atomicity. This
example only reduces the overhead of recovering from an expired
filehandle.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
5. File Attributes 5. File Attributes
To meet the requirements of extensibility and increased To meet the requirements of extensibility and increased
interoperability with non-Unix platforms, attributes must be handled interoperability with non-UNIX platforms, attributes must be handled
in a flexible manner. The NFS Version 3 fattr3 structure contains a in a flexible manner. The NFS version 3 fattr3 structure contains a
fixed list of attributes that not all clients and servers are able to fixed list of attributes that not all clients and servers are able to
support or care about. The fattr3 structure can not be extended as support or care about. The fattr3 structure can not be extended as
new needs arise and it provides no way to indicate non-support. With new needs arise and it provides no way to indicate non-support. With
the NFS Version 4 protocol, the client will be able to ask what the NFS version 4 protocol, the client is able query what attributes
attributes the server supports and will be able to request only those the server supports and construct requests with only those supported
attributes in which it is interested. attributes (or a subset thereof).
To this end, attributes will be divided into three groups: mandatory, To this end, attributes are divided into three groups: mandatory,
recommended, and named. Both mandatory and recommended attributes recommended, and named. Both mandatory and recommended attributes
are supported in the NFS version 4 protocol by a specific and well- are supported in the NFS version 4 protocol by a specific and well-
defined encoding and are identified by number. They are requested by defined encoding and are identified by number. They are requested by
setting a bit in the bit vector sent in the GETATTR request; the setting a bit in the bit vector sent in the GETATTR request; the
server response includes a bit vector to list what attributes were server response includes a bit vector to list what attributes were
returned in the response. New mandatory or recommended attributes returned in the response. New mandatory or recommended attributes
may be added to the NFS protocol between major revisions by may be added to the NFS protocol between major revisions by
publishing a standards-track RFC which allocates a new attribute publishing a standards-track RFC which allocates a new attribute
number value and defines the encoding for the attribute. See the number value and defines the encoding for the attribute. See the
section "Minor Versioning" for further discussion. section "Minor Versioning" for further discussion.
skipping to change at page 32, line 53 skipping to change at page 34, line 53
LOOKUP "x11icon" ; look up specific attribute LOOKUP "x11icon" ; look up specific attribute
READ 0,4096 ; read stream of bytes READ 0,4096 ; read stream of bytes
Named attributes are intended for data needed by applications rather Named attributes are intended for data needed by applications rather
than by an NFS client implementation. NFS implementors are strongly than by an NFS client implementation. NFS implementors are strongly
encouraged to define their new attributes as recommended attributes encouraged to define their new attributes as recommended attributes
by bringing them to the IETF standards-track process. by bringing them to the IETF standards-track process.
The set of attributes which are classified as mandatory is The set of attributes which are classified as mandatory is
deliberately small since servers must do whatever it takes to support deliberately small since servers must do whatever it takes to support
them. The recommended attributes may be unsupported; though a server them. A server should support as many of the recommended attributes
should support as many as it can. Attributes are deemed mandatory if as possible but by their definition, the server is not required to
the data is both needed by a large number of clients and is not support all of them. Attributes are deemed mandatory if the data is
otherwise reasonably computable by the client when support is not both needed by a large number of clients and is not otherwise
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
provided on the server. reasonably computable by the client when support is not provided on
the server.
Note that the hidden directory returned by OPENATTR is a convenience
for protocol processing. The client should not make any assumptions
about the server's implementation of named attributes and whether the
underlying filesystem at the server has a named attribute directory
or not. Therefore, operations such as SETATTR and GETATTR on the
named attribute directory are undefined.
5.1. Mandatory Attributes 5.1. Mandatory Attributes
These MUST be supported by every NFS Version 4 client and server in These MUST be supported by every NFS version 4 client and server in
order to ensure a minimum level of interoperability. The server must order to ensure a minimum level of interoperability. The server must
store and return these attributes and the client must be able to store and return these attributes and the client must be able to
function with an attribute set limited to these attributes. With function with an attribute set limited to these attributes. With
just the mandatory attributes some client functionality may be just the mandatory attributes some client functionality may be
impaired or limited in some ways. A client may ask for any of these impaired or limited in some ways. A client may ask for any of these
attributes to be returned by setting a bit in the GETATTR request and attributes to be returned by setting a bit in the GETATTR request and
the server must return their value. the server must return their value.
5.2. Recommended Attributes 5.2. Recommended Attributes
These attributes are understood well enough to warrant support in the These attributes are understood well enough to warrant support in the
NFS Version 4 protocol. However, they may not be supported on all NFS version 4 protocol. However, they may not be supported on all
clients and servers. A client may ask for any of these attributes to clients and servers. A client may ask for any of these attributes to
be returned by setting a bit in the GETATTR request but must handle be returned by setting a bit in the GETATTR request but must handle
the case where the server does not return them. A client may ask for the case where the server does not return them. A client may ask for
the set of attributes the server supports and should not request the set of attributes the server supports and should not request
attributes the server does not support. A server should be tolerant attributes the server does not support. A server should be tolerant
of requests for unsupported attributes and simply not return them of requests for unsupported attributes and simply not return them
rather than considering the request an error. It is expected that rather than considering the request an error. It is expected that
servers will support all attributes they comfortably can and only servers will support all attributes they comfortably can and only
fail to support attributes which are difficult to support in their fail to support attributes which are difficult to support in their
operating environments. A server should provide attributes whenever operating environments. A server should provide attributes whenever
they don't have to "tell lies" to the client. For example, a file they don't have to "tell lies" to the client. For example, a file
modification time should be either an accurate time or should not be modification time should be either an accurate time or should not be
supported by the server. This will not always be comfortable to supported by the server. This will not always be comfortable to
clients but it seems that the client has a better ability to clients but the client is better positioned decide whether and how to
fabricate or construct an attribute or do without the attribute. fabricate or construct an attribute or whether to do without the
attribute.
5.3. Named Attributes 5.3. Named Attributes
These attributes are not supported by direct encoding in the NFS These attributes are not supported by direct encoding in the NFS
Version 4 protocol but are accessed by string names rather than Version 4 protocol but are accessed by string names rather than
numbers and correspond to an uninterpreted stream of bytes which are numbers and correspond to an uninterpreted stream of bytes which are
stored with the file system object. The name space for these stored with the file system object. The name space for these
Draft Specification NFS version 4 Protocol August 2002
attributes may be accessed by using the OPENATTR operation. The attributes may be accessed by using the OPENATTR operation. The
OPENATTR operation returns a filehandle for a virtual "attribute OPENATTR operation returns a filehandle for a virtual "attribute
directory" and further perusal of the name space may be done using directory" and further perusal of the name space may be done using
READDIR and LOOKUP operations on this filehandle. Named attributes READDIR and LOOKUP operations on this filehandle. Named attributes
may then be examined or changed by normal READ and WRITE and CREATE may then be examined or changed by normal READ and WRITE and CREATE
operations on the filehandles returned from READDIR and LOOKUP. operations on the filehandles returned from READDIR and LOOKUP.
Named attributes may have attributes. Named attributes may have attributes.
It is recommended that servers support arbitrary named attributes. A It is recommended that servers support arbitrary named attributes. A
client should not depend on the ability to store any named attributes client should not depend on the ability to store any named attributes
Draft Specification NFS version 4 Protocol July 2002
in the server's file system. If a server does support named in the server's file system. If a server does support named
attributes, a client which is also able to handle them should be able attributes, a client which is also able to handle them should be able
to copy a file's data and meta-data with complete transparency from to copy a file's data and meta-data with complete transparency from
one location to another; this would imply that names allowed for one location to another; this would imply that names allowed for
regular directory entries are valid for named attribute names as regular directory entries are valid for named attribute names as
well. well.
Names of attributes will not be controlled by this document or other Names of attributes will not be controlled by this document or other
IETF standards track documents. See the section "IANA IETF standards track documents. See the section "IANA
Considerations" for further discussion. Considerations" for further discussion.
Draft Specification NFS version 4 Protocol July 2002 5.4. Classification of Attributes
5.4. Mandatory Attributes - Definitions Each of the Mandatory and Recommended attributes can be classified in
one of three categories: per server, per filesystem, or per
filesystem object. Note that it is possible that some per filesystem
attributes may vary within the filesystem. See the "homogeneous"
attribute for its definition. Note that the attributes
time_access_set and time_modify_set are not listed below because they
are write-only attributes used in a special instance of SETATTR.
o The per server attribute is:
lease_time
o The per filesystem attributes are:
supp_attr, fh_expire_type, link_support, symlink_support,
unique_handles, aclsupport, cansettime, case_insensitive,
case_preserving, chown_restricted, files_avail, files_free,
files_total, fs_locations, homogeneous, maxfilesize, maxname,
maxread, maxwrite, no_trunc, space_avail, space_free,
space_total, time_delta
o The per filesystem object attributes are:
type, change, size, named_attr, fsid, rdattr_error, filehandle,
ACL, archive, fileid, hidden, maxlink, mimetype, mode, numlinks,
owner, owner_group, rawdev, space_used, system, time_access,
time_backup, time_create, time_metadata, time_modify,
mounted_on_fileid
Draft Specification NFS version 4 Protocol August 2002
For quota_avail_hard, quota_avail_soft, and quota_used see their
definitions below for the appropriate classification.
Draft Specification NFS version 4 Protocol August 2002
5.5. Mandatory Attributes - Definitions
Name # DataType Access Description Name # DataType Access Description
___________________________________________________________________ ___________________________________________________________________
supp_attr 0 bitmap READ supp_attr 0 bitmap READ The bit vector which
The bit vector which
would retrieve all would retrieve all
mandatory and mandatory and
recommended attributes recommended attributes
that are supported for that are supported for
this object. this object. The
scope of this
attribute applies to
all objects with a
matching fsid.
type 1 nfs4_ftype READ type 1 nfs4_ftype READ The type of the object
The type of the object
(file, directory, (file, directory,
symlink) symlink, etc.)
fh_expire_type 2 uint32 READ fh_expire_type 2 uint32 READ Server uses this to
Server uses this to
specify filehandle specify filehandle
expiration behavior to expiration behavior to
the client. See the the client. See the
section "Filehandles" section "Filehandles"
for additional for additional
description. description.
change 3 uint64 READ change 3 uint64 READ A value created by the
A value created by the
server that the client server that the client
can use to determine can use to determine
if file data, if file data,
directory contents or directory contents or
attributes of the attributes of the
object have been object have been
modified. The server modified. The server
may return the may return the
object's time_modify object's time_metadata
attribute for this attribute for this
attribute's value but attribute's value but
only if the file only if the filesystem
system object can not object can not be
be updated more updated more
frequently than the frequently than the
resolution of resolution of
time_modify. time_metadata.
size 4 uint64 R/W size 4 uint64 R/W
The size of the object The size of the object
in bytes. in bytes.
link_support 5 bool READ Draft Specification NFS version 4 Protocol August 2002
Does the object's file
system supports hard
links?
Draft Specification NFS version 4 Protocol July 2002 link_support 5 bool READ True, if the object's
filesystem supports
hard links.
symlink_support 6 bool READ symlink_support 6 bool READ True, if the object's
Does the object's file filesystem supports
system supports symbolic links.
symbolic links?
named_attr 7 bool READ named_attr 7 bool READ True, if this object
Does this object have has named attributes.
named attributes? In other words, object
has a non-empty named
attribute directory.
fsid 8 fsid4 READ fsid 8 fsid4 READ Unique filesystem
Unique file system
identifier for the identifier for the
file system holding file system holding
this object. fsid this object. fsid
contains major and contains major and
minor components each minor components each
of which are uint64. of which are uint64.
unique_handles 9 bool READ unique_handles 9 bool READ
Are two distinct True, if two distinct
filehandles guaranteed filehandles guaranteed
to refer to two to refer to two
different file system different file system
objects? objects.
lease_time 10 nfs_lease4 READ lease_time 10 nfs_lease4 READ Duration of leases at
Duration of leases at
server in seconds. server in seconds.
rdattr_error 11 enum READ rdattr_error 11 enum READ Error returned from
Error returned from
getattr during getattr during
readdir. readdir.
filehandle 19 nfs_fh4 READ filehandle 19 nfs_fh4 READ The filehandle of this
The filehandle of this
object (primarily for object (primarily for
readdir requests). readdir requests).
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
5.5. Recommended Attributes - Definitions 5.6. Recommended Attributes - Definitions
Name # Data Type Access Description Name # Data Type Access Description
_____________________________________________________________________ ______________________________________________________________________
ACL 12 nfsace4<> R/W ACL 12 nfsace4<> R/W The access control
The access control
list for the object. list for the object.
aclsupport 13 uint32 READ aclsupport 13 uint32 READ Indicates what types
Indicates what types
of ACLs are supported of ACLs are supported
on the current file on the current
system. filesystem.
archive 14 bool R/W archive 14 bool R/W True, if this file
Whether or not this has been archived
file has been since the time of
archived since the last modification
time of last
modification
(deprecated in favor (deprecated in favor
of time_backup). of time_backup).
cansettime 15 bool READ cansettime 15 bool READ True, if the server
Is the server able to able to change the
change the times for times for a
a file system object filesystem object as
as specified in a specified in a
SETATTR operation? SETATTR operation.
case_insensitive 16 bool READ case_insensitive 16 bool READ True, if filename
Are filename
comparisons on this comparisons on this
file system case file system case
insensitive? insensitive.
case_preserving 17 bool READ case_preserving 17 bool READ True, if filename
Is filename case on case on this
this file system filesystem preserved.
preserved?
chown_restricted 18 bool READ chown_restricted 18 bool READ If TRUE, the server
If TRUE, the server
will reject any will reject any
request to change request to change
either the owner or either the owner or
the group associated the group associated
with a file if the with a file if the
caller is not a caller is not a
privileged user (for privileged user (for
example, "root" in example, "root" in
Unix operating UNIX operating
environments or in NT environments or in
the "Take Ownership" Windows 2000 the
privilege) "Take Ownership"
privilege).
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
fileid 20 uint64 READ fileid 20 uint64 READ A number uniquely
A number uniquely
identifying the file identifying the file
within the file within the
system. filesystem.
files_avail 21 uint64 READ files_avail 21 uint64 READ File slots available
File slots available
to this user on the to this user on the
file system filesystem containing
containing this this object - this
object - this should should be the
be the smallest smallest relevant
relevant limit. limit.
files_free 22 uint64 READ files_free 22 uint64 READ Free file slots on
Free file slots on
the file system the file system
containing this containing this
object - this should object - this should
be the smallest be the smallest
relevant limit. relevant limit.
files_total 23 uint64 READ files_total 23 uint64 READ Total file slots on
Total file slots on
the file system the file system
containing this containing this
object. object.
fs_locations 24 fs_locations READ fs_locations 24 fs_locations READ Locations where this
Locations where this
file system may be file system may be
found. If the server found. If the server
returns NFS4ERR_MOVED returns NFS4ERR_MOVED
as an error, this as an error, this
attribute must be attribute MUST be
supported. supported.
hidden 25 bool R/W hidden 25 bool R/W True, if the file is
Is file considered considered hidden
hidden with respect with respect to the
to the WIN32 API? Windows API?
homogeneous 26 bool READ homogeneous 26 bool READ True, if this
Whether or not this
object's file system object's file system
is homogeneous, i.e. is homogeneous, i.e.
are per file system are per file system
attributes the same attributes the same
for all file system's for all file system's
objects. objects.
maxfilesize 27 uint64 READ maxfilesize 27 uint64 READ Maximum supported
Maximum supported
file size for the file size for the
file system of this file system of this
object. object.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
maxlink 28 uint32 READ maxlink 28 uint32 READ Maximum number of
Maximum number of
links for this links for this
object. object.
maxname 29 uint32 READ maxname 29 uint32 READ Maximum filename size
Maximum filename size
supported for this supported for this
object. object.
maxread 30 uint64 READ maxread 30 uint64 READ Maximum read size
Maximum read size
supported for this supported for this
object. object.
maxwrite 31 uint64 READ maxwrite 31 uint64 READ
Maximum write size Maximum write size
supported for this supported for this
object. This object. This
attribute SHOULD be attribute SHOULD be
supported if the file supported if the file
is writable. Lack of is writable. Lack of
this attribute can this attribute can
lead to the client lead to the client
either wasting either wasting
bandwidth or not bandwidth or not
receiving the best receiving the best
performance. performance.
mimetype 32 utf8<> R/W mimetype 32 utf8<> R/W MIME body
MIME body
type/subtype of this type/subtype of this
object. object.
mode 33 mode4 R/W mode 33 mode4 R/W UNIX-style mode and
Unix-style permission permission bits for
bits for this object this object.
(deprecated in favor
of ACLs)
no_trunc 34 bool READ no_trunc 34 bool READ True, if a name
If a name longer than longer than name_max
name_max is used, is used, an error be
will an error be returned and name is
returned or will the not truncated.
name be truncated?
numlinks 35 uint32 READ numlinks 35 uint32 READ Number of hard links
Number of hard links
to this object. to this object.
owner 36 utf8<> R/W owner 36 utf8<> R/W The string name of
The string name of
the owner of this the owner of this
object. object.
owner_group 37 utf8<> R/W owner_group 37 utf8<> R/W The string name of
The string name of
the group ownership the group ownership
of this object. of this object.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
quota_avail_hard 38 uint64 READ quota_avail_hard 38 uint64 READ For definition see
For definition see
"Quota Attributes" "Quota Attributes"
section below. section below.
quota_avail_soft 39 uint64 READ quota_avail_soft 39 uint64 READ For definition see
For definition see
"Quota Attributes" "Quota Attributes"
section below. section below.
quota_used 40 uint64 READ quota_used 40 uint64 READ For definition see
For definition see
"Quota Attributes" "Quota Attributes"
section below. section below.
rawdev 41 specdata4 READ rawdev 41 specdata4 READ Raw device
Raw device identifier. UNIX
identifier. Unix
device major/minor device major/minor
node information. node information. If
the value of type is
not NF4BLK or NF4CHR,
the value return
SHOULD NOT be
considered useful.
space_avail 42 uint64 READ space_avail 42 uint64 READ Disk space in bytes
Disk space in bytes
available to this available to this
user on the file user on the
system containing filesystem containing
this object - this this object - this
should be the should be the
smallest relevant smallest relevant
limit. limit.
space_free 43 uint64 READ space_free 43 uint64 READ Free disk space in
Free disk space in bytes on the
bytes on the file filesystem containing
system containing
this object - this this object - this
should be the should be the
smallest relevant smallest relevant
limit. limit.
space_total 44 uint64 READ space_total 44 uint64 READ Total disk space in
Total disk space in bytes on the
bytes on the file filesystem containing
system containing
this object. this object.
space_used 45 uint64 READ space_used 45 uint64 READ Number of filesystem
Number of file system
bytes allocated to bytes allocated to
this object. this object.
system 46 bool R/W Draft Specification NFS version 4 Protocol August 2002
Is this file a system
file with respect to
the WIN32 API?
time_access 47 nfstime4 READ system 46 bool R/W True, if this file is
The time of last a "system" file with
access to the object. respect to the
Windows API?
Draft Specification NFS version 4 Protocol July 2002 time_access 47 nfstime4 READ The time of last
access to the object
by a read that was
satisfied by the
server.
time_access_set 48 settime4 WRITE time_access_set 48 settime4 WRITE Set the time of last
Set the time of last
access to the object. access to the object.
SETATTR use only. SETATTR use only.
time_backup 49 nfstime4 R/W time_backup 49 nfstime4 R/W The time of last
The time of last
backup of the object. backup of the object.
time_create 50 nfstime4 R/W time_create 50 nfstime4 R/W
The time of creation The time of creation
of the object. This of the object. This
attribute does not attribute does not
have any relation to have any relation to
the traditional Unix the traditional UNIX
file attribute file attribute
"ctime" or "change "ctime" or "change
time". time".
time_delta 51 nfstime4 READ time_delta 51 nfstime4 READ Smallest useful
Smallest useful
server time server time
granularity. granularity.
time_metadata 52 nfstime4 R/W time_metadata 52 nfstime4 R/W The time of last
The time of last
meta-data meta-data
modification of the modification of the
object. object.
time_modify 53 nfstime4 READ time_modify 53 nfstime4 READ The time of last
The time of last
modification to the modification to the
object. object.
time_modify_set 54 settime4 WRITE time_modify_set 54 settime4 WRITE Set the time of last
Set the time of last
modification to the modification to the
object. SETATTR use object. SETATTR use
only. only.
5.6. Interpreting owner and owner_group mounted_on_fileid 55 uint64 READ Like fileid, but if
the target filehandle
is the root of a
filesystem return the
fileid of the
underlying directory.
Draft Specification NFS version 4 Protocol August 2002
5.7. Time Access
As defined above, the time_access attribute represents the time of
last access to the object by a read that was satisfied by the server.
The notion of what is an "access" depends on server's operating
environment and/or the server's filesystem semantics. For example,
for servers obeying POSIX semantics, time_access would be updated
only by the READLINK, READ, and READDIR operations and not any of the
operations that modify the content of the object. Of course, setting
the corresponding time_access_set attribute is another way to modify
the time_access attribute.
Whenever the file object resides on a writeable filesystem, the
server should make best efforts to record time_access into stable
storage. However, to mitigate the performance effects of doing so,
and most especially whenever the server is satisifying the read of
the object's content from its cache, the server MAY cache access time
updates and lazily write them to stable storage. It is also
acceptable to give administrators of the server the option to disable
time_access updates.
5.8. Interpreting owner and owner_group
The recommended attributes "owner" and "owner_group" (and also users The recommended attributes "owner" and "owner_group" (and also users
and groups within the "acl" attribute) are represented in terms of a and groups within the "acl" attribute) are represented in terms of a
UTF-8 string. To avoid a representation that is tied to a particular UTF-8 string. To avoid a representation that is tied to a particular
underlying implementation at the client or server, the use of the underlying implementation at the client or server, the use of the
UTF-8 string has been chosen. Note that section 6.1 of [RFC2624] UTF-8 string has been chosen. Note that section 6.1 of [RFC2624]
provides additional rationale. It is expected that the client and provides additional rationale. It is expected that the client and
server will have their own local representation of owner and server will have their own local representation of owner and
owner_group that is used for local storage or presentation to the end owner_group that is used for local storage or presentation to the end
user. Therefore, it is expected that when these attributes are user. Therefore, it is expected that when these attributes are
transferred between the client and server that the local transferred between the client and server that the local
representation is translated to a syntax of the form representation is translated to a syntax of the form
"user@dns_domain". This will allow for a client and server that do "user@dns_domain". This will allow for a client and server that do
not use the same local representation the ability to translate to a not use the same local representation the ability to translate to a
common syntax that can be interpreted by both. common syntax that can be interpreted by both.
Draft Specification NFS version 4 Protocol July 2002
Similarly, security principals may be represented in different ways Similarly, security principals may be represented in different ways
by different security mechanisms. Servers normally translate these by different security mechanisms. Servers normally translate these
representations into a common format, generally that used by local representations into a common format, generally that used by local
storage, to serve as a means of identifying the users corresponding storage, to serve as a means of identifying the users corresponding
to these security principals. When these local identifiers are to these security principals. When these local identifiers are
translated to the form of the owner attribute, associated with files translated to the form of the owner attribute, associated with files
created by such principals they identify, in a common format, the created by such principals they identify, in a common format, the
users associated with each corresponding set of security principals. users associated with each corresponding set of security principals.
The translation used to interpret owner and group strings is not The translation used to interpret owner and group strings is not
specified as part of the protocol. This allows various solutions to specified as part of the protocol. This allows various solutions to
be employed. For example, a local translation table may be consulted be employed. For example, a local translation table may be consulted
that maps between a numeric id to the user@dns_domain syntax. A name that maps between a numeric id to the user@dns_domain syntax. A name
Draft Specification NFS version 4 Protocol August 2002
service may also be used to accomplish the translation. A server may service may also be used to accomplish the translation. A server may
provide a more general service, not limited by any particular provide a more general service, not limited by any particular
translation (which would only translate a limited set of possible translation (which would only translate a limited set of possible
strings) by storing the owner and owner_group attributes in local strings) by storing the owner and owner_group attributes in local
storage without any translation or it may augment a translation storage without any translation or it may augment a translation
method by storing the entire string for attributes for which no method by storing the entire string for attributes for which no
translation is available while using the local representation for translation is available while using the local representation for
those cases in which a translation is available. those cases in which a translation is available.
Servers that do not provide support for all possible values of the Servers that do not provide support for all possible values of the
skipping to change at page 43, line 4 skipping to change at page 46, line 46
constraints. constraints.
In the case where there is no translation available to the client or In the case where there is no translation available to the client or
server, the attribute value must be constructed without the "@". server, the attribute value must be constructed without the "@".
Therefore, the absence of the @ from the owner or owner_group Therefore, the absence of the @ from the owner or owner_group
attribute signifies that no translation was available at the sender attribute signifies that no translation was available at the sender
and that the receiver of the attribute should not use that string as and that the receiver of the attribute should not use that string as
a basis for translation into its own internal format. Even though a basis for translation into its own internal format. Even though
the attribute value can not be translated, it may still be useful. the attribute value can not be translated, it may still be useful.
In the case of a client, the attribute string may be used for local In the case of a client, the attribute string may be used for local
Draft Specification NFS version 4 Protocol July 2002
display of ownership. display of ownership.
To provide a greater degree of compatibility with previous versions To provide a greater degree of compatibility with previous versions
of NFS (i.e. v2 and v3), which identified users and groups by 32-bit of NFS (i.e. v2 and v3), which identified users and groups by 32-bit
unsigned uid's and gid's, owner and group strings that consist of unsigned uid's and gid's, owner and group strings that consist of
decimal numeric values with no leading zeros can be given a special decimal numeric values with no leading zeros can be given a special
interpretation by clients and servers which choose to provide such interpretation by clients and servers which choose to provide such
support. The receiver may treat such a user or group string as support. The receiver may treat such a user or group string as
representing the same user as would be represented by a v2/v3 uid or representing the same user as would be represented by a v2/v3 uid or
gid having the corresponding numeric value. A server is not gid having the corresponding numeric value. A server is not
obligated to accept such a string, but may return an NFS4ERR_BADOWNER obligated to accept such a string, but may return an NFS4ERR_BADOWNER
instead. To avoid this mechanism being used to subvert user and instead. To avoid this mechanism being used to subvert user and
group translation, so that a client might pass all of the owners and group translation, so that a client might pass all of the owners and
Draft Specification NFS version 4 Protocol August 2002
groups in numeric form, a server SHOULD return an NFS4ERR_BADOWNER groups in numeric form, a server SHOULD return an NFS4ERR_BADOWNER
error when there is a valid translation for the user or owner error when there is a valid translation for the user or owner
designated in this way. In that case, the client must use the designated in this way. In that case, the client must use the
appropriate name@domain string and not the special form for appropriate name@domain string and not the special form for
compatibility. compatibility.
The owner string "nobody" may be used to designate an anonymous user, The owner string "nobody" may be used to designate an anonymous user,
which will be associated with a file created by a security principal which will be associated with a file created by a security principal
that cannot be mapped through normal means to the owner attribute. that cannot be mapped through normal means to the owner attribute.
5.7. Character Case Attributes 5.9. Character Case Attributes
With respect to the case_insensitive and case_preserving attributes, With respect to the case_insensitive and case_preserving attributes,
each UCS-4 character (which UTF-8 encodes) has a "long descriptive each UCS-4 character (which UTF-8 encodes) has a "long descriptive
name" [RFC1345] which may or may not included the word "CAPITAL" or name" [RFC1345] which may or may not included the word "CAPITAL" or
"SMALL". The presence of SMALL or CAPITAL allows an NFS server to "SMALL". The presence of SMALL or CAPITAL allows an NFS server to
implement unambiguous and efficient table driven mappings for case implement unambiguous and efficient table driven mappings for case
insensitive comparisons, and non-case-preserving storage. For insensitive comparisons, and non-case-preserving storage. For
general character handling and internationalization issues, see the general character handling and internationalization issues, see the
section "Internationalization". section "Internationalization".
5.8. Quota Attributes 5.10. Quota Attributes
For the attributes related to file system quotas, the following For the attributes related to file system quotas, the following
definitions apply: definitions apply:
quota_avail_soft quota_avail_soft
The value in bytes which represents the amount of additional The value in bytes which represents the amount of additional
disk space that can be allocated to this file or directory disk space that can be allocated to this file or directory
before the user may reasonably be warned. It is understood that before the user may reasonably be warned. It is understood that
this space may be consumed by allocations to other files or this space may be consumed by allocations to other files or
directories though there is a rule as to which other files or directories though there is a rule as to which other files or
directories. directories.
quota_avail_hard quota_avail_hard
The value in bytes which represent the amount of additional disk The value in bytes which represent the amount of additional disk
Draft Specification NFS version 4 Protocol July 2002
space beyond the current allocation that can be allocated to space beyond the current allocation that can be allocated to
this file or directory before further allocations will be this file or directory before further allocations will be
refused. It is understood that this space may be consumed by refused. It is understood that this space may be consumed by
allocations to other files or directories. allocations to other files or directories.
quota_used quota_used
The value in bytes which represent the amount of disc space used The value in bytes which represent the amount of disc space used
by this file or directory and possibly a number of other similar by this file or directory and possibly a number of other similar
files or directories, where the set of "similar" meets at least files or directories, where the set of "similar" meets at least
the criterion that allocating space to any file or directory in the criterion that allocating space to any file or directory in
the set will reduce the "quota_avail_hard" of every other file the set will reduce the "quota_avail_hard" of every other file
or directory in the set. or directory in the set.
Draft Specification NFS version 4 Protocol August 2002
Note that there may be a number of distinct but overlapping sets Note that there may be a number of distinct but overlapping sets
of files or directories for which a quota_used value is of files or directories for which a quota_used value is
maintained. E.g. "all files with a given owner", "all files with maintained. E.g. "all files with a given owner", "all files with
a given group owner". etc. a given group owner". etc.
The server is at liberty to choose any of those sets but should The server is at liberty to choose any of those sets but should
do so in a repeatable way. The rule may be configured per- do so in a repeatable way. The rule may be configured per-
filesystem or may be "choose the set with the smallest quota". filesystem or may be "choose the set with the smallest quota".
5.9. Access Control Lists 5.11. Access Control Lists
The NFS ACL attribute is an array of access control entries (ACE).
There are various access control entry types. The server is able to
communicate which ACE types are supported by returning the
appropriate value within the aclsupport attribute. The types of ACEs
are defined as follows:
Type Description
_____________________________________________________
ALLOW
Explicitly grants the access defined in
acemask4 to the file or directory.
DENY
Explicitly denies the access defined in
acemask4 to the file or directory.
AUDIT
LOG (system dependent) any access
attempt to a file or directory which
uses any of the access methods specified
in acemask4.
ALARM The NFS version 4 ACL attribute is an array of access control entries
Generate a system ALARM (system (ACE). There are various access control entry types, as defined in
dependent) when any access attempt is the Section "ACE type". The server is able to communicate which ACE
made to a file or directory for the types are supported by returning the appropriate value within the
access methods specified in acemask4. aclsupport attribute. Each ACE covers one or more operations on a
file or directory as described in the Section "ACE Access Mask". It
may also contain one or more flags that modify the semantics of the
ACE as defined in the Section "ACE flag".
The NFS ACE attribute is defined as follows: The NFS ACE attribute is defined as follows:
Draft Specification NFS version 4 Protocol July 2002
typedef uint32_t acetype4; typedef uint32_t acetype4;
typedef uint32_t aceflag4; typedef uint32_t aceflag4;
typedef uint32_t acemask4; typedef uint32_t acemask4;
struct nfsace4 { struct nfsace4 {
acetype4 type; acetype4 type;
aceflag4 flag; aceflag4 flag;
acemask4 access_mask; acemask4 access_mask;
utf8string who; utf8string who;
}; };
To determine if an ACCESS or OPEN request succeeds each nfsace4 entry To determine if a request succeeds, each nfsace4 entry is processed
is processed in order by the server. Only ACEs which have a "who" in order by the server. Only ACEs which have a "who" that matches
that matches the requester are considered. Each ACE is processed the requester are considered. Each ACE is processed until all of the
until all of the bits of the requester's access have been ALLOWED. bits of the requester's access have been ALLOWED. Once a bit (see
Once a bit (see below) has been ALLOWED by an ACCESS_ALLOWED_ACE, it below) has been ALLOWED by an ACCESS_ALLOWED_ACE, it is no longer
is no longer considered in the processing of later ACEs. If an considered in the processing of later ACEs. If an ACCESS_DENIED_ACE
ACCESS_DENIED_ACE is encountered where the requester's mode still has is encountered where the requester's access still has unALLOWED bits
unALLOWED bits in common with the "access_mask" of the ACE, the in common with the "access_mask" of the ACE, the request is denied.
request is denied. However, unlike the ALLOWED and DENIED ACE types, the ALARM and AUDIT
ACE types do not affect a requestor's access, and instead are for
triggering events as a result of a requestor's access attempt.
Therefore, all AUDIT and ALARM ACEs are processed until end of the
ACL.
The bitmask constants used to represent the above definitions within The NFS version 4 ACL model is quite rich. Some server platforms may
the aclsupport attribute are as follows: provide access control functionality that goes beyond the UNIX-style
Draft Specification NFS version 4 Protocol August 2002
mode attribute, but which is not as rich as the NFS ACL model. So
that users can take advantage of this more limited functionality, the
server may indicate that it supports ACLs as long as it follows the
guidelines for mapping between its ACL model and the NFS version 4
ACL model.
The situation is complicated by the fact that a server may have
multiple modules that enforce ACLs. For example, the enforcement for
NFS version 4 access may be different from the enforcement for local
access, and both may be different from the enforcement for access
through other protocols such as SMB. So it may be useful for a
server to accept an ACL even if not all of its modules are able to
support it.
The guiding principle in all cases is that the server must not accept
ACLs that appear to make the file more secure than it really is.
5.11.1. ACE type
Type Description
_____________________________________________________
ALLOW Explicitly grants the access defined in
acemask4 to the file or directory.
DENY Explicitly denies the access defined in
acemask4 to the file or directory.
AUDIT LOG (system dependent) any access
attempt to a file or directory which
uses any of the access methods specified
in acemask4.
ALARM Generate a system ALARM (system
dependent) when any access attempt is
made to a file or directory for the
access methods specified in acemask4.
A server need not support all of the above ACE types. The bitmask
constants used to represent the above definitions within the
aclsupport attribute are as follows:
const ACL4_SUPPORT_ALLOW_ACL = 0x00000001; const ACL4_SUPPORT_ALLOW_ACL = 0x00000001;
const ACL4_SUPPORT_DENY_ACL = 0x00000002; const ACL4_SUPPORT_DENY_ACL = 0x00000002;
const ACL4_SUPPORT_AUDIT_ACL = 0x00000004; const ACL4_SUPPORT_AUDIT_ACL = 0x00000004;
const ACL4_SUPPORT_ALARM_ACL = 0x00000008; const ACL4_SUPPORT_ALARM_ACL = 0x00000008;
5.9.1. ACE type
The semantics of the "type" field follow the descriptions provided The semantics of the "type" field follow the descriptions provided
Draft Specification NFS version 4 Protocol August 2002
above. above.
The bitmask constants used for the type field are as follows: The constants used for the type field (acetype4) are as follows:
const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000;
const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001;
const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002;
const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003;
5.9.2. ACE flag Clients should not attempt to set an ACE unless the server claims
support for that ACE type. If the server receives a request to set
an ACE that it cannot store, it must reject the request with
NFS4ERR_ATTRNOTSUPP.
If the server receives a request to set an ACE that it can store but
cannot enforce, the server SHOULD reject the request.
Example: suppose a server can enforce NFS ACLs for NFS access but
cannot enforce ACLs for local access. If arbitrary processes can run
on the server, then the server SHOULD NOT indicate ACL support. On
the other hand, if only trusted administrative programs run locally,
then the server may indicate ACL support.
5.11.2. ACE Access Mask
The access_mask field contains values based on the following:
Access Description
_______________________________________________________________
READ_DATA Permission to read the data of the file
LIST_DIRECTORY Permission to list the contents of a
directory
WRITE_DATA Permission to modify the file's data
ADD_FILE Permission to add a new file to a
directory
APPEND_DATA Permission to append data to a file
ADD_SUBDIRECTORY Permission to create a subdirectory to a
directory
READ_NAMED_ATTRS Permission to read the named attributes
of a file
WRITE_NAMED_ATTRS Permission to write the named attributes
of a file
EXECUTE Permission to execute a file
DELETE_CHILD Permission to delete a file or directory
within a directory
READ_ATTRIBUTES The ability to read basic attributes
(non-acls) of a file
Draft Specification NFS version 4 Protocol August 2002
WRITE_ATTRIBUTES Permission to change basic attributes
(non-acls) of a file
DELETE Permission to Delete the file
READ_ACL Permission to Read the ACL
WRITE_ACL Permission to Write the ACL
WRITE_OWNER Permission to change the owner
SYNCHRONIZE Permission to access file locally at the
server with synchronous reads and writes
The bitmask constants used for the access mask field are as follows:
const ACE4_READ_DATA = 0x00000001;
const ACE4_LIST_DIRECTORY = 0x00000001;
const ACE4_WRITE_DATA = 0x00000002;
const ACE4_ADD_FILE = 0x00000002;
const ACE4_APPEND_DATA = 0x00000004;
const ACE4_ADD_SUBDIRECTORY = 0x00000004;
const ACE4_READ_NAMED_ATTRS = 0x00000008;
const ACE4_WRITE_NAMED_ATTRS = 0x00000010;
const ACE4_EXECUTE = 0x00000020;
const ACE4_DELETE_CHILD = 0x00000040;
const ACE4_READ_ATTRIBUTES = 0x00000080;
const ACE4_WRITE_ATTRIBUTES = 0x00000100;
const ACE4_DELETE = 0x00010000;
const ACE4_READ_ACL = 0x00020000;
const ACE4_WRITE_ACL = 0x00040000;
const ACE4_WRITE_OWNER = 0x00080000;
const ACE4_SYNCHRONIZE = 0x00100000;
Server implementations need not provide the granularity of control
that is implied by this list of masks. For example, POSIX-based
systems might not distinguish APPEND_DATA (the ability to append to a
file) from WRITE_DATA (the ability to modify existing contents); both
masks would be tied to a single ``write'' permission. When such a
server returns attributes to the client, it would show both
APPEND_DATA and WRITE_DATA if and only if the write permission is
enabled.
If a server receives a SETATTR request that it cannot accurately
implement, it should error in the direction of more restricted
access. For example, suppose a server cannot distinguish overwriting
data from appending new data, as described in the previous paragraph.
If a client submits an ACE where APPEND_DATA is set but WRITE_DATA is
not (or vice versa), the server should reject the request with
NFS4ERR_ATTRNOTSUPP. Nonetheless, if the ACE has type DENY, the
server may silently turn on the other bit, so that both APPEND_DATA
and WRITE_DATA are denied.
Draft Specification NFS version 4 Protocol August 2002
5.11.3. ACE flag
The "flag" field contains values based on the following descriptions. The "flag" field contains values based on the following descriptions.
ACE4_FILE_INHERIT_ACE ACE4_FILE_INHERIT_ACE
Can be placed on a directory and indicates that this ACE should be Can be placed on a directory and indicates that this ACE should be
added to each new non-directory file created. added to each new non-directory file created.
Draft Specification NFS version 4 Protocol July 2002
ACE4_DIRECTORY_INHERIT_ACE ACE4_DIRECTORY_INHERIT_ACE
Can be placed on a directory and indicates that this ACE should be Can be placed on a directory and indicates that this ACE should be
added to each new directory created. added to each new directory created.
ACE4_INHERIT_ONLY_ACE ACE4_INHERIT_ONLY_ACE
Can be placed on a directory but does not apply to the directory, Can be placed on a directory but does not apply to the directory,
only to newly created files/directories as specified by the above two only to newly created files/directories as specified by the above two
flags. flags.
skipping to change at page 46, line 32 skipping to change at page 52, line 41
ACL4_DIRECTORY_INHERIT_ACE, two ACEs are placed on the new directory. ACL4_DIRECTORY_INHERIT_ACE, two ACEs are placed on the new directory.
One for the directory itself and one which is an inheritable ACE for One for the directory itself and one which is an inheritable ACE for
newly created directories. This flag tells the server to not place newly created directories. This flag tells the server to not place
an ACE on the newly created directory which is inheritable by an ACE on the newly created directory which is inheritable by
subdirectories of the created directory. subdirectories of the created directory.
ACE4_SUCCESSFUL_ACCESS_ACE_FLAG ACE4_SUCCESSFUL_ACCESS_ACE_FLAG
ACL4_FAILED_ACCESS_ACE_FLAG ACL4_FAILED_ACCESS_ACE_FLAG
Both indicate for AUDIT and ALARM which state to log the event. On The ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (SUCCESS) and
every ACCESS or OPEN call which occurs on a file or directory which ACE4_FAILED_ACCESS_ACE_FLAG (FAILED) flag bits relate only to
has an ACL that is of type ACE4_SYSTEM_AUDIT_ACE_TYPE or ACE4_SYSTEM_AUDIT_ACE_TYPE (AUDIT) and ACE4_SYSTEM_ALARM_ACE_TYPE
ACE4_SYSTEM_ALARM_ACE_TYPE, the attempted access is compared to the (ALARM) ACE types. If during the processing of the file's ACL, the
ace4mask of these ACLs. If the access is a subset of ace4mask and the server encounters an AUDIT or ALARM ACE that matches the principal
identifier match, an AUDIT trail or an ALARM is generated. By attempting the OPEN, the server notes that fact, and the prescence,
default this happens regardless of the success or failure of the if any, of the SUCCESS and FAILED flags encountered in the AUDIT or
ACCESS or OPEN call. ALARM ACE. Once the server completes the ACL processing, and the
share reservation processing, and the OPEN call, it then notes if the
OPEN succeeded or failed. If the OPEN succeeded, and if the SUCCESS
flag was set for a matching AUDIT or ALARM, then the appropriate
AUDIT or ALARM event occurs. If the OPEN failed, and if the FAILED
flag was set for the matching AUDIT or ALARM, then the appropriate
The flag ACE4_SUCCESSFUL_ACCESS_ACE_FLAG only produces the AUDIT or Draft Specification NFS version 4 Protocol August 2002
ALARM if the ACCESS or OPEN call is successful. The
ACE4_FAILED_ACCESS_ACE_FLAG causes the ALARM or AUDIT if the ACCESS AUDIT or ALARM event occurs. Clearly either or both of the SUCCESS
or OPEN call fails. or FAILED can be set, but if neither is set, the AUDIT or ALARM ACE
is not useful.
The previously described processing applies to that of the ACCESS
operation as well. The difference being that "success" or "failure"
does not mean whether ACCESS returns NFS4_OK or not. Success means
whether ACCESS returns all requested and supported bits. Failure
means whether ACCESS failed to return a bit that was requested and
supported.
ACE4_IDENTIFIER_GROUP ACE4_IDENTIFIER_GROUP
Indicates that the "who" refers to a GROUP as defined under Unix. Indicates that the "who" refers to a GROUP as defined under UNIX.
The bitmask constants used for the flag field are as follows: The bitmask constants used for the flag field are as follows:
const ACE4_FILE_INHERIT_ACE = 0x00000001; const ACE4_FILE_INHERIT_ACE = 0x00000001;
Draft Specification NFS version 4 Protocol July 2002
const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002;
const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004;
const ACE4_INHERIT_ONLY_ACE = 0x00000008; const ACE4_INHERIT_ONLY_ACE = 0x00000008;
const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010;
const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020;
const ACE4_IDENTIFIER_GROUP = 0x00000040; const ACE4_IDENTIFIER_GROUP = 0x00000040;
5.9.3. ACE Access Mask A server need not support any of these flags. If the server supports
flags that are similar to, but not exactly the same as, these flags,
The access_mask field contains values based on the following: the implementation may define a mapping between the protocol-defined
flags and the implementation-defined flags. Again, the guiding
Access Description principle is that the file not appear to be more secure than it
_______________________________________________________________ really is.
READ_DATA
Permission to read the data of the file
LIST_DIRECTORY
Permission to list the contents of a
directory
WRITE_DATA
Permission to modify the file's data
ADD_FILE
Permission to add a new file to a
directory
APPEND_DATA
Permission to append data to a file
ADD_SUBDIRECTORY
Permission to create a subdirectory to a
directory
READ_NAMED_ATTRS
Permission to read the named attributes
of a file
WRITE_NAMED_ATTRS
Permission to write the named attributes
of a file
EXECUTE
Permission to execute a file
DELETE_CHILD
Permission to delete a file or directory
within a directory
READ_ATTRIBUTES
The ability to read basic attributes
(non-acls) of a file
WRITE_ATTRIBUTES
Permission to change basic attributes
(non-acls) of a file
DELETE
Permission to Delete the file
READ_ACL
Permission to Read the ACL
WRITE_ACL
Permission to Write the ACL
WRITE_OWNER
Permission to change the owner
SYNCHRONIZE
Permission to access file locally at the
server with synchronous reads and writes
The bitmask constants used for the access mask field are as follows:
const ACE4_READ_DATA = 0x00000001;
const ACE4_LIST_DIRECTORY = 0x00000001;
const ACE4_WRITE_DATA = 0x00000002;
const ACE4_ADD_FILE = 0x00000002;
const ACE4_APPEND_DATA = 0x00000004;
const ACE4_ADD_SUBDIRECTORY = 0x00000004;
const ACE4_READ_NAMED_ATTRS = 0x00000008;
Draft Specification NFS version 4 Protocol July 2002 For example, suppose a client tries to set an ACE with
ACE4_FILE_INHERIT_ACE set but not ACE4_DIRECTORY_INHERIT_ACE. If the
server does not support any form of ACL inheritance, the server
should reject the request with NFS4ERR_ATTRNOTSUPP. If the server
supports a single "inherit ACE" flag that applies to both files and
directories, the server may reject the request (i.e., requiring the
client to set both the file and directory inheritance flags). The
server may also accept the request and silently turn on the
ACE4_DIRECTORY_INHERIT_ACE flag.
const ACE4_WRITE_NAMED_ATTRS = 0x00000010; 5.11.4. ACE who
const ACE4_EXECUTE = 0x00000020;
const ACE4_DELETE_CHILD = 0x00000040;
const ACE4_READ_ATTRIBUTES = 0x00000080;
const ACE4_WRITE_ATTRIBUTES = 0x00000100;
const ACE4_DELETE = 0x00010000; There are several special identifiers ("who") which need to be
const ACE4_READ_ACL = 0x00020000; understood universally, rather than in the context of a particular
const ACE4_WRITE_ACL = 0x00040000; DNS domain. Some of these identifiers cannot be understood when an
const ACE4_WRITE_OWNER = 0x00080000; NFS client accesses the server, but have meaning when a local process
const ACE4_SYNCHRONIZE = 0x00100000;
5.9.4. ACE who Draft Specification NFS version 4 Protocol August 2002
There are several special identifiers ("who") which need to be accesses the file. The ability to display and modify these
understood universally. Some of these identifiers cannot be permissions is permitted over NFS, even if none of the access methods
understood when an NFS client accesses the server, but have meaning on the server understands the identifiers.
when a local process accesses the file. The ability to display and
modify these permissions is permitted over NFS.
Who Description Who Description
_______________________________________________________________ _______________________________________________________________
"OWNER" "OWNER" The owner of the file.
The owner of the file. "GROUP" The group associated with the file.
"GROUP" "EVERYONE" The world.
The group associated with the file. "INTERACTIVE" Accessed from an interactive terminal.
"EVERYONE" "NETWORK" Accessed via the network.
The world. "DIALUP" Accessed as a dialup user to the server.
"INTERACTIVE" "BATCH" Accessed from a batch job.
Accessed from an interactive terminal. "ANONYMOUS" Accessed without any authentication.
"NETWORK" "AUTHENTICATED" Any authenticated user (opposite of
Accessed via the network.
"DIALUP"
Accessed as a dialup user to the server.
"BATCH"
Accessed from a batch job.
"ANONYMOUS"
Accessed without any authentication.
"AUTHENTICATED"
Any authenticated user (opposite of
ANONYMOUS) ANONYMOUS)
"SERVICE" "SERVICE" Access from a system service.
Access from a system service.
To avoid conflict, these special identifiers are distinguish by an To avoid conflict, these special identifiers are distinguish by an
appended "@" and should appear in the form "xxxx@" (note: no domain appended "@" and should appear in the form "xxxx@" (note: no domain
name after the "@"). For example: ANONYMOUS@. name after the "@"). For example: ANONYMOUS@.
Draft Specification NFS version 4 Protocol July 2002 5.11.5. Mode Attribute
6. File System Migration and Replication The NFS version 4 mode attribute is based on the UNIX mode bits. The
following bits are defined:
const MODE4_SUID = 0x800; /* set user id on execution */
const MODE4_SGID = 0x400; /* set group id on execution */
const MODE4_SVTX = 0x200; /* save text even after use */
const MODE4_RUSR = 0x100; /* read permission: owner */
const MODE4_WUSR = 0x080; /* write permission: owner */
const MODE4_XUSR = 0x040; /* execute permission: owner */
const MODE4_RGRP = 0x020; /* read permission: group */
const MODE4_WGRP = 0x010; /* write permission: group */
const MODE4_XGRP = 0x008; /* execute permission: group */
const MODE4_ROTH = 0x004; /* read permission: other */
const MODE4_WOTH = 0x002; /* write permission: other */
const MODE4_XOTH = 0x001; /* execute permission: other */
Bits MODE4_RUSR, MODE4_WUSR, and MODE4_XUSR apply to the principal
identified in the owner attribute. Bits MODE4_RGRP, MODE4_WGRP, and
MODE4_XGRP apply to the principals identified in the owner_group
attribute. Bits MODE4_ROTH, MODE4_WOTH, MODE4_XOTH apply to any
principal that does not match that in the owner group, and does not
have a group matching that of the owner_group attribute.
The remaining bits are not defined by this protocol and MUST NOT be
Draft Specification NFS version 4 Protocol August 2002
used. The minor version mechanism must be used to define further bit
usage.
Note that in UNIX, if a file has the MODE4_SGID bit set and no
MODE4_XGRP bit set, then READ and WRITE must use mandatory file
locking.
5.11.6. Mode and ACL Attribute
The server that supports both mode and ACL must take care to
synchronize the MODE4_*USR, MODE4_*GRP, and MODE4_*OTH bits with the
ACEs which have respective who fields of "OWNER@", "GROUP@", and
"EVERYONE@" so that the client can see semantically equivalent access
permissions exist whether the client asks for owner, owner_group and
mode attributes, or for just the ACL.
Because the mode attribute includes bits (e.g. MODE4_SVTX) that have
nothing to do with ACL semantics, it is permitted for clients to
specify both the ACL attribute and mode in the same SETATTR
operation. However, because there is no prescribed order for
processing the attributes in a SETATTR, the client must ensure that
ACL attribute, if specified without mode, would produce the desired
mode bits, and conversely, the mode attribute if specified without
ACL, would produce the desired "OWNER@", "GROUP@", and "EVERYONE@"
ACEs.
5.11.7. mounted_on_fileid
UNIX-based operating environments connect a filesystem into the
namespace by connecting (mounting) the filesystem onto the existing
file object (the mount point, usually a directory) of an existing
filesystem. When the mount point's parent directory is read via an
API like readdir(), the return results are directory entries, each
with a component name and a fileid. The fileid of the mount point's
directory entry will be different from the fileid that the stat()
system call returns. The stat() system call is returning the fileid
of the root of the mounted filesystem, whereas readdir() is returning
the fileid stat() would have returned before any filesystems were
mounted on the mount point.
Unlike NFS version 3, NFS version 4 allows a client's LOOKUP request
to cross other filesystems. The client detects the filesystem
crossing whenever the filehandle argument of LOOKUP has an fsid
attribute different from that of the filehandle returned by LOOKUP. A
UNIX-based client will consider this a "mount point crossing". UNIX
has a legacy scheme for allowing a process to determine its current
working directory. This relies on readdir() of a mount point's parent
and stat() of the mount point returning fileids as previously
described. The mounted_on_fileid attribute corresponds to the fileid
that readdir() would have returned as described previously.
Draft Specification NFS version 4 Protocol August 2002
While the NFS version 4 client could simply fabricate a fileid
corresponding to what mounted_on_fileid provides (and if the server
does not support mounted_on_fileid, the client has no choice), there
is a risk that the client will generate a fileid that conflicts with
one that is already assigned to another object in the filesystem.
Instead, if the server can provide the mounted_on_fileid, the
potential for client operational problems in this area is eliminated.
If the server detects that there is no mounted point at the target
file object, then the value for mounted_on_fileid that it returns is
the same as that of the fileid attribute.
The mounted_on_fileid attribute is RECOMMENDED, so the server SHOULD
provide it if possible, and for a UNIX-based server, this is
straightforward. Usually, mounted_on_fileid will be requested during
a READDIR operation, in which case it is trivial (at least for UNIX-
based servers) to return mounted_on_fileid since it is equal to the
fileid of a directory entry returned by readdir(). If
mounted_on_fileid is requested in a GETATTR operation, the server
should obey an invariant that has it returning a value that is equal
to the file object's entry in the object's parent directory, i.e.
what readdir() would have returned. Some operating environments
allow a series of two or more filesystems to be mounted onto a single
mount point. In this case, for the server to obey the aforementioned
invariant, it will need to find the base mount point, and not the
intermediate mount points.
Draft Specification NFS version 4 Protocol August 2002
6. Filesystem Migration and Replication
With the use of the recommended attribute "fs_locations", the NFS With the use of the recommended attribute "fs_locations", the NFS
version 4 server has a method of providing file system migration or version 4 server has a method of providing file system migration or
replication services. For the purposes of migration and replication, replication services. For the purposes of migration and replication,
a file system will be defined as all files that share a given fsid a file system will be defined as all files that share a given fsid
(both major and minor values are the same). (both major and minor values are the same).
The fs_locations attribute provides a list of file system locations. The fs_locations attribute provides a list of file system locations.
These locations are specified by providing the server name (either These locations are specified by providing the server name (either
DNS domain or IP address) and the path name representing the root of DNS domain or IP address) and the path name representing the root of
the file system. Depending on the type of service being provided, the filesystem. Depending on the type of service being provided, the
the list will provide a new location or a set of alternate locations list will provide a new location or a set of alternate locations for
for the file system. The client will use this information to the filesystem. The client will use this information to redirect its
redirect its requests to the new server. requests to the new server.
6.1. Replication 6.1. Replication
It is expected that file system replication will be used in the case It is expected that file system replication will be used in the case
of read-only data. Typically, the file system will be replicated on of read-only data. Typically, the file system will be replicated on
two or more servers. The fs_locations attribute will provide the two or more servers. The fs_locations attribute will provide the
list of these locations to the client. On first access of the file list of these locations to the client. On first access of the
system, the client should obtain the value of the fs_locations filesystem, the client should obtain the value of the fs_locations
attribute. If, in the future, the client finds the server attribute. If, in the future, the client finds the server
unresponsive, the client may attempt to use another server specified unresponsive, the client may attempt to use another server specified
by fs_locations. by fs_locations.
If applicable, the client must take the appropriate steps to recover If applicable, the client must take the appropriate steps to recover
valid filehandles from the new server. This is described in more valid filehandles from the new server. This is described in more
detail in the following sections. detail in the following sections.
6.2. Migration 6.2. Migration
File system migration is used to move a file system from one server Filesystem migration is used to move a filesystem from one server to
to another. Migration is typically used for a file system that is another. Migration is typically used for a filesystem that is
writable and has a single copy. The expected use of migration is for writable and has a single copy. The expected use of migration is for
load balancing or general resource reallocation. The protocol does load balancing or general resource reallocation. The protocol does
not specify how the file system will be moved between servers. This not specify how the file system will be moved between servers. This
server-to-server transfer mechanism is left to the server server-to-server transfer mechanism is left to the server
implementor. However, the method used to communicate the migration implementor. However, the method used to communicate the migration
event between client and server is specified here. event between client and server is specified here.
Once the servers participating in the migration have completed the Once the servers participating in the migration have completed the
move of the file system, the error NFS4ERR_MOVED will be returned for move of the file system, the error NFS4ERR_MOVED will be returned for
subsequent requests received by the original server. The subsequent requests received by the original server. The
NFS4ERR_MOVED error is returned for all operations except PUTFH and NFS4ERR_MOVED error is returned for all operations except PUTFH and
GETATTR. Upon receiving the NFS4ERR_MOVED error, the client will GETATTR. Upon receiving the NFS4ERR_MOVED error, the client will
obtain the value of the fs_locations attribute. The client will then obtain the value of the fs_locations attribute. The client will then
use the contents of the attribute to redirect its requests to the use the contents of the attribute to redirect its requests to the
specified server. To facilitate the use of GETATTR, operations such specified server. To facilitate the use of GETATTR, operations such
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
as PUTFH must also be accepted by the server for the migrated file as PUTFH must also be accepted by the server for the migrated file
system's filehandles. Note that if the server returns NFS4ERR_MOVED, system's filehandles. Note that if the server returns NFS4ERR_MOVED,
the server MUST support the fs_locations attribute. the server MUST support the fs_locations attribute.
If the client requests more attributes than just fs_locations, the If the client requests more attributes than just fs_locations, the
server may return fs_locations only. This is to be expected since server may return fs_locations only. This is to be expected since
the server has migrated the file system and may not have a method of the server has migrated the file system and may not have a method of
obtaining additional attribute data. obtaining additional attribute data.
skipping to change at page 50, line 38 skipping to change at page 58, line 38
struct fs_location { struct fs_location {
utf8string server<>; utf8string server<>;
pathname4 rootpath; pathname4 rootpath;
}; };
struct fs_locations { struct fs_locations {
pathname4 fs_root; pathname4 fs_root;
fs_location locations<>; fs_location locations<>;
}; };
The fs_location struct is used to represent the location of a file The fs_location struct is used to represent the location of a
system by providing a server name and the path to the root of the filesystem by providing a server name and the path to the root of the
file system. For a multi-homed server or a set of servers that use file system. For a multi-homed server or a set of servers that use
the same rootpath, an array of server names may be provided. An the same rootpath, an array of server names may be provided. An
entry in the server array is an UTF8 string and represents one of a entry in the server array is an UTF8 string and represents one of a
traditional DNS host name, IPv4 address, or IPv6 address. It is not traditional DNS host name, IPv4 address, or IPv6 address. It is not
a requirement that all servers that share the same rootpath be listed a requirement that all servers that share the same rootpath be listed
in one fs_location struct. The array of server names is provided for in one fs_location struct. The array of server names is provided for
convenience. Servers that share the same rootpath may also be listed convenience. Servers that share the same rootpath may also be listed
in separate fs_location entries in the fs_locations attribute. in separate fs_location entries in the fs_locations attribute.
The fs_locations struct and attribute then contains an array of The fs_locations struct and attribute then contains an array of
locations. Since the name space of each server may be constructed locations. Since the name space of each server may be constructed
differently, the "fs_root" field is provided. The path represented differently, the "fs_root" field is provided. The path represented
by fs_root represents the location of the file system in the server's by fs_root represents the location of the file system in the server's
name space. Therefore, the fs_root path is only associated with the name space. Therefore, the fs_root path is only associated with the
server from which the fs_locations attribute was obtained. The server from which the fs_locations attribute was obtained. The
fs_root path is meant to aid the client in locating the file system fs_root path is meant to aid the client in locating the filesystem at
at the various servers listed. the various servers listed.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
As an example, there is a replicated file system located at two As an example, there is a replicated file system located at two
servers (servA and servB). At servA the file system is located at servers (servA and servB). At servA the file system is located at
path "/a/b/c". At servB the file system is located at path "/x/y/z". path "/a/b/c". At servB the file system is located at path "/x/y/z".
In this example the client accesses the file system first at servA In this example the client accesses the file system first at servA
with a multi-component lookup path of "/a/b/c/d". Since the client with a multi-component lookup path of "/a/b/c/d". Since the client
used a multi-component lookup to obtain the filehandle at "/a/b/c/d", used a multi-component lookup to obtain the filehandle at "/a/b/c/d",
it is unaware that the file system's root is located in servA's name it is unaware that the file system's root is located in servA's name
space at "/a/b/c". When the client switches to servB, it will need space at "/a/b/c". When the client switches to servB, it will need
to determine that the directory it first referenced at servA is now to determine that the directory it first referenced at servA is now
represented by the path "/x/y/z/d" on servB. To facilitate this, the represented by the path "/x/y/z/d" on servB. To facilitate this, the
fs_locations attribute provided by servA would have a fs_root value fs_locations attribute provided by servA would have a fs_root value
of "/a/b/c" and two entries in fs_location. One entry in fs_location of "/a/b/c" and two entries in fs_location. One entry in fs_location
will be for itself (servA) and the other will be for servB with a will be for itself (servA) and the other will be for servB with a
path of "/x/y/z". With this information, the client is able to path of "/x/y/z". With this information, the client is able to
substitute "/x/y/z" for the "/a/b/c" at the beginning of its access substitute "/x/y/z" for the "/a/b/c" at the beginning of its access
path and construct "/x/y/z/d" to use for the new server. path and construct "/x/y/z/d" to use for the new server.
See the section "Security Considerations" for a discussion on the
recommendations for the security flavor to be used by any GETATTR
operation that requests the "fs_locations" attribute.
6.4. Filehandle Recovery for Migration or Replication 6.4. Filehandle Recovery for Migration or Replication
Filehandles for file systems that are replicated or migrated Filehandles for filesystems that are replicated or migrated generally
generally have the same semantics as for file systems that are not have the same semantics as for filesystems that are not replicated or
replicated or migrated. For example, if a file system has persistent migrated. For example, if a filesystem has persistent filehandles
filehandles and it is migrated to another server, the filehandle and it is migrated to another server, the filehandle values for the
values for the file system will be valid at the new server. filesystem will be valid at the new server.
For volatile filehandles, the servers involved likely do not have a For volatile filehandles, the servers involved likely do not have a
mechanism to transfer filehandle format and content between mechanism to transfer filehandle format and content between
themselves. Therefore, a server may have difficulty in determining themselves. Therefore, a server may have difficulty in determining
if a volatile filehandle from an old server should return an error of if a volatile filehandle from an old server should return an error of
NFS4ERR_FHEXPIRED. Therefore, the client is informed, with the use NFS4ERR_FHEXPIRED. Therefore, the client is informed, with the use
of the fh_expire_type attribute, whether volatile filehandles will of the fh_expire_type attribute, whether volatile filehandles will
expire at the migration or replication event. If the bit expire at the migration or replication event. If the bit
FH4_VOL_MIGRATION is set in the fh_expire_type attribute, the client FH4_VOL_MIGRATION is set in the fh_expire_type attribute, the client
must treat the volatile filehandle as if the server had returned the must treat the volatile filehandle as if the server had returned the
NFS4ERR_FHEXPIRED error. At the migration or replication event in NFS4ERR_FHEXPIRED error. At the migration or replication event in
the presence of the FH4_VOL_MIGRATION bit, the client will not the presence of the FH4_VOL_MIGRATION bit, the client will not
present the original or old volatile file handle to the new server. present the original or old volatile file handle to the new server.
The client will start its communication with the new server by The client will start its communication with the new server by
recovering its filehandles using the saved file names. recovering its filehandles using the saved file names.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
7. NFS Server Name Space 7. NFS Server Name Space
7.1. Server Exports 7.1. Server Exports
On a UNIX server the name space describes all the files reachable by On a UNIX server the name space describes all the files reachable by
pathnames under the root directory or "/". On a Windows NT server pathnames under the root directory or "/". On a Windows NT server
the name space constitutes all the files on disks named by mapped the name space constitutes all the files on disks named by mapped
disk letters. NFS server administrators rarely make the entire disk letters. NFS server administrators rarely make the entire
server's file system name space available to NFS clients. More often server's file system name space available to NFS clients. More often
skipping to change at page 52, line 36 skipping to change at page 60, line 36
The NFS version 4 protocol provides a root filehandle that clients The NFS version 4 protocol provides a root filehandle that clients
can use to obtain filehandles for these exports via a multi-component can use to obtain filehandles for these exports via a multi-component
LOOKUP. A common user experience is to use a graphical user LOOKUP. A common user experience is to use a graphical user
interface (perhaps a file "Open" dialog window) to find a file via interface (perhaps a file "Open" dialog window) to find a file via
progressive browsing through a directory tree. The client must be progressive browsing through a directory tree. The client must be
able to move from one export to another export via single-component, able to move from one export to another export via single-component,
progressive LOOKUP operations. progressive LOOKUP operations.
This style of browsing is not well supported by the NFS version 2 and This style of browsing is not well supported by the NFS version 2 and
3 protocols. The client expects all LOOKUP operations to remain 3 protocols. The client expects all LOOKUP operations to remain
within a single server file system. For example, the device within a single server filesystem. For example, the device attribute
attribute will not change. This prevents a client from taking name will not change. This prevents a client from taking name space paths
space paths that span exports. that span exports.
An automounter on the client can obtain a snapshot of the server's An automounter on the client can obtain a snapshot of the server's
name space using the EXPORTS procedure of the MOUNT protocol. If it name space using the EXPORTS procedure of the MOUNT protocol. If it
understands the server's pathname syntax, it can create an image of understands the server's pathname syntax, it can create an image of
the server's name space on the client. The parts of the name space the server's name space on the client. The parts of the name space
that are not exported by the server are filled in with a "pseudo file that are not exported by the server are filled in with a "pseudo
system" that allows the user to browse from one mounted file system filesystem" that allows the user to browse from one mounted
to another. There is a drawback to this representation of the filesystem to another. There is a drawback to this representation of
server's name space on the client: it is static. If the server the server's name space on the client: it is static. If the server
administrator adds a new export the client will be unaware of it. administrator adds a new export the client will be unaware of it.
7.3. Server Pseudo File System 7.3. Server Pseudo Filesystem
NFS version 4 servers avoid this name space inconsistency by NFS version 4 servers avoid this name space inconsistency by
presenting all the exports within the framework of a single server presenting all the exports within the framework of a single server
name space. An NFS version 4 client uses LOOKUP and READDIR name space. An NFS version 4 client uses LOOKUP and READDIR
operations to browse seamlessly from one export to another. Portions operations to browse seamlessly from one export to another. Portions
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
of the server name space that are not exported are bridged via a of the server name space that are not exported are bridged via a
"pseudo file system" that provides a view of exported directories "pseudo file system" that provides a view of exported directories
only. A pseudo file system has a unique fsid and behaves like a only. A pseudo file system has a unique fsid and behaves like a
normal, read only file system. normal, read only file system.
Based on the construction of the server's name space, it is possible Based on the construction of the server's name space, it is possible
that multiple pseudo file systems may exist. For example, that multiple pseudo file systems may exist. For example,
/a pseudo file system /a pseudo file system
/a/b real file system /a/b real file system
/a/b/c pseudo file system /a/b/c pseudo file system
/a/b/c/d real file system /a/b/c/d real file system
Each of the pseudo file systems are consider separate entities and Each of the pseudo filesystems are considered separate entities and
therefore will have a unique fsid. therefore will have a unique fsid.
7.4. Multiple Roots 7.4. Multiple Roots
The DOS and Windows operating environments are sometimes described as The DOS and Windows operating environments are sometimes described as
having "multiple roots". File systems are commonly represented as having "multiple roots". filesystems are commonly represented as
disk letters. MacOS represents file systems as top level names. NFS disk letters. MacOS represents file systems as top level names. NFS
version 4 servers for these platforms can construct a pseudo file version 4 servers for these platforms can construct a pseudo file
system above these root names so that disk letters or volume names system above these root names so that disk letters or volume names
are simply directory names in the pseudo root. are simply directory names in the pseudo root.
7.5. Filehandle Volatility 7.5. Filehandle Volatility
The nature of the server's pseudo file system is that it is a logical The nature of the server's pseudo file system is that it is a logical
representation of file system(s) available from the server. representation of file system(s) available from the server.
Therefore, the pseudo file system is most likely constructed Therefore, the pseudo file system is most likely constructed
skipping to change at page 54, line 5 skipping to change at page 62, line 5
7.6. Exported Root 7.6. Exported Root
If the server's root file system is exported, one might conclude that If the server's root file system is exported, one might conclude that
a pseudo-file system is not needed. This would be wrong. Assume the a pseudo-file system is not needed. This would be wrong. Assume the
following file systems on a server: following file systems on a server:
/ disk1 (exported) / disk1 (exported)
/a disk2 (not exported) /a disk2 (not exported)
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
/a/b disk3 (exported) /a/b disk3 (exported)
Because disk2 is not exported, disk3 cannot be reached with simple Because disk2 is not exported, disk3 cannot be reached with simple
LOOKUPs. The server must bridge the gap with a pseudo-file system. LOOKUPs. The server must bridge the gap with a pseudo-file system.
7.7. Mount Point Crossing 7.7. Mount Point Crossing
The server file system environment may be constructed in such a way The server file system environment may be constructed in such a way
that one file system contains a directory which is 'covered' or that one file system contains a directory which is 'covered' or
skipping to change at page 54, line 31 skipping to change at page 62, line 31
The pseudo file system for this server may be constructed to look The pseudo file system for this server may be constructed to look
like: like:
/ (place holder/not exported) / (place holder/not exported)
/a/b (file system 1) /a/b (file system 1)
/a/b/c/d (file system 2) /a/b/c/d (file system 2)
It is the server's responsibility to present the pseudo file system It is the server's responsibility to present the pseudo file system
that is complete to the client. If the client sends a lookup request that is complete to the client. If the client sends a lookup request
for the path "/a/b/c/d", the server's response is the filehandle of for the path "/a/b/c/d", the server's response is the filehandle of
the file system "/a/b/c/d". In previous versions of the NFS the filesystem "/a/b/c/d". In previous versions of the NFS protocol,
protocol, the server would respond with the directory "/a/b/c/d" the server would respond with the filehandle of directory "/a/b/c/d"
within the file system "/a/b". within the file system "/a/b".
The NFS client will be able to determine if it crosses a server mount The NFS client will be able to determine if it crosses a server mount
point by a change in the value of the "fsid" attribute. point by a change in the value of the "fsid" attribute.
7.8. Security Policy and Name Space Presentation 7.8. Security Policy and Name Space Presentation
The application of the server's security policy needs to be carefully The application of the server's security policy needs to be carefully
considered by the implementor. One may choose to limit the considered by the implementor. One may choose to limit the
viewability of portions of the pseudo file system based on the viewability of portions of the pseudo file system based on the
server's perception of the client's ability to authenticate itself server's perception of the client's ability to authenticate itself
properly. However, with the support of multiple security mechanisms properly. However, with the support of multiple security mechanisms
and the ability to negotiate the appropriate use of these mechanisms, and the ability to negotiate the appropriate use of these mechanisms,
the server is unable to properly determine if a client will be able the server is unable to properly determine if a client will be able
to authenticate itself. If, based on its policies, the server to authenticate itself. If, based on its policies, the server
chooses to limit the contents of the pseudo file system, the server chooses to limit the contents of the pseudo file system, the server
may effectively hide file systems from a client that may otherwise may effectively hide file systems from a client that may otherwise
have legitimate access. have legitimate access.
Draft Specification NFS version 4 Protocol July 2002 As suggested practice, the server should apply the security policy of
a shared resource in the server's namespace to the ancestors
components of the namespace. For example:
/
Draft Specification NFS version 4 Protocol August 2002
/a/b
/a/b/c
The /a/b/c directory is a real filesystem and is the shared resource.
The security policy for /a/b/c is Kerberos with integrity. The
server should should apply the same security policy to /, /a, and
/a/b. This allows for the extension of the protection of the
server's namespace to the ancestors of the real shared resource.
For the case of the use of multiple, disjoint security mechanisms in
the server's resources, the security for a particular object in the
server's namespace should be the union of all security mechanisms of
all direct descendants.
Draft Specification NFS version 4 Protocol August 2002
8. File Locking and Share Reservations 8. File Locking and Share Reservations
Integrating locking into the NFS protocol necessarily causes it to be Integrating locking into the NFS protocol necessarily causes it to be
state-full. With the inclusion of "share" file locks the protocol stateful. With the inclusion of share reservations the protocol
becomes substantially more dependent on state than the traditional becomes substantially more dependent on state than the traditional
combination of NFS and NLM [XNFS]. There are three components to combination of NFS and NLM [XNFS]. There are three components to
making this state manageable: making this state manageable:
o Clear division between client and server o Clear division between client and server
o Ability to reliably detect inconsistency in state between client o Ability to reliably detect inconsistency in state between client
and server and server
o Simple and robust recovery mechanisms o Simple and robust recovery mechanisms
In this model, the server owns the state information. The client In this model, the server owns the state information. The client
communicates its view of this state to the server as needed. The communicates its view of this state to the server as needed. The
client is also able to detect inconsistent state before modifying a client is also able to detect inconsistent state before modifying a
file. file.
To support Win32 "share" locks it is necessary to atomically OPEN or To support Win32 share reservations it is necessary to atomically
CREATE files. Having a separate share/unshare operation would not OPEN or CREATE files. Having a separate share/unshare operation
allow correct implementation of the Win32 OpenFile API. In order to would not allow correct implementation of the Win32 OpenFile API. In
correctly implement share semantics, the previous NFS protocol order to correctly implement share semantics, the previous NFS
mechanisms used when a file is opened or created (LOOKUP, CREATE, protocol mechanisms used when a file is opened or created (LOOKUP,
ACCESS) need to be replaced. The NFS version 4 protocol has an OPEN CREATE, ACCESS) need to be replaced. The NFS version 4 protocol has
operation that subsumes the NFS version 3 methodology of LOOKUP, an OPEN operation that subsumes the NFS version 3 methodology of
CREATE, and ACCESS. However, because many operations require a LOOKUP, CREATE, and ACCESS. However, because many operations require
filehandle, the traditional LOOKUP is preserved to map a file name to a filehandle, the traditional LOOKUP is preserved to map a file name
filehandle without establishing state on the server. The policy of to filehandle without establishing state on the server. The policy
granting access or modifying files is managed by the server based on of granting access or modifying files is managed by the server based
the client's state. These mechanisms can implement policy ranging on the client's state. These mechanisms can implement policy ranging
from advisory only locking to full mandatory locking. from advisory only locking to full mandatory locking.
8.1. Locking 8.1. Locking
It is assumed that manipulating a lock is rare when compared to READ It is assumed that manipulating a lock is rare when compared to READ
and WRITE operations. It is also assumed that crashes and network and WRITE operations. It is also assumed that crashes and network
partitions are relatively rare. Therefore it is important that the partitions are relatively rare. Therefore it is important that the
READ and WRITE operations have a lightweight mechanism to indicate if READ and WRITE operations have a lightweight mechanism to indicate if
they possess a held lock. A lock request contains the heavyweight they possess a held lock. A lock request contains the heavyweight
information required to establish a lock and uniquely define the lock information required to establish a lock and uniquely define the lock
owner. owner.
The following sections describe the transition from the heavy weight The following sections describe the transition from the heavy weight
information to the eventual stateid used for most client and server information to the eventual stateid used for most client and server
locking and lease interactions. locking and lease interactions.
8.1.1. Client ID 8.1.1. Client ID
For each LOCK request, the client must identify itself to the server. For each LOCK request, the client must identify itself to the server.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
This is done in such a way as to allow for correct lock This is done in such a way as to allow for correct lock
identification and crash recovery. Client identification is identification and crash recovery. A sequence of a SETCLIENTID
accomplished with two values. operation followed by a SETCLIENTID_CONFIRM operation is required to
establish the identification onto the server. Establishment of
identification by a new incarnation of the client also has the effect
of immediately breaking any leased state that a previous incarnation
of the client might have had on the server, as opposed to forcing the
new client incarnation to wait for the leases to expire. Breaking
the lease state amounts to the server removing all lock, share
reservation, and, where the server is not supporting the
CLAIM_DELEGATE_PREV claim type, all delegation state associated with
same client with the same identity. For discussion of delegation
state recovery, see the section "Delegation Recovery".
o A verifier that is used to detect client reboots. Client identification is encapsulated in the following structure:
o A variable length opaque array to uniquely define a client. struct nfs_client_id4 {
verifier4 verifier;
opaque id<NFS4_OPAQUE_LIMIT>;
};
For an operating system this may be a fully qualified host The first field, verifier is a client incarnation verifier that is
name or IP address. For a user level NFS client it may used to detect client reboots. Only if the verifier is different from
additionally contain a process id or other unique sequence. that the server has previously recorded the client (as identified by
the second field f the structure, id) does the server start the
process of cancelling the client's leased state.
The data structure for the Client ID would then appear as: The second field, id is a variable length string that uniquely
defines the client.
struct nfs_client_id { There are several considerations for how the client generates the id
opaque verifier[4]; string:
opaque id<>;
}
It is possible through the mis-configuration of a client or the o The string should be unique so that multiple clients do not
existence of a rogue client that two clients end up using the same present the same string. The consequences of two clients
nfs_client_id. This situation is avoided by "negotiating" the presenting the same string range from one client getting an
nfs_client_id between client and server with the use of the error to one client having its leased state abruptly and
SETCLIENTID and SETCLIENTID_CONFIRM operations. The following unexpectedly cancelled.
describes the two scenarios of negotiation.
1 Client has never connected to the server o The string should be selected so the subsequent incarnations
(e.g. reboots) of the same client cause the client to present
the same string. The implementor is cautioned from an approach
that requires the string to be recorded in a local file because
this precludes the use of the implementation in an environment
where there is no local disk and all file access is from an NFS
version 4 server.
In this case the client generates an nfs_client_id and o The string should be different for each server network address
unless another client has the same nfs_client_id.id field, that the client accesses, rather than common to all server
the server accepts the request. The server also records the network addresses. The reason is that it may not be possible for
principal (or principal to uid mapping) from the credential the client to tell if same server is listening on multiple
in the RPC request that contains the nfs_client_id network addresses. If the client issues SETCLIENTID with the
negotiation request (SETCLIENTID operation).
Two clients might still use the same nfs_client_id.id due Draft Specification NFS version 4 Protocol August 2002
to perhaps configuration error. For example, a High
Availability configuration where the nfs_client_id.id is
derived from the ethernet controller address and both
systems have the same address. In this case, the result is
a switched union that returns, in addition to
NFS4ERR_CLID_INUSE, the network address (the rpcbind netid
and universal address) of the client that is using the id.
2 Client is re-connecting to the server after a client reboot same id string to each network address of such a server, the
server will think it is the same client, and each successive
SETCLIENTID will cause the server to begin the process of
removing the client's previous leased state.
In this case, the client still generates an nfs_client_id o The algorithm for generating the string should not assume that
but the nfs_client_id.id field will be the same as the the client's network address won't change. This includes
nfs_client_id.id generated prior to reboot. If the server changes between client incarnations and even changes while the
finds that the principal/uid is equal to the previously client is stilling running in its current incarnation. This
"registered" nfs_client_id.id, the server creates and means that if the client includes just the client's and server's
network address in the id string, there is a real risk, after
the client gives up the network address, that another client,
using a similar algorithm for generate the id string, will
generating a conflicting id string.
Draft Specification NFS version 4 Protocol July 2002 Given the above considerations, an example of a well generated id
string is one that includes:
returns a new clientid in response to the SETCLIENTID. If o The server's network address.
the principal/uid is not equal, then this is a rogue client
and the request is returned in error. For more discussion
of crash recovery semantics, see the section on "Crash
Recovery".
It is possible for a retransmission of request to be received by the o The client's network address.
server after the server has acted upon and responded to the original
client request. Therefore to mitigate effects of the retransmission
of the SETCLIENTID operation, the client and server use a
confirmation step. The client uses the SETCLIENTID_CONFIRM operation
with the server provided clientid to confirm the client's use of the
new clientid. Once the server receives the confirmation from the
client, the locking state for the client is released.
In both cases, upon success, NFS4_OK is returned. To help reduce the o For a user level NFS version 4 client, it should contain
amount of data transferred on OPEN and LOCK, the server will also additional information to distinguish the client from other user
return a unique 64-bit clientid value that is a shorthand reference level clients running on the same host, such as a process id or
to the nfs_client_id values presented by the client. From this point other unique sequence.
forward, the client will use the clientid to refer to itself.
The clientid assigned by the server should be chosen so that it will o Additional information that tends to be unique, such as one or
not conflict with a clientid previously assigned by the server. This more of:
applies across server restarts or reboots. When a clientid is
presented to a server and that clientid is not recognized, as would - The client machines serial number (for privacy reasons, it is
happen after a server reboot, the server will reject the request with best to perform some one way function on the serial number).
the error NFS4ERR_STALE_CLIENTID. When this happens, the client must
obtain a new clientid by use of the SETCLIENTID operation and then - A MAC address.
proceed to any other necessary recovery for the server reboot case
(See the section "Server Failure and Recovery"). - The timestamp of when the NFS version 4 software was first
installed on the client (though this is subject to the
previously mentioned caution about using information that is
stored in a file, because the file might only be accessible
over NFS version 4).
- A true random number. However since this number ought to be
the same between client incarnations, this shares the same
problem as that of the using the timestamp of the software
installation.
As a security measure, the server MUST NOT cancel a client's leased
state if the principal established the state for a given id string is
not the same as the principal issuing the SETCLIENTID.
Note that SETCLIENTID and SETCLIENTID_CONFIRM has a secondary purpose
Draft Specification NFS version 4 Protocol August 2002
of establishing the information the server needs to make callbacks to
the client for purpose of supporting delegations. It is permitted to
change this information via SETCLIENTID and SETCLIENTID_CONFIRM
within the same incarnation of the client without removing the
client's leased state.
Once a SETCLIENTID and SETCLIENTID_CONFIRM sequence has successfully
completed, the client uses the short hand client identifier, of type
clientid4, instead of the longer and less compact nfs_client_id4
structure. This short hand client identfier (a clientid) is assigned
by the server and should be chosen so that it will not conflict with
a clientid previously assigned by the server. This applies across
server restarts or reboots. When a clientid is presented to a server
and that clientid is not recognized, as would happen after a server
reboot, the server will reject the request with the error
NFS4ERR_STALE_CLIENTID. When this happens, the client must obtain a
new clientid by use of the SETCLIENTID operation and then proceed to
any other necessary recovery for the server reboot case (See the
section "Server Failure and Recovery").
The client must also employ the SETCLIENTID operation when it The client must also employ the SETCLIENTID operation when it
receives a NFS4ERR_STALE_STATEID error using a stateid derived from receives a NFS4ERR_STALE_STATEID error using a stateid derived from
its current clientid, since this also indicates a server reboot which its current clientid, since this also indicates a server reboot which
has invalidated the existing clientid (see the next section has invalidated the existing clientid (see the next section
"nfs_lockowner and stateid Definition" for details). "lock_owner and stateid Definition" for details).
See the detailed descriptions of SETCLIENTID and SETCLIENTID_CONFIRM
for a complete specification of the operations.
8.1.2. Server Release of Clientid 8.1.2. Server Release of Clientid
If the server determines that the client holds no associated state If the server determines that the client holds no associated state
for its clientid, the server may choose to release the clientid. The for its clientid, the server may choose to release the clientid. The
server may make this choice for an inactive client so that resources server may make this choice for an inactive client so that resources
are not consumed by those intermittently active clients. If the are not consumed by those intermittently active clients. If the
client contacts the server after this release, the server must ensure client contacts the server after this release, the server must ensure
the client receives the appropriate error so that it will use the the client receives the appropriate error so that it will use the
SETCLIENTID/SETCLIENTID_CONFIRM sequence to establish a new identity. SETCLIENTID/SETCLIENTID_CONFIRM sequence to establish a new identity.
It should be clear that the server must be very hesitant to release a It should be clear that the server must be very hesitant to release a
clientid since the resulting work on the client to recover from such clientid since the resulting work on the client to recover from such
an event will be the same burden as if the server had failed and an event will be the same burden as if the server had failed and
restarted. Typically a server would not release a clientid unless restarted. Typically a server would not release a clientid unless
there had been no activity from that client for many minutes. there had been no activity from that client for many minutes.
Draft Specification NFS version 4 Protocol July 2002 Note that if the id string in a SETCLIENTID request is properly
constructed, and if the client takes care to use the same principal
for each successive use of SETCLIENTID, then, barring an active
denial of service attack, NFS4ERR_CLID_INUSE should never be
returned.
8.1.3. nfs_lockowner and stateid Definition However, client bugs, server bugs, or perhaps a deliberate change of
Draft Specification NFS version 4 Protocol August 2002
the principal owner of the id string (such as the case of a client
that changes security flavors, and under the new flavor, there is no
mapping to the previous owner) will in rare cases result in
NFS4ERR_CLID_INUSE.
In that event, when the server gets a SETCLIENTID for a client id
that currently has no state, or it has state, but the lease has
expired, rather than returning NFS4ERR_CLID_INUSE, the server MUST
allow the SETCLIENTID, and confirm the new clientid if followed by
the appropriate SETCLIENTID_CONFIRM.
8.1.3. lock_owner and stateid Definition
When requesting a lock, the client must present to the server the When requesting a lock, the client must present to the server the
clientid and an identifier for the owner of the requested lock. clientid and an identifier for the owner of the requested lock.
These two fields are referred to as the nfs_lockowner and the These two fields are referred to as the lock_owner and the definition
definition of those fields are: of those fields are:
o A clientid returned by the server as part of the client's use of o A clientid returned by the server as part of the client's use of
the SETCLIENTID operation. the SETCLIENTID operation.
o A variable length opaque array used to uniquely define the owner o A variable length opaque array used to uniquely define the owner
of a lock managed by the client. of a lock managed by the client.
This may be a thread id, process id, or other unique value. This may be a thread id, process id, or other unique value.
When the server grants the lock, it responds with a unique 64-bit When the server grants the lock, it responds with a unique stateid.
stateid. The stateid is used as a shorthand reference to the The stateid is used as a shorthand reference to the lock_owner, since
nfs_lockowner, since the server will be maintaining the the server will be maintaining the correspondence between them.
correspondence between them.
The server is free to form the stateid in any manner that it chooses The server is free to form the stateid in any manner that it chooses
as long as it is able to recognize invalid and out-of-date stateids. as long as it is able to recognize invalid and out-of-date stateids.
This requirement includes those stateids generated by earlier This requirement includes those stateids generated by earlier
instances of the server. From this, the client can be properly instances of the server. From this, the client can be properly
notified of a server restart. This notification will occur when the notified of a server restart. This notification will occur when the
client presents a stateid to the server from a previous client presents a stateid to the server from a previous
instantiation. instantiation.
The server must be able to distinguish the following situations and The server must be able to distinguish the following situations and
skipping to change at page 58, line 48 skipping to change at page 69, line 5
o The stateid was generated by an earlier server instance (i.e. o The stateid was generated by an earlier server instance (i.e.
before a server reboot). The error NFS4ERR_STALE_STATEID should before a server reboot). The error NFS4ERR_STALE_STATEID should
be returned. be returned.
o The stateid was generated by the current server instance but the o The stateid was generated by the current server instance but the
stateid no longer designates the current locking state for the stateid no longer designates the current locking state for the
lockowner-file pair in question (i.e. one or more locking lockowner-file pair in question (i.e. one or more locking
operations has occurred). The error NFS4ERR_OLD_STATEID should operations has occurred). The error NFS4ERR_OLD_STATEID should
be returned. be returned.
Draft Specification NFS version 4 Protocol August 2002
This error condition will only occur when the client issues a This error condition will only occur when the client issues a
locking request which changes a stateid while an I/O request locking request which changes a stateid while an I/O request
that uses that stateid is outstanding. that uses that stateid is outstanding.
o The stateid was generated by the current server instance but the o The stateid was generated by the current server instance but the
stateid does not designate a locking state for any active stateid does not designate a locking state for any active
lockowner-file pair. The error NFS4ERR_BAD_STATEID should be lockowner-file pair. The error NFS4ERR_BAD_STATEID should be
returned. returned.
This error condition will occur when there has been a logic This error condition will occur when there has been a logic
Draft Specification NFS version 4 Protocol July 2002
error on the part of the client or server. This should not error on the part of the client or server. This should not
happen. happen.
One mechanism that may be used to satisfy these requirements is for One mechanism that may be used to satisfy these requirements is for
the server to divide stateids into three fields: the server to,
o A server verifier which uniquely designates a particular server o divide the "other" field of each stateid into two fields:
- A server verifier which uniquely designates a particular
server
instantiation. instantiation.
o An index into a table of locking-state structures. - An index into a table of locking-state structures.
o A sequence value which is incremented for each stateid that is o utilize the "seqid" field of each stateid, such that seqid is
associated with the same index into the locking-state table. monotonically incremented for each stateid that is associated
with the same index into the locking-state table.
By matching the incoming stateid and its field values with the state By matching the incoming stateid and its field values with the state
held at the server, the server is able to easily determine if a held at the server, the server is able to easily determine if a
stateid is valid for its current instantiation and state. If the stateid is valid for its current instantiation and state. If the
stateid is not valid, the appropriate error can be supplied to the stateid is not valid, the appropriate error can be supplied to the
client. client.
8.1.4. Use of the stateid 8.1.4. Use of the stateid and Locking
All READ, WRITE and SETATTR operations contain a stateid. For the All READ, WRITE and SETATTR operations contain a stateid. For the
purposes of this section, SETATTR operations which change the size purposes of this section, SETATTR operations which change the size
attribute of a file are treated as if they are writing the area attribute of a file are treated as if they are writing the area
between the old and new size (i.e. the range truncated or added to between the old and new size (i.e. the range truncated or added to
the file by means of the SETATTR), even where SETATTR is not the file by means of the SETATTR), even where SETATTR is not
explicitly mentioned in the text. explicitly mentioned in the text.
If the nfs_lockowner performs a READ or WRITE in a situation in which If the lock_owner performs a READ or WRITE in a situation in which it
it has established a lock on the server (and for these purposes any has established a lock or share reservation on the server (any OPEN
OPEN constitutes a share lock) the stateid (previously returned by constitutes a share reservation) the stateid (previously returned by
the server) must be used to indicate what locks, including both the server) must be used to indicate what locks, including both
record and share locks, are held by the lockowner. If no state is record locks and share reservations, are held by the lockowner. If
established by the client, either record lock or share lock, a no state is established by the client, either record lock or share
stateid of all bits 0 is used. Regardless of whether a stateid of reservation, a stateid of all bits 0 is used. Regardless whether a
all bits 0, or a stateid returned by the server is used, if no stateid of all bits 0, or a stateid returned by the server is used,
conflicting locks are held on the file, the server may service the
READ or WRITE operation. If a conflict with an explicit lock occurs,
an error is returned for the operation (NFS4ERR_LOCKED). This allows
"mandatory locking" to be implemented.
Share locks are established by OPEN operations and by their nature Draft Specification NFS version 4 Protocol August 2002
are mandatory in that when the OPEN denies READ or WRITE operations,
that denial results in such operations being rejected with error
NFS4ERR_LOCKED. Record locks may be implemented by the server as
either mandatory or advisory, or the choice of mandatory or advisory
behavior may be determined by the server on the basis of the file
being accessed. When record locks are advisory, they only prevent
the granting of conflicting lock requests and have no effect on
Draft Specification NFS version 4 Protocol July 2002 if there is a conflicting share reservation or mandatory record lock
held on the file, the server MUST refuse to service the READ or WRITE
operation.
READ's or WRITE's. Mandatory record locks, however, prevent Share reservations are established by OPEN operations and by their
conflicting IO operations and when they are attempted, they are nature are mandatory in that when the OPEN denies READ or WRITE
rejected with NFS4ERR_LOCKED. operations, that denial results in such operations being rejected
with error NFS4ERR_LOCKED. Record locks may be implemented by the
server as either mandatory or advisory, or the choice of mandatory or
advisory behavior may be determined by the server on the basis of the
file being accessed (for example, some UNIX-based servers support a
"mandatory lock bit" on the mode attribute such that if set, record
locks are required on the file before I/O is possible). When record
locks are advisory, they only prevent the granting of conflicting
lock requests and have no effect on READ's or WRITE's. Mandatory
record locks, however, prevent conflicting I/O operations. When they
are attempted, they are rejected with NFS4ERR_LOCKED. Assuming an
operating environment like UNIX that requires it, when the client
gets NFS4ERR_LOCKED on a file it knows it has the proper share
reservation for, it will need to issue a LOCK request on the region
of the file that includes the region the I/O was to be performed on,
with an appropriate locktype (i.e. READ*_LT for a READ operation,
WRITE*_LT for a WRITE operation).
Every stateid other than the special stateid values noted above, With NFS version 3, there was no notion of a stateid so there was no
whether returned by an OPEN-type operation (i.e. OPEN, way to tell if the application process of the client sending the READ
or WRITE operation had also acquired the appropriate record lock on
the file. Thus there was no way to implement mandatory locking. With
the stateid construct, this barrier has been removed.
Note that for UNIX environments that support mandatory file locking,
the distinction between advisory and mandatory locking is subtle. In
fact, advisory and mandatory record locks are exactly the same in so
far as the APIs and requirements on implementation. If the mandatory
lock attribute is set on the file, the server checks to see if the
lockowner has an appropriate shared (read) or exclusive (write)
record lock on the region it wishes to read or write to. If there is
no appropriate lock, the server checks if there is a conflicting lock
(which can be done by attempting to acquire the conflicting lock on
the behalf of the lockowner, and if successful, release the lock
after the READ or WRITE is done), and if there is, the server returns
NFS4ERR_LOCKED.
For Windows environments, there are no advisory record locks, so the
server always checks for record locks during I/O requests.
Thus, the NFS version 4 LOCK operation does not need to distinguish
between advisory and mandatory record locks. It is the NFS version 4
server's processing of the READ and WRITE operations that introduces
the distinction.
Every stateid other than the special stateid values noted in this
Draft Specification NFS version 4 Protocol August 2002
section, whether returned by an OPEN-type operation (i.e. OPEN,
OPEN_DOWNGRADE), or by a LOCK-type operation (i.e. LOCK or LOCKU), OPEN_DOWNGRADE), or by a LOCK-type operation (i.e. LOCK or LOCKU),
defines an access mode for the file (i.e. READ, WRITE, or READ_WRITE) defines an access mode for the file (i.e. READ, WRITE, or READ-WRITE)
as established by the original OPEN which began the stateid sequence, as established by the original OPEN which began the stateid sequence,
and as modified by subsequent OPEN's and OPEN_DOWNGRADE's within that and as modified by subsequent OPEN's and OPEN_DOWNGRADE's within that
stateid sequence. When a READ, WRITE, or SETATTR which specifies the stateid sequence. When a READ, WRITE, or SETATTR which specifies the
size attribute, is done, the operation is subject to checking against size attribute, is done, the operation is subject to checking against
the access mode to verify that the operation is appropriate given the the access mode to verify that the operation is appropriate given the
OPEN with which the operation is associated. OPEN with which the operation is associated.
In the case of WRITE-type operations (i.e. WRITE's and SETATTR's In the case of WRITE-type operations (i.e. WRITE's and SETATTR's
which set size), the server must verify that the access mode allows which set size), the server must verify that the access mode allows
writing and return an NFS4ERR_OPENMODE error if it does not. In the writing and return an NFS4ERR_OPENMODE error if it does not. In the
skipping to change at page 60, line 36 skipping to change at page 71, line 31
access mode, or it may choose to allow READ on opens for WRITE only, access mode, or it may choose to allow READ on opens for WRITE only,
to accommodate clients whose write implementation may unavoidably do to accommodate clients whose write implementation may unavoidably do
reads (e.g. due to buffer cache constraints). However, even if reads (e.g. due to buffer cache constraints). However, even if
READ's are allowed in these circumstances, the server MUST still READ's are allowed in these circumstances, the server MUST still
check for locks that conflict with the READ (e.g. another open check for locks that conflict with the READ (e.g. another open
specify denial of READ's). Note that a server which does enforce the specify denial of READ's). Note that a server which does enforce the
access mode check on READ's need not explicitly check for conflicting access mode check on READ's need not explicitly check for conflicting
share reservations since the existence of OPEN for read access share reservations since the existence of OPEN for read access
guarantees that no conflicting share reservation can exist. guarantees that no conflicting share reservation can exist.
A stateid of all bits 1 (one) allows READ operations to bypass A stateid of all bits 1 (one) MAY allow READ operations to bypass
locking checks at the server. However, WRITE operations with a locking checks at the server. However, WRITE operations with a
stateid with bits all 1 (one) do not bypass locking checks and are stateid with bits all 1 (one) MUST NOT bypass locking checks and are
treated exactly the same as if a stateid of all bits 0 were used. treated exactly the same as if a stateid of all bits 0 were used.
An explicit lock may not be granted while a READ or WRITE operation A lock may not be granted while a READ or WRITE operation using one
with conflicting implicit locking is being performed. For the of the special stateids is being performed and the range of the lock
purposes of this paragraph, a READ is considered as having an request conflicts with the range of the READ or WRITE operation. For
implicit shared record lock for the area being read while a WRITE is the purposes of this paragraph, a conflict occurs when a shared lock
considered as having an implicit exclusive record lock for the area is requested and a WRITE operation is being performed, or an
being written (and similarly for SETATTR's that set size as discussed exclusive lock is requested and either a READ or a WRITE operation is
above). being performed. A SETATTR that sets size is treated similarly to a
WRITE as discussed above.
8.1.5. Sequencing of Lock Requests 8.1.5. Sequencing of Lock Requests
Locking is different than most NFS operations as it requires "at- Locking is different than most NFS operations as it requires "at-
most-one" semantics that are not provided by ONCRPC. ONCRPC over a most-one" semantics that are not provided by ONCRPC. ONCRPC over a
reliable transport is not sufficient because a sequence of locking reliable transport is not sufficient because a sequence of locking
requests may span multiple TCP connections. In the face of requests may span multiple TCP connections. In the face of
retransmission or reordering, lock or unlock requests must have a retransmission or reordering, lock or unlock requests must have a
well defined and consistent behavior. To accomplish this, each lock well defined and consistent behavior. To accomplish this, each lock
request contains a sequence number that is a consecutively increasing request contains a sequence number that is a consecutively increasing
integer. Different lock_owners have different sequences. The server
maintains the last sequence number (L) received and the response that
was returned. The first request issued for any given lock_owner is
issued with a sequence number of zero.
Draft Specification NFS version 4 Protocol July 2002 Draft Specification NFS version 4 Protocol August 2002
integer. Different nfs_lockowners have different sequences. The
server maintains the last sequence number (L) received and the
response that was returned.
Note that for requests that contain a sequence number, for each Note that for requests that contain a sequence number, for each
nfs_lockowner, there should be no more than one outstanding request. lock_owner, there should be no more than one outstanding request.
If a request (r) with a previous sequence number (r < L) is received, If a request (r) with a previous sequence number (r < L) is received,
it is rejected with the return of error NFS4ERR_BAD_SEQID. Given a it is rejected with the return of error NFS4ERR_BAD_SEQID. Given a
properly-functioning client, the response to (r) must have been properly-functioning client, the response to (r) must have been
received before the last request (L) was sent. If a duplicate of received before the last request (L) was sent. If a duplicate of
last request (r == L) is received, the stored response is returned. last request (r == L) is received, the stored response is returned.
If a request beyond the next sequence (r == L + 2) is received, it is If a request beyond the next sequence (r == L + 2) is received, it is
rejected with the return of error NFS4ERR_BAD_SEQID. Sequence rejected with the return of error NFS4ERR_BAD_SEQID. Sequence
history is reinitialized whenever the client verifier changes. history is reinitialized whenever the SETCLIENTID/SETCLIENTID_CONFIRM
sequence changes the client verifier.
Since the sequence number is represented with an unsigned 32-bit Since the sequence number is represented with an unsigned 32-bit
integer, the arithmetic involved with the sequence number is mod integer, the arithmetic involved with the sequence number is mod
2^32. 2^32.
It is critical the server maintain the last response sent to the It is critical the server maintain the last response sent to the
client to provide a more reliable cache of duplicate non-idempotent client to provide a more reliable cache of duplicate non-idempotent
requests than that of the traditional cache described in [Juszczak]. requests than that of the traditional cache described in [Juszczak].
The traditional duplicate request cache uses a least recently used The traditional duplicate request cache uses a least recently used
algorithm for removing unneeded requests. However, the last lock algorithm for removing unneeded requests. However, the last lock
request and response on a given nfs_lockowner must be cached as long request and response on a given lock_owner must be cached as long as
as the lock state exists on the server. the lock state exists on the server.
The client MUST monotonically increment the sequence number for the
CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE
operations. This is true even in the event that the previous
operation that used the sequence number received an error. The only
exception to this rule is if the previous operation received one of
the following errors: NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID,
NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID.
8.1.6. Recovery from Replayed Requests 8.1.6. Recovery from Replayed Requests
As described above, the sequence number is per nfs_lockowner. As As described above, the sequence number is per lock_owner. As long
long as the server maintains the last sequence number received and as the server maintains the last sequence number received and follows
follows the methods described above, there are no risks of a the methods described above, there are no risks of a Byzantine router
Byzantine router re-sending old requests. The server need only re-sending old requests. The server need only maintain the
maintain the (nfs_lockowner, sequence number) state as long as there (lock_owner, sequence number) state as long as there are open files
are open files or closed files with locks outstanding. or closed files with locks outstanding.
LOCK, LOCKU, OPEN, OPEN_DOWNGRADE, and CLOSE each contain a sequence LOCK, LOCKU, OPEN, OPEN_DOWNGRADE, and CLOSE each contain a sequence
number and therefore the risk of the replay of these operations number and therefore the risk of the replay of these operations
resulting in undesired effects is non-existent while the server resulting in undesired effects is non-existent while the server
maintains the nfs_lockowner state. maintains the lock_owner state.
8.1.7. Releasing nfs_lockowner State 8.1.7. Releasing lock_owner State
When a particular lock_owner no longer holds open or file locking
Draft Specification NFS version 4 Protocol August 2002
When a particular nfs_lockowner no longer holds open or file locking
state at the server, the server may choose to release the sequence state at the server, the server may choose to release the sequence
number state associated with the nfs_lockowner. The server may make number state associated with the lock_owner. The server may make
this choice based on lease expiration, for the reclamation of server this choice based on lease expiration, for the reclamation of server
memory, or other implementation specific details. In any event, the memory, or other implementation specific details. In any event, the
server is able to do this safely only when the nfs_lockowner no server is able to do this safely only when the lock_owner no longer
is being utilized by the client. The server may choose to hold the
lock_owner state in the event that retransmitted requests are
received. However, the period to hold this state is implementation
specific.
Draft Specification NFS version 4 Protocol July 2002 In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is
retransmitted after the server has previously released the lock_owner
state, the server will find that the lock_owner has no files open and
an error will be returned to the client. If the lock_owner does have
a file open, the stateid will not match and again an error is
returned to the client.
longer is being utilized by the client. The server may choose to 8.1.8. Use of Open Confirmation
hold the nfs_lockowner state in the event that retransmitted requests
are received. However, the period to hold this state is
implementation specific.
In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is In the case that an OPEN is retransmitted and the lock_owner is being
retransmitted after the server has previously released the used for the first time or the lock_owner state has been previously
nfs_lockowner state, the server will find that the nfs_lockowner has released by the server, the use of the OPEN_CONFIRM operation will
no files open and an error will be returned to the client. If the prevent incorrect behavior. When the server observes the use of the
nfs_lockowner does have a file open, the stateid will not match and lock_owner for the first time, it will direct the client to perform
again an error is returned to the client. the OPEN_CONFIRM for the corresponding OPEN. This sequence
establishes the use of an lock_owner and associated sequence number.
Since the OPEN_CONFIRM sequence connects a new open_owner on the
server with an existing open_owner on a client, the sequence number
may have any value. The OPEN_CONFIRM step assures the server that
the value received is the correct one. See the section "OPEN_CONFIRM
- Confirm Open" for further details.
In the case that an OPEN is retransmitted and the nfs_lockowner is There are a number of situations in which the requirement to confirm
being used for the first time or the nfs_lockowner state has been an OPEN would pose difficulties for the client and server, in that
previously released by the server, the use of the OPEN_CONFIRM they would be prevented from acting in a timely fashion on
operation will prevent incorrect behavior. When the server observes information received, because that information would be provisional,
the use of the nfs_lockowner for the first time, it will direct the subject to deletion upon non-confirmation. Fortunately, these are
client to perform the OPEN_CONFIRM for the corresponding OPEN. This situations in which the server can avoid the need for confirmation
sequence establishes the use of an nfs_lockowner and associated when responding to open requests. The two constraints are:
sequence number. See the section "OPEN_CONFIRM - Confirm Open" for
further details. o The server must not bestow a delegation for any open which would
require confirmation.
o The server MUST NOT require confirmation on a reclaim-type open
(i.e. one specifying claim type CLAIM_PREVIOUS or
CLAIM_DELEGATE_PREV).
These constraints are related in that reclaim-type opens are the
only ones in which the server may be required to send a
delegation. For CLAIM_NULL, sending the delegation is optional
while for CLAIM_DELEGATE_CUR, no delegation is sent.
Draft Specification NFS version 4 Protocol August 2002
Delegations being sent with an open requiring confirmation are
troublesome because recovering from non-confirmation adds undue
complexity to the protocol while requiring confirmation on
reclaim-type opens poses difficulties in that the inability to
resolve the status of the reclaim until lease expiration may
make it difficult to have timely determination of the set of
locks being reclaimed (since the grace period may expire).
Requiring open confirmation on reclaim-type opens is avoidable
because of the nature of the environments in which such opens
are done. For CLAIM_PREVIOUS opens, this is immediately after
server reboot, so there should be no time for lockowners to be
created, found to be unused, and recycled. For
CLAIM_DELEGATE_PREV opens, we are dealing with a client reboot
situation. A server which supports delegation can be sure that
no lockowners for that client have been recycled since client
initialization and thus can ensure that confirmation will not be
required.
8.2. Lock Ranges 8.2. Lock Ranges
The protocol allows a lock owner to request a lock with a byte range The protocol allows a lock owner to request a lock with a byte range
and then either upgrade or unlock a sub-range of the initial lock. and then either upgrade or unlock a sub-range of the initial lock.
It is expected that this will be an uncommon type of request. In any It is expected that this will be an uncommon type of request. In any
case, servers or server file systems may not be able to support sub- case, servers or server file systems may not be able to support sub-
range lock semantics. In the event that a server receives a locking range lock semantics. In the event that a server receives a locking
request that represents a sub-range of current locking state for the request that represents a sub-range of current locking state for the
lock owner, the server is allowed to return the error lock owner, the server is allowed to return the error
skipping to change at page 62, line 52 skipping to change at page 74, line 49
The client is discouraged from combining multiple independent locking The client is discouraged from combining multiple independent locking
ranges that happen to be adjacent into a single request since the ranges that happen to be adjacent into a single request since the
server may not support sub-range requests and for reasons related to server may not support sub-range requests and for reasons related to
the recovery of file locking state in the event of server failure. the recovery of file locking state in the event of server failure.
As discussed in the section "Server Failure and Recovery" below, the As discussed in the section "Server Failure and Recovery" below, the
server may employ certain optimizations during recovery that work server may employ certain optimizations during recovery that work
effectively only when the client's behavior during lock recovery is effectively only when the client's behavior during lock recovery is
similar to the client's locking behavior prior to server failure. similar to the client's locking behavior prior to server failure.
8.3. Blocking Locks 8.3. Upgrading and Downgrading Locks
If a client has a write lock on a record, it can request an atomic
downgrade of the lock to a read lock via the LOCK request, by setting
the type to READ_LT. If the server supports atomic downgrade, the
request will succeed. If not, it will return NFS4ERR_LOCK_NOTSUPP.
The client should be prepared to receive this error, and if
appropriate, report the error to the requesting application.
Draft Specification NFS version 4 Protocol August 2002
If a client has a read lock on a record, it can request an atomic
upgrade of the lock to a write lock via the LOCK request by setting
the type to WRITE_LT or WRITEW_LT. If the server does not support
atomic upgrade, it will return NFS4ERR_LOCK_NOTSUPP. If the upgrade
can be achieved without an existing conflict, the request will
succeed. Otherwise, the server will return either NFS4ERR_DENIED or
NFS4ERR_DEADLOCK. The error NFS4ERR_DEADLOCK is returned if the
client issued the LOCK request with the type set to WRITEW_LT and the
server has detected a deadlock. The client should be prepared to
receive such errors and if appropriate, report the error to the
requesting application.
8.4. Blocking Locks
Some clients require the support of blocking locks. The NFS version Some clients require the support of blocking locks. The NFS version
4 protocol must not rely on a callback mechanism and therefore is 4 protocol must not rely on a callback mechanism and therefore is
unable to notify a client when a previously denied lock has been unable to notify a client when a previously denied lock has been
Draft Specification NFS version 4 Protocol July 2002
granted. Clients have no choice but to continually poll for the granted. Clients have no choice but to continually poll for the
lock. This presents a fairness problem. Two new lock types are lock. This presents a fairness problem. Two new lock types are
added, READW and WRITEW, and are used to indicate to the server that added, READW and WRITEW, and are used to indicate to the server that
the client is requesting a blocking lock. The server should maintain the client is requesting a blocking lock. The server should maintain
an ordered list of pending blocking locks. When the conflicting lock an ordered list of pending blocking locks. When the conflicting lock
is released, the server may wait the lease period for the first is released, the server may wait the lease period for the first
waiting client to re-request the lock. After the lease period waiting client to re-request the lock. After the lease period
expires the next waiting client request is allowed the lock. Clients expires the next waiting client request is allowed the lock. Clients
are required to poll at an interval sufficiently small that it is are required to poll at an interval sufficiently small that it is
likely to acquire the lock in a timely manner. The server is not likely to acquire the lock in a timely manner. The server is not
skipping to change at page 63, line 30 skipping to change at page 75, line 47
storage would be required to guarantee ordered granting of blocking storage would be required to guarantee ordered granting of blocking
locks. locks.
Servers may also note the lock types and delay returning denial of Servers may also note the lock types and delay returning denial of
the request to allow extra time for a conflicting lock to be the request to allow extra time for a conflicting lock to be
released, allowing a successful return. In this way, clients can released, allowing a successful return. In this way, clients can
avoid the burden of needlessly frequent polling for blocking locks. avoid the burden of needlessly frequent polling for blocking locks.
The server should take care in the length of delay in the event the The server should take care in the length of delay in the event the
client retransmits the request. client retransmits the request.
8.4. Lease Renewal 8.5. Lease Renewal
The purpose of a lease is to allow a server to remove stale locks The purpose of a lease is to allow a server to remove stale locks
that are held by a client that has crashed or is otherwise that are held by a client that has crashed or is otherwise
unreachable. It is not a mechanism for cache consistency and lease unreachable. It is not a mechanism for cache consistency and lease
renewals may not be denied if the lease interval has not expired. renewals may not be denied if the lease interval has not expired.
The following events cause implicit renewal of all of the leases for The following events cause implicit renewal of all of the leases for
a given client (i.e. all those sharing a given clientid). Each of a given client (i.e. all those sharing a given clientid). Each of
these is a positive indication that the client is still active and these is a positive indication that the client is still active and
Draft Specification NFS version 4 Protocol August 2002
that the associated state held at the server, for the client, is that the associated state held at the server, for the client, is
still valid. still valid.
o An OPEN with a valid clientid. o An OPEN with a valid clientid.
o Any operation made with a valid stateid (CLOSE, DELEGPURGE, o Any operation made with a valid stateid (CLOSE, DELEGPURGE,
DELEGRETURN, LOCK, LOCKU, OPEN, OPEN_CONFIRM, OPEN_DOWNGRADE, DELEGRETURN, LOCK, LOCKU, OPEN, OPEN_CONFIRM, OPEN_DOWNGRADE,
READ, RENEW, SETATTR, SETCLIENTID_CONFIRM, WRITE). This does READ, RENEW, SETATTR, WRITE). This does not include the special
not include the special stateids of all bits 0 or all bits 1. stateids of all bits 0 or all bits 1.
Note that if the client had restarted or rebooted, the Note that if the client had restarted or rebooted, the
client would not be making these requests without issuing client would not be making these requests without issuing
the SETCLIENTID/SETCLIENTID_CONFIRM sequence. The use of the SETCLIENTID/SETCLIENTID_CONFIRM sequence. The use of
the SETCLIENTID/SETCLIENTID_CONFIRM operations notifies the the SETCLIENTID/SETCLIENTID_CONFIRM sequence (one that
server to drop the locking state associated with the changes the client verifier) notifies the server to drop
client. the locking state associated with the client.
SETCLIENTID/SETCLIENTID_CONFIRM never renews a lease.
If the server has rebooted, the stateids If the server has rebooted, the stateids
Draft Specification NFS version 4 Protocol July 2002
(NFS4ERR_STALE_STATEID error) or the clientid (NFS4ERR_STALE_STATEID error) or the clientid
(NFS4ERR_STALE_CLIENTID error) will not be valid hence (NFS4ERR_STALE_CLIENTID error) will not be valid hence
preventing spurious renewals. preventing spurious renewals.
This approach allows for low overhead lease renewal which scales This approach allows for low overhead lease renewal which scales
well. In the typical case no extra RPC calls are required for lease well. In the typical case no extra RPC calls are required for lease
renewal and in the worst case one RPC is required every lease period renewal and in the worst case one RPC is required every lease period
(i.e. a RENEW operation). The number of locks held by the client is (i.e. a RENEW operation). The number of locks held by the client is
not a factor since all state for the client is involved with the not a factor since all state for the client is involved with the
lease renewal action. lease renewal action.
Since all operations that create a new lease also renew existing Since all operations that create a new lease also renew existing
leases, the server must maintain a common lease expiration time for leases, the server must maintain a common lease expiration time for
all valid leases for a given client. This lease time can then be all valid leases for a given client. This lease time can then be
easily updated upon implicit lease renewal actions. easily updated upon implicit lease renewal actions.
8.5. Crash Recovery 8.6. Crash Recovery
The important requirement in crash recovery is that both the client The important requirement in crash recovery is that both the client
and the server know when the other has failed. Additionally, it is and the server know when the other has failed. Additionally, it is
required that a client sees a consistent view of data across server required that a client sees a consistent view of data across server
restarts or reboots. All READ and WRITE operations that may have restarts or reboots. All READ and WRITE operations that may have
been queued within the client or network buffers must wait until the been queued within the client or network buffers must wait until the
client has successfully recovered the locks protecting the READ and client has successfully recovered the locks protecting the READ and
WRITE operations. WRITE operations.
8.5.1. Client Failure and Recovery 8.6.1. Client Failure and Recovery
In the event that a client fails, the server may recover the client's In the event that a client fails, the server may recover the client's
locks when the associated leases have expired. Conflicting locks locks when the associated leases have expired. Conflicting locks
from another client may only be granted after this lease expiration. from another client may only be granted after this lease expiration.
Draft Specification NFS version 4 Protocol August 2002
If the client is able to restart or reinitialize within the lease If the client is able to restart or reinitialize within the lease
period the client may be forced to wait the remainder of the lease period the client may be forced to wait the remainder of the lease
period before obtaining new locks. period before obtaining new locks.
To minimize client delay upon restart, lock requests are associated To minimize client delay upon restart, lock requests are associated
with an instance of the client by a client supplied verifier. This with an instance of the client by a client supplied verifier. This
verifier is part of the initial SETCLIENTID call made by the client. verifier is part of the initial SETCLIENTID call made by the client.
The server returns a clientid as a result of the SETCLIENTID The server returns a clientid as a result of the SETCLIENTID
operation. The client then confirms the use of the clientid with operation. The client then confirms the use of the clientid with
SETCLIENTID_CONFIRM. The clientid in combination with an opaque SETCLIENTID_CONFIRM. The clientid in combination with an opaque
owner field is then used by the client to identify the lock owner for owner field is then used by the client to identify the lock owner for
OPEN. This chain of associations is then used to identify all locks OPEN. This chain of associations is then used to identify all locks
for a particular client. for a particular client.
Since the verifier will be changed by the client upon each Since the verifier will be changed by the client upon each
initialization, the server can compare a new verifier to the verifier initialization, the server can compare a new verifier to the verifier
associated with currently held locks and determine that they do not associated with currently held locks and determine that they do not
match. This signifies the client's new instantiation and subsequent match. This signifies the client's new instantiation and subsequent
loss of locking state. As a result, the server is free to release loss of locking state. As a result, the server is free to release
Draft Specification NFS version 4 Protocol July 2002
all locks held which are associated with the old clientid which was all locks held which are associated with the old clientid which was
derived from the old verifier. derived from the old verifier.
For secure environments, a change in the verifier must only cause the
release of locks associated with the authenticated requester. This
is required to prevent a rogue entity from freeing otherwise valid
locks.
Note that the verifier must have the same uniqueness properties of Note that the verifier must have the same uniqueness properties of
the verifier for the COMMIT operation. the verifier for the COMMIT operation.
8.5.2. Server Failure and Recovery 8.6.2. Server Failure and Recovery
If the server loses locking state (usually as a result of a restart If the server loses locking state (usually as a result of a restart
or reboot), it must allow clients time to discover this fact and re- or reboot), it must allow clients time to discover this fact and re-
establish the lost locking state. The client must be able to re- establish the lost locking state. The client must be able to re-
establish the locking state without having the server deny valid establish the locking state without having the server deny valid
requests because the server has granted conflicting access to another requests because the server has granted conflicting access to another
client. Likewise, if there is the possibility that clients have not client. Likewise, if there is the possibility that clients have not
yet re-established their locking state for a file, the server must yet re-established their locking state for a file, the server must
disallow READ and WRITE operations for that file. The duration of disallow READ and WRITE operations for that file. The duration of
this recovery period is equal to the duration of the lease period. this recovery period is equal to the duration of the lease period.
skipping to change at page 65, line 44 skipping to change at page 78, line 4
clientid invalidated by reboot or restart. When either of these are clientid invalidated by reboot or restart. When either of these are
received, the client must establish a new clientid (See the section received, the client must establish a new clientid (See the section
"Client ID") and re-establish the locking state as discussed below. "Client ID") and re-establish the locking state as discussed below.
The period of special handling of locking and READs and WRITEs, equal The period of special handling of locking and READs and WRITEs, equal
in duration to the lease period, is referred to as the "grace in duration to the lease period, is referred to as the "grace
period". During the grace period, clients recover locks and the period". During the grace period, clients recover locks and the
associated state by reclaim-type locking requests (i.e. LOCK requests associated state by reclaim-type locking requests (i.e. LOCK requests
with reclaim set to true and OPEN operations with a claim type of with reclaim set to true and OPEN operations with a claim type of
CLAIM_PREVIOUS). During the grace period, the server must reject CLAIM_PREVIOUS). During the grace period, the server must reject
Draft Specification NFS version 4 Protocol August 2002
READ and WRITE operations and non-reclaim locking requests (i.e. READ and WRITE operations and non-reclaim locking requests (i.e.
other LOCK and OPEN operations) with an error of NFS4ERR_GRACE. other LOCK and OPEN operations) with an error of NFS4ERR_GRACE.
If the server can reliably determine that granting a non-reclaim If the server can reliably determine that granting a non-reclaim
request will not conflict with reclamation of locks by other clients, request will not conflict with reclamation of locks by other clients,
the NFS4ERR_GRACE error does not have to be returned and the non- the NFS4ERR_GRACE error does not have to be returned and the non-
reclaim client request can be serviced. For the server to be able to reclaim client request can be serviced. For the server to be able to
service READ and WRITE operations during the grace period, it must service READ and WRITE operations during the grace period, it must
again be able to guarantee that no possible conflict could arise again be able to guarantee that no possible conflict could arise
between an impending reclaim locking request and the READ or WRITE between an impending reclaim locking request and the READ or WRITE
operation. If the server is unable to offer that guarantee, the operation. If the server is unable to offer that guarantee, the
NFS4ERR_GRACE error must be returned to the client. NFS4ERR_GRACE error must be returned to the client.
For a server to provide simple, valid handling during the grace For a server to provide simple, valid handling during the grace
Draft Specification NFS version 4 Protocol July 2002
period, the easiest method is to simply reject all non-reclaim period, the easiest method is to simply reject all non-reclaim
locking requests and READ and WRITE operations by returning the locking requests and READ and WRITE operations by returning the
NFS4ERR_GRACE error. However, a server may keep information about NFS4ERR_GRACE error. However, a server may keep information about
granted locks in stable storage. With this information, the server granted locks in stable storage. With this information, the server
could determine if a regular lock or READ or WRITE operation can be could determine if a regular lock or READ or WRITE operation can be
safely processed. safely processed.
For example, if a count of locks on a given file is available in For example, if a count of locks on a given file is available in
stable storage, the server can track reclaimed locks for the file and stable storage, the server can track reclaimed locks for the file and
when all reclaims have been processed, non-reclaim locking requests when all reclaims have been processed, non-reclaim locking requests
skipping to change at page 66, line 34 skipping to change at page 78, line 48
To reiterate, for a server that allows non-reclaim lock and I/O To reiterate, for a server that allows non-reclaim lock and I/O
requests to be processed during the grace period, it MUST determine requests to be processed during the grace period, it MUST determine
that no lock subsequently reclaimed will be rejected and that no lock that no lock subsequently reclaimed will be rejected and that no lock
subsequently reclaimed would have prevented any I/O operation subsequently reclaimed would have prevented any I/O operation
processed during the grace period. processed during the grace period.
Clients should be prepared for the return of NFS4ERR_GRACE errors for Clients should be prepared for the return of NFS4ERR_GRACE errors for
non-reclaim lock and I/O requests. In this case the client should non-reclaim lock and I/O requests. In this case the client should
employ a retry mechanism for the request. A delay (on the order of employ a retry mechanism for the request. A delay (on the order of
several seconds) between retries should be used to avoid overwhelming several seconds) between retries should be used to avoid overwhelming
the server. Further discussion of the general is included in the server. Further discussion of the general issue is included in
[Floyd]. The client must account for the server that is able to [Floyd]. The client must account for the server that is able to
perform I/O and non-reclaim locking requests within the grace period perform I/O and non-reclaim locking requests within the grace period
as well as those that can not do so. as well as those that can not do so.
A reclaim-type locking request outside the server's grace period can A reclaim-type locking request outside the server's grace period can
only succeed if the server can guarantee that no conflicting lock or only succeed if the server can guarantee that no conflicting lock or
I/O request has been granted since reboot or restart. I/O request has been granted since reboot or restart.
8.5.3. Network Partitions and Recovery A server may, upon restart, establish a new value for the lease
period. Therefore, clients should, once a new clientid is
Draft Specification NFS version 4 Protocol August 2002
established, refetch the lease_time attribute and use it as the basis
for lease renewal for the lease associated with that server. However,
the server must establish, for this restart event, a grace period at
least as long as the lease period for the previous server
instantiation. This allows the client state obtained during the
previous server instance to be reliably re-established.
8.6.3. Network Partitions and Recovery
If the duration of a network partition is greater than the lease If the duration of a network partition is greater than the lease
period provided by the server, the server will have not received a period provided by the server, the server will have not received a
lease renewal from the client. If this occurs, the server may free lease renewal from the client. If this occurs, the server may free
all locks held for the client. As a result, all stateids held by the all locks held for the client. As a result, all stateids held by the
client will become invalid or stale. Once the client is able to client will become invalid or stale. Once the client is able to
reach the server after such a network partition, all I/O submitted by reach the server after such a network partition, all I/O submitted by
the client with the now invalid stateids will fail with the server the client with the now invalid stateids will fail with the server
returning the error NFS4ERR_EXPIRED. Once this error is received, returning the error NFS4ERR_EXPIRED. Once this error is received,
the client will suitably notify the application that held the lock. the client will suitably notify the application that held the lock.
As a courtesy to the client or as an optimization, the server may As a courtesy to the client or as an optimization, the server may
continue to hold locks on behalf of a client for which recent continue to hold locks on behalf of a client for which recent
communication has extended beyond the lease period. If the server communication has extended beyond the lease period. If the server
Draft Specification NFS version 4 Protocol July 2002
receives a lock or I/O request that conflicts with one of these receives a lock or I/O request that conflicts with one of these
courtesy locks, the server must free the courtesy lock and grant the courtesy locks, the server must free the courtesy lock and grant the
new request. new request.
If the server continues to hold locks beyond the expiration of a If the server continues to hold locks beyond the expiration of a
client's lease, the server MUST employ a method of recording this client's lease, the server MUST employ a method of recording this
fact in its stable storage. Conflicting locks requests from another fact in its stable storage. Conflicting lock requests from another
client may be serviced after the lease expiration. There are various client may be serviced after the lease expiration. There are various
scenarios involving server failure after such an event that require scenarios involving server failure after such an event that require
the storage of these lease expirations or network partitions. One the storage of these lease expirations or network partitions. One
scenario is as follows: scenario is as follows:
A client holds a lock at the server and encounters a A client holds a lock at the server and encounters a
network partition and is unable to renew the associated network partition and is unable to renew the associated
lease. A second client obtains a conflicting lock and then lease. A second client obtains a conflicting lock and then
frees the lock. After the unlock request by the second frees the lock. After the unlock request by the second
client, the server reboots or reinitializes. Once the client, the server reboots or reinitializes. Once the
skipping to change at page 67, line 35 skipping to change at page 80, line 4
original client attempts to reclaim the original lock. original client attempts to reclaim the original lock.
In this scenario and without any state information, the server will In this scenario and without any state information, the server will
allow the reclaim and the client will be in an inconsistent state allow the reclaim and the client will be in an inconsistent state
because the server or the client has no knowledge of the conflicting because the server or the client has no knowledge of the conflicting
lock. lock.
The server may choose to store this lease expiration or network The server may choose to store this lease expiration or network
partitioning state in a way that will only identify the client as a partitioning state in a way that will only identify the client as a
whole. Note that this may potentially lead to lock reclaims being whole. Note that this may potentially lead to lock reclaims being
Draft Specification NFS version 4 Protocol August 2002
denied unnecessarily because of a mix of conflicting and non- denied unnecessarily because of a mix of conflicting and non-
conflicting locks. The server may also choose to store information conflicting locks. The server may also choose to store information
about each lock that has an expired lease with an associated about each lock that has an expired lease with an associated
conflicting lock. The choice of the amount and type of state conflicting lock. The choice of the amount and type of state
information that is stored is left to the implementor. In any case, information that is stored is left to the implementor. In any case,
the server must have enough state information to enable correct the server must have enough state information to enable correct
recovery from multiple partitions and multiple server failures. recovery from multiple partitions and multiple server failures.
8.6. Recovery from a Lock Request Timeout or Abort For further discussion of revocation of locks see the section "Server
Revocation of Locks".
8.7. Recovery from a Lock Request Timeout or Abort
In the event a lock request times out, a client may decide to not In the event a lock request times out, a client may decide to not
retry the request. The client may also abort the request when the retry the request. The client may also abort the request when the
process for which it was issued is terminated (e.g. in UNIX due to a process for which it was issued is terminated (e.g. in UNIX due to a
signal). It is possible though that the server received the request signal). It is possible though that the server received the request
and acted upon it. This would change the state on the server without and acted upon it. This would change the state on the server without
the client being aware of the change. It is paramount that the the client being aware of the change. It is paramount that the
client re-synchronize state with server before it attempts any other client re-synchronize state with server before it attempts any other
operation that takes a seqid and/or a stateid with the same operation that takes a seqid and/or a stateid with the same
nfs_lockowner. This is straightforward to do without a special re- lock_owner. This is straightforward to do without a special re-
synchronize operation. synchronize operation.
Since the server maintains the last lock request and response Since the server maintains the last lock request and response
received on the lock_owner, for each lock_owner, the client should
Draft Specification NFS version 4 Protocol July 2002 cache the last lock request it sent such that the lock request did
not receive a response. From this, the next time the client does a
received on the nfs_lockowner, for each nfs_lockowner, the client lock operation for the lock_owner, it can send the cached request, if
should cache the last lock request it sent such that the lock request there is one, and if the request was one that established state (e.g.
did not receive a response. From this, the next time the client does a LOCK or OPEN operation), the server will return the cached result
a lock operation for the nfs_lockowner, it can send the cached or if never saw the request, perform it. The client can follow up
request, if there is one, and if the request was one that established with a request to remove the state (e.g. a LOCKU or CLOSE operation).
state (e.g. a LOCK or OPEN operation) the client can follow up with a With this approach, the sequencing and stateid information on the
request to remove the state (e.g. a LOCKU or CLOSE operation). With client and server for the given lock_owner will re-synchronize and in
this approach, the sequencing and stateid information on the client
and server for the given nfs_lockowner will re-synchronize and in
turn the lock state will re-synchronize. turn the lock state will re-synchronize.
8.7. Server Revocation of Locks 8.8. Server Revocation of Locks
At any point, the server can revoke locks held by a client and the At any point, the server can revoke locks held by a client and the
client must be prepared for this event. When the client detects that client must be prepared for this event. When the client detects that
its locks have been or may have been revoked, the client is its locks have been or may have been revoked, the client is
responsible for validating the state information between itself and responsible for validating the state information between itself and
the server. Validating locking state for the client means that it the server. Validating locking state for the client means that it
must verify or reclaim state for each lock currently held. must verify or reclaim state for each lock currently held.
The first instance of lock revocation is upon server reboot or re- The first instance of lock revocation is upon server reboot or re-
initialization. In this instance the client will receive an error initialization. In this instance the client will receive an error
(NFS4ERR_STALE_STATEID or NFS4ERR_STALE_CLIENTID) and the client will (NFS4ERR_STALE_STATEID or NFS4ERR_STALE_CLIENTID) and the client will
proceed with normal crash recovery as described in the previous proceed with normal crash recovery as described in the previous
Draft Specification NFS version 4 Protocol August 2002
section. section.
The second lock revocation event is the inability to renew the lease The second lock revocation event is the inability to renew the lease
period. While this is considered a rare or unusual event, the client before expiration. While this is considered a rare or unusual event,
must be prepared to recover. Both the server and client will be able the client must be prepared to recover. Both the server and client
to detect the failure to renew the lease and are capable of will be able to detect the failure to renew the lease and are capable
recovering without data corruption. For the server, it tracks the of recovering without data corruption. For the server, it tracks the
last renewal event serviced for the client and knows when the lease last renewal event serviced for the client and knows when the lease
will expire. Similarly, the client must track operations which will will expire. Similarly, the client must track operations which will
renew the lease period. Using the time that each such request was renew the lease period. Using the time that each such request was
sent and the time that the corresponding reply was received, the sent and the time that the corresponding reply was received, the
client should bound the time that the corresponding renewal could client should bound the time that the corresponding renewal could
have occurred on the server and thus determine if it is possible that have occurred on the server and thus determine if it is possible that
a lease period expiration could have occurred. a lease period expiration could have occurred.
The third lock revocation event can occur as a result of The third lock revocation event can occur as a result of
administrative intervention within the lease period. While this is administrative intervention within the lease period. While this is
considered a rare event, it is possible that the server's considered a rare event, it is possible that the server's
administrator has decided to release or revoke a particular lock held administrator has decided to release or revoke a particular lock held
by the client. As a result of revocation, the client will receive an by the client. As a result of revocation, the client will receive an
error of NFS4ERR_EXPIRED and the error is received within the lease error of NFS4ERR_EXPIRED and the error is received within the lease
period for the lock. In this instance the client may assume that period for the lock. In this instance the client may assume that
only the nfs_lockowner's locks have been lost. The client notifies only the lock_owner's locks have been lost. The client notifies the
the lock holder appropriately. The client may not assume the lease lock holder appropriately. The client may not assume the lease
period has been renewed as a result of failed operation. period has been renewed as a result of failed operation.
When the client determines the lease period may have expired, the When the client determines the lease period may have expired, the
Draft Specification NFS version 4 Protocol July 2002
client must mark all locks held for the associated lease as client must mark all locks held for the associated lease as
"unvalidated". This means the client has been unable to re-establish "unvalidated". This means the client has been unable to re-establish
or confirm the appropriate lock state with the server. As described or confirm the appropriate lock state with the server. As described
in the previous section on crash recovery, there are scenarios in in the previous section on crash recovery, there are scenarios in
which the server may grant conflicting locks after the lease period which the server may grant conflicting locks after the lease period
has expired for a client. When it is possible that the lease period has expired for a client. When it is possible that the lease period
has expired, the client must validate each lock currently held to has expired, the client must validate each lock currently held to
ensure that a conflicting lock has not been granted. The client may ensure that a conflicting lock has not been granted. The client may
accomplish this task by issuing an I/O request, either a pending I/O accomplish this task by issuing an I/O request, either a pending I/O
or a zero-length read, specifying the stateid associated with the or a zero-length read, specifying the stateid associated with the
lock in question. If the response to the request is success, the lock in question. If the response to the request is success, the
client has validated all of the locks governed by that stateid and client has validated all of the locks governed by that stateid and
re-established the appropriate state between itself and the server. re-established the appropriate state between itself and the server.
If the I/O request is not successful, then one or more of the locks If the I/O request is not successful, then one or more of the locks
associated with the stateid was revoked by the server and the client associated with the stateid was revoked by the server and the client
must notify the owner. must notify the owner.
8.8. Share Reservations 8.9. Share Reservations
A share reservation is a mechanism to control access to a file. It A share reservation is a mechanism to control access to a file. It
is a separate and independent mechanism from record locking. When a is a separate and independent mechanism from record locking. When a
client opens a file, it issues an OPEN operation to the server client opens a file, it issues an OPEN operation to the server
specifying the type of access required (READ, WRITE, or BOTH) and the specifying the type of access required (READ, WRITE, or BOTH) and the
type of access to deny others (deny NONE, READ, WRITE, or BOTH). If type of access to deny others (deny NONE, READ, WRITE, or BOTH). If
Draft Specification NFS version 4 Protocol August 2002
the OPEN fails the client will fail the application's open request. the OPEN fails the client will fail the application's open request.
Pseudo-code definition of the semantics: Pseudo-code definition of the semantics:
if ((request.access & file_state.deny)) || if ((request.access & file_state.deny)) ||
(request.deny & file_state.access)) (request.deny & file_state.access))
return (NFS4ERR_DENIED) return (NFS4ERR_DENIED)
This checking of share reservations on OPEN is done with no exception
for an existing OPEN for the same open_owner.
The constants used for the OPEN and OPEN_DOWNGRADE operations for the The constants used for the OPEN and OPEN_DOWNGRADE operations for the
access and deny fields are as follows: access and deny fields are as follows:
const OPEN4_SHARE_ACCESS_READ = 0x00000001; const OPEN4_SHARE_ACCESS_READ = 0x00000001;
const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; const OPEN4_SHARE_ACCESS_WRITE = 0x00000002;
const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; const OPEN4_SHARE_ACCESS_BOTH = 0x00000003;
const OPEN4_SHARE_DENY_NONE = 0x00000000; const OPEN4_SHARE_DENY_NONE = 0x00000000;
const OPEN4_SHARE_DENY_READ = 0x00000001; const OPEN4_SHARE_DENY_READ = 0x00000001;
const OPEN4_SHARE_DENY_WRITE = 0x00000002; const OPEN4_SHARE_DENY_WRITE = 0x00000002;
const OPEN4_SHARE_DENY_BOTH = 0x00000003; const OPEN4_SHARE_DENY_BOTH = 0x00000003;
8.9. OPEN/CLOSE Operations 8.10. OPEN/CLOSE Operations
To provide correct share semantics, a client MUST use the OPEN To provide correct share semantics, a client MUST use the OPEN
operation to obtain the initial filehandle and indicate the desired operation to obtain the initial filehandle and indicate the desired
access and what if any access to deny. Even if the client intends to access and what if any access to deny. Even if the client intends to