draft-ietf-nfsv4-rfc3530bis-07.txt   draft-ietf-nfsv4-rfc3530bis-08.txt 
NFSv4 T. Haynes NFSv4 T. Haynes
Internet-Draft D. Noveck Internet-Draft D. Noveck
Intended status: Standards Track Editors Intended status: Standards Track Editors
Expires: August 31, 2011 February 27, 2011 Expires: September 5, 2011 March 04, 2011
NFS Version 4 Protocol NFS Version 4 Protocol
draft-ietf-nfsv4-rfc3530bis-07.txt draft-ietf-nfsv4-rfc3530bis-08.txt
Abstract Abstract
The Network File System (NFS) version 4 is a distributed filesystem The Network File System (NFS) version 4 is a distributed filesystem
protocol which owes heritage to NFS protocol version 2, RFC 1094, and protocol which owes heritage to NFS protocol version 2, RFC 1094, and
version 3, RFC 1813. Unlike earlier versions, the NFS version 4 version 3, RFC 1813. Unlike earlier versions, the NFS version 4
protocol supports traditional file access while integrating support protocol supports traditional file access while integrating support
for file locking and the mount protocol. In addition, support for for file locking and the mount protocol. In addition, support for
strong security (and its negotiation), compound operations, client strong security (and its negotiation), compound operations, client
caching, and internationalization have been added. Of course, caching, and internationalization have been added. Of course,
skipping to change at page 2, line 8 skipping to change at page 2, line 8
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
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.
This Internet-Draft will expire on August 31, 2011. This Internet-Draft will expire on September 5, 2011.
Copyright Notice Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the Copyright (c) 2011 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 3, line 9 skipping to change at page 3, line 9
the copyright in such materials, this document may not be modified the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other it for publication as an RFC or to translate it into languages other
than English. than English.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1. Changes since RFC 3530 . . . . . . . . . . . . . . . . . 8 1.1. Changes since RFC 3530 . . . . . . . . . . . . . . . . . 8
1.2. Changes since RFC 3010 . . . . . . . . . . . . . . . . . 8 1.2. Changes since RFC 3010 . . . . . . . . . . . . . . . . . 9
1.3. NFS Version 4 Goals . . . . . . . . . . . . . . . . . . 10 1.3. NFS Version 4 Goals . . . . . . . . . . . . . . . . . . 10
1.4. Inconsistencies of this Document with the companion 1.4. Inconsistencies of this Document with the companion
document NFS Version 4 Protocol . . . . . . . . . . . . 10 document NFS Version 4 Protocol . . . . . . . . . . . . 10
1.5. Overview of NFS version 4 Features . . . . . . . . . . . 11 1.5. Overview of NFSv4 Features . . . . . . . . . . . . . . . 11
1.5.1. RPC and Security . . . . . . . . . . . . . . . . . . 11 1.5.1. RPC and Security . . . . . . . . . . . . . . . . . . 11
1.5.2. Procedure and Operation Structure . . . . . . . . . 11 1.5.2. Procedure and Operation Structure . . . . . . . . . 11
1.5.3. Filesystem Model . . . . . . . . . . . . . . . . . . 12 1.5.3. Filesystem Model . . . . . . . . . . . . . . . . . . 12
1.5.4. OPEN and CLOSE . . . . . . . . . . . . . . . . . . . 14 1.5.4. OPEN and CLOSE . . . . . . . . . . . . . . . . . . . 14
1.5.5. File Locking . . . . . . . . . . . . . . . . . . . . 14 1.5.5. File Locking . . . . . . . . . . . . . . . . . . . . 14
1.5.6. Client Caching and Delegation . . . . . . . . . . . 14 1.5.6. Client Caching and Delegation . . . . . . . . . . . 14
1.6. General Definitions . . . . . . . . . . . . . . . . . . 15 1.6. General Definitions . . . . . . . . . . . . . . . . . . 15
2. Protocol Data Types . . . . . . . . . . . . . . . . . . . . . 17 2. Protocol Data Types . . . . . . . . . . . . . . . . . . . . . 17
2.1. Basic Data Types . . . . . . . . . . . . . . . . . . . . 17 2.1. Basic Data Types . . . . . . . . . . . . . . . . . . . . 17
2.2. Structured Data Types . . . . . . . . . . . . . . . . . 18 2.2. Structured Data Types . . . . . . . . . . . . . . . . . 19
3. RPC and Security Flavor . . . . . . . . . . . . . . . . . . . 24 3. RPC and Security Flavor . . . . . . . . . . . . . . . . . . . 24
3.1. Ports and Transports . . . . . . . . . . . . . . . . . . 24 3.1. Ports and Transports . . . . . . . . . . . . . . . . . . 24
3.1.1. Client Retransmission Behavior . . . . . . . . . . . 25 3.1.1. Client Retransmission Behavior . . . . . . . . . . . 25
3.2. Security Flavors . . . . . . . . . . . . . . . . . . . . 25 3.2. Security Flavors . . . . . . . . . . . . . . . . . . . . 25
3.2.1. Security mechanisms for NFS version 4 . . . . . . . 26 3.2.1. Security mechanisms for NFSv4 . . . . . . . . . . . 26
3.3. Security Negotiation . . . . . . . . . . . . . . . . . . 28 3.3. Security Negotiation . . . . . . . . . . . . . . . . . . 28
3.3.1. SECINFO . . . . . . . . . . . . . . . . . . . . . . 28 3.3.1. SECINFO . . . . . . . . . . . . . . . . . . . . . . 28
3.3.2. Security Error . . . . . . . . . . . . . . . . . . . 28 3.3.2. Security Error . . . . . . . . . . . . . . . . . . . 28
3.3.3. Callback RPC Authentication . . . . . . . . . . . . 29 3.3.3. Callback RPC Authentication . . . . . . . . . . . . 29
4. Filehandles . . . . . . . . . . . . . . . . . . . . . . . . . 31 4. Filehandles . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.1. Obtaining the First Filehandle . . . . . . . . . . . . . 31 4.1. Obtaining the First Filehandle . . . . . . . . . . . . . 31
4.1.1. Root Filehandle . . . . . . . . . . . . . . . . . . 31 4.1.1. Root Filehandle . . . . . . . . . . . . . . . . . . 31
4.1.2. Public Filehandle . . . . . . . . . . . . . . . . . 31 4.1.2. Public Filehandle . . . . . . . . . . . . . . . . . 31
4.2. Filehandle Types . . . . . . . . . . . . . . . . . . . . 32 4.2. Filehandle Types . . . . . . . . . . . . . . . . . . . . 32
4.2.1. General Properties of a Filehandle . . . . . . . . . 32 4.2.1. General Properties of a Filehandle . . . . . . . . . 32
skipping to change at page 5, line 11 skipping to change at page 5, line 11
8. NFS Server Name Space . . . . . . . . . . . . . . . . . . . . 101 8. NFS Server Name Space . . . . . . . . . . . . . . . . . . . . 101
8.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 101 8.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 101
8.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 101 8.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 101
8.3. Server Pseudo Filesystem . . . . . . . . . . . . . . . . 101 8.3. Server Pseudo Filesystem . . . . . . . . . . . . . . . . 101
8.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 102 8.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 102
8.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 102 8.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 102
8.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 102 8.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 102
8.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 103 8.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 103
8.8. Security Policy and Name Space Presentation . . . . . . 103 8.8. Security Policy and Name Space Presentation . . . . . . 103
9. File Locking and Share Reservations . . . . . . . . . . . . . 104 9. File Locking and Share Reservations . . . . . . . . . . . . . 104
9.1. Locking . . . . . . . . . . . . . . . . . . . . . . . . 105 9.1. Opens and Byte-Range Locks . . . . . . . . . . . . . . . 105
9.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . 105 9.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . 105
9.1.2. Server Release of Clientid . . . . . . . . . . . . . 108 9.1.2. Server Release of Client ID . . . . . . . . . . . . 108
9.1.3. lock_owner and stateid Definition . . . . . . . . . 109 9.1.3. Stateid Definition . . . . . . . . . . . . . . . . . 109
9.1.4. Use of the stateid and Locking . . . . . . . . . . . 110 9.1.4. lock_owner . . . . . . . . . . . . . . . . . . . . . 117
9.1.5. Sequencing of Lock Requests . . . . . . . . . . . . 112 9.1.5. Use of the Stateid and Locking . . . . . . . . . . . 117
9.1.6. Recovery from Replayed Requests . . . . . . . . . . 113 9.1.6. Sequencing of Lock Requests . . . . . . . . . . . . 119
9.1.7. Releasing lock_owner State . . . . . . . . . . . . . 114 9.1.7. Recovery from Replayed Requests . . . . . . . . . . 120
9.1.8. Use of Open Confirmation . . . . . . . . . . . . . . 114 9.1.8. Releasing lock_owner State . . . . . . . . . . . . . 121
9.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 115 9.1.9. Use of Open Confirmation . . . . . . . . . . . . . . 121
9.3. Upgrading and Downgrading Locks . . . . . . . . . . . . 116 9.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 122
9.4. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 116 9.3. Upgrading and Downgrading Locks . . . . . . . . . . . . 123
9.5. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 117 9.4. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 123
9.6. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 118 9.5. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 124
9.6.1. Client Failure and Recovery . . . . . . . . . . . . 118 9.6. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 125
9.6.2. Server Failure and Recovery . . . . . . . . . . . . 119 9.6.1. Client Failure and Recovery . . . . . . . . . . . . 125
9.6.3. Network Partitions and Recovery . . . . . . . . . . 120 9.6.2. Server Failure and Recovery . . . . . . . . . . . . 126
9.7. Recovery from a Lock Request Timeout or Abort . . . . . 124 9.6.3. Network Partitions and Recovery . . . . . . . . . . 127
9.8. Server Revocation of Locks . . . . . . . . . . . . . . . 124 9.7. Recovery from a Lock Request Timeout or Abort . . . . . 133
9.9. Share Reservations . . . . . . . . . . . . . . . . . . . 125 9.8. Server Revocation of Locks . . . . . . . . . . . . . . . 133
9.10. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 126 9.9. Share Reservations . . . . . . . . . . . . . . . . . . . 135
9.10.1. Close and Retention of State Information . . . . . . 127 9.10. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 135
9.11. Open Upgrade and Downgrade . . . . . . . . . . . . . . . 127 9.10.1. Close and Retention of State Information . . . . . . 136
9.12. Short and Long Leases . . . . . . . . . . . . . . . . . 128 9.11. Open Upgrade and Downgrade . . . . . . . . . . . . . . . 137
9.12. Short and Long Leases . . . . . . . . . . . . . . . . . 137
9.13. Clocks, Propagation Delay, and Calculating Lease 9.13. Clocks, Propagation Delay, and Calculating Lease
Expiration . . . . . . . . . . . . . . . . . . . . . . . 129 Expiration . . . . . . . . . . . . . . . . . . . . . . . 138
9.14. Migration, Replication and State . . . . . . . . . . . . 129 9.14. Migration, Replication and State . . . . . . . . . . . . 138
9.14.1. Migration and State . . . . . . . . . . . . . . . . 130 9.14.1. Migration and State . . . . . . . . . . . . . . . . 139
9.14.2. Replication and State . . . . . . . . . . . . . . . 130 9.14.2. Replication and State . . . . . . . . . . . . . . . 140
9.14.3. Notification of Migrated Lease . . . . . . . . . . . 131 9.14.3. Notification of Migrated Lease . . . . . . . . . . . 140
9.14.4. Migration and the Lease_time Attribute . . . . . . . 132 9.14.4. Migration and the Lease_time Attribute . . . . . . . 141
10. Client-Side Caching . . . . . . . . . . . . . . . . . . . . . 132 10. Client-Side Caching . . . . . . . . . . . . . . . . . . . . . 141
10.1. Performance Challenges for Client-Side Caching . . . . . 133 10.1. Performance Challenges for Client-Side Caching . . . . . 142
10.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 134 10.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 143
10.2.1. Delegation Recovery . . . . . . . . . . . . . . . . 135 10.2.1. Delegation Recovery . . . . . . . . . . . . . . . . 145
10.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 137 10.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 147
10.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . 138 10.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . 147
10.3.2. Data Caching and File Locking . . . . . . . . . . . 139 10.3.2. Data Caching and File Locking . . . . . . . . . . . 148
10.3.3. Data Caching and Mandatory File Locking . . . . . . 140 10.3.3. Data Caching and Mandatory File Locking . . . . . . 149
10.3.4. Data Caching and File Identity . . . . . . . . . . . 141 10.3.4. Data Caching and File Identity . . . . . . . . . . . 150
10.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 142
10.4.1. Open Delegation and Data Caching . . . . . . . . . . 144 10.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 151
10.4.2. Open Delegation and File Locks . . . . . . . . . . . 145 10.4.1. Open Delegation and Data Caching . . . . . . . . . . 153
10.4.3. Handling of CB_GETATTR . . . . . . . . . . . . . . . 146 10.4.2. Open Delegation and File Locks . . . . . . . . . . . 155
10.4.4. Recall of Open Delegation . . . . . . . . . . . . . 149 10.4.3. Handling of CB_GETATTR . . . . . . . . . . . . . . . 155
10.4.5. Clients that Fail to Honor Delegation Recalls . . . 151 10.4.4. Recall of Open Delegation . . . . . . . . . . . . . 158
10.4.6. Delegation Revocation . . . . . . . . . . . . . . . 151 10.4.5. OPEN Delegation Race with CB_RECALL . . . . . . . . 160
10.5. Data Caching and Revocation . . . . . . . . . . . . . . 152 10.4.6. Clients that Fail to Honor Delegation Recalls . . . 161
10.5.1. Revocation Recovery for Write Open Delegation . . . 152 10.4.7. Delegation Revocation . . . . . . . . . . . . . . . 162
10.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 153 10.5. Data Caching and Revocation . . . . . . . . . . . . . . 162
10.7. Data and Metadata Caching and Memory Mapped Files . . . 155 10.5.1. Revocation Recovery for Write Open Delegation . . . 163
10.8. Name Caching . . . . . . . . . . . . . . . . . . . . . . 157 10.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 163
10.9. Directory Caching . . . . . . . . . . . . . . . . . . . 158 10.7. Data and Metadata Caching and Memory Mapped Files . . . 165
11. Minor Versioning . . . . . . . . . . . . . . . . . . . . . . 159 10.8. Name Caching . . . . . . . . . . . . . . . . . . . . . . 167
12. Internationalization . . . . . . . . . . . . . . . . . . . . 162 10.9. Directory Caching . . . . . . . . . . . . . . . . . . . 168
12.1. Use of UTF-8 . . . . . . . . . . . . . . . . . . . . . . 163 11. Minor Versioning . . . . . . . . . . . . . . . . . . . . . . 169
12.1.1. Relation to Stringprep . . . . . . . . . . . . . . . 163 12. Internationalization . . . . . . . . . . . . . . . . . . . . 172
12.1.2. Normalization, Equivalence, and Confusability . . . 164 12.1. Use of UTF-8 . . . . . . . . . . . . . . . . . . . . . . 173
12.2. String Type Overview . . . . . . . . . . . . . . . . . . 166 12.1.1. Relation to Stringprep . . . . . . . . . . . . . . . 173
12.2.1. Overall String Class Divisions . . . . . . . . . . . 167 12.1.2. Normalization, Equivalence, and Confusability . . . 174
12.2.2. Divisions by Typedef Parent types . . . . . . . . . 168 12.2. String Type Overview . . . . . . . . . . . . . . . . . . 177
12.2.3. Individual Types and Their Handling . . . . . . . . 168 12.2.1. Overall String Class Divisions . . . . . . . . . . . 177
12.3. Errors Related to Strings . . . . . . . . . . . . . . . 170 12.2.2. Divisions by Typedef Parent types . . . . . . . . . 178
12.4. Types with Pre-processing to Resolve Mixture Issues . . 171 12.2.3. Individual Types and Their Handling . . . . . . . . 179
12.4.1. Processing of Principal Strings . . . . . . . . . . 171 12.3. Errors Related to Strings . . . . . . . . . . . . . . . 180
12.4.2. Processing of Server Id Strings . . . . . . . . . . 171 12.4. Types with Pre-processing to Resolve Mixture Issues . . 181
12.5. String Types without Internationalization Processing . . 172 12.4.1. Processing of Principal Strings . . . . . . . . . . 181
12.6. Types with Processing Defined by Other Internet Areas . 172 12.4.2. Processing of Server Id Strings . . . . . . . . . . 181
12.7. String Types with NFS-specific Processing . . . . . . . 173 12.5. String Types without Internationalization Processing . . 182
12.7.1. Handling of File Name Components . . . . . . . . . . 174 12.6. Types with Processing Defined by Other Internet Areas . 182
12.7.2. Processing of Link Text . . . . . . . . . . . . . . 183 12.7. String Types with NFS-specific Processing . . . . . . . 183
12.7.3. Processing of Principal Prefixes . . . . . . . . . . 184 12.7.1. Handling of File Name Components . . . . . . . . . . 184
13. Error Values . . . . . . . . . . . . . . . . . . . . . . . . 185 12.7.2. Processing of Link Text . . . . . . . . . . . . . . 193
13.1. Error Definitions . . . . . . . . . . . . . . . . . . . 185 12.7.3. Processing of Principal Prefixes . . . . . . . . . . 194
13.1.1. General Errors . . . . . . . . . . . . . . . . . . . 187 13. Error Values . . . . . . . . . . . . . . . . . . . . . . . . 195
13.1.2. Filehandle Errors . . . . . . . . . . . . . . . . . 188 13.1. Error Definitions . . . . . . . . . . . . . . . . . . . 195
13.1.3. Compound Structure Errors . . . . . . . . . . . . . 189 13.1.1. General Errors . . . . . . . . . . . . . . . . . . . 197
13.1.4. File System Errors . . . . . . . . . . . . . . . . . 190 13.1.2. Filehandle Errors . . . . . . . . . . . . . . . . . 198
13.1.5. State Management Errors . . . . . . . . . . . . . . 192 13.1.3. Compound Structure Errors . . . . . . . . . . . . . 199
13.1.6. Security Errors . . . . . . . . . . . . . . . . . . 193 13.1.4. File System Errors . . . . . . . . . . . . . . . . . 200
13.1.7. Name Errors . . . . . . . . . . . . . . . . . . . . 193 13.1.5. State Management Errors . . . . . . . . . . . . . . 202
13.1.8. Locking Errors . . . . . . . . . . . . . . . . . . . 194 13.1.6. Security Errors . . . . . . . . . . . . . . . . . . 203
13.1.9. Reclaim Errors . . . . . . . . . . . . . . . . . . . 195 13.1.7. Name Errors . . . . . . . . . . . . . . . . . . . . 203
13.1.10. Client Management Errors . . . . . . . . . . . . . . 196 13.1.8. Locking Errors . . . . . . . . . . . . . . . . . . . 204
13.1.11. Attribute Handling Errors . . . . . . . . . . . . . 196 13.1.9. Reclaim Errors . . . . . . . . . . . . . . . . . . . 205
13.2. Operations and their valid errors . . . . . . . . . . . 197 13.1.10. Client Management Errors . . . . . . . . . . . . . . 206
13.3. Callback operations and their valid errors . . . . . . . 205 13.1.11. Attribute Handling Errors . . . . . . . . . . . . . 206
13.4. Errors and the operations that use them . . . . . . . . 205 13.2. Operations and their valid errors . . . . . . . . . . . 207
14. NFS version 4 Requests . . . . . . . . . . . . . . . . . . . 209 13.3. Callback operations and their valid errors . . . . . . . 214
14.1. Compound Procedure . . . . . . . . . . . . . . . . . . . 210 13.4. Errors and the operations that use them . . . . . . . . 214
14.2. Evaluation of a Compound Request . . . . . . . . . . . . 210 14. NFSv4 Requests . . . . . . . . . . . . . . . . . . . . . . . 219
14.3. Synchronous Modifying Operations . . . . . . . . . . . . 211 14.1. Compound Procedure . . . . . . . . . . . . . . . . . . . 219
14.4. Operation Values . . . . . . . . . . . . . . . . . . . . 212 14.2. Evaluation of a Compound Request . . . . . . . . . . . . 220
15. NFS version 4 Procedures . . . . . . . . . . . . . . . . . . 212 14.3. Synchronous Modifying Operations . . . . . . . . . . . . 221
15.1. Procedure 0: NULL - No Operation . . . . . . . . . . . . 212 14.4. Operation Values . . . . . . . . . . . . . . . . . . . . 221
15.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 212 15. NFSv4 Procedures . . . . . . . . . . . . . . . . . . . . . . 221
15.3. Operation 3: ACCESS - Check Access Rights . . . . . . . 215 15.1. Procedure 0: NULL - No Operation . . . . . . . . . . . . 221
15.4. Operation 4: CLOSE - Close File . . . . . . . . . . . . 218 15.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 222
15.5. Operation 5: COMMIT - Commit Cached Data . . . . . . . . 219 15.3. Operation 3: ACCESS - Check Access Rights . . . . . . . 227
15.6. Operation 6: CREATE - Create a Non-Regular File Object . 221 15.4. Operation 4: CLOSE - Close File . . . . . . . . . . . . 230
15.5. Operation 5: COMMIT - Commit Cached Data . . . . . . . . 231
15.6. Operation 6: CREATE - Create a Non-Regular File Object . 233
15.7. Operation 7: DELEGPURGE - Purge Delegations Awaiting 15.7. Operation 7: DELEGPURGE - Purge Delegations Awaiting
Recovery . . . . . . . . . . . . . . . . . . . . . . . . 224 Recovery . . . . . . . . . . . . . . . . . . . . . . . . 236
15.8. Operation 8: DELEGRETURN - Return Delegation . . . . . . 225 15.8. Operation 8: DELEGRETURN - Return Delegation . . . . . . 237
15.9. Operation 9: GETATTR - Get Attributes . . . . . . . . . 225 15.9. Operation 9: GETATTR - Get Attributes . . . . . . . . . 237
15.10. Operation 10: GETFH - Get Current Filehandle . . . . . . 226 15.10. Operation 10: GETFH - Get Current Filehandle . . . . . . 239
15.11. Operation 11: LINK - Create Link to a File . . . . . . . 227 15.11. Operation 11: LINK - Create Link to a File . . . . . . . 240
15.12. Operation 12: LOCK - Create Lock . . . . . . . . . . . . 229 15.12. Operation 12: LOCK - Create Lock . . . . . . . . . . . . 241
15.13. Operation 13: LOCKT - Test For Lock . . . . . . . . . . 233 15.13. Operation 13: LOCKT - Test For Lock . . . . . . . . . . 245
15.14. Operation 14: LOCKU - Unlock File . . . . . . . . . . . 234 15.14. Operation 14: LOCKU - Unlock File . . . . . . . . . . . 247
15.15. Operation 15: LOOKUP - Lookup Filename . . . . . . . . . 236 15.15. Operation 15: LOOKUP - Lookup Filename . . . . . . . . . 248
15.16. Operation 16: LOOKUPP - Lookup Parent Directory . . . . 237 15.16. Operation 16: LOOKUPP - Lookup Parent Directory . . . . 250
15.17. Operation 17: NVERIFY - Verify Difference in 15.17. Operation 17: NVERIFY - Verify Difference in
Attributes . . . . . . . . . . . . . . . . . . . . . . . 238 Attributes . . . . . . . . . . . . . . . . . . . . . . . 250
15.18. Operation 18: OPEN - Open a Regular File . . . . . . . . 239 15.18. Operation 18: OPEN - Open a Regular File . . . . . . . . 252
15.19. Operation 19: OPENATTR - Open Named Attribute 15.19. Operation 19: OPENATTR - Open Named Attribute
Directory . . . . . . . . . . . . . . . . . . . . . . . 249 Directory . . . . . . . . . . . . . . . . . . . . . . . 262
15.20. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . . . 250 15.20. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . . . 263
15.21. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access . 252 15.21. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access . 265
15.22. Operation 22: PUTFH - Set Current Filehandle . . . . . . 253 15.22. Operation 22: PUTFH - Set Current Filehandle . . . . . . 266
15.23. Operation 23: PUTPUBFH - Set Public Filehandle . . . . . 253 15.23. Operation 23: PUTPUBFH - Set Public Filehandle . . . . . 267
15.24. Operation 24: PUTROOTFH - Set Root Filehandle . . . . . 255 15.24. Operation 24: PUTROOTFH - Set Root Filehandle . . . . . 268
15.25. Operation 25: READ - Read from File . . . . . . . . . . 255 15.25. Operation 25: READ - Read from File . . . . . . . . . . 269
15.26. Operation 26: READDIR - Read Directory . . . . . . . . . 258 15.26. Operation 26: READDIR - Read Directory . . . . . . . . . 271
15.27. Operation 27: READLINK - Read Symbolic Link . . . . . . 261 15.27. Operation 27: READLINK - Read Symbolic Link . . . . . . 275
15.28. Operation 28: REMOVE - Remove Filesystem Object . . . . 262 15.28. Operation 28: REMOVE - Remove Filesystem Object . . . . 276
15.29. Operation 29: RENAME - Rename Directory Entry . . . . . 264 15.29. Operation 29: RENAME - Rename Directory Entry . . . . . 278
15.30. Operation 30: RENEW - Renew a Lease . . . . . . . . . . 266 15.30. Operation 30: RENEW - Renew a Lease . . . . . . . . . . 280
15.31. Operation 31: RESTOREFH - Restore Saved Filehandle . . . 267 15.31. Operation 31: RESTOREFH - Restore Saved Filehandle . . . 281
15.32. Operation 32: SAVEFH - Save Current Filehandle . . . . . 268 15.32. Operation 32: SAVEFH - Save Current Filehandle . . . . . 282
15.33. Operation 33: SECINFO - Obtain Available Security . . . 269 15.33. Operation 33: SECINFO - Obtain Available Security . . . 282
15.34. Operation 34: SETATTR - Set Attributes . . . . . . . . . 272 15.34. Operation 34: SETATTR - Set Attributes . . . . . . . . . 285
15.35. Operation 35: SETCLIENTID - Negotiate Clientid . . . . . 275 15.35. Operation 35: SETCLIENTID - Negotiate Client ID . . . . 288
15.36. Operation 36: SETCLIENTID_CONFIRM - Confirm Clientid . . 278 15.36. Operation 36: SETCLIENTID_CONFIRM - Confirm Client ID . 292
15.37. Operation 37: VERIFY - Verify Same Attributes . . . . . 282 15.37. Operation 37: VERIFY - Verify Same Attributes . . . . . 295
15.38. Operation 38: WRITE - Write to File . . . . . . . . . . 283 15.38. Operation 38: WRITE - Write to File . . . . . . . . . . 297
15.39. Operation 39: RELEASE_LOCKOWNER - Release Lockowner 15.39. Operation 39: RELEASE_LOCKOWNER - Release Lockowner
State . . . . . . . . . . . . . . . . . . . . . . . . . 287 State . . . . . . . . . . . . . . . . . . . . . . . . . 301
15.40. Operation 10044: ILLEGAL - Illegal operation . . . . . . 302
15.40. Operation 10044: ILLEGAL - Illegal operation . . . . . . 288 16. NFSv4 Callback Procedures . . . . . . . . . . . . . . . . . . 302
16. NFS version 4 Callback Procedures . . . . . . . . . . . . . . 289 16.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 303
16.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 289 16.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . . 303
16.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . . 290 16.2.6. Operation 3: CB_GETATTR - Get Attributes . . . . . . 305
16.2.6. Operation 3: CB_GETATTR - Get Attributes . . . . . . 291 16.2.7. Operation 4: CB_RECALL - Recall an Open Delegation . 306
16.2.7. Operation 4: CB_RECALL - Recall an Open Delegation . 292
16.2.8. Operation 10044: CB_ILLEGAL - Illegal Callback 16.2.8. Operation 10044: CB_ILLEGAL - Illegal Callback
Operation . . . . . . . . . . . . . . . . . . . . . 293 Operation . . . . . . . . . . . . . . . . . . . . . 307
17. Security Considerations . . . . . . . . . . . . . . . . . . . 294 17. Security Considerations . . . . . . . . . . . . . . . . . . . 308
18. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 296 18. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 309
18.1. Named Attribute Definition . . . . . . . . . . . . . . . 296 18.1. Named Attribute Definitions . . . . . . . . . . . . . . 309
18.2. ONC RPC Network Identifiers (netids) . . . . . . . . . . 296 18.1.1. Initial Registry . . . . . . . . . . . . . . . . . . 310
19. References . . . . . . . . . . . . . . . . . . . . . . . . . 297 18.1.2. Updating Registrations . . . . . . . . . . . . . . . 310
19.1. Normative References . . . . . . . . . . . . . . . . . . 297 18.2. ONC RPC Network Identifiers (netids) . . . . . . . . . . 310
19.2. Informative References . . . . . . . . . . . . . . . . . 298 18.2.1. Initial Registry . . . . . . . . . . . . . . . . . . 312
Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 300 18.2.2. Updating Registrations . . . . . . . . . . . . . . . 312
Appendix B. RFC Editor Notes . . . . . . . . . . . . . . . . . . 300 19. References . . . . . . . . . . . . . . . . . . . . . . . . . 312
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 301 19.1. Normative References . . . . . . . . . . . . . . . . . . 312
19.2. Informative References . . . . . . . . . . . . . . . . . 313
Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 315
Appendix B. RFC Editor Notes . . . . . . . . . . . . . . . . . . 316
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 316
1. Introduction 1. Introduction
1.1. Changes since RFC 3530 1.1. Changes since RFC 3530
This document, together with the companion XDR description document This document, together with the companion XDR description document
[2], obsoletes RFC 3530 [11] as the authoritative document describing [2], obsoletes RFC 3530 [11] as the authoritative document describing
NFSv4. It does not introduce any over-the-wire protocol changes, in NFSv4. It does not introduce any over-the-wire protocol changes, in
the sense that previously valid requests requests remain valid. the sense that previously valid requests requests remain valid.
However, some requests previously defined as invalid, although not However, some requests previously defined as invalid, although not
skipping to change at page 9, line 40 skipping to change at page 9, line 40
these name are the province of the receiving entity. these name are the province of the receiving entity.
o Updating handling of domain names to reflect IDNA. o Updating handling of domain names to reflect IDNA.
o Restructuring of string types to more appropriately reflect the o Restructuring of string types to more appropriately reflect the
reality of required string processing. reality of required string processing.
o LIPKEY SPKM/3 has been moved from being REQUIRED to OPTIONAL. o LIPKEY SPKM/3 has been moved from being REQUIRED to OPTIONAL.
o Some clarification on a client re-establishing callback o Some clarification on a client re-establishing callback
information to the new server if state has been migrated information to the new server if state has been migrated.
o A third edge case was added for Courtesy locks and network
partitions.
o The definintion of stateid was strengthened, which had the side
effect of introducing a semantic change in a COMPOUND structure
having a current stateid and a saved stateid.
1.2. Changes since RFC 3010 1.2. Changes since RFC 3010
This definition of the NFS version 4 protocol replaces or obsoletes This definition of the NFSv4 protocol replaces or obsoletes the
the definition present in [12]. While portions of the two documents definition present in [12]. While portions of the two documents have
have remained the same, there have been substantive changes in remained the same, there have been substantive changes in others.
others. The changes made between [12] and this document represent The changes made between [12] and this document represent
implementation experience and further review of the protocol. While implementation experience and further review of the protocol. While
some modifications were made for ease of implementation or some modifications were made for ease of implementation or
clarification, most updates represent errors or situations where the clarification, most updates represent errors or situations where the
[12] definition were untenable. [12] definition were untenable.
The following list is not all inclusive of all changes but presents The following list is not all inclusive of all changes but presents
some of the most notable changes or additions made: some of the most notable changes or additions made:
o The state model has added an open_owner4 identifier. This was o The state model has added an open_owner4 identifier. This was
done to accommodate Posix based clients and the model they use for done to accommodate Posix based clients and the model they use for
skipping to change at page 10, line 45 skipping to change at page 11, line 9
o Added a new operation LOCKOWNER_RELEASE to enable notifying the o Added a new operation LOCKOWNER_RELEASE to enable notifying the
server that a lock_owner4 will no longer be used by the client. server that a lock_owner4 will no longer be used by the client.
o RENEW operation changes to identify the client correctly and allow o RENEW operation changes to identify the client correctly and allow
for additional error returns. for additional error returns.
o Verify error return possibilities for all operations. o Verify error return possibilities for all operations.
o Remove use of the pathname4 data type from LOOKUP and OPEN in o Remove use of the pathname4 data type from LOOKUP and OPEN in
favor of having the client construct a sequence of LOOKUP favor of having the client construct a sequence of LOOKUP
operations to achieive the same effect. operations to achieve the same effect.
o Clarification of the internationalization issues and adoption of o Clarification of the internationalization issues and adoption of
the new stringprep profile framework. the new stringprep profile framework.
1.3. NFS Version 4 Goals 1.3. NFS Version 4 Goals
The NFS version 4 protocol is a further revision of the NFS protocol The NFSv4 protocol is a further revision of the NFS protocol defined
defined already by versions 2 [13] and 3 [14]. It retains the already by versions 2 [13] and 3 [14]. It retains the essential
essential characteristics of previous versions: design for easy characteristics of previous versions: design for easy recovery,
recovery, independent of transport protocols, operating systems and independent of transport protocols, operating systems and
filesystems, simplicity, and good performance. The NFS version 4 filesystems, simplicity, and good performance. The NFSv4 revision
revision has the following goals: has the following goals:
o Improved access and good performance on the Internet. o Improved access and good performance on the Internet.
The protocol is designed to transit firewalls easily, perform well The protocol is designed to transit firewalls easily, perform well
where latency is high and bandwidth is low, and scale to very where latency is high and bandwidth is low, and scale to very
large numbers of clients per server. large numbers of clients per server.
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
skipping to change at page 12, line 5 skipping to change at page 12, line 10
Version 4 Protocol Version 4 Protocol
[2], NFS Version 4 Protocol, contains the definitions in XDR [2], NFS Version 4 Protocol, contains the definitions in XDR
description language of the constructs used by the protocol. Inside description language of the constructs used by the protocol. Inside
this document, several of the constructs are reproduced for purposes this document, several of the constructs are reproduced for purposes
of explanation. The reader is warned of the possibility of errors in of explanation. The reader is warned of the possibility of errors in
the reproduced constructs outside of [2]. For any part of the the reproduced constructs outside of [2]. For any part of the
document that is inconsistent with [2], [2] is to be considered document that is inconsistent with [2], [2] is to be considered
authoritative. authoritative.
1.5. Overview of NFS version 4 Features 1.5. Overview of NFSv4 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 NFSv4 protocol will be reviewed in brief. This will be done to
to provide an appropriate context for both the reader who is familiar 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 [3] should be familiar with the XDR and RPC protocols as described in [3]
and [15]. A basic knowledge of filesystems and distributed and [15]. A basic knowledge of filesystems and distributed
filesystems is expected as well. filesystems is expected as well.
1.5.1. RPC and Security 1.5.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 NFSv4
version 4 protocol are those defined in [3] and [15]. To meet end to protocol are those defined in [3] and [15]. To meet end to end
end security requirements, the RPCSEC_GSS framework [4] will be used security requirements, the RPCSEC_GSS framework [4] will be used to
to extend the basic RPC security. With the use of RPCSEC_GSS, extend the basic RPC security. With the use of RPCSEC_GSS, various
various mechanisms can be provided to offer authentication, mechanisms can be provided to offer authentication, integrity, and
integrity, and privacy to the NFS version 4 protocol. Kerberos V5 privacy to the NFS version 4 protocol. Kerberos V5 will be used as
will be used as described in [16] to provide one security framework. described in [16] to provide one security framework. The LIPKEY GSS-
The LIPKEY GSS-API mechanism described in [5] will be used to provide API mechanism described in [5] will be used to provide for the use of
for the use of user password and server public key by the NFS version user password and server public key by the NFSv4 protocol. With the
4 protocol. With the use of RPCSEC_GSS, other mechanisms may also be use of RPCSEC_GSS, other mechanisms may also be specified and used
specified and used for NFS version 4 security. for NFS version 4 security.
To enable in-band security negotiation, the NFS version 4 protocol To enable in-band security negotiation, the NFSv4 protocol has added
has added a new operation which provides the client a method of a new operation which provides the client a method of querying the
querying the server about its policies regarding which security server about its policies regarding which security mechanisms must be
mechanisms must be used for access to the server's filesystem used for access to the server's filesystem resources. With this, the
resources. With this, the client can securely match the security client can securely match the security mechanism that meets the
mechanism that meets the policies specified at both the client and policies specified at both the client and server.
server.
1.5.2. Procedure and Operation Structure 1.5.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
version 4 protocol, there are two RPC procedures, NULL and COMPOUND. NFSv4 protocol, there are two RPC procedures, NULL and COMPOUND. The
The COMPOUND procedure is defined in terms of operations and these 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 filesystem reduction in the number of RPCs needed for logical filesystem
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
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 NFSv4 protocol continues to have the client refer to a file or
file or directory at the server by a "filehandle". The COMPOUND directory at the server by a "filehandle". The COMPOUND procedure
procedure has a method of passing a filehandle from one operation to has a method of passing a filehandle from one operation to another
another within the sequence of operations. There is a concept of a within the sequence of operations. There is a concept of a "current
"current filehandle" and "saved filehandle". Most operations use the filehandle" and "saved filehandle". Most operations use the "current
"current filehandle" as the filesystem object to operate upon. The filehandle" as the filesystem object to operate upon. The "saved
"saved filehandle" is used as temporary filehandle storage within a filehandle" is used as temporary filehandle storage within a COMPOUND
COMPOUND procedure as well as an additional operand for certain procedure as well as an additional operand for certain operations.
operations.
1.5.3. Filesystem Model 1.5.3. Filesystem Model
The general filesystem model used for the NFS version 4 protocol is The general filesystem model used for the NFSv4 protocol is the same
the same as previous versions. The server filesystem is hierarchical as previous versions. The server filesystem is hierarchical with the
with the regular files contained within being treated as opaque byte regular files contained within being treated as opaque byte streams.
streams. In a slight departure, file and directory names are encoded In a slight departure, file and directory names are encoded with
with UTF-8 to deal with the basics of internationalization. UTF-8 to deal with the basics of internationalization.
The NFS version 4 protocol does not require a separate protocol to The NFSv4 protocol does not require a separate protocol to provide
provide for the initial mapping between path name and filehandle. for the initial mapping between path name and filehandle. Instead of
Instead of using the older MOUNT protocol for this mapping, the using the older MOUNT protocol for this mapping, the server provides
server provides a ROOT filehandle that represents the logical root or a ROOT filehandle that represents the logical root or top of the
top of the filesystem tree provided by the server. The server filesystem tree provided by the server. The server provides multiple
provides multiple filesystems by gluing them together with pseudo filesystems by gluing them together with pseudo filesystems. These
filesystems. These pseudo filesystems provide for potential gaps in pseudo filesystems provide for potential gaps in the path names
the path names between real filesystems. between real filesystems.
1.5.3.1. Filehandle Types 1.5.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 filesystem object to which it referred. For some server of the filesystem 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 NFSv4 protocol, this requirement has been relaxed by
relaxed by introducing another type of filehandle, volatile. With introducing another type of filehandle, volatile. With persistent
persistent and volatile filehandle types, the server implementation and volatile filehandle types, the server implementation can match
can match the abilities of the filesystem at the server along with the abilities of the filesystem at the server along with the
the operating environment. The client will have knowledge of the operating environment. The client will have knowledge of the type of
type of filehandle being provided by the server and can be prepared filehandle being provided by the server and can be prepared to deal
to deal with the semantics of each. with the semantics of each.
1.5.3.2. Attribute Types 1.5.3.2. Attribute Types
The NFS version 4 protocol introduces three classes of filesystem or The NFSv4 protocol has a rich and extensible file object attribute
file attributes. Like the additional filehandle type, the structure, which is divided into REQUIRED, RECOMMENDED, and named
classification of file attributes has been done to ease server attributes (see Section 5).
implementations along with extending the overall functionality of the
NFS protocol. This attribute model is structured to be extensible
such that new attributes can be introduced in minor revisions of the
protocol without requiring significant rework.
The three classifications are: mandatory, recommended and named Several (but not all) of the REQUIRED attributes are derived from the
attributes. This is a significant departure from the previous attributes of NFSv3 (see definition of the fattr3 data type in [14]).
attribute model used in the NFS protocol. Previously, the attributes An example of a REQUIRED attribute is the file object's type
for the filesystem and file objects were a fixed set of mainly UNIX (Section 5.8.1.2) so that regular files can be distinguished from
attributes. If the server or client did not support a particular directories (also known as folders in some operating environments)
attribute, it would have to simulate the attribute the best it could. and other types of objects. REQUIRED attributes are discussed in
Section 5.1.
Mandatory attributes are the minimal set of file or filesystem An example of three RECOMMENDED attributes are acl, sacl, and dacl.
attributes that must be provided by the server and must be properly These attributes define an Access Control List (ACL) on a file object
represented by the server. Recommended attributes represent ((Section 6). An ACL provides directory and file access control
different filesystem types and operating environments. The beyond the model used in NFSv3. The ACL definition allows for
recommended attributes will allow for better interoperability and the specification of specific sets of permissions for individual users
inclusion of more operating environments. The mandatory and and groups. In addition, ACL inheritance allows propagation of
recommended attribute sets are traditional file or filesystem access permissions and restriction down a directory tree as file
attributes. The third type of attribute is the named attribute. A system objects are created. RECOMMENDED attributes are discussed in
named attribute is an opaque byte stream that is associated with a Section 5.2.
A named attribute is an opaque byte stream that is associated with a
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. NFSv4.1
modifies named attributes relative to NFSv4.0 by tightening the
allowed operations in order to prevent the development of non-
interoperable implementations. Named attributes are discussed in
Section 5.3.
One significant addition to the recommended set of file attributes is 1.5.3.3. Multi-server Namespace
the Access Control List (ACL) attribute. This attribute provides for
directory and file access control beyond the model used in previous
versions of the NFS protocol. The ACL definition allows for
specification of user and group level access control.
1.5.3.3. Filesystem Replication and Migration NFSv4 contains a number of features to allow implementation of
namespaces that cross server boundaries and that allow and facilitate
a non-disruptive transfer of support for individual file systems
between servers. They are all based upon attributes that allow one
file system to specify alternate or new locations for that file
system.
With the use of a special file attribute, the ability to inform the These attributes may be used together with the concept of absent file
client of filesystem locations on another server is enabled. The systems, which provide specifications for additional locations but no
filesystem locations attribute provides a method for the client to actual file system content. This allows a number of important
probe the server about the location of a filesystem. In the event facilities:
that a fileystems is not present on server the client will receive an
error when attempting to operate on the filesystem and it can then
query as to the correct filesystem location. Thus is allowed
construction of multi-server namespaces..
These features also allow file system replication and migration. In o Location attributes may be used with absent file systems to
the event of a migration of a filesystem, the client will receive an implement referrals whereby one server may direct the client to a
error when operating on the filesystem and it can then query location file system provided by another server. This allows extensive
attribute to determine the new file system location. Similar steps multi-server namespaces to be constructed.
are used for replication, the client is able to query the server for
the multiple available locations of a particular filesystem. From o Location attributes may be provided for present file systems to
this information, the client can use its own policies to access the provide the locations of alternate file system instances or
appropriate filesystem location. replicas to be used in the event that the current file system
instance becomes unavailable.
o Location attributes may be provided when a previously present file
system becomes absent. This allows non-disruptive migration of
file systems to alternate servers.
1.5.4. OPEN and CLOSE 1.5.4. OPEN and CLOSE
The NFS version 4 protocol introduces OPEN and CLOSE operations. The The NFSv4 protocol introduces OPEN and CLOSE operations. The OPEN
OPEN operation provides a single point where file lookup, creation, operation provides a single point where file lookup, creation, and
and share semantics can be combined. The CLOSE operation also share semantics can be combined. The CLOSE operation also provides
provides for the release of state accumulated by OPEN. for the release of state accumulated by OPEN.
1.5.5. File Locking 1.5.5. File Locking
With the NFS version 4 protocol, the support for byte range file With the NFSv4 protocol, the support for byte range file locking is
locking is part of the NFS protocol. The file locking support is part of the NFS protocol. The file locking support is structured so
structured so that an RPC callback mechanism is not required. This that an RPC callback mechanism is not required. This is a departure
is a departure from the previous versions of the NFS file locking from the previous versions of the NFS file locking protocol, Network
protocol, Network Lock Manager (NLM). The state associated with file Lock Manager (NLM). The state associated with file locks is
locks is maintained at the server under a lease-based model. The maintained at the server under a lease-based model. The server
server defines a single lease period for all state held by a NFS defines a single lease period for all state held by a NFS client. If
client. If the client does not renew its lease within the defined the client does not renew its lease within the defined period, all
period, all state associated with the client's lease may be released state associated with the client's lease may be released by the
by the server. The client may renew its lease with use of the RENEW 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.5.6. Client Caching and Delegation 1.5.6. Client Caching and Delegation
The file, attribute, and directory caching for the NFS version 4 The file, attribute, and directory caching for the NFSv4 protocol is
protocol is similar to previous versions. Attributes and directory similar to previous versions. Attributes and directory information
information are cached for a duration determined by the client. At are cached for a duration determined by the client. At the end of a
the end of a predefined timeout, the client will query the server to predefined timeout, the client will query the server to see if the
see if the related filesystem object has been updated. related filesystem 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
the data cache for the file should kept or released. Also, when the the data cache for the file should kept or released. Also, when the
file is closed, any modified data is written to the server. file is closed, any modified data is written to the server.
If an application wants to serialize access to file data, file If an application wants to serialize access to file data, file
locking of the file data ranges in question should be used. locking of the file data ranges in question should be used.
The major addition to NFS version 4 in the area of caching is the The major addition to NFSv4 in the area of caching is the ability of
ability of the server to delegate certain responsibilities to the the server to delegate certain responsibilities to the client. When
client. When the server grants a delegation for a file to a client, the server grants a delegation for a file to a client, the client is
the client is guaranteed certain semantics with respect to the guaranteed certain semantics with respect to the sharing of that file
sharing of that file with other clients. At OPEN, the server may with other clients. At OPEN, the server may provide the client
provide the client either a read or write delegation for the file. either a OPEN_DELEGATE_READ or OPEN_DELEGATE_WRITE delegation for the
If the client is granted a read delegation, it is assured that no file. If the client is granted a OPEN_DELEGATE_READ delegation, it
other client has the ability to write to the file for the duration of is assured that no other client has the ability to write to the file
the delegation. If the client is granted a write delegation, the for the duration of the delegation. If the client is granted a
client is assured that no other client has read or write access to OPEN_DELEGATE_WRITE delegation, the client is assured that no other
the file. client has read or write access to the file.
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 cannot be granted. The essence of a exist, then delegations cannot 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, or WRITE without immediate such as OPEN, CLOSE, LOCK, LOCKU, READ, or WRITE without immediate
interaction with the server. interaction with the server.
1.6. General Definitions 1.6. 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 Byte In this document, a byte is an octet, i.e., a datum exactly 8
resources. The client may be an application which contains the bits in length.
Client The client is the entity that accesses the NFS server's
resources. The client may be an application that contains the
logic to access the NFS server directly. The client may also be logic to access the NFS server directly. The client may also be
the traditional operating system client remote filesystem services the traditional operating system client that provides remote
for a set of applications. filesystem services for a set of applications.
In the case of file locking the client is the entity that With reference to byte-range locking, the client is also the
maintains a set of locks on behalf of one or more applications. entity that maintains a set of locks on behalf of one or more
This client is responsible for crash or failure recovery for those applications. This client is responsible for crash or failure
locks it manages. recovery for those locks it manages.
Note that multiple clients may share the same transport and Note that multiple clients may share the same transport and
multiple clients may exist on the same network node. connection and multiple clients may exist on the same network
node.
Clientid A 64-bit quantity used as a unique, short-hand reference to Client ID A 64-bit quantity used as a unique, short-hand reference
a client supplied Verifier and ID. The server is responsible for to a client supplied Verifier and ID. The server is responsible
supplying the Clientid. for supplying the Client ID.
File System The file system is the collection of objects on a server
that share the same fsid attribute (see Section 5.8.1.9).
Lease An interval of time defined by the server for which the client Lease An interval of time defined by the server for which the client
is irrevocably granted a lock. At the end of a lease period the is irrevocably granted a lock. At the end of a lease period the
lock may be revoked if the lease has not been extended. The lock lock may be revoked if the lease has not been extended. The lock
must be revoked if a conflicting lock has been granted after the must be revoked if a conflicting lock has been granted after the
lease interval. lease interval.
All leases granted by a server have the same fixed interval. Note All leases granted by a server have the same fixed interval. Note
that the fixed interval was chosen to alleviate the expense a that the fixed interval was chosen to alleviate the expense a
server would have in maintaining state about variable length server would have in maintaining state about variable length
leases across server failures. leases across server failures.
Lock The term "lock" is used to refer to both record (byte-range) Lock The term "lock" is used to refer to both record (byte-range)
locks as well as share reservations unless specifically stated locks as well as share reservations unless specifically stated
otherwise. 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 filesystems. client access to a set of filesystems.
Stable Storage NFS version 4 servers must be able to recover without Stable Storage NFSv4 servers must be able to recover without data
data loss from multiple power failures (including cascading power loss from multiple power failures (including cascading power
failures, that is, several power failures in quick succession), failures, that is, several power failures in quick succession),
operating system failures, and hardware failure of components operating system failures, and hardware failure of components
other than the storage medium itself (for example, disk, other than the storage medium itself (for example, disk,
nonvolatile RAM). nonvolatile RAM).
Some examples of stable storage that are allowable for an NFS Some examples of stable storage that are allowable for an NFS
server include: server include:
1. Media commit of data, that is, the modified data has been 1. Media commit of data, that is, the modified data has been
successfully written to the disk media, for example, the disk successfully written to the disk media, for example, the disk
skipping to change at page 17, line 46 skipping to change at page 18, line 11
2. An immediate reply disk drive with battery-backed on-drive 2. An immediate reply disk drive with battery-backed on-drive
intermediate storage or uninterruptible power system (UPS). intermediate storage or uninterruptible power system (UPS).
3. Server commit of data with battery-backed intermediate storage 3. Server commit of data with battery-backed intermediate storage
and recovery software. and recovery software.
4. Cache commit with uninterruptible power system (UPS) and 4. Cache commit with uninterruptible power system (UPS) and
recovery software. recovery software.
Stateid A 128-bit quantity returned by a server that uniquely Stateid A stateid is a 128-bit quantity returned by a server that
defines the open and locking state provided by the server for a uniquely defines the open and locking states provided by the
specific open or lock owner for a specific file. server for a specific open-owner or lock-owner/open-owner pair for
a specific file and type of lock.
Stateids composed of all bits 0 or all bits 1 have special 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 all can use to determine if the client has restarted and lost all
previous lock state. previous lock state.
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 [15] and RPC [3] documents. version 4 protocol are defined in the XDR [15] and RPC [3] documents.
The next sections build upon the XDR data types to define types and The next sections build upon the XDR data types to define types and
skipping to change at page 22, line 37 skipping to change at page 22, line 39
2.2.10. clientaddr4 2.2.10. 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 SETCLIENTID The clientaddr4 structure is used as part of the SETCLIENTID
operation to either specify the address of the client that is using a operation to either specify the address of the client that is using a
clientid or as part of the callback registration. The r_netid and client ID or as part of the callback registration. The r_netid and
r_addr fields are specified in [17], but they are underspecified in r_addr fields are specified in [17], but they are underspecified in
[17] as far as what they should look like for specific protocols. [17] 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 For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the
US-ASCII string: US-ASCII string:
h1.h2.h3.h4.p1.p2 h1.h2.h3.h4.p1.p2
The prefix, "h1.h2.h3.h4", is the standard textual form for The prefix, "h1.h2.h3.h4", is the standard textual form for
representing an IPv4 address, which is always four octets long. representing an IPv4 address, which is always four octets long.
skipping to change at page 25, line 9 skipping to change at page 25, line 9
This structure 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 structure between the client and server. For the client, this data structure
is read-only. The starting value of the seqid field is undefined. is read-only. The starting value of the seqid field is undefined.
The server is required to increment the seqid field monotonically at The server is required to increment the seqid field monotonically at
each transition of the stateid. This is important since the client each transition of the stateid. This is important since the client
will inspect the seqid in OPEN stateids to determine the order of will inspect the seqid in OPEN stateids to determine the order of
OPEN processing done by the server. OPEN processing done by the server.
3. RPC and Security Flavor 3. RPC and Security Flavor
The NFS version 4 protocol is a Remote Procedure Call (RPC) The NFSv4 protocol is a Remote Procedure Call (RPC) application that
application that uses RPC version 2 and the corresponding eXternal uses RPC version 2 and the corresponding eXternal Data Representation
Data Representation (XDR) as defined in [3] and [15]. The RPCSEC_GSS (XDR) as defined in [3] and [15]. The RPCSEC_GSS security flavor as
security flavor as defined in [4] MUST be used as the mechanism to defined in [4] MUST be used as the mechanism to deliver stronger
deliver stronger security for the NFS version 4 protocol. security for the NFSv4 protocol.
3.1. Ports and Transports 3.1. Ports and Transports
Historically, NFS version 2 and version 3 servers have resided on Historically, NFSv2 and NFSv3 servers have resided on port 2049. The
port 2049. The registered port 2049 [19] for the NFS protocol should registered port 2049 [19] for the NFS protocol SHOULD be the default
be the default configuration. Using the registered port for NFS configuration. Using the registered port for NFS services means the
services means the NFS client will not need to use the RPC binding NFS client will not need to use the RPC binding protocols as
protocols as described in [17]; this will allow NFS to transit described in [17]; this will allow NFS to transit firewalls.
firewalls.
Where an NFS version 4 implementation supports operation over the IP Where an NFSv4 implementation supports operation over the IP network
network protocol, the supported transports between NFS and IP MUST be protocol, the supported transports between NFS and IP MUST be among
among the IETF-approved congestion control transport protocols, which the IETF-approved congestion control transport protocols, which
include TCP and SCTP. To enhance the possibilities for include TCP and SCTP. To enhance the possibilities for
interoperability, an NFS version 4 implementation MUST support interoperability, an NFSv4 implementation MUST support operation over
operation over the TCP transport protocol, at least until such time the TCP transport protocol, at least until such time as a standards
as a standards track RFC revises this requirement to use a different track RFC revises this requirement to use a different IETF-approved
IETF-approved congestion control transport protocol. congestion control transport protocol.
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.
As noted in Section 17, the authentication model for NFS version 4 As noted in Section 17, the authentication model for NFSv4 has moved
has moved from machine-based to principal-based. However, this from machine-based to principal-based. However, this modification of
modification of the authentication model does not imply a technical the authentication model does not imply a technical requirement to
requirement to move the TCP connection management model from whole move the TCP connection management model from whole machine-based to
machine-based to one based on a per user model. In particular, NFS one based on a per user model. In particular, NFS over TCP client
over TCP client implementations have traditionally multiplexed implementations have traditionally multiplexed traffic for multiple
traffic for multiple users over a common TCP connection between an users over a common TCP connection between an NFS client and server.
NFS client and server. This has been true, regardless whether the This has been true, regardless whether the NFS client is using
NFS client is using AUTH_SYS, AUTH_DH, RPCSEC_GSS or any other AUTH_SYS, AUTH_DH, RPCSEC_GSS or any other flavor. Similarly, NFS
flavor. Similarly, NFS over TCP server implementations have assumed over TCP server implementations have assumed such a model and thus
such a model and thus scale the implementation of TCP connection scale the implementation of TCP connection management in proportion
management in proportion to the number of expected client machines. to the number of expected client machines. It is intended that NFSv4
will not modify this connection management model. NFSv4 clients that
It is intended that NFS version 4 will not modify this connection violate this assumption can expect scaling issues on the server and
management model. NFS version 4 clients that violate this assumption hence reduced service.
can expect scaling issues on the server and hence reduced service.
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 [20]. of the general issue refer to [20].
3.1.1. Client Retransmission Behavior 3.1.1. Client Retransmission Behavior
When processing a request received over a reliable transport such as When processing a request received over a reliable transport such as
TCP, the NFS version 4 server MUST NOT silently drop the request, TCP, the NFSv4 server MUST NOT silently drop the request, except if
except if the transport connection has been broken. Given such a the transport connection has been broken. Given such a contract
contract between NFS version 4 clients and servers, clients MUST NOT between NFSv4 clients and servers, clients MUST NOT retry a request
retry a request unless one or both of the following are true: unless one or both of the following are true:
o The transport connection has been broken o The transport connection has been broken
o The procedure being retried is the NULL procedure o The procedure being retried is the NULL procedure
Since reliable transports, such as TCP, do not always synchronously Since reliable transports, such as TCP, do not always synchronously
inform a peer when the other peer has broken the connection (for inform a peer when the other peer has broken the connection (for
example, when an NFS server reboots), the NFS version 4 client may example, when an NFS server reboots), the NFSv4 client may want to
want to actively "probe" the connection to see if has been broken. actively "probe" the connection to see if has been broken. Use of
Use of the NULL procedure is one recommended way to do so. So, when the NULL procedure is one recommended way to do so. So, when a
a client experiences a remote procedure call timeout (of some client experiences a remote procedure call timeout (of some arbitrary
arbitrary implementation specific amount), rather than retrying the implementation specific amount), rather than retrying the remote
remote procedure call, it could instead issue a NULL procedure call procedure call, it could instead issue a NULL procedure call to the
to the server. If the server has died, the transport connection server. If the server has died, the transport connection break will
break will eventually be indicated to the NFS version 4 client. The eventually be indicated to the NFSv4 client. The client can then
client can then reconnect, and then retry the original request. If reconnect, and then retry the original request. If the NULL
the NULL procedure call gets a response, the connection has not procedure call gets a response, the connection has not broken. The
broken. The client can decide to wait longer for the original client can decide to wait longer for the original request's response,
request's response, or it can break the transport connection and or it can break the transport connection and reconnect before re-
reconnect before re-sending the original request. sending the original request.
For callbacks from the server to the client, the same rules apply, For callbacks from the server to the client, the same rules apply,
but the server doing the callback becomes the client, and the client but the server doing the callback becomes the client, and the client
receiving the callback becomes the server. 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 [4] an additional AUTH_DH, and AUTH_KRB4 as security flavors. With [4] an additional
security flavor of RPCSEC_GSS has been introduced which uses the security flavor of RPCSEC_GSS has been introduced which uses the
functionality of GSS-API [6]. This allows for the use of various functionality of GSS-API [6]. This allows for the use of various
security mechanisms by the RPC layer without the additional security mechanisms by the RPC layer without the additional
implementation overhead of adding RPC security flavors. For NFS implementation overhead of adding RPC security flavors. For NFSv4,
version 4, the RPCSEC_GSS security flavor MUST be used to enable the the RPCSEC_GSS security flavor MUST be used to enable the mandatory
mandatory security mechanism. Other flavors, such as, AUTH_NONE, security mechanism. Other flavors, such as, AUTH_NONE, AUTH_SYS, and
AUTH_SYS, and AUTH_DH MAY be implemented as well. AUTH_DH MAY be implemented as well.
3.2.1. Security mechanisms for NFS version 4 3.2.1. Security mechanisms for NFSv4
The use of RPCSEC_GSS requires selection of: mechanism, quality of The use of RPCSEC_GSS requires selection of: mechanism, quality of
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 a security triple 3.2.1.1. Kerberos V5 as a security triple
The Kerberos V5 GSS-API mechanism as described in [16] MUST be The Kerberos V5 GSS-API mechanism as described in [16] MUST be
implemented and provide the following security triples. implemented and provide the following security triples.
skipping to change at page 27, line 40 skipping to change at page 27, line 39
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
negotiate security and it understands the GSS-API mechanism, the negotiate security and it understands the GSS-API mechanism, the
pseudo flavor is not needed. The pseudo flavor is needed for NFS pseudo flavor is not needed. The pseudo flavor is needed for NFSv3
version 3 since the security negotiation is done via the MOUNT since the security negotiation is done via the MOUNT protocol.
protocol.
For a discussion of NFS' use of RPCSEC_GSS and Kerberos V5, please For a discussion of NFS' use of RPCSEC_GSS and Kerberos V5, please
see [21]. see [21].
Users and implementors are warned that 56 bit DES is no longer Users and implementors are warned that 56 bit DES is no longer
considered state of the art in terms of resistance to brute force considered state of the art in terms of resistance to brute force
attacks. Once a revision to [16] is available that adds support for attacks. Once a revision to [16] is available that adds support for
AES, implementors are urged to incorporate AES into their NFSv4 over AES, implementors are urged to incorporate AES into their NFSv4 over
Kerberos V5 protocol stacks, and users are similarly urged to migrate Kerberos V5 protocol stacks, and users are similarly urged to migrate
to the use of AES. to the use of AES.
skipping to change at page 29, line 24 skipping to change at page 29, line 21
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.
3.3. Security Negotiation 3.3. Security Negotiation
With the NFS version 4 server potentially offering multiple security With the NFSv4 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 filesystem name space NFS server may have multiple points within its filesystem 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 SHOULD be done
a secure channel to eliminate the possibility of a third party with 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 Section 17 for further discussion. See Section 17 for further discussion.
3.3.1. SECINFO 3.3.1. SECINFO
The new SECINFO operation will allow the client to determine, on a The new SECINFO operation will allow the client to determine, on a
per filehandle basis, what security triple is to be used for server per filehandle basis, what security triple is to be used for server
access. In general, the client will not have to use the SECINFO access. In general, the client will not have to use the SECINFO
operation except during initial communication with the server or when operation except during initial communication with the server or when
the client crosses policy boundaries at the server. It is possible the client crosses policy boundaries at the server. It is possible
that the server's policies change during the client's interaction that the server's policies change during the client's interaction
therefore forcing the client to negotiate a new security triple. therefore forcing the client to negotiate a new security triple.
3.3.2. Security Error 3.3.2. Security Error
Based on the assumption that each NFS version 4 client and server Based on the assumption that each NFSv4 client and server MUST
must support a minimum set of security (i.e., LIPKEY, SPKM-3, and 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 filesystem used is not appropriate for access to the server's filesystem
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. See Section 15.33 for further discussion appropriate for the client. See Section 15.33 for further discussion
of how the client will respond to the NFS4ERR_WRONGSEC error and use of how the client will respond to the NFS4ERR_WRONGSEC error and use
SECINFO. SECINFO.
3.3.3. Callback RPC Authentication 3.3.3. Callback RPC Authentication
Except as noted elsewhere in this section, the callback RPC Except as noted elsewhere in this section, the callback RPC
(described later) MUST mutually authenticate the NFS server to the (described later) MUST mutually authenticate the NFS server to the
principal that acquired the clientid (also described later), using principal that acquired the client ID (also described later), using
the security flavor the original SETCLIENTID operation used. the security flavor the original SETCLIENTID operation used.
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.
AUTH_SYS has no notions of mutual authentication or a server AUTH_SYS has no notions of mutual authentication or a server
principal, so the callback from the server simply uses the AUTH_SYS principal, so the callback from the server simply uses the AUTH_SYS
credential that the user used when he set up the delegation. credential that the user used when he 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:
skipping to change at page 32, line 17 skipping to change at page 32, line 17
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 filesystem object. The contents of the filehandle are opaque for a filesystem 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 filesystem the filehandle to an internal representation of the filesystem
object. object.
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 NFSv2 protocol [13]
protocol [13] and the NFS version 3 protocol [14], there exists an and the NFSv3 protocol [14], there exists an ancillary protocol to
ancillary protocol to obtain this first filehandle. The MOUNT obtain this first filehandle. The MOUNT protocol, RPC program number
protocol, RPC program number 100005, provides the mechanism of 100005, provides the mechanism of translating a string based
translating a string based filesystem path name to a filehandle which filesystem path name to a filehandle which can then be used by the
can then be used by the NFS protocols. 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 [23] and [24]. With the use of the filehandle was introduced in [23] and [24]. With the use of the
public filehandle in combination with the LOOKUP operation in the NFS public filehandle in combination with the LOOKUP operation in the
version 2 and 3 protocols, it has been demonstrated that the MOUNT NFSv2 and NFSv3 protocols, it has been demonstrated that the MOUNT
protocol is unnecessary for viable interaction between NFS client and protocol is unnecessary for viable interaction between NFS client and
server. server.
Therefore, the NFS version 4 protocol will not use an ancillary Therefore, the NFSv4 protocol will not use an ancillary protocol for
protocol for translation from string based path names to a translation from string based path names to a filehandle. Two
filehandle. Two special filehandles will be used as starting points special filehandles will be used as starting points for the NFS
for the NFS client. 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 filesystem name space ROOT filehandle is the "conceptual" root of the filesystem name 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
skipping to change at page 33, line 15 skipping to change at page 33, line 15
for this binding. It may be that the PUBLIC filehandle and the ROOT for this binding. It may be that the PUBLIC filehandle and the ROOT
filehandle refer to the same filesystem object. However, it is up to filehandle refer to the same filesystem object. However, it is up to
the administrative software at the server and the policies of the the administrative software at the server and the policies of the
server administrator to define the binding of the PUBLIC filehandle server administrator to define the binding of the PUBLIC filehandle
and server filesystem object. The client may not make any and server filesystem object. The client may not make any
assumptions about this binding. The client uses the PUBLIC assumptions about this binding. The client uses the PUBLIC
filehandle via the PUTPUBFH operation. 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 NFSv2 and NFSv3 protocols, there was one type of filehandle
filehandle with a single set of semantics. This type of filehandle with a single set of semantics. This type of filehandle is termed
is termed "persistent" in NFS Version 4. The semantics of a "persistent" in NFS Version 4. The semantics of a persistent
persistent filehandle remain the same as before. A new type of filehandle remain the same as before. A new type of filehandle
filehandle introduced in NFS Version 4 is the "volatile" filehandle, introduced in NFS Version 4 is the "volatile" filehandle, which
which attempts to accommodate certain server environments. attempts to accommodate certain server environments.
The volatile filehandle type was 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 filesystem level invariant that can be environments do not provide a filesystem level invariant that can be
used to construct a persistent filehandle. The underlying server used to construct a persistent filehandle. The underlying server
filesystem may not provide the invariant or the server's filesystem filesystem may not provide the invariant or the server's filesystem
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 server functionality such as hierarchical storage management or
skipping to change at page 47, line 6 skipping to change at page 47, line 6
5.8.2.9. Attribute 23: files_total 5.8.2.9. Attribute 23: files_total
Total file slots on the file system containing this object. Total file slots on the file system containing this object.
5.8.2.10. Attribute 24: fs_locations 5.8.2.10. Attribute 24: fs_locations
Locations where this file system may be found. If the server returns Locations where this file system may be found. If the server returns
NFS4ERR_MOVED as an error, this attribute MUST be supported. NFS4ERR_MOVED as an error, this attribute MUST be supported.
The server can specify a root path by setting an array of zero path The server can specify a root path by setting an array of zero path
compenents. Other than this special case, the server MUST not components. Other than this special case, the server MUST not
present empty path components to the client. present empty path components to the client.
5.8.2.11. Attribute 25: hidden 5.8.2.11. Attribute 25: hidden
TRUE, if the file is considered hidden with respect to the Windows TRUE, if the file is considered hidden with respect to the Windows
API. API.
5.8.2.12. Attribute 26: homogeneous 5.8.2.12. Attribute 26: homogeneous
TRUE, if this object's file system is homogeneous, i.e., all objects TRUE, if this object's file system is homogeneous, i.e., all objects
skipping to change at page 84, line 49 skipping to change at page 84, line 49
[31], an additional attribute "fs_locations_info" is presented, which [31], an additional attribute "fs_locations_info" is presented, which
will define the specific choices that can be made, how these choices will define the specific choices that can be made, how these choices
are communicated to the client, and how the client is to deal with are communicated to the client, and how the client is to deal with
any discontinuities. any discontinuities.
In the sections below, references will be made to various possible In the sections below, references will be made to various possible
server implementation choices as a way of illustrating the transition server implementation choices as a way of illustrating the transition
scenarios that clients may deal with. The intent here is not to scenarios that clients may deal with. The intent here is not to
define or limit server implementations but rather to illustrate the define or limit server implementations but rather to illustrate the
range of issues that clients may face. Again, as the NFSv4.0 range of issues that clients may face. Again, as the NFSv4.0
protocol does not have an explict means of communicating these issues protocol does not have an explicit means of communicating these
to the client, the intent is to document the problems that can be issues to the client, the intent is to document the problems that can
faced in a multi-server name space and allow the client to use the be faced in a multi-server name space and allow the client to use the
inferred transitions available via fs_locations and other attributes inferred transitions available via fs_locations and other attributes
(see Section 7.9.1). (see Section 7.9.1).
In the discussion below, references will be made to a file system In the discussion below, references will be made to a file system
having a particular property or to two file systems (typically the having a particular property or to two file systems (typically the
source and destination) belonging to a common class of any of several source and destination) belonging to a common class of any of several
types. Two file systems that belong to such a class share some types. Two file systems that belong to such a class share some
important aspects of file system behavior that clients may depend important aspects of file system behavior that clients may depend
upon when present, to easily effect a seamless transition between upon when present, to easily effect a seamless transition between
file system instances. Conversely, where the file systems do not file system instances. Conversely, where the file systems do not
skipping to change at page 85, line 41 skipping to change at page 85, line 41
7.7.1. File System Transitions and Simultaneous Access 7.7.1. File System Transitions and Simultaneous Access
When a single file system may be accessed at multiple locations, When a single file system may be accessed at multiple locations,
either because of an indication of file system identity as reported either because of an indication of file system identity as reported
by the fs_locations attribute, the client will, depending on specific by the fs_locations attribute, the client will, depending on specific
circumstances as discussed below, either: circumstances as discussed below, either:
o Access multiple instances simultaneously, each of which represents o Access multiple instances simultaneously, each of which represents
an alternate path to the same data and metadata. an alternate path to the same data and metadata.
o Acesses one instance (or set of instances) and then transition to o Accesses one instance (or set of instances) and then transition to
an alternative instance (or set of instances) as a result of an alternative instance (or set of instances) as a result of
network issues, server unresponsiveness, or server-directed network issues, server unresponsiveness, or server-directed
migration. migration.
7.7.2. Filehandles and File System Transitions 7.7.2. Filehandles and File System Transitions
There are a number of ways in which filehandles can be handled across There are a number of ways in which filehandles can be handled across
a file system transition. These can be divided into two broad a file system transition. These can be divided into two broad
classes depending upon whether the two file systems across which the classes depending upon whether the two file systems across which the
transition happens share sufficient state to effect some sort of transition happens share sufficient state to effect some sort of
skipping to change at page 102, line 24 skipping to change at page 102, line 24
portions of the name space are made available via an "export" portions of the name space are made available via an "export"
feature. In previous versions of the NFS protocol, the root feature. In previous versions of the NFS protocol, the root
filehandle for each export is obtained through the MOUNT protocol; filehandle for each export is obtained through the MOUNT protocol;
the client sends a string that identifies the export of name space the client sends a string that identifies the export of name space
and the server returns the root filehandle for it. The MOUNT and the server returns the root filehandle for it. The MOUNT
protocol supports an EXPORTS procedure that will enumerate the protocol supports an EXPORTS procedure that will enumerate the
server's exports. server's exports.
8.2. Browsing Exports 8.2. Browsing Exports
The NFS version 4 protocol provides a root filehandle that clients The NFSv4 protocol provides a root filehandle that clients can use to
can use to obtain filehandles for these exports via a multi-component obtain filehandles for these exports via a multi-component LOOKUP. A
LOOKUP. A common user experience is to use a graphical user common user experience is to use a graphical user interface (perhaps
interface (perhaps a file "Open" dialog window) to find a file via a file "Open" dialog window) to find a file via progressive browsing
progressive browsing through a directory tree. The client must be through a directory tree. The client must be able to move from one
able to move from one export to another export via single-component, export to another export via single-component, progressive LOOKUP
progressive LOOKUP operations. 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 NFSv2 and NFSv3
3 protocols. The client expects all LOOKUP operations to remain protocols. The client expects all LOOKUP operations to remain within
within a single server filesystem. For example, the device attribute a single server filesystem. For example, the device attribute will
will not change. This prevents a client from taking name space paths not change. This prevents a client from taking name space paths that
that span exports. 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 that are not exported by the server are filled in with a "pseudo
filesystem" that allows the user to browse from one mounted filesystem" that allows the user to browse from one mounted
filesystem to another. There is a drawback to this representation of filesystem to another. There is a drawback to this representation of
the 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.
8.3. Server Pseudo Filesystem 8.3. Server Pseudo Filesystem
NFS version 4 servers avoid this name space inconsistency by NFSv4 servers avoid this name space inconsistency by presenting all
presenting all the exports within the framework of a single server the exports within the framework of a single server name space. An
name space. An NFS version 4 client uses LOOKUP and READDIR NFSv4 client uses LOOKUP and READDIR operations to browse seamlessly
operations to browse seamlessly from one export to another. Portions from one export to another. Portions of the server name space that
of the server name space that are not exported are bridged via a are not exported are bridged via a "pseudo filesystem" that provides
"pseudo filesystem" that provides a view of exported directories a view of exported directories only. A pseudo filesystem has a
only. A pseudo filesystem has a unique fsid and behaves like a unique fsid and behaves like a normal, read only filesystem.
normal, read only filesystem.
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 filesystems may exist. For example, that multiple pseudo filesystems may exist. For example,
/a pseudo filesystem /a pseudo filesystem
/a/b real filesystem /a/b real filesystem
/a/b/c pseudo filesystem /a/b/c pseudo filesystem
/a/b/c/d real filesystem /a/b/c/d real filesystem
Each of the pseudo filesystems are considered 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.
8.4. Multiple Roots 8.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". Filesystems are commonly represented as having "multiple roots". Filesystems are commonly represented as
disk letters. MacOS represents filesystems as top level names. NFS disk letters. MacOS represents filesystems as top level names.
version 4 servers for these platforms can construct a pseudo file NFSv4 servers for these platforms can construct a pseudo file system
system above these root names so that disk letters or volume names above these root names so that disk letters or volume names are
are simply directory names in the pseudo root. simply directory names in the pseudo root.
8.5. Filehandle Volatility 8.5. Filehandle Volatility
The nature of the server's pseudo filesystem is that it is a logical The nature of the server's pseudo filesystem is that it is a logical
representation of filesystem(s) available from the server. representation of filesystem(s) available from the server.
Therefore, the pseudo filesystem is most likely constructed Therefore, the pseudo filesystem is most likely constructed
dynamically when the server is first instantiated. It is expected dynamically when the server is first instantiated. It is expected
that the pseudo filesystem may not have an on disk counterpart from that the pseudo filesystem may not have an on disk counterpart from
which persistent filehandles could be constructed. Even though it is which persistent filehandles could be constructed. Even though it is
preferable that the server provide persistent filehandles for the preferable that the server provide persistent filehandles for the
skipping to change at page 105, line 27 skipping to change at page 105, line 27
For the case of the use of multiple, disjoint security mechanisms in For the case of the use of multiple, disjoint security mechanisms in
the server's resources, the security for a particular object in the the server's resources, the security for a particular object in the
server's namespace should be the union of all security mechanisms of server's namespace should be the union of all security mechanisms of
all direct descendants. all direct descendants.
9. File Locking and Share Reservations 9. 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
stateful. With the inclusion of share reservations 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 [32]. There are three components to combination of NFS and NLM (Network Lock Manager) [32]. There are
making this state manageable: three components to 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 requests changes in locks and the server responds with the changes
client is also able to detect inconsistent state before modifying a made. Non-client-initiated changes in locking state are infrequent.
file. The client receives prompt notification of such changes and can
adjust its view of the locking state to reflect the server's changes.
Individual pieces of state created by the server and passed to the
client at its request are represented by 128-bit stateids. These
stateids may represent a particular open file, a set of byte-range
locks held by a particular owner, or a recallable delegation of
privileges to access a file in particular ways or at a particular
location.
In all cases, there is a transition from the most general information
that represents a client as a whole to the eventual lightweight
stateid used for most client and server locking interactions. The
details of this transition will vary with the type of object but it
always starts with a client ID.
To support Win32 share reservations it is necessary to atomically To support Win32 share reservations it is necessary to atomically
OPEN or CREATE files. Having a separate share/unshare operation OPEN or CREATE files. Having a separate share/unshare operation
would not allow correct implementation of the Win32 OpenFile API. In would not allow correct implementation of the Win32 OpenFile API. In
order to correctly implement share semantics, the previous NFS order to correctly implement share semantics, the previous NFS
protocol mechanisms used when a file is opened or created (LOOKUP, protocol mechanisms used when a file is opened or created (LOOKUP,
CREATE, ACCESS) need to be replaced. The NFS version 4 protocol has CREATE, ACCESS) need to be replaced. The NFSv4 protocol has an OPEN
an OPEN operation that subsumes the NFS version 3 methodology of operation that subsumes the NFSv3 methodology of LOOKUP, CREATE, and
LOOKUP, CREATE, and ACCESS. However, because many operations require ACCESS. However, because many operations require a filehandle, the
a filehandle, the traditional LOOKUP is preserved to map a file name traditional LOOKUP is preserved to map a file name to filehandle
to filehandle without establishing state on the server. The policy without establishing state on the server. The policy of granting
of granting access or modifying files is managed by the server based access or modifying files is managed by the server based on the
on the client's state. These mechanisms can implement policy ranging client's state. These mechanisms can implement policy ranging from
from advisory only locking to full mandatory locking. advisory only locking to full mandatory locking.
9.1. Locking 9.1. Opens and Byte-Range Locks
It is assumed that manipulating a lock is rare when compared to READ It is assumed that manipulating a byte-range lock is rare when
and WRITE operations. It is also assumed that crashes and network compared to READ and WRITE operations. It is also assumed that
partitions are relatively rare. Therefore it is important that the server restarts and network partitions are relatively rare.
READ and WRITE operations have a lightweight mechanism to indicate if Therefore it is important that the READ and WRITE operations have a
they possess a held lock. A lock request contains the heavyweight lightweight mechanism to indicate if they possess a held lock. A
information required to establish a lock and uniquely define the lock byte-range lock request contains the heavyweight information required
owner. to establish a lock and uniquely define the owner of the lock.
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.
9.1.1. Client ID 9.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.
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. A sequence of a SETCLIENTID identification and crash recovery. A sequence of a SETCLIENTID
operation followed by a SETCLIENTID_CONFIRM operation is required to operation followed by a SETCLIENTID_CONFIRM operation is required to
establish the identification onto the server. Establishment of establish the identification onto the server. Establishment of
identification by a new incarnation of the client also has the effect identification by a new incarnation of the client also has the effect
of immediately breaking any leased state that a previous incarnation of immediately breaking any leased state that a previous incarnation
of the client might have had on the server, as opposed to forcing the 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 new client incarnation to wait for the leases to expire. Breaking
the lease state amounts to the server removing all lock, share the lease state amounts to the server removing all lock, share
reservation, and, where the server is not supporting the reservation, and, where the server is not supporting the
skipping to change at page 106, line 41 skipping to change at page 107, line 6
identification by a new incarnation of the client also has the effect identification by a new incarnation of the client also has the effect
of immediately breaking any leased state that a previous incarnation of immediately breaking any leased state that a previous incarnation
of the client might have had on the server, as opposed to forcing the 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 new client incarnation to wait for the leases to expire. Breaking
the lease state amounts to the server removing all lock, share the lease state amounts to the server removing all lock, share
reservation, and, where the server is not supporting the reservation, and, where the server is not supporting the
CLAIM_DELEGATE_PREV claim type, all delegation state associated with CLAIM_DELEGATE_PREV claim type, all delegation state associated with
same client with the same identity. For discussion of delegation same client with the same identity. For discussion of delegation
state recovery, see Section 10.2.1. state recovery, see Section 10.2.1.
Owners of opens and owners of byte-range locks are separate entities
and remain separate even if the same opaque arrays are used to
designate owners of each. The protocol distinguishes between open-
owners (represented by open_owner4 structures) and lock-owners
(represented by lock_owner4 structures).
Each open is associated with a specific open-owner while each byte-
range lock is associated with a lock-owner and an open-owner, the
latter being the open-owner associated with the open file under which
the LOCK operation was done.
Unlike the text in NFSv4.1 [31], this text treats "lock_owner" as
meaning both a open_owner4 and a lock_owner4. Also, a "lock" can
refer to both a byte-range and share lock.
Client identification is encapsulated in the following structure: Client identification is encapsulated in the following structure:
struct nfs_client_id4 { struct nfs_client_id4 {
verifier4 verifier; verifier4 verifier;
opaque id<NFS4_OPAQUE_LIMIT>; opaque id<NFS4_OPAQUE_LIMIT>;
}; };
The first field, verifier is a client incarnation verifier that is The first field, verifier is a client incarnation verifier that is
used to detect client reboots. Only if the verifier is different used to detect client reboots. Only if the verifier is different
from that which the server has previously recorded the client (as from that which the server has previously recorded the client (as
skipping to change at page 107, line 23 skipping to change at page 107, line 51
present the same string. The consequences of two clients present the same string. The consequences of two clients
presenting the same string range from one client getting an error presenting the same string range from one client getting an error
to one client having its leased state abruptly and unexpectedly to one client having its leased state abruptly and unexpectedly
canceled. canceled.
o The string should be selected so the subsequent incarnations o The string should be selected so the subsequent incarnations
(e.g., reboots) of the same client cause the client to present the (e.g., reboots) of the same client cause the client to present the
same string. The implementor is cautioned against an approach same string. The implementor is cautioned against an approach
that requires the string to be recorded in a local file because that requires the string to be recorded in a local file because
this precludes the use of the implementation in an environment this precludes the use of the implementation in an environment
where there is no local disk and all file access is from an NFS where there is no local disk and all file access is from an NFSv4
version 4 server. server.
o The string should be different for each server network address o The string should be different for each server network address
that the client accesses, rather than common to all server network that the client accesses, rather than common to all server network
addresses. The reason is that it may not be possible for the addresses. The reason is that it may not be possible for the
client to tell if the same server is listening on multiple network client to tell if the same server is listening on multiple network
addresses. If the client issues SETCLIENTID with the same id addresses. If the client issues SETCLIENTID with the same id
string to each network address of such a server, the server will string to each network address of such a server, the server will
think it is the same client, and each successive SETCLIENTID will think it is the same client, and each successive SETCLIENTID will
cause the server to begin the process of removing the client's cause the server to begin the process of removing the client's
previous leased state. previous leased state.
skipping to change at page 108, line 7 skipping to change at page 108, line 33
algorithm for generating the id string, will generate a algorithm for generating the id string, will generate a
conflicting id string. conflicting id string.
Given the above considerations, an example of a well generated id Given the above considerations, an example of a well generated id
string is one that includes: string is one that includes:
o The server's network address. o The server's network address.
o The client's network address. o The client's network address.
o For a user level NFS version 4 client, it should contain o For a user level NFSv4 client, it should contain additional
additional information to distinguish the client from other user information to distinguish the client from other user level
level clients running on the same host, such as an universally clients running on the same host, such as an universally unique
unique identifier (UUID). identifier (UUID).
o Additional information that tends to be unique, such as one or o Additional information that tends to be unique, such as one or
more of: more of:
* The client machine's serial number (for privacy reasons, it is * The client machine's serial number (for privacy reasons, it is
best to perform some one way function on the serial number). best to perform some one way function on the serial number).
* A MAC address. * A MAC address.
* The timestamp of when the NFS version 4 software was first * The timestamp of when the NFSv4 software was first installed on
installed on the client (though this is subject to the the client (though this is subject to the previously mentioned
previously mentioned caution about using information that is caution about using information that is stored in a file,
stored in a file, because the file might only be accessible because the file might only be accessible over NFSv4).
over NFS version 4).
* A true random number. However since this number ought to be * A true random number. However since this number ought to be
the same between client incarnations, this shares the same the same between client incarnations, this shares the same
problem as that of the using the timestamp of the software problem as that of the using the timestamp of the software
installation. installation.
As a security measure, the server MUST NOT cancel a client's leased 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 state if the principal that established the state for a given id
not the same as the principal issuing the SETCLIENTID. string is not the same as the principal issuing the SETCLIENTID.
Note that SETCLIENTID and SETCLIENTID_CONFIRM has a secondary purpose Note that SETCLIENTID and SETCLIENTID_CONFIRM has a secondary purpose
of establishing the information the server needs to make callbacks to of establishing the information the server needs to make callbacks to
the client for purpose of supporting delegations. It is permitted to the client for purpose of supporting delegations. It is permitted to
change this information via SETCLIENTID and SETCLIENTID_CONFIRM change this information via SETCLIENTID and SETCLIENTID_CONFIRM
within the same incarnation of the client without removing the within the same incarnation of the client without removing the
client's leased state. client's leased state.
Once a SETCLIENTID and SETCLIENTID_CONFIRM sequence has successfully Once a SETCLIENTID and SETCLIENTID_CONFIRM sequence has successfully
completed, the client uses the shorthand client identifier, of type completed, the client uses the shorthand client identifier, of type
clientid4, instead of the longer and less compact nfs_client_id4 clientid4, instead of the longer and less compact nfs_client_id4
structure. This shorthand client identifier (a clientid) is assigned structure. This shorthand client identifier (a client ID) is
by the server and should be chosen so that it will not conflict with assigned by the server and should be chosen so that it will not
a clientid previously assigned by the server. This applies across conflict with a client ID previously assigned by the server. This
server restarts or reboots. When a clientid is presented to a server applies across server restarts or reboots. When a client ID is
and that clientid is not recognized, as would happen after a server presented to a server and that client ID is not recognized, as would
reboot, the server will reject the request with the error happen after a server reboot, the server will reject the request with
NFS4ERR_STALE_CLIENTID. When this happens, the client must obtain a the error NFS4ERR_STALE_CLIENTID. When this happens, the client must
new clientid by use of the SETCLIENTID operation and then proceed to obtain a new client ID by use of the SETCLIENTID operation and then
any other necessary recovery for the server reboot case (See proceed to any other necessary recovery for the server reboot case
Section 9.6.2). (See Section 9.6.2).
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 client ID, since this also indicates a server reboot
has invalidated the existing clientid (see Section 9.1.3 for which has invalidated the existing client ID (see Section 9.1.4 for
details). details).
See the detailed descriptions of SETCLIENTID and SETCLIENTID_CONFIRM See the detailed descriptions of SETCLIENTID and SETCLIENTID_CONFIRM
for a complete specification of the operations. for a complete specification of the operations.
9.1.2. Server Release of Clientid 9.1.2. Server Release of Client ID
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 client ID, the server may choose to release the client ID.
server may make this choice for an inactive client so that resources The server may make this choice for an inactive client so that
are not consumed by those intermittently active clients. If the resources are not consumed by those intermittently active clients.
client contacts the server after this release, the server must ensure If the client contacts the server after this release, the server must
the client receives the appropriate error so that it will use the ensure the client receives the appropriate error so that it will use
SETCLIENTID/SETCLIENTID_CONFIRM sequence to establish a new identity. the SETCLIENTID/SETCLIENTID_CONFIRM sequence to establish a new
It should be clear that the server must be very hesitant to release a identity. It should be clear that the server must be very hesitant
clientid since the resulting work on the client to recover from such to release a client ID since the resulting work on the client to
an event will be the same burden as if the server had failed and recover from such an event will be the same burden as if the server
restarted. Typically a server would not release a clientid unless had failed and restarted. Typically a server would not release a
there had been no activity from that client for many minutes. client ID unless there had been no activity from that client for many
minutes.
Note that if the id string in a SETCLIENTID request is properly Note that if the id string in a SETCLIENTID request is properly
constructed, and if the client takes care to use the same principal constructed, and if the client takes care to use the same principal
for each successive use of SETCLIENTID, then, barring an active for each successive use of SETCLIENTID, then, barring an active
denial of service attack, NFS4ERR_CLID_INUSE should never be denial of service attack, NFS4ERR_CLID_INUSE should never be
returned. returned.
However, client bugs, server bugs, or perhaps a deliberate change of However, client bugs, server bugs, or perhaps a deliberate change of
the principal owner of the id string (such as the case of a client 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 that changes security flavors, and under the new flavor, there is no
mapping to the previous owner) will in rare cases result in mapping to the previous owner) will in rare cases result in
NFS4ERR_CLID_INUSE. NFS4ERR_CLID_INUSE.
In that event, when the server gets a SETCLIENTID for a client id 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 that currently has no state, or it has state, but the lease has
expired, rather than returning NFS4ERR_CLID_INUSE, the server MUST expired, rather than returning NFS4ERR_CLID_INUSE, the server MUST
allow the SETCLIENTID, and confirm the new clientid if followed by allow the SETCLIENTID, and confirm the new client ID if followed by
the appropriate SETCLIENTID_CONFIRM. the appropriate SETCLIENTID_CONFIRM.
9.1.3. lock_owner and stateid Definition 9.1.3. Stateid Definition
When requesting a lock, the client must present to the server the When the server grants a lock of any type (including opens, byte-
clientid and an identifier for the owner of the requested lock. range locks, and delegations), it responds with a unique stateid that
These two fields are referred to as the lock_owner and the definition represents a set of locks (often a single lock) for the same file, of
of those fields are: the same type, and sharing the same ownership characteristics. Thus,
opens of the same file by different open- owners each have an
identifying stateid. Similarly, each set of byte-range locks on a
file owned by a specific lock-owner has its own identifying stateid.
Delegations also have associated stateids by which they may be
referenced. The stateid is used as a shorthand reference to a lock
or set of locks, and given a stateid, the server can determine the
associated state-owner or state-owners (in the case of an open-owner/
lock-owner pair) and the associated filehandle. When stateids are
used, the current filehandle must be the one associated with that
stateid.
o A clientid returned by the server as part of the client's use of All stateids associated with a given client ID are associated with a
the SETCLIENTID operation. common lease that represents the claim of those stateids and the
objects they represent to be maintained by the server. See
Section 9.5 for a discussion of the lease.
o A variable length opaque array used to uniquely define the owner The server may assign stateids independently for different clients.
of a lock managed by the client.
This may be a thread id, process id, or other unique value. A stateid with the same bit pattern for one client may designate an
entirely different set of locks for a different client. The stateid
is always interpreted with respect to the client ID associated with
the current session.
When the server grants the lock, it responds with a unique stateid. 9.1.3.1. Stateid Types
The stateid is used as a shorthand reference to the lock_owner, since
the server will be maintaining the correspondence between them.
The server is free to form the stateid in any manner that it chooses With the exception of special stateids (see Section 9.1.3.3), each
as long as it is able to recognize invalid and out-of-date stateids. stateid represents locking objects of one of a set of types defined
This requirement includes those stateids generated by earlier by the NFSv4 protocol. Note that in all these cases, where we speak
instances of the server. From this, the client can be properly of guarantee, it is understood there are situations such as a client
notified of a server restart. This notification will occur when the restart, or lock revocation, that allow the guarantee to be voided.
client presents a stateid to the server from a previous
instantiation.
The server must be able to distinguish the following situations and o Stateids may represent opens of files.
return the error as specified:
o The stateid was generated by an earlier server instance (i.e., Each stateid in this case represents the OPEN state for a given
before a server reboot). The error NFS4ERR_STALE_STATEID should client ID/open-owner/filehandle triple. Such stateids are subject
be returned. to change (with consequent incrementing of the stateid's seqid) in
response to OPENs that result in upgrade and OPEN_DOWNGRADE
operations.
o The stateid was generated by the current server instance but the o Stateids may represent sets of byte-range locks.
stateid no longer designates the current locking state for the
lockowner-file pair in question (i.e., one or more locking
operations has occurred). The error NFS4ERR_OLD_STATEID should be
returned.
This error condition will only occur when the client issues a All locks held on a particular file by a particular owner and all
locking request which changes a stateid while an I/O request that gotten under the aegis of a particular open file are associated
uses that stateid is outstanding. with a single stateid with the seqid being incremented whenever
LOCK and LOCKU operations affect that set of locks.
o The stateid was generated by the current server instance but the o Stateids may represent file delegations, which are recallable
stateid does not designate a locking state for any active guarantees by the server to the client, that other clients will
lockowner-file pair. The error NFS4ERR_BAD_STATEID should be not reference, or will not modify a particular file, until the
returned. delegation is returned.
This error condition will occur when there has been a logic error A stateid represents a single delegation held by a client for a
on the part of the client or server. This should not happen. particular filehandle.
One mechanism that may be used to satisfy these requirements is for 9.1.3.2. Stateid Structure
the server to,
o divide the "other" field of each stateid into two fields: Stateids are divided into two fields, a 96-bit "other" field
identifying the specific set of locks and a 32-bit "seqid" sequence
value. Except in the case of special stateids (see Section 9.1.3.3),
a particular value of the "other" field denotes a set of locks of the
same type (for example, byte-range locks, opens, delegations, or
layouts), for a specific file or directory, and sharing the same
ownership characteristics. The seqid designates a specific instance
of such a set of locks, and is incremented to indicate changes in
such a set of locks, either by the addition or deletion of locks from
the set, a change in the byte-range they apply to, or an upgrade or
downgrade in the type of one or more locks.
* A server verifier which uniquely designates a particular server When such a set of locks is first created, the server returns a
instantiation. stateid with seqid value of one. On subsequent operations that
modify the set of locks, the server is required to increment the
"seqid" field by one whenever it returns a stateid for the same
state-owner/file/type combination and there is some change in the set
of locks actually designated. In this case, the server will return a
stateid with an "other" field the same as previously used for that
state-owner/file/type combination, with an incremented "seqid" field.
This pattern continues until the seqid is incremented past
NFS4_UINT32_MAX, and one (not zero) is the next seqid value. The
purpose of the incrementing of the seqid is to allow the server to
communicate to the client the order in which operations that modified
locking state associated with a stateid have been processed and to
make it possible for the client to send requests that are conditional
on the set of locks not having changed since the stateid in question
was returned.
* An index into a table of locking-state structures. When a client sends a stateid to the server, it has two choices with
regard to the seqid sent. It may set the seqid to zero to indicate
to the server that it wishes the most up-to-date seqid for that
stateid's "other" field to be used. This would be the common choice
in the case of a stateid sent with a READ or WRITE operation. It
also may set a non-zero value, in which case the server checks if
that seqid is the correct one. In that case, the server is required
to return NFS4ERR_OLD_STATEID if the seqid is lower than the most
current value and NFS4ERR_BAD_STATEID if the seqid is greater than
the most current value. This would be the common choice in the case
of stateids sent with a CLOSE or OPEN_DOWNGRADE. Because OPENs may
be sent in parallel for the same owner, a client might close a file
without knowing that an OPEN upgrade had been done by the server,
changing the lock in question. If CLOSE were sent with a zero seqid,
the OPEN upgrade would be cancelled before the client even received
an indication that an upgrade had happened.
o utilize the "seqid" field of each stateid, such that seqid is When a stateid is sent by the server to the client as part of a
monotonically incremented for each stateid that is associated with callback operation, it is not subject to checking for a current seqid
the same index into the locking-state table. and returning NFS4ERR_OLD_STATEID. This is because the client is not
in a position to know the most up-to-date seqid and thus cannot
verify it. Unless specially noted, the seqid value for a stateid
sent by the server to the client as part of a callback is required to
be zero with NFS4ERR_BAD_STATEID returned if it is not.
By matching the incoming stateid and its field values with the state In making comparisons between seqids, both by the client in
held at the server, the server is able to easily determine if a determining the order of operations and by the server in determining
stateid is valid for its current instantiation and state. If the whether the NFS4ERR_OLD_STATEID is to be returned, the possibility of
stateid is not valid, the appropriate error can be supplied to the the seqid being swapped around past the NFS4_UINT32_MAX value needs
client. to be taken into account. When two seqid values are being compared,
the total count of slots for all sessions associated with the current
client is used to do this. When one seqid value is less than this
total slot count and another seqid value is greater than
NFS4_UINT32_MAX minus the total slot count, the former is to be
treated as lower than the latter, despite the fact that it is
numerically greater.
9.1.4. Use of the stateid and Locking 9.1.3.3. Special Stateids
Stateid values whose "other" field is either all zeros or all ones
are reserved. They may not be assigned by the server but have
special meanings defined by the protocol. The particular meaning
depends on whether the "other" field is all zeros or all ones and the
specific value of the "seqid" field.
The following combinations of "other" and "seqid" are defined in
NFSv4:
o When "other" and "seqid" are both zero, the stateid is treated as
a special anonymous stateid, which can be used in READ, WRITE, and
SETATTR requests to indicate the absence of any open state
associated with the request. When an anonymous stateid value is
used, and an existing open denies the form of access requested,
then access will be denied to the request.
o When "other" and "seqid" are both all ones, the stateid is a
special READ bypass stateid. When this value is used in WRITE or
SETATTR, it is treated like the anonymous value. When used in
READ, the server MAY grant access, even if access would normally
be denied to READ requests.
o When "other" is zero and "seqid" is one, the stateid represents
the current stateid, which is whatever value is the last stateid
returned by an operation within the COMPOUND. In the case of an
OPEN, the stateid returned for the open file, and not the
delegation is used. The stateid passed to the operation in place
of the special value has its "seqid" value set to zero, except
when the current stateid is used by the operation CLOSE or
OPEN_DOWNGRADE. If there is no operation in the COMPOUND which
has returned a stateid value, the server MUST return the error
NFS4ERR_BAD_STATEID. As illustrated in Figure 5, if the value of
a current stateid is a special stateid, and the stateid of an
operation's arguments has "other" set to zero, and "seqid" set to
one, then the server MUST return the error NFS4ERR_BAD_STATEID.
o When "other" is zero and "seqid" is NFS4_UINT32_MAX, the stateid
represents a reserved stateid value defined to be invalid. When
this stateid is used, the server MUST return the error
NFS4ERR_BAD_STATEID.
If a stateid value is used which has all zero or all ones in the
"other" field, but does not match one of the cases above, the server
MUST return the error NFS4ERR_BAD_STATEID.
Special stateids, unlike other stateids, are not associated with
individual client IDs or filehandles and can be used with all valid
client IDs and filehandles. In the case of a special stateid
designating the current stateid, the current stateid value
substituted for the special stateid is associated with a particular
client ID and filehandle, and so, if it is used where current
filehandle does not match that associated with the current stateid,
the operation to which the stateid is passed will return
NFS4ERR_BAD_STATEID.
9.1.3.4. Stateid Lifetime and Validation
Stateids must remain valid until either a client restart or a server
restart or until the client returns all of the locks associated with
the stateid by means of an operation such as CLOSE or DELEGRETURN.
If the locks are lost due to revocation as long as the client ID is
valid, the stateid remains a valid designation of that revoked state.
Stateids associated with byte-range locks are an exception. They
remain valid even if a LOCKU frees all remaining locks, so long as
the open file with which they are associated remains open.
It should be noted that there are situations in which the client's
locks become invalid, without the client requesting they be returned.
These include lease expiration and a number of forms of lock
revocation within the lease period. It is important to note that in
these situations, the stateid remains valid and the client can use it
to determine the disposition of the associated lost locks.
An "other" value must never be reused for a different purpose (i.e.
different filehandle, owner, or type of locks) within the context of
a single client ID. A server may retain the "other" value for the
same purpose beyond the point where it may otherwise be freed but if
it does so, it must maintain "seqid" continuity with previous values.
One mechanism that may be used to satisfy the requirement that the
server recognize invalid and out-of-date stateids is for the server
to divide the "other" field of the stateid into two fields.
o An index into a table of locking-state structures.
o A generation number which is incremented on each allocation of a
table entry for a particular use.
And then store in each table entry,
o The client ID with which the stateid is associated.
o The current generation number for the (at most one) valid stateid
sharing this index value.
o The filehandle of the file on which the locks are taken.
o An indication of the type of stateid (open, byte-range lock, file
delegation).
o The last "seqid" value returned corresponding to the current
"other" value.
o An indication of the current status of the locks associated with
this stateid. In particular, whether these have been revoked and
if so, for what reason.
With this information, an incoming stateid can be validated and the
appropriate error returned when necessary. Special and non-special
stateids are handled separately. (See Section 9.1.3.3 for a
discussion of special stateids.)
When a stateid is being tested, and the "other" field is all zeros or
all ones, a check that the "other" and "seqid" fields match a defined
combination for a special stateid is done and the results determined
as follows:
o If the "other" and "seqid" fields do not match a defined
combination associated with a special stateid, the error
NFS4ERR_BAD_STATEID is returned.
o If the special stateid is one designating the current stateid, and
there is a current stateid, then the current stateid is
substituted for the special stateid and the checks appropriate to
non-special stateids in performed.
o If the combination is valid in general but is not appropriate to
the context in which the stateid is used (e.g. an all-zero stateid
is used when an open stateid is required in a LOCK operation), the
error NFS4ERR_BAD_STATEID is also returned.
o Otherwise, the check is completed and the special stateid is
accepted as valid.
When a stateid is being tested, and the "other" field is neither all
zeros or all ones, the following procedure could be used to validate
an incoming stateid and return an appropriate error, when necessary,
assuming that the "other" field would be divided into a table index
and an entry generation.
o If the table index field is outside the range of the associated
table, return NFS4ERR_BAD_STATEID.
o If the selected table entry is of a different generation than that
specified in the incoming stateid, return NFS4ERR_BAD_STATEID.
o If the selected table entry does not match the current filehandle,
return NFS4ERR_BAD_STATEID.
o If the client ID in the table entry does not match the client ID
associated with the current session, return NFS4ERR_BAD_STATEID.
o If the stateid represents revoked state, then return
NFS4ERR_EXPIRED, NFS4ERR_ADMIN_REVOKED, or NFS4ERR_DELEG_REVOKED,
as appropriate.
o If the stateid type is not valid for the context in which the
stateid appears, return NFS4ERR_BAD_STATEID. Note that a stateid
may be valid in general, but be invalid for a particular
operation, as, for example, when a stateid which doesn't represent
byte-range locks is passed to the non-from_open case of LOCK or to
LOCKU, or when a stateid which does not represent an open is
passed to CLOSE or OPEN_DOWNGRADE. In such cases, the server MUST
return NFS4ERR_BAD_STATEID.
o If the "seqid" field is not zero, and it is greater than the
current sequence value corresponding the current "other" field,
return NFS4ERR_BAD_STATEID.
o If the "seqid" field is not zero, and it is less than the current
sequence value corresponding the current "other" field, return
NFS4ERR_OLD_STATEID.
o Otherwise, the stateid is valid and the table entry should contain
any additional information about the type of stateid and
information associated with that particular type of stateid, such
as the associated set of locks, such as open-owner and lock-owner
information, as well as information on the specific locks, such as
open modes and byte ranges.
9.1.3.5. Stateid Use for I/O Operations
Clients performing I/O operations need to select an appropriate
stateid based on the locks (including opens and delegations) held by
the client and the various types of state-owners sending the I/O
requests. SETATTR operations that change the file size are treated
like I/O operations in this regard.
The following rules, applied in order of decreasing priority, govern
the selection of the appropriate stateid. In following these rules,
the client will only consider locks of which it has actually received
notification by an appropriate operation response or callback.
o If the client holds a delegation for the file in question, the
delegation stateid SHOULD be used.
o Otherwise, if the entity corresponding to the lock-owner (e.g., a
process) sending the I/O has a byte-range lock stateid for the
associated open file, then the byte-range lock stateid for that
lock-owner and open file SHOULD be used.
o If there is no byte-range lock stateid, then the OPEN stateid for
the open file in question SHOULD be used.
o Finally, if none of the above apply, then a special stateid SHOULD
be used.
Ignoring these rules may result in situations in which the server
does not have information necessary to properly process the request.
For example, when mandatory byte-range locks are in effect, if the
stateid does not indicate the proper lock-owner, via a lock stateid,
a request might be avoidably rejected.
The server however should not try to enforce these ordering rules and
should use whatever information is available to properly process I/O
requests. In particular, when a client has a delegation for a given
file, it SHOULD take note of this fact in processing a request, even
if it is sent with a special stateid.
9.1.3.6. Stateid Use for SETATTR Operations
In the case of SETATTR operations, a stateid is present. In cases
other than those that set the file size, the client may send either a
special stateid or, when a delegation is held for the file in
question, a delegation stateid. While the server SHOULD validate the
stateid and may use the stateid to optimize the determination as to
whether a delegation is held, it SHOULD note the presence of a
delegation even when a special stateid is sent, and MUST accept a
valid delegation stateid when sent.
9.1.4. lock_owner
When requesting a lock, the client must present to the server the
client ID and an identifier for the owner of the requested lock.
These two fields are referred to as the lock_owner and the definition
of those fields are:
o A client ID returned by the server as part of the client's use of
the SETCLIENTID operation.
o A variable length opaque array used to uniquely define the owner
of a lock managed by the client.
This may be a thread id, process id, or other unique value.
When the server grants the lock, it responds with a unique stateid.
The stateid is used as a shorthand reference to the lock_owner, since
the server will be maintaining the correspondence between them.
9.1.5. 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. The stateid passed to one of these
operations must be one that represents an OPEN, a set of byte-range
locks, or a delegation, or it may be a special stateid representing
anonymous access or the special bypass stateid.
If the lock_owner performs a READ or WRITE in a situation in which it If the lock_owner performs a READ or WRITE in a situation in which it
has established a lock or share reservation on the server (any OPEN has established a lock or share reservation on the server (any OPEN
constitutes a share reservation) 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 byte-
record locks and share reservations, are held by the lockowner. If range locks and share reservations, are held by the lockowner. If no
no state is established by the client, either record lock or share state is established by the client, either byte-range lock or share
reservation, a stateid of all bits 0 is used. Regardless whether a reservation, a stateid of all bits 0 is used. Regardless whether a
stateid of all bits 0, or a stateid returned by the server is used, stateid of all bits 0, or a stateid returned by the server is used,
if there is a conflicting share reservation or mandatory record lock if there is a conflicting share reservation or mandatory byte-range
held on the file, the server MUST refuse to service the READ or WRITE lock held on the file, the server MUST refuse to service the READ or
operation. WRITE operation.
Share reservations are established by OPEN operations and by their Share reservations are established by OPEN operations and by their
nature are mandatory in that when the OPEN denies READ or WRITE nature are mandatory in that when the OPEN denies READ or WRITE
operations, that denial results in such operations being rejected operations, that denial results in such operations being rejected
with error NFS4ERR_LOCKED. Record locks may be implemented by the with error NFS4ERR_LOCKED. Byte-range locks may be implemented by
server as either mandatory or advisory, or the choice of mandatory or the server as either mandatory or advisory, or the choice of
advisory behavior may be determined by the server on the basis of the mandatory or advisory behavior may be determined by the server on the
file being accessed (for example, some UNIX-based servers support a basis of the file being accessed (for example, some UNIX-based
"mandatory lock bit" on the mode attribute such that if set, record servers support a "mandatory lock bit" on the mode attribute such
locks are required on the file before I/O is possible). When record that if set, byte-range locks are required on the file before I/O is
locks are advisory, they only prevent the granting of conflicting possible). When byte-range locks are advisory, they only prevent the
lock requests and have no effect on READs or WRITEs. Mandatory granting of conflicting lock requests and have no effect on READs or
record locks, however, prevent conflicting I/O operations. When they WRITEs. Mandatory byte-range locks, however, prevent conflicting I/O
are attempted, they are rejected with NFS4ERR_LOCKED. When the operations. When they are attempted, they are rejected with
client gets NFS4ERR_LOCKED on a file it knows it has the proper share NFS4ERR_LOCKED. When the client gets NFS4ERR_LOCKED on a file it
reservation for, it will need to issue a LOCK request on the region knows it has the proper share reservation for, it will need to issue
of the file that includes the region the I/O was to be performed on, a LOCK request on the region of the file that includes the region the
with an appropriate locktype (i.e., READ*_LT for a READ operation, I/O was to be performed on, with an appropriate locktype (i.e.,
WRITE*_LT for a WRITE operation). READ*_LT for a READ operation, WRITE*_LT for a WRITE operation).
With NFS version 3, there was no notion of a stateid so there was no With NFSv3, there was no notion of a stateid so there was no way to
way to tell if the application process of the client sending the READ tell if the application process of the client sending the READ or
or WRITE operation had also acquired the appropriate record lock on WRITE operation had also acquired the appropriate byte-range lock on
the file. Thus there was no way to implement mandatory locking. the file. Thus there was no way to implement mandatory locking.
With the stateid construct, this barrier has been removed. With the stateid construct, this barrier has been removed.
Note that for UNIX environments that support mandatory file locking, Note that for UNIX environments that support mandatory file locking,
the distinction between advisory and mandatory locking is subtle. In the distinction between advisory and mandatory locking is subtle. In
fact, advisory and mandatory record locks are exactly the same in so fact, advisory and mandatory byte-range locks are exactly the same in
far as the APIs and requirements on implementation. If the mandatory so far as the APIs and requirements on implementation. If the
lock attribute is set on the file, the server checks to see if the mandatory lock attribute is set on the file, the server checks to see
lockowner has an appropriate shared (read) or exclusive (write) if the lockowner has an appropriate shared (read) or exclusive
record lock on the region it wishes to read or write to. If there is (write) byte-range lock on the region it wishes to read or write to.
no appropriate lock, the server checks if there is a conflicting lock If there is no appropriate lock, the server checks if there is a
(which can be done by attempting to acquire the conflicting lock on conflicting lock (which can be done by attempting to acquire the
the behalf of the lockowner, and if successful, release the lock conflicting lock on the behalf of the lockowner, and if successful,
after the READ or WRITE is done), and if there is, the server returns release the lock after the READ or WRITE is done), and if there is,
NFS4ERR_LOCKED. the server returns NFS4ERR_LOCKED.
For Windows environments, there are no advisory record locks, so the For Windows environments, there are no advisory byte-range locks, so
server always checks for record locks during I/O requests. the server always checks for byte-range locks during I/O requests.
Thus, the NFS version 4 LOCK operation does not need to distinguish Thus, the NFSv4 LOCK operation does not need to distinguish between
between advisory and mandatory record locks. It is the NFS version 4 advisory and mandatory byte-range locks. It is the NFS version 4
server's processing of the READ and WRITE operations that introduces server's processing of the READ and WRITE operations that introduces
the distinction. the distinction.
Every stateid other than the special stateid values noted in this Every stateid other than the special stateid values noted in this
section, whether returned by an OPEN-type operation (i.e., OPEN, 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- defines an access mode for the file (i.e., READ, WRITE, or READ-
WRITE) as established by the original OPEN which began the stateid WRITE) as established by the original OPEN which began the stateid
sequence, and as modified by subsequent OPENs and OPEN_DOWNGRADEs sequence, and as modified by subsequent OPENs and OPEN_DOWNGRADEs
within that stateid sequence. When a READ, WRITE, or SETATTR which within that stateid sequence. When a READ, WRITE, or SETATTR which
skipping to change at page 113, line 37 skipping to change at page 120, line 38
A lock may not be granted while a READ or WRITE operation using one A lock may not be granted while a READ or WRITE operation using one
of the special stateids is being performed and the range of the lock of the special stateids is being performed and the range of the lock
request conflicts with the range of the READ or WRITE operation. For request conflicts with the range of the READ or WRITE operation. For
the purposes of this paragraph, a conflict occurs when a shared lock the purposes of this paragraph, a conflict occurs when a shared lock
is requested and a WRITE operation is being performed, or an is requested and a WRITE operation is being performed, or an
exclusive lock is requested and either a READ or a WRITE operation is exclusive lock is requested and either a READ or a WRITE operation is
being performed. A SETATTR that sets size is treated similarly to a being performed. A SETATTR that sets size is treated similarly to a
WRITE as discussed above. WRITE as discussed above.
9.1.5. Sequencing of Lock Requests 9.1.6. 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 integer. Different lock_owners have different sequences. The server
maintains the last sequence number (L) received and the response that maintains the last sequence number (L) received and the response that
skipping to change at page 114, line 36 skipping to change at page 121, line 38
request and response on a given lock_owner must be cached as long as request and response on a given lock_owner must be cached as long 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 The client MUST monotonically increment the sequence number for the
CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE
operations. This is true even in the event that the previous operations. This is true even in the event that the previous
operation that used the sequence number received an error. The only operation that used the sequence number received an error. The only
exception to this rule is if the previous operation received one of exception to this rule is if the previous operation received one of
the following errors: NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID, the following errors: NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID,
NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID, NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID, NFS4ERR_BADXDR,
NFS4ERR_RESOURCE, NFS4ERR_NOFILEHANDLE, NFS4ERR_LEASE_MOVED, or NFS4ERR_RESOURCE, NFS4ERR_NOFILEHANDLE, or NFS4ERR_MOVED.
NFS4ERR_MOVED.
9.1.6. Recovery from Replayed Requests 9.1.7. Recovery from Replayed Requests
As described above, the sequence number is per lock_owner. As long As described above, the sequence number is per lock_owner. As long
as the server maintains the last sequence number received and follows as the server maintains the last sequence number received and follows
the methods described above, there are no risks of a Byzantine router the methods described above, there are no risks of a Byzantine router
re-sending old requests. The server need only maintain the re-sending old requests. The server need only maintain the
(lock_owner, sequence number) state as long as there are open files (lock_owner, sequence number) state as long as there 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 lock_owner state. maintains the lock_owner state.
9.1.7. Releasing lock_owner State 9.1.8. Releasing lock_owner State
When a particular lock_owner no longer holds open or file locking When a particular lock_owner 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 lock_owner. 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 lock_owner no longer 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 is being utilized by the client. The server may choose to hold the
lock_owner state in the event that retransmitted requests are lock_owner state in the event that retransmitted requests are
received. However, the period to hold this state is implementation received. However, the period to hold this state is implementation
specific. specific.
In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is
retransmitted after the server has previously released the lock_owner retransmitted after the server has previously released the lock_owner
state, the server will find that the lock_owner has no files open and 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 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 a file open, the stateid will not match and again an error is
returned to the client. returned to the client.
9.1.8. Use of Open Confirmation 9.1.9. Use of Open Confirmation
In the case that an OPEN is retransmitted and the lock_owner is being In the case that an OPEN is retransmitted and the lock_owner is being
used for the first time or the lock_owner state has been previously used for the first time or the lock_owner state has been previously
released by the server, the use of the OPEN_CONFIRM operation will released by the server, the use of the OPEN_CONFIRM operation will
prevent incorrect behavior. When the server observes the use of the prevent incorrect behavior. When the server observes the use of the
lock_owner for the first time, it will direct the client to perform lock_owner for the first time, it will direct the client to perform
the OPEN_CONFIRM for the corresponding OPEN. This sequence the OPEN_CONFIRM for the corresponding OPEN. This sequence
establishes the use of a lock_owner and associated sequence number. establishes the use of a lock_owner and associated sequence number.
Since the OPEN_CONFIRM sequence connects a new open_owner on the Since the OPEN_CONFIRM sequence connects a new open_owner on the
server with an existing open_owner on a client, the sequence number server with an existing open_owner on a client, the sequence number
skipping to change at page 118, line 26 skipping to change at page 125, line 26
that this final locking request will be accepted. that this final locking request will be accepted.
9.5. Lease Renewal 9.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 client ID). 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
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 client ID.
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, or WRITE). This does not include the READ, RENEW, SETATTR, or WRITE). This does not include the
special stateids of all bits 0 or all bits 1. special stateids of all bits 0 or all bits 1.
Note that if the client had restarted or rebooted, the client Note that if the client had restarted or rebooted, the client
would not be making these requests without issuing the 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 sequence (one that changes the SETCLIENTID/SETCLIENTID_CONFIRM sequence (one that changes the
client verifier) notifies the server to drop the locking state client verifier) notifies the server to drop the locking state
associated with the client. SETCLIENTID/SETCLIENTID_CONFIRM never associated with the client. SETCLIENTID/SETCLIENTID_CONFIRM never
renews a lease. renews a lease.
If the server has rebooted, the stateids (NFS4ERR_STALE_STATEID If the server has rebooted, the stateids (NFS4ERR_STALE_STATEID
error) or the clientid (NFS4ERR_STALE_CLIENTID error) will not be error) or the client ID (NFS4ERR_STALE_CLIENTID error) will not be
valid hence preventing spurious renewals. valid hence 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
skipping to change at page 119, line 35 skipping to change at page 126, line 35
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.
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 client ID 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 client ID with
SETCLIENTID_CONFIRM. The clientid in combination with an opaque SETCLIENTID_CONFIRM. The client ID 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
all locks held which are associated with the old clientid which was all locks held which are associated with the old client ID which was
derived from the old verifier. derived from the old verifier.
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.
9.6.2. Server Failure and Recovery 9.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-
skipping to change at page 120, line 21 skipping to change at page 127, line 21
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.
A client can determine that server failure (and thus loss of locking A client can determine that server failure (and thus loss of locking
state) has occurred, when it receives one of two errors. The state) has occurred, when it receives one of two errors. The
NFS4ERR_STALE_STATEID error indicates a stateid invalidated by a NFS4ERR_STALE_STATEID error indicates a stateid invalidated by a
reboot or restart. The NFS4ERR_STALE_CLIENTID error indicates a reboot or restart. The NFS4ERR_STALE_CLIENTID error indicates a
clientid invalidated by reboot or restart. When either of these are client ID invalidated by reboot or restart. When either of these are
received, the client must establish a new clientid (see received, the client must establish a new client ID (see
Section 9.1.1) and re-establish the locking state as discussed below. Section 9.1.1) 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 associated state by reclaim-type locking requests (i.e., LOCK
requests with reclaim set to true and OPEN operations with a claim requests with reclaim set to true and OPEN operations with a claim
type of CLAIM_PREVIOUS). During the grace period, the server must type of CLAIM_PREVIOUS). During the grace period, the server must
reject READ and WRITE operations and non-reclaim locking requests reject READ and WRITE operations and non-reclaim locking requests
(i.e., other LOCK and OPEN operations) with an error of (i.e., other LOCK and OPEN operations) with an error of
skipping to change at page 121, line 35 skipping to change at page 128, line 35
the server. Further discussion of the general issue is included in the server. Further discussion of the general issue is included in
[20]. The client must account for the server that is able to perform [20]. The client must account for the server that is able to perform
I/O and non-reclaim locking requests within the grace period as well I/O and non-reclaim locking requests within the grace period as well
as those that cannot do so. as those that cannot 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.
A server may, upon restart, establish a new value for the lease A server may, upon restart, establish a new value for the lease
period. Therefore, clients should, once a new clientid is period. Therefore, clients should, once a new client ID is
established, refetch the lease_time attribute and use it as the basis established, refetch the lease_time attribute and use it as the basis
for lease renewal for the lease associated with that server. for lease renewal for the lease associated with that server.
However, the server must establish, for this restart event, a grace However, the server must establish, for this restart event, a grace
period at least as long as the lease period for the previous server period at least as long as the lease period for the previous server
instantiation. This allows the client state obtained during the instantiation. This allows the client state obtained during the
previous server instance to be reliably re-established. previous server instance to be reliably re-established.
9.6.3. Network Partitions and Recovery 9.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.
9.6.3.1. Courtesy Locks
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
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 does not reboot before the network partition is healed,
when the original client tries to access a courtesy lock which was
freed, the server SHOULD send back a NFS4ERR_BAD_STATEID to the
client. If the client tries to access a courtesy lock which was not
freed, then the server should mark all of the courtesy locks as
implicitly being renewed.
When a network partition is combined with a server reboot, there are When a network partition is combined with a server reboot, there are
edge conditions that place requirements on the server in order to edge conditions that place requirements on the server in order to
avoid silent data corruption following the server reboot. Two of avoid silent data corruption following the server reboot. Two of
these edge conditions are known, and are discussed below. these edge conditions are known, and are discussed below.
9.6.3.1.1. First Server Edge Condition
The first edge condition has the following scenario: The first edge condition has the following scenario:
1. Client A acquires a lock. 1. Client A acquires a lock.
2. Client A and server experience mutual network partition, such 2. Client A and server experience mutual network partition, such
that client A is unable to renew its lease. that client A is unable to renew its lease.
3. Client A's lease expires, so server releases lock. 3. Client A's lease expires, so server releases lock.
4. Client B acquires a lock that would have conflicted with that of 4. Client B acquires a lock that would have conflicted with that of
skipping to change at page 122, line 45 skipping to change at page 130, line 9
8. Client A issues a RENEW operation, and gets back a 8. Client A issues a RENEW operation, and gets back a
NFS4ERR_STALE_CLIENTID. NFS4ERR_STALE_CLIENTID.
9. Client A reclaims its lock within the server's grace period. 9. Client A reclaims its lock within the server's grace period.
Thus, at the final step, the server has erroneously granted client Thus, at the final step, the server has erroneously granted client
A's lock reclaim. If client B modified the object the lock was A's lock reclaim. If client B modified the object the lock was
protecting, client A will experience object corruption. protecting, client A will experience object corruption.
9.6.3.1.2. Second Server Edge Condition
The second known edge condition follows: The second known edge condition follows:
1. Client A acquires a lock. 1. Client A acquires a lock.
2. Server reboots. 2. Server reboots.
3. Client A and server experience mutual network partition, such 3. Client A and server experience mutual network partition, such
that client A is unable to reclaim its lock within the grace that client A is unable to reclaim its lock within the grace
period. period.
skipping to change at page 123, line 30 skipping to change at page 130, line 42
9. Client A issues a RENEW operation, and gets back a 9. Client A issues a RENEW operation, and gets back a
NFS4ERR_STALE_CLIENTID. NFS4ERR_STALE_CLIENTID.
10. Client A reclaims its lock within the server's grace period. 10. Client A reclaims its lock within the server's grace period.
As with the first edge condition, the final step of the scenario of As with the first edge condition, the final step of the scenario of
the second edge condition has the server erroneously granting client the second edge condition has the server erroneously granting client
A's lock reclaim. A's lock reclaim.
Solving the first and second edge conditions requires that the server 9.6.3.1.3. Handling Server Edge Conditions
either assume after it reboots that edge condition occurs, and thus
return NFS4ERR_NO_GRACE for all reclaim attempts, or that the server Solving these edge conditions requires that the server either assume
record some information stable storage. The amount of information after it reboots that edge condition occurs, and thus return
the server records in stable storage is in inverse proportion to how NFS4ERR_NO_GRACE for all reclaim attempts, or that the server record
some information in stable storage. The amount of information the
server records in stable storage is in inverse proportion to how
harsh the server wants to be whenever the edge conditions occur. The harsh the server wants to be whenever the edge conditions occur. The
server that is completely tolerant of all edge conditions will record server that is completely tolerant of all edge conditions will record
in stable storage every lock that is acquired, removing the lock in stable storage every lock that is acquired, removing the lock
record from stable storage only when the lock is unlocked by the record from stable storage only when the lock is unlocked by the
client and the lock's lockowner advances the sequence number such client and the lock's lockowner advances the sequence number such
that the lock release is not the last stateful event for the that the lock release is not the last stateful event for the
lockowner's sequence. For the two aforementioned edge conditions, lockowner's sequence. For the two aforementioned edge conditions,
the harshest a server can be, and still support a grace period for the harshest a server can be, and still support a grace period for
reclaims, requires that the server record in stable storage reclaims, requires that the server record in stable storage
information some minimal information. For example, a server information some minimal information. For example, a server
implementation could, for each client, save in stable storage a implementation could, for each client, save in stable storage a
record containing: record containing:
o the client's id string o the client's id string
o a boolean that indicates if the client's lease expired or if there o a boolean that indicates if the client's lease expired or if there
was administrative intervention (see Section 9.8) to revoke a was administrative intervention (see Section 9.8) to revoke a
record lock, share reservation, or delegation byte-range lock, share reservation, or delegation
o a timestamp that is updated the first time after a server boot or o a timestamp that is updated the first time after a server boot or
reboot the client acquires record locking, share reservation, or reboot the client acquires byte-range locking, share reservation,
delegation state on the server. The timestamp need not be updated or delegation state on the server. The timestamp need not be
on subsequent lock requests until the server reboots. updated on subsequent lock requests until the server reboots.
The server implementation would also record in the stable storage the The server implementation would also record in the stable storage the
timestamps from the two most recent server reboots. timestamps from the two most recent server reboots.
Assuming the above record keeping, for the first edge condition, Assuming the above record keeping, for the first edge condition,
after the server reboots, the record that client A's lease expired after the server reboots, the record that client A's lease expired
means that another client could have acquired a conflicting record means that another client could have acquired a conflicting record
lock, share reservation, or delegation. Hence the server must reject lock, share reservation, or delegation. Hence the server must reject
a reclaim from client A with the error NFS4ERR_NO_GRACE. a reclaim from client A with the error NFS4ERR_NO_GRACE.
For the second edge condition, after the server reboots for a second For the second edge condition, after the server reboots for a second
time, the record that the client had an unexpired record lock, share time, the record that the client had an unexpired record lock, share
reservation, or delegation established before the server's previous reservation, or delegation established before the server's previous
incarnation means that the server must reject a reclaim from client A incarnation means that the server must reject a reclaim from client A
with the error NFS4ERR_NO_GRACE. with the error NFS4ERR_NO_GRACE.
Regardless of the level and approach to record keeping, the server Regardless of the level and approach to record keeping, the server
MUST implement one of the following strategies (which apply to MUST implement one of the following strategies (which apply to
reclaims of share reservations, record locks, and delegations): reclaims of share reservations, byte-range locks, and delegations):
1. Reject all reclaims with NFS4ERR_NO_GRACE. This is superharsh, 1. Reject all reclaims with NFS4ERR_NO_GRACE. This is super harsh,
but necessary if the server does not want to record lock state in but necessary if the server does not want to record lock state in
stable storage. stable storage.
2. Record sufficient state in stable storage such that all known 2. Record sufficient state in stable storage such that all known
edge conditions involving server reboot, including the two noted edge conditions involving server reboot, including the two noted
in this section, are detected. False positives are acceptable. in this section, are detected. False positives are acceptable.
Note that at this time, it is not known if there are other edge Note that at this time, it is not known if there are other edge
conditions. In the event, after a server reboot, the server conditions. In the event, after a server reboot, the server
determines that there is unrecoverable damage or corruption to determines that there is unrecoverable damage or corruption to
the the stable storage, then for all clients and/or locks the the stable storage, then for all clients and/or locks
affected, the server MUST return NFS4ERR_NO_GRACE. affected, the server MUST return NFS4ERR_NO_GRACE.
9.6.3.1.4. Client Edge Condition
A third edge condition effects the client and not the server. If the
server reboots in the middle of the client reclaiming some locks and
then a network partition is established, the client might be in the
situation of having reclaimed some, but not all locks. In that case,
a conservative client would assume that the non-reclaimed locks were
revoked.
The third known edge condition follows:
1. Client A acquires a lock 1.
2. Client A acquires a lock 2.
3. Server reboots.
4. Client A issues a RENEW operation, and gets back a
NFS4ERR_STALE_CLIENTID.
5. Client A reclaims its lock 1 within the server's grace period.
6. Client A and server experience mutual network partition, such
that client A is unable to reclaim its remaining locks within
the grace period.
7. Server's reclaim grace period ends. Client A has no locks
recorded on server.
8. Server reboots a second time.
9. Network partition between client A and server heals.
10. Client A issues a RENEW operation, and gets back a
NFS4ERR_STALE_CLIENTID.
11. Client A reclaims its lock 1 within the server's grace period.
During the partition, client A decided that the server had revoked
lock 2. After the partition, it was able to reclaim lock 1, but made
no attempt to reclaim lock 2. After the grace period, it is free to
try to reestablish lock 2 via LOCK operations.
Note that the other two edge conditions are able to interact with
this third edge condition. Another client B may have established a
conflicting lock during the partition, made some changes, and the
released the lock before the second server reboot.
9.6.3.1.5. Client's Handling of NFS4ERR_NO_GRACE
A mandate for the client's handling of the NFS4ERR_NO_GRACE error is A mandate for the client's handling of the NFS4ERR_NO_GRACE error is
outside the scope of this specification, since the strategies for outside the scope of this specification, since the strategies for
such handling are very dependent on the client's operating such handling are very dependent on the client's operating
environment. However, one potential approach is described below. environment. However, one potential approach is described below.
When the client receives NFS4ERR_NO_GRACE, it could examine the When the client receives NFS4ERR_NO_GRACE, it could examine the
change attribute of the objects the client is trying to reclaim state change attribute of the objects the client is trying to reclaim state
for, and use that to determine whether to re-establish the state via for, and use that to determine whether to re-establish the state via
normal OPEN or LOCK requests. This is acceptable provided the normal OPEN or LOCK requests. This is acceptable provided the
client's operating environment allows it. In otherwords, the client client's operating environment allows it. In other words, the client
implementor is advised to document for his users the behavior. The implementor is advised to document for his users the behavior. The
client could also inform the application that its record lock or client could also inform the application that its byte-range lock or
share reservations (whether they were delegated or not) have been share reservations (whether they were delegated or not) have been
lost, such as via a UNIX signal, a GUI pop-up window, etc. See lost, such as via a UNIX signal, a GUI pop-up window, etc. See
Section 10.5, for a discussion of what the client should do for Section 10.5, for a discussion of what the client should do for
dealing with unreclaimed delegations on client state. dealing with unreclaimed delegations on client state.
For further discussion of revocation of locks see Section 9.8. For further discussion of revocation of locks see Section 9.8.
9.6.3.2. Client's Reaction to a Freed Lock
There is no way for a client to predetermine how a given server is
going to behave during a network partition. When the partition
heals, either the client still has all of its locks, it has some of
its locks, or it has none of them. The client will be able to
examine the various error return values to determine its response.
NFS4ERR_EXPIRED:
All locks has been revoked during the partition. The client
should use a SETCLIENTID to recover.
NFS4ERR_ADMIN_REVOKED:
The current lock has been revoked during the partition and there
is no clue as to whether the server rebooted.
NFS4ERR_BAD_STATEID:
The current lock has been revoked during the partition and the
server did not reboot. Other locks MAY still be renewed. The
client MAY NOT want to do a SETCLIENTID and instead SHOULD probe
via a RENEW call.
NFS4ERR_NO_GRACE:
The current lock has been revoked during the partition and the
server rebooted. The server might have no information on the
other locks. They may still be renewable.
NFS4ERR_OLD_STATEID:
The server has not rebooted. The client SHOULD handle this error
as it normally would.
9.7. Recovery from a Lock Request Timeout or Abort 9.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
skipping to change at page 126, line 50 skipping to change at page 136, line 8
the locks governed by that stateid and re-established the appropriate the locks governed by that stateid and re-established the appropriate
state between itself and the server. 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.
9.9. Share Reservations 9.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 byte-range locking.
client opens a file, it issues an OPEN operation to the server When a 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 (OPEN4_SHARE_DENY_NONE,
the OPEN fails the client will fail the application's open request. OPEN4_SHARE_DENY_READ, OPEN4_SHARE_DENY_WRITE, or
OPEN4_SHARE_DENY_BOTH). If 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 == 0) if (request.access == 0)
return (NFS4ERR_INVAL) return (NFS4ERR_INVAL)
else if ((request.access & file_state.deny)) || else 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 This checking of share reservations on OPEN is done with no exception
skipping to change at page 127, line 37 skipping to change at page 136, line 46
const OPEN4_SHARE_DENY_WRITE = 0x00000002; const OPEN4_SHARE_DENY_WRITE = 0x00000002;
const OPEN4_SHARE_DENY_BOTH = 0x00000003; const OPEN4_SHARE_DENY_BOTH = 0x00000003;
9.10. OPEN/CLOSE Operations 9.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 access, if any, to deny. Even if the client intends access and what access, if any, to deny. Even if the client intends
to use a stateid of all 0's or all 1's, it must still obtain the to use a stateid of all 0's or all 1's, it must still obtain the
filehandle for the regular file with the OPEN operation so the filehandle for the regular file with the OPEN operation so the
appropriate share semantics can be applied. For clients that do not appropriate share semantics can be applied. Clients that do not have
have a deny mode built into their open programming interfaces, deny a deny mode built into their programming interfaces for opening a
equal to NONE should be used. file should request a deny mode of OPEN4_SHARE_DENY_NONE.
The OPEN operation with the CREATE flag, also subsumes the CREATE The OPEN operation with the CREATE flag, also subsumes the CREATE
operation for regular files as used in previous versions of the NFS operation for regular files as used in previous versions of the NFS
protocol. This allows a create with a share to be done atomically. protocol. This allows a create with a share to be done atomically.
The CLOSE operation removes all share reservations held by the The CLOSE operation removes all share reservations held by the
lock_owner on that file. If record locks are held, the client SHOULD lock_owner on that file. If byte-range locks are held, the client
release all locks before issuing a CLOSE. The server MAY free all SHOULD release all locks before issuing a CLOSE. The server MAY free
outstanding locks on CLOSE but some servers may not support the CLOSE all outstanding locks on CLOSE but some servers may not support the
of a file that still has record locks held. The server MUST return CLOSE of a file that still has byte-range locks held. The server
failure, NFS4ERR_LOCKS_HELD, if any locks would exist after the MUST return failure, NFS4ERR_LOCKS_HELD, if any locks would exist
CLOSE. after the CLOSE.
The LOOKUP operation will return a filehandle without establishing The LOOKUP operation will return a filehandle without establishing
any lock state on the server. Without a valid stateid, the server any lock state on the server. Without a valid stateid, the server
will assume the client has the least access. For example, a file will assume the client has the least access. For example, if one
opened with deny READ/WRITE cannot be accessed using a filehandle client opened a file with OPEN4_SHARE_DENY_BOTH and another client
obtained through LOOKUP because it would not have a valid stateid accesses the file via a filehandle obtained through LOOKUP, the
(i.e., using a stateid of all bits 0 or all bits 1). second client could only read the file using the special read bypass
stateid. The second client could not WRITE the file at all because
it would not have a valid stateid from OPEN and the special anonymous
stateid would not be allowed access.
9.10.1. Close and Retention of State Information 9.10.1. Close and Retention of State Information
Since a CLOSE operation requests deallocation of a stateid, dealing Since a CLOSE operation requests deallocation of a stateid, dealing
with retransmission of the CLOSE, may pose special difficulties, with retransmission of the CLOSE, may pose special difficulties,
since the state information, which normally would be used to since the state information, which normally would be used to
determine the state of the open file being designated, might be determine the state of the open file being designated, might be
deallocated, resulting in an NFS4ERR_BAD_STATEID error. deallocated, resulting in an NFS4ERR_BAD_STATEID error.
Servers may deal with this problem in a number of ways. To provide Servers may deal with this problem in a number of ways. To provide
skipping to change at page 129, line 28 skipping to change at page 138, line 39
stateids and will require separate CLOSEs to free them. stateids and will require separate CLOSEs to free them.
When multiple open files on the client are merged into a single open When multiple open files on the client are merged into a single open
file object on the server, the close of one of the open files (on the file object on the server, the close of one of the open files (on the
client) may necessitate change of the access and deny status of the client) may necessitate change of the access and deny status of the
open file on the server. This is because the union of the access and open file on the server. This is because the union of the access and
deny bits for the remaining opens may be smaller (i.e., a proper deny bits for the remaining opens may be smaller (i.e., a proper
subset) than previously. The OPEN_DOWNGRADE operation is used to subset) than previously. The OPEN_DOWNGRADE operation is used to
make the necessary change and the client should use it to update the make the necessary change and the client should use it to update the
server so that share reservation requests by other clients are server so that share reservation requests by other clients are
handled properly. handled properly. The stateid returned has the same "other" field as
that passed to the server. The "seqid" value in the returned stateid
MUST be incremented, even in situations in which there is no change
to the access and deny bits for the file.
9.12. Short and Long Leases 9.12. Short and Long Leases
When determining the time period for the server lease, the usual When determining the time period for the server lease, the usual
lease tradeoffs apply. Short leases are good for fast server lease tradeoffs apply. Short leases are good for fast server
recovery at a cost of increased RENEW or READ (with zero length) recovery at a cost of increased RENEW or READ (with zero length)
requests. Longer leases are certainly kinder and gentler to servers requests. Longer leases are certainly kinder and gentler to servers
trying to handle very large numbers of clients. The number of RENEW trying to handle very large numbers of clients. The number of RENEW
requests drop in proportion to the lease time. The disadvantages of requests drop in proportion to the lease time. The disadvantages of
long leases are slower recovery after server failure (the server must long leases are slower recovery after server failure (the server must
skipping to change at page 130, line 38 skipping to change at page 139, line 48
for an automatic method to determine an appropriate lease period, the for an automatic method to determine an appropriate lease period, the
server's administrator may have to tune the lease period. server's administrator may have to tune the lease period.
9.14. Migration, Replication and State 9.14. Migration, Replication and State
When responsibility for handling a given file system is transferred When responsibility for handling a given file system is transferred
to a new server (migration) or the client chooses to use an alternate to a new server (migration) or the client chooses to use an alternate
server (e.g., in response to server unresponsiveness) in the context server (e.g., in response to server unresponsiveness) in the context
of file system replication, the appropriate handling of state shared of file system replication, the appropriate handling of state shared
between the client and server (i.e., locks, leases, stateids, and between the client and server (i.e., locks, leases, stateids, and
clientids) is as described below. The handling differs between client IDs) is as described below. The handling differs between
migration and replication. For related discussion of file server migration and replication. For related discussion of file server
state and recover of such see the sections under Section 9.6. state and recover of such see the sections under Section 9.6.
If a server replica or a server immigrating a filesystem agrees to, If a server replica or a server immigrating a filesystem agrees to,
or is expected to, accept opaque values from the client that or is expected to, accept opaque values from the client that
originated from another server, then it is a wise implementation originated from another server, then it is a wise implementation
practice for the servers to encode the "opaque" values in network practice for the servers to encode the "opaque" values in network
byte order. This way, servers acting as replicas or immigrating byte order. This way, servers acting as replicas or immigrating
filesystems will be able to parse values like stateids, directory filesystems will be able to parse values like stateids, directory
cookies, filehandles, etc. even if their native byte order is cookies, filehandles, etc. even if their native byte order is
skipping to change at page 131, line 14 skipping to change at page 140, line 24
9.14.1. Migration and State 9.14.1. Migration and State
In the case of migration, the servers involved in the migration of a In the case of migration, the servers involved in the migration of a
filesystem SHOULD transfer all server state from the original to the filesystem SHOULD transfer all server state from the original to the
new server. This must be done in a way that is transparent to the new server. This must be done in a way that is transparent to the
client. This state transfer will ease the client's transition when a client. This state transfer will ease the client's transition when a
filesystem migration occurs. If the servers are successful in filesystem migration occurs. If the servers are successful in
transferring all state, the client will continue to use stateids transferring all state, the client will continue to use stateids
assigned by the original server. Therefore the new server must assigned by the original server. Therefore the new server must
recognize these stateids as valid. This holds true for the clientid recognize these stateids as valid. This holds true for the client ID
as well. Since responsibility for an entire filesystem is as well. Since responsibility for an entire filesystem is
transferred with a migration event, there is no possibility that transferred with a migration event, there is no possibility that
conflicts will arise on the new server as a result of the transfer of conflicts will arise on the new server as a result of the transfer of
locks. locks.
As part of the transfer of information between servers, leases would As part of the transfer of information between servers, leases would
be transferred as well. The leases being transferred to the new be transferred as well. The leases being transferred to the new
server will typically have a different expiration time from those for server will typically have a different expiration time from those for
the same client, previously on the old server. To maintain the the same client, previously on the old server. To maintain the
property that all leases on a given server for a given client expire property that all leases on a given server for a given client expire
skipping to change at page 131, line 50 skipping to change at page 141, line 11
A client SHOULD re-establish new callback information with the new A client SHOULD re-establish new callback information with the new
server as soon as possible, according to sequences described in server as soon as possible, according to sequences described in
Section 15.35 and Section 15.36. This ensures that server operations Section 15.35 and Section 15.36. This ensures that server operations
are not blocked by the inability to recall delegations. are not blocked by the inability to recall delegations.
9.14.2. Replication and State 9.14.2. Replication and State
Since client switch-over in the case of replication is not under Since client switch-over in the case of replication is not under
server control, the handling of state is different. In this case, server control, the handling of state is different. In this case,
leases, stateids and clientids do not have validity across a leases, stateids and client IDs do not have validity across a
transition from one server to another. The client must re-establish transition from one server to another. The client must re-establish
its locks on the new server. This can be compared to the re- its locks on the new server. This can be compared to the re-
establishment of locks by means of reclaim-type requests after a establishment of locks by means of reclaim-type requests after a
server reboot. The difference is that the server has no provision to server reboot. The difference is that the server has no provision to
distinguish requests reclaiming locks from those obtaining new locks distinguish requests reclaiming locks from those obtaining new locks
or to defer the latter. Thus, a client re-establishing a lock on the or to defer the latter. Thus, a client re-establishing a lock on the
new server (by means of a LOCK or OPEN request), may have the new server (by means of a LOCK or OPEN request), may have the
requests denied due to a conflicting lock. Since replication is requests denied due to a conflicting lock. Since replication is
intended for read-only use of filesystems, such denial of locks intended for read-only use of filesystems, such denial of locks
should not pose large difficulties in practice. When an attempt to should not pose large difficulties in practice. When an attempt to
skipping to change at page 133, line 49 skipping to change at page 143, line 11
Client-side caching of data, of file attributes, and of file names is Client-side caching of data, of file attributes, and of file names is
essential to providing good performance with the NFS protocol. essential to providing good performance with the NFS protocol.
Providing distributed cache coherence is a difficult problem and Providing distributed cache coherence is a difficult problem and
previous versions of the NFS protocol have not attempted it. previous versions of the NFS protocol have not attempted it.
Instead, several NFS client implementation techniques have been used Instead, several NFS client implementation techniques have been used
to reduce the problems that a lack of coherence poses for users. to reduce the problems that a lack of coherence poses for users.
These techniques have not been clearly defined by earlier protocol These techniques have not been clearly defined by earlier protocol
specifications and it is often unclear what is valid or invalid specifications and it is often unclear what is valid or invalid
client behavior. client behavior.
The NFS version 4 protocol uses many techniques similar to those that The NFSv4 protocol uses many techniques similar to those that have
have been used in previous protocol versions. The NFS version 4 been used in previous protocol versions. The NFSv4 protocol does not
protocol does not provide distributed cache coherence. However, it provide distributed cache coherence. However, it defines a more
defines a more limited set of caching guarantees to allow locks and limited set of caching guarantees to allow locks and share
share reservations to be used without destructive interference from reservations to be used without destructive interference from client
client side caching. side caching.
In addition, the NFS version 4 protocol introduces a delegation In addition, the NFSv4 protocol introduces a delegation mechanism
mechanism which allows many decisions normally made by the server to which allows many decisions normally made by the server to be made
be made locally by clients. This mechanism provides efficient locally by clients. This mechanism provides efficient support of the
support of the common cases where sharing is infrequent or where common cases where sharing is infrequent or where sharing is read-
sharing is read-only. only.
10.1. Performance Challenges for Client-Side Caching 10.1. Performance Challenges for Client-Side Caching
Caching techniques used in previous versions of the NFS protocol have Caching techniques used in previous versions of the NFS protocol have
been successful in providing good performance. However, several been successful in providing good performance. However, several
scalability challenges can arise when those techniques are used with scalability challenges can arise when those techniques are used with
very large numbers of clients. This is particularly true when very large numbers of clients. This is particularly true when
clients are geographically distributed which classically increases clients are geographically distributed which classically increases
the latency for cache revalidation requests. the latency for cache re-validation requests.
The previous versions of the NFS protocol repeat their file data The previous versions of the NFS protocol repeat their file data
cache validation requests at the time the file is opened. This cache validation requests at the time the file is opened. This
behavior can have serious performance drawbacks. A common case is behavior can have serious performance drawbacks. A common case is
one in which a file is only accessed by a single client. Therefore, one in which a file is only accessed by a single client. Therefore,
sharing is infrequent. sharing is infrequent.
In this case, repeated reference to the server to find that no In this case, repeated reference to the server to find that no
conflicts exist is expensive. A better option with regards to conflicts exist is expensive. A better option with regards to
performance is to allow a client that repeatedly opens a file to do performance is to allow a client that repeatedly opens a file to do
skipping to change at page 134, line 44 skipping to change at page 144, line 5
conflicting operations from another client actually occur. conflicting operations from another client actually occur.
A similar situation arises in connection with file locking. Sending A similar situation arises in connection with file locking. Sending
file lock and unlock requests to the server as well as the read and file lock and unlock requests to the server as well as the read and
write requests necessary to make data caching consistent with the write requests necessary to make data caching consistent with the
locking semantics (see Section 10.3.2) can severely limit locking semantics (see Section 10.3.2) can severely limit
performance. When locking is used to provide protection against performance. When locking is used to provide protection against
infrequent conflicts, a large penalty is incurred. This penalty may infrequent conflicts, a large penalty is incurred. This penalty may
discourage the use of file locking by applications. discourage the use of file locking by applications.
The NFS version 4 protocol provides more aggressive caching The NFSv4 protocol provides more aggressive caching strategies with
strategies with the following design goals: the following design goals:
o Compatibility with a large range of server semantics. o Compatibility with a large range of server semantics.
o Provide the same caching benefits as previous versions of the NFS o Provide the same caching benefits as previous versions of the NFS
protocol when unable to provide the more aggressive model. protocol when unable to provide the more aggressive model.
o Requirements for aggressive caching are organized so that a large o Requirements for aggressive caching are organized so that a large
portion of the benefit can be obtained even when not all of the portion of the benefit can be obtained even when not all of the
requirements can be met. requirements can be met.
skipping to change at page 135, line 28 skipping to change at page 144, line 36
"callback" RPC from server to client, a server recalls delegated "callback" RPC from server to client, a server recalls delegated
responsibilities when another client engages in sharing of a responsibilities when another client engages in sharing of a
delegated file. delegated file.
A delegation is passed from the server to the client, specifying the A delegation is passed from the server to the client, specifying the
object of the delegation and the type of delegation. There are object of the delegation and the type of delegation. There are
different types of delegations but each type contains a stateid to be different types of delegations but each type contains a stateid to be
used to represent the delegation when performing operations that used to represent the delegation when performing operations that
depend on the delegation. This stateid is similar to those depend on the delegation. This stateid is similar to those
associated with locks and share reservations but differs in that the associated with locks and share reservations but differs in that the
stateid for a delegation is associated with a clientid and may be stateid for a delegation is associated with a client ID and may be
used on behalf of all the open_owners for the given client. A used on behalf of all the open_owners for the given client. A
delegation is made to the client as a whole and not to any specific delegation is made to the client as a whole and not to any specific
process or thread of control within it. process or thread of control within it.
Because callback RPCs may not work in all environments (due to Because callback RPCs may not work in all environments (due to
firewalls, for example), correct protocol operation does not depend firewalls, for example), correct protocol operation does not depend
on them. Preliminary testing of callback functionality by means of a on them. Preliminary testing of callback functionality by means of a
CB_NULL procedure determines whether callbacks can be supported. The CB_NULL procedure determines whether callbacks can be supported. The
CB_NULL procedure checks the continuity of the callback path. A CB_NULL procedure checks the continuity of the callback path. A
server makes a preliminary assessment of callback availability to a server makes a preliminary assessment of callback availability to a
skipping to change at page 137, line 4 skipping to change at page 146, line 10
able to determine that a limit has been reached because each new able to determine that a limit has been reached because each new
delegation request results in a revoke. The client could then delegation request results in a revoke. The client could then
determine which delegations it may not need and preemptively release determine which delegations it may not need and preemptively release
them. them.
10.2.1. Delegation Recovery 10.2.1. Delegation Recovery
There are three situations that delegation recovery must deal with: There are three situations that delegation recovery must deal with:
o Client reboot or restart o Client reboot or restart
o Server reboot or restart o Server reboot or restart
o Network partition (full or callback-only) o Network partition (full or callback-only)
In the event the client reboots or restarts, the failure to renew In the event the client reboots or restarts, the failure to renew
leases will result in the revocation of record locks and share leases will result in the revocation of byte-range locks and share
reservations. Delegations, however, may be treated a bit reservations. Delegations, however, may be treated a bit
differently. differently.
There will be situations in which delegations will need to be There will be situations in which delegations will need to be
reestablished after a client reboots or restarts. The reason for reestablished after a client reboots or restarts. The reason for
this is the client may have file data stored locally and this data this is the client may have file data stored locally and this data
was associated with the previously held delegations. The client will was associated with the previously held delegations. The client will
need to reestablish the appropriate file state on the server. need to reestablish the appropriate file state on the server.
To allow for this type of client recovery, the server MAY extend the To allow for this type of client recovery, the server MAY extend the
skipping to change at page 137, line 41 skipping to change at page 146, line 48
A server MAY support a claim type of CLAIM_DELEGATE_PREV, but if it A server MAY support a claim type of CLAIM_DELEGATE_PREV, but if it
does, it MUST NOT remove delegations upon SETCLIENTID_CONFIRM, and does, it MUST NOT remove delegations upon SETCLIENTID_CONFIRM, and
instead MUST, for a period of time no less than that of the value of instead MUST, for a period of time no less than that of the value of
the lease_time attribute, maintain the client's delegations to allow the lease_time attribute, maintain the client's delegations to allow
time for the client to issue CLAIM_DELEGATE_PREV requests. The time for the client to issue CLAIM_DELEGATE_PREV requests. The
server that supports CLAIM_DELEGATE_PREV MUST support the DELEGPURGE server that supports CLAIM_DELEGATE_PREV MUST support the DELEGPURGE
operation. operation.
When the server reboots or restarts, delegations are reclaimed (using When the server reboots or restarts, delegations are reclaimed (using
the OPEN operation with CLAIM_PREVIOUS) in a similar fashion to the OPEN operation with CLAIM_PREVIOUS) in a similar fashion to byte-
record locks and share reservations. However, there is a slight range locks and share reservations. However, there is a slight
semantic difference. In the normal case if the server decides that a semantic difference. In the normal case if the server decides that a
delegation should not be granted, it performs the requested action delegation should not be granted, it performs the requested action
(e.g., OPEN) without granting any delegation. For reclaim, the (e.g., OPEN) without granting any delegation. For reclaim, the
server grants the delegation but a special designation is applied so server grants the delegation but a special designation is applied so
that the client treats the delegation as having been granted but that the client treats the delegation as having been granted but
recalled by the server. Because of this, the client has the duty to recalled by the server. Because of this, the client has the duty to
write all modified state to the server and then return the write all modified state to the server and then return the
delegation. This process of handling delegation reclaim reconciles delegation. This process of handling delegation reclaim reconciles
three principles of the NFS version 4 protocol: three principles of the NFSv4 protocol:
o Upon reclaim, a client reporting resources assigned to it by an o Upon reclaim, a client reporting resources assigned to it by an
earlier server instance must be granted those resources. earlier server instance must be granted those resources.
o The server has unquestionable authority to determine whether o The server has unquestionable authority to determine whether
delegations are to be granted and, once granted, whether they are delegations are to be granted and, once granted, whether they are
to be continued. to be continued.
o The use of callbacks is not to be depended upon until the client o The use of callbacks is not to be depended upon until the client
has proven its ability to receive them. has proven its ability to receive them.
skipping to change at page 138, line 35 skipping to change at page 147, line 41
requests are held off. Eventually the occurrence of a conflicting requests are held off. Eventually the occurrence of a conflicting
request from another client will cause revocation of the delegation. request from another client will cause revocation of the delegation.
A loss of the callback path (e.g., by later network configuration A loss of the callback path (e.g., by later network configuration
change) will have the same effect. A recall request will fail and change) will have the same effect. A recall request will fail and
revocation of the delegation will result. revocation of the delegation will result.
A client normally finds out about revocation of a delegation when it A client normally finds out about revocation of a delegation when it
uses a stateid associated with a delegation and receives the error uses a stateid associated with a delegation and receives the error
NFS4ERR_EXPIRED. It also may find out about delegation revocation NFS4ERR_EXPIRED. It also may find out about delegation revocation
after a client reboot when it attempts to reclaim a delegation and after a client reboot when it attempts to reclaim a delegation and
receives that same error. Note that in the case of a revoked write receives that same error. Note that in the case of a revoked
open delegation, there are issues because data may have been modified OPEN_DELEGATE_WRITE delegation, there are issues because data may
by the client whose delegation is revoked and separately by other have been modified by the client whose delegation is revoked and
clients. See Section 10.5.1 for a discussion of such issues. Note separately by other clients. See Section 10.5.1 for a discussion of
also that when delegations are revoked, information about the revoked such issues. Note also that when delegations are revoked,
delegation will be written by the server to stable storage (as information about the revoked delegation will be written by the
described in Section 9.6). This is done to deal with the case in server to stable storage (as described in Section 9.6). This is done
which a server reboots after revoking a delegation but before the to deal with the case in which a server reboots after revoking a
client holding the revoked delegation is notified about the delegation but before the client holding the revoked delegation is
revocation. notified about the revocation.
10.3. Data Caching 10.3. Data Caching
When applications share access to a set of files, they need to be When applications share access to a set of files, they need to be
implemented so as to take account of the possibility of conflicting implemented so as to take account of the possibility of conflicting
access by another application. This is true whether the applications access by another application. This is true whether the applications
in question execute on different clients or reside on the same in question execute on different clients or reside on the same
client. client.
Share reservations and record locks are the facilities the NFS Share reservations and byte-range locks are the facilities the NFS
version 4 protocol provides to allow applications to coordinate version 4 protocol provides to allow applications to coordinate
access by providing mutual exclusion facilities. The NFS version 4 access by providing mutual exclusion facilities. The NFSv4
protocol's data caching must be implemented such that it does not protocol's data caching must be implemented such that it does not
invalidate the assumptions that those using these facilities depend invalidate the assumptions that those using these facilities depend
upon. upon.
10.3.1. Data Caching and OPENs 10.3.1. Data Caching and OPENs
In order to avoid invalidating the sharing assumptions that In order to avoid invalidating the sharing assumptions that
applications rely on, NFS version 4 clients should not provide cached applications rely on, NFSv4 clients should not provide cached data to
data to applications or modify it on behalf of an application when it applications or modify it on behalf of an application when it would
would not be valid to obtain or modify that same data via a READ or not be valid to obtain or modify that same data via a READ or WRITE
WRITE operation. operation.
Furthermore, in the absence of open delegation (see Section 10.4) two Furthermore, in the absence of open delegation (see Section 10.4) two
additional rules apply. Note that these rules are obeyed in practice additional rules apply. Note that these rules are obeyed in practice
by many NFS version 2 and version 3 clients. by many NFSv2 and NFSv3 clients.
o First, cached data present on a client must be revalidated after o First, cached data present on a client must be revalidated after
doing an OPEN. Revalidating means that the client fetches the doing an OPEN. Revalidating means that the client fetches the
change attribute from the server, compares it with the cached change attribute from the server, compares it with the cached
change attribute, and if different, declares the cached data (as change attribute, and if different, declares the cached data (as
well as the cached attributes) as invalid. This is to ensure that well as the cached attributes) as invalid. This is to ensure that
the data for the OPENed file is still correctly reflected in the the data for the OPENed file is still correctly reflected in the
client's cache. This validation must be done at least when the client's cache. This validation must be done at least when the
client's OPEN operation includes DENY=WRITE or BOTH thus client's OPEN operation includes DENY=WRITE or BOTH thus
terminating a period in which other clients may have had the terminating a period in which other clients may have had the
opportunity to open the file with WRITE access. Clients may opportunity to open the file with WRITE access. Clients may
choose to do the revalidation more often (i.e., at OPENs choose to do the revalidation more often (i.e., at OPENs
specifying DENY=NONE) to parallel the NFS version 3 protocol's specifying DENY=NONE) to parallel the NFSv3 protocol's practice
practice for the benefit of users assuming this degree of cache for the benefit of users assuming this degree of cache
revalidation. Since the change attribute is updated for data and revalidation. Since the change attribute is updated for data and
metadata modifications, some client implementors may be tempted to metadata modifications, some client implementors may be tempted to
use the time_modify attribute and not change to validate cached use the time_modify attribute and not change to validate cached
data, so that metadata changes do not spuriously invalidate clean data, so that metadata changes do not spuriously invalidate clean
data. The implementor is cautioned in this approach. The change data. The implementor is cautioned in this approach. The change
attribute is guaranteed to change for each update to the file, attribute is guaranteed to change for each update to the file,
whereas time_modify is guaranteed to change only at the whereas time_modify is guaranteed to change only at the
granularity of the time_delta attribute. Use by the client's data granularity of the time_delta attribute. Use by the client's data
cache validation logic of time_modify and not change runs the risk cache validation logic of time_modify and not change runs the risk
of the client incorrectly marking stale data as valid. of the client incorrectly marking stale data as valid.
skipping to change at page 140, line 27 skipping to change at page 149, line 35
operations executed. This is as opposed to file locking that is operations executed. This is as opposed to file locking that is
based on pure convention. For example, it is possible to manipulate based on pure convention. For example, it is possible to manipulate
a two-megabyte file by dividing the file into two one-megabyte a two-megabyte file by dividing the file into two one-megabyte
regions and protecting access to the two regions by file locks on regions and protecting access to the two regions by file locks on
bytes zero and one. A lock for write on byte zero of the file would bytes zero and one. A lock for write on byte zero of the file would
represent the right to do READ and WRITE operations on the first represent the right to do READ and WRITE operations on the first
region. A lock for write on byte one of the file would represent the region. A lock for write on byte one of the file would represent the
right to do READ and WRITE operations on the second region. As long right to do READ and WRITE operations on the second region. As long
as all applications manipulating the file obey this convention, they as all applications manipulating the file obey this convention, they
will work on a local filesystem. However, they may not work with the will work on a local filesystem. However, they may not work with the
NFS version 4 protocol unless clients refrain from data caching. NFSv4 protocol unless clients refrain from data caching.
The rules for data caching in the file locking environment are: The rules for data caching in the file locking environment are:
o First, when a client obtains a file lock for a particular region, o First, when a client obtains a file lock for a particular region,
the data cache corresponding to that region (if any cached data the data cache corresponding to that region (if any cached data
exists) must be revalidated. If the change attribute indicates exists) must be revalidated. If the change attribute indicates
that the file may have been updated since the cached data was that the file may have been updated since the cached data was
obtained, the client must flush or invalidate the cached data for obtained, the client must flush or invalidate the cached data for
the newly locked region. A client might choose to invalidate all the newly locked region. A client might choose to invalidate all
of non-modified cached data that it has for the file but the only of non-modified cached data that it has for the file but the only
skipping to change at page 141, line 20 skipping to change at page 150, line 28
client possesses may not be valid. client possesses may not be valid.
The data that is written to the server as a prerequisite to the The data that is written to the server as a prerequisite to the
unlocking of a region must be written, at the server, to stable unlocking of a region must be written, at the server, to stable
storage. The client may accomplish this either with synchronous storage. The client may accomplish this either with synchronous
writes or by following asynchronous writes with a COMMIT operation. writes or by following asynchronous writes with a COMMIT operation.
This is required because retransmission of the modified data after a This is required because retransmission of the modified data after a
server reboot might conflict with a lock held by another client. server reboot might conflict with a lock held by another client.
A client implementation may choose to accommodate applications which A client implementation may choose to accommodate applications which
use record locking in non-standard ways (e.g., using a record lock as use byte-range locking in non-standard ways (e.g., using a byte-range
a global semaphore) by flushing to the server more data upon a LOCKU lock as a global semaphore) by flushing to the server more data upon
than is covered by the locked range. This may include modified data a LOCKU than is covered by the locked range. This may include
within files other than the one for which the unlocks are being done. modified data within files other than the one for which the unlocks
In such cases, the client must not interfere with applications whose are being done. In such cases, the client must not interfere with
READs and WRITEs are being done only within the bounds of record applications whose READs and WRITEs are being done only within the
locks which the application holds. For example, an application locks bounds of record locks which the application holds. For example, an
a single byte of a file and proceeds to write that single byte. A application locks a single byte of a file and proceeds to write that
client that chose to handle a LOCKU by flushing all modified data to single byte. A client that chose to handle a LOCKU by flushing all
the server could validly write that single byte in response to an modified data to the server could validly write that single byte in
unrelated unlock. However, it would not be valid to write the entire response to an unrelated unlock. However, it would not be valid to
block in which that single written byte was located since it includes write the entire block in which that single written byte was located
an area that is not locked and might be locked by another client. since it includes an area that is not locked and might be locked by
Client implementations can avoid this problem by dividing files with another client. Client implementations can avoid this problem by
modified data into those for which all modifications are done to dividing files with modified data into those for which all
areas covered by an appropriate record lock and those for which there modifications are done to areas covered by an appropriate byte-range
are modifications not covered by a record lock. Any writes done for lock and those for which there are modifications not covered by a
the former class of files must not include areas not locked and thus byte-range lock. Any writes done for the former class of files must
not modified on the client. not include areas not locked and thus not modified on the client.
10.3.3. Data Caching and Mandatory File Locking 10.3.3. Data Caching and Mandatory File Locking
Client side data caching needs to respect mandatory file locking when Client side data caching needs to respect mandatory file locking when
it is in effect. The presence of mandatory file locking for a given it is in effect. The presence of mandatory file locking for a given
file is indicated when the client gets back NFS4ERR_LOCKED from a file is indicated when the client gets back NFS4ERR_LOCKED from a
READ or WRITE on a file it has an appropriate share reservation for. READ or WRITE on a file it has an appropriate share reservation for.
When mandatory locking is in effect for a file, the client must check When mandatory locking is in effect for a file, the client must check
for an appropriate file lock for data being read or written. If a for an appropriate file lock for data being read or written. If a
lock exists for the range being read or written, the client may lock exists for the range being read or written, the client may
skipping to change at page 142, line 13 skipping to change at page 151, line 20
the read or write request must not be satisfied by the client's cache the read or write request must not be satisfied by the client's cache
and the request must be sent to the server for processing. When a and the request must be sent to the server for processing. When a
read or write request partially overlaps a locked region, the request read or write request partially overlaps a locked region, the request
should be subdivided into multiple pieces with each region (locked or should be subdivided into multiple pieces with each region (locked or
not) treated appropriately. not) treated appropriately.
10.3.4. Data Caching and File Identity 10.3.4. Data Caching and File Identity
When clients cache data, the file data needs to be organized When clients cache data, the file data needs to be organized
according to the filesystem object to which the data belongs. For according to the filesystem object to which the data belongs. For
NFS version 3 clients, the typical practice has been to assume for NFSv3 clients, the typical practice has been to assume for the
the purpose of caching that distinct filehandles represent distinct purpose of caching that distinct filehandles represent distinct
filesystem objects. The client then has the choice to organize and filesystem objects. The client then has the choice to organize and
maintain the data cache on this basis. maintain the data cache on this basis.
In the NFS version 4 protocol, there is now the possibility to have In the NFSv4 protocol, there is now the possibility to have
significant deviations from a "one filehandle per object" model significant deviations from a "one filehandle per object" model
because a filehandle may be constructed on the basis of the object's because a filehandle may be constructed on the basis of the object's
pathname. Therefore, clients need a reliable method to determine if pathname. Therefore, clients need a reliable method to determine if
two filehandles designate the same filesystem object. If clients two filehandles designate the same filesystem object. If clients
were simply to assume that all distinct filehandles denote distinct were simply to assume that all distinct filehandles denote distinct
objects and proceed to do data caching on this basis, caching objects and proceed to do data caching on this basis, caching
inconsistencies would arise between the distinct client side objects inconsistencies would arise between the distinct client side objects
which mapped to the same server side object. which mapped to the same server side object.
By providing a method to differentiate filehandles, the NFS version 4 By providing a method to differentiate filehandles, the NFSv4
protocol alleviates a potential functional regression in comparison protocol alleviates a potential functional regression in comparison
with the NFS version 3 protocol. Without this method, caching with the NFSv3 protocol. Without this method, caching
inconsistencies within the same client could occur and this has not inconsistencies within the same client could occur and this has not
been present in previous versions of the NFS protocol. Note that it been present in previous versions of the NFS protocol. Note that it
is possible to have such inconsistencies with applications executing is possible to have such inconsistencies with applications executing
on multiple clients but that is not the issue being addressed here. on multiple clients but that is not the issue being addressed here.
For the purposes of data caching, the following steps allow an NFS For the purposes of data caching, the following steps allow an NFSv4
version 4 client to determine whether two distinct filehandles denote client to determine whether two distinct filehandles denote the same
the same server side object: server side object:
o If GETATTR directed to two filehandles returns different values of o If GETATTR directed to two filehandles returns different values of
the fsid attribute, then the filehandles represent distinct the fsid attribute, then the filehandles represent distinct
objects. objects.
o If GETATTR for any file with an fsid that matches the fsid of the o If GETATTR for any file with an fsid that matches the fsid of the
two filehandles in question returns a unique_handles attribute two filehandles in question returns a unique_handles attribute
with a value of TRUE, then the two objects are distinct. with a value of TRUE, then the two objects are distinct.
o If GETATTR directed to the two filehandles does not return the o If GETATTR directed to the two filehandles does not return the
fileid attribute for both of the handles, then it cannot be fileid attribute for both of the handles, then it cannot be
determined whether the two objects are the same. Therefore, determined whether the two objects are the same. Therefore,
operations which depend on that knowledge (e.g., client side data operations which depend on that knowledge (e.g., client side data
caching) cannot be done reliably. caching) cannot be done reliably. Note that if GETATTR does not
return the fileid attribute for both filehandles, it will return
it for neither of the filehandles, since the fsid for both
filehandles is the same.
o If GETATTR directed to the two filehandles returns different o If GETATTR directed to the two filehandles returns different
values for the fileid attribute, then they are distinct objects. values for the fileid attribute, then they are distinct objects.
o Otherwise they are the same object. o Otherwise they are the same object.
10.4. Open Delegation 10.4. Open Delegation
When a file is being OPENed, the server may delegate further handling When a file is being OPENed, the server may delegate further handling
of opens and closes for that file to the opening client. Any such of opens and closes for that file to the opening client. Any such
skipping to change at page 143, line 44 skipping to change at page 153, line 9
o There should be no current delegation that conflicts with the o There should be no current delegation that conflicts with the
delegation being requested. delegation being requested.
o The probability of future conflicting open requests should be low o The probability of future conflicting open requests should be low
based on the recent history of the file. based on the recent history of the file.
o The existence of any server-specific semantics of OPEN/CLOSE that o The existence of any server-specific semantics of OPEN/CLOSE that
would make the required handling incompatible with the prescribed would make the required handling incompatible with the prescribed
handling that the delegated client would apply (see below). handling that the delegated client would apply (see below).
There are two types of open delegations, read and write. A read open There are two types of open delegations, OPEN_DELEGATE_READ and
delegation allows a client to handle, on its own, requests to open a OPEN_DELEGATE_WRITE. A OPEN_DELEGATE_READ delegation allows a client
file for reading that do not deny read access to others. Multiple to handle, on its own, requests to open a file for reading that do
read open delegations may be outstanding simultaneously and do not not deny read access to others. Multiple OPEN_DELEGATE_READ
conflict. A write open delegation allows the client to handle, on delegations may be outstanding simultaneously and do not conflict. A
its own, all opens. Only one write open delegation may exist for a OPEN_DELEGATE_WRITE delegation allows the client to handle, on its
given file at a given time and it is inconsistent with any read open own, all opens. Only one OPEN_DELEGATE_WRITE delegation may exist
delegations. for a given file at a given time and it is inconsistent with any
OPEN_DELEGATE_READ delegations.
When a client has a read open delegation, it may not make any changes When a client has a OPEN_DELEGATE_READ delegation, it may not make
to the contents or attributes of the file but it is assured that no any changes to the contents or attributes of the file but it is
other client may do so. When a client has a write open delegation, assured that no other client may do so. When a client has a
it may modify the file data since no other client will be accessing OPEN_DELEGATE_WRITE delegation, it may modify the file data since no
the file's data. The client holding a write delegation may only other client will be accessing the file's data. The client holding a
affect file attributes which are intimately connected with the file OPEN_DELEGATE_WRITE delegation may only affect file attributes which
data: size, time_modify, change. are intimately connected with the file data: size, time_modify,
change.
When a client has an open delegation, it does not send OPENs or When a client has an open delegation, it does not send OPENs or
CLOSEs to the server but updates the appropriate status internally. CLOSEs to the server but updates the appropriate status internally.
For a read open delegation, opens that cannot be handled locally For a OPEN_DELEGATE_READ delegation, opens that cannot be handled
(opens for write or that deny read access) must be sent to the locally (opens for write or that deny read access) must be sent to
server. the server.
When an open delegation is made, the response to the OPEN contains an When an open delegation is made, the response to the OPEN contains an
open delegation structure which specifies the following: open delegation structure which specifies the following:
o the type of delegation (read or write) o the type of delegation (read or write)
o space limitation information to control flushing of data on close o space limitation information to control flushing of data on close
(write open delegation only, see Section 10.4.1) (OPEN_DELEGATE_WRITE delegation only, see Section 10.4.1)
o an nfsace4 specifying read and write permissions o an nfsace4 specifying read and write permissions
o a stateid to represent the delegation for READ and WRITE o a stateid to represent the delegation for READ and WRITE
The delegation stateid is separate and distinct from the stateid for The delegation stateid is separate and distinct from the stateid for
the OPEN proper. The standard stateid, unlike the delegation the OPEN proper. The standard stateid, unlike the delegation
stateid, is associated with a particular lock_owner and will continue stateid, is associated with a particular lock_owner and will continue
to be valid after the delegation is recalled and the file remains to be valid after the delegation is recalled and the file remains
open. open.
skipping to change at page 145, line 31 skipping to change at page 154, line 46
each user by use of the ACCESS operation. This should be the case each user by use of the ACCESS operation. This should be the case
even if an ACCESS operation would not be required otherwise. As even if an ACCESS operation would not be required otherwise. As
mentioned before, the server may enforce frequent authentication by mentioned before, the server may enforce frequent authentication by
returning an nfsace4 denying all access with every open delegation. returning an nfsace4 denying all access with every open delegation.
10.4.1. Open Delegation and Data Caching 10.4.1. Open Delegation and Data Caching
OPEN delegation allows much of the message overhead associated with OPEN delegation allows much of the message overhead associated with
the opening and closing files to be eliminated. An open when an open the opening and closing files to be eliminated. An open when an open
delegation is in effect does not require that a validation message be delegation is in effect does not require that a validation message be
sent to the server. The continued endurance of the "read open sent to the server. The continued endurance of the
delegation" provides a guarantee that no OPEN for write and thus no "OPEN_DELEGATE_READ delegation" provides a guarantee that no OPEN for
write has occurred. Similarly, when closing a file opened for write write and thus no write has occurred. Similarly, when closing a file
and if write open delegation is in effect, the data written does not opened for write and if OPEN_DELEGATE_WRITE delegation is in effect,
have to be flushed to the server until the open delegation is the data written does not have to be flushed to the server until the
recalled. The continued endurance of the open delegation provides a open delegation is recalled. The continued endurance of the open
guarantee that no open and thus no read or write has been done by delegation provides a guarantee that no open and thus no read or
another client. write has been done by another client.
For the purposes of open delegation, READs and WRITEs done without an For the purposes of open delegation, READs and WRITEs done without an
OPEN are treated as the functional equivalents of a corresponding OPEN are treated as the functional equivalents of a corresponding
type of OPEN. This refers to the READs and WRITEs that use the type of OPEN. This refers to the READs and WRITEs that use the
special stateids consisting of all zero bits or all one bits. special stateids consisting of all zero bits or all one bits.
Therefore, READs or WRITEs with a special stateid done by another Therefore, READs or WRITEs with a special stateid done by another
client will force the server to recall a write open delegation. A client will force the server to recall a OPEN_DELEGATE_WRITE
WRITE with a special stateid done by another client will force a delegation. A WRITE with a special stateid done by another client
recall of read open delegations. will force a recall of OPEN_DELEGATE_READ delegations.
With delegations, a client is able to avoid writing data to the With delegations, a client is able to avoid writing data to the
server when the CLOSE of a file is serviced. The file close system server when the CLOSE of a file is serviced. The file close system
call is the usual point at which the client is notified of a lack of call is the usual point at which the client is notified of a lack of
stable storage for the modified file data generated by the stable storage for the modified file data generated by the
application. At the close, file data is written to the server and application. At the close, file data is written to the server and
through normal accounting the server is able to determine if the through normal accounting the server is able to determine if the
available filesystem space for the data has been exceeded (i.e., available filesystem space for the data has been exceeded (i.e.,
server returns NFS4ERR_NOSPC or NFS4ERR_DQUOT). This accounting server returns NFS4ERR_NOSPC or NFS4ERR_DQUOT). This accounting
includes quotas. The introduction of delegations requires that a includes quotas. The introduction of delegations requires that a
skipping to change at page 146, line 26 skipping to change at page 155, line 42
original delegation. The server must make this assurance for all original delegation. The server must make this assurance for all
outstanding delegations. Therefore, the server must be careful in outstanding delegations. Therefore, the server must be careful in
its management of available space for new or modified data taking its management of available space for new or modified data taking
into account available filesystem space and any applicable quotas. into account available filesystem space and any applicable quotas.
The server can recall delegations as a result of managing the The server can recall delegations as a result of managing the
available filesystem space. The client should abide by the server's available filesystem space. The client should abide by the server's
state space limits for delegations. If the client exceeds the stated state space limits for delegations. If the client exceeds the stated
limits for the delegation, the server's behavior is undefined. limits for the delegation, the server's behavior is undefined.
Based on server conditions, quotas or available filesystem space, the Based on server conditions, quotas or available filesystem space, the
server may grant write open delegations with very restrictive space server may grant OPEN_DELEGATE_WRITE delegations with very
limitations. The limitations may be defined in a way that will restrictive space limitations. The limitations may be defined in a
always force modified data to be flushed to the server on close. way that will always force modified data to be flushed to the server
on close.
With respect to authentication, flushing modified data to the server With respect to authentication, flushing modified data to the server
after a CLOSE has occurred may be problematic. For example, the user after a CLOSE has occurred may be problematic. For example, the user
of the application may have logged off the client and unexpired of the application may have logged off the client and unexpired
authentication credentials may not be present. In this case, the authentication credentials may not be present. In this case, the
client may need to take special care to ensure that local unexpired client may need to take special care to ensure that local unexpired
credentials will in fact be available. This may be accomplished by credentials will in fact be available. This may be accomplished by
tracking the expiration time of credentials and flushing data well in tracking the expiration time of credentials and flushing data well in
advance of their expiration or by making private copies of advance of their expiration or by making private copies of
credentials to assure their availability when needed. credentials to assure their availability when needed.
10.4.2. Open Delegation and File Locks 10.4.2. Open Delegation and File Locks
When a client holds a write open delegation, lock operations may be When a client holds a OPEN_DELEGATE_WRITE delegation, lock operations
performed locally. This includes those required for mandatory file may be performed locally. This includes those required for mandatory
locking. This can be done since the delegation implies that there file locking. This can be done since the delegation implies that
can be no conflicting locks. Similarly, all of the revalidations there can be no conflicting locks. Similarly, all of the
that would normally be associated with obtaining locks and the revalidations that would normally be associated with obtaining locks
flushing of data associated with the releasing of locks need not be and the flushing of data associated with the releasing of locks need
done. not be done.
When a client holds a read open delegation, lock operations are not When a client holds a OPEN_DELEGATE_READ delegation, lock operations
performed locally. All lock operations, including those requesting are not performed locally. All lock operations, including those
non-exclusive locks, are sent to the server for resolution. requesting non-exclusive locks, are sent to the server for
resolution.
10.4.3. Handling of CB_GETATTR 10.4.3. Handling of CB_GETATTR
The server needs to employ special handling for a GETATTR where the The server needs to employ special handling for a GETATTR where the
target is a file that has a write open delegation in effect. The target is a file that has a OPEN_DELEGATE_WRITE delegation in effect.
reason for this is that the client holding the write delegation may The reason for this is that the client holding the
have modified the data and the server needs to reflect this change to OPEN_DELEGATE_WRITE delegation may have modified the data and the
the second client that submitted the GETATTR. Therefore, the client server needs to reflect this change to the second client that
holding the write delegation needs to be interrogated. The server submitted the GETATTR. Therefore, the client holding the
OPEN_DELEGATE_WRITE delegation needs to be interrogated. The server
will use the CB_GETATTR operation. The only attributes that the will use the CB_GETATTR operation. The only attributes that the
server can reliably query via CB_GETATTR are size and change. server can reliably query via CB_GETATTR are size and change.
Since CB_GETATTR is being used to satisfy another client's GETATTR Since CB_GETATTR is being used to satisfy another client's GETATTR
request, the server only needs to know if the client holding the request, the server only needs to know if the client holding the
delegation has a modified version of the file. If the client's copy delegation has a modified version of the file. If the client's copy
of the delegated file is not modified (data or size), the server can of the delegated file is not modified (data or size), the server can
satisfy the second client's GETATTR request from the attributes satisfy the second client's GETATTR request from the attributes
stored locally at the server. If the file is modified, the server stored locally at the server. If the file is modified, the server
only needs to know about this modified state. If the server only needs to know about this modified state. If the server
skipping to change at page 147, line 32 skipping to change at page 156, line 51
stored locally at the server. If the file is modified, the server stored locally at the server. If the file is modified, the server
only needs to know about this modified state. If the server only needs to know about this modified state. If the server
determines that the file is currently modified, it will respond to determines that the file is currently modified, it will respond to
the second client's GETATTR as if the file had been modified locally the second client's GETATTR as if the file had been modified locally
at the server. at the server.
Since the form of the change attribute is determined by the server Since the form of the change attribute is determined by the server
and is opaque to the client, the client and server need to agree on a and is opaque to the client, the client and server need to agree on a
method of communicating the modified state of the file. For the size method of communicating the modified state of the file. For the size
attribute, the client will report its current view of the file size. attribute, the client will report its current view of the file size.
For the change attribute, the handling is more involved. For the change attribute, the handling is more involved.
For the client, the following steps will be taken when receiving a For the client, the following steps will be taken when receiving a
write delegation: OPEN_DELEGATE_WRITE delegation:
o The value of the change attribute will be obtained from the server o The value of the change attribute will be obtained from the server
and cached. Let this value be represented by c. and cached. Let this value be represented by c.
o The client will create a value greater than c that will be used o The client will create a value greater than c that will be used
for communicating modified data is held at the client. Let this for communicating modified data is held at the client. Let this
value be represented by d. value be represented by d.
o When the client is queried via CB_GETATTR for the change o When the client is queried via CB_GETATTR for the change
attribute, it checks to see if it holds modified data. If the attribute, it checks to see if it holds modified data. If the
skipping to change at page 148, line 20 skipping to change at page 157, line 38
While the change attribute is opaque to the client in the sense that While the change attribute is opaque to the client in the sense that
it has no idea what units of time, if any, the server is counting it has no idea what units of time, if any, the server is counting
change with, it is not opaque in that the client has to treat it as change with, it is not opaque in that the client has to treat it as
an unsigned integer, and the server has to be able to see the results an unsigned integer, and the server has to be able to see the results
of the client's changes to that integer. Therefore, the server MUST of the client's changes to that integer. Therefore, the server MUST
encode the change attribute in network order when sending it to the encode the change attribute in network order when sending it to the
client. The client MUST decode it from network order to its native client. The client MUST decode it from network order to its native
order when receiving it and the client MUST encode it network order order when receiving it and the client MUST encode it network order
when sending it to the server. For this reason, change is defined as when sending it to the server. For this reason, change is defined as
an unsigned integer rather than an opaque array of octets. an unsigned integer rather than an opaque array of bytes.
For the server, the following steps will be taken when providing a For the server, the following steps will be taken when providing a
write delegation: OPEN_DELEGATE_WRITE delegation:
o Upon providing a write delegation, the server will cache a copy of o Upon providing a OPEN_DELEGATE_WRITE delegation, the server will
the change attribute in the data structure it uses to record the cache a copy of the change attribute in the data structure it uses
delegation. Let this value be represented by sc. to record the delegation. Let this value be represented by sc.
o When a second client sends a GETATTR operation on the same file to o When a second client sends a GETATTR operation on the same file to
the server, the server obtains the change attribute from the first the server, the server obtains the change attribute from the first
client. Let this value be cc. client. Let this value be cc.
o If the value cc is equal to sc, the file is not modified and the o If the value cc is equal to sc, the file is not modified and the
server returns the current values for change, time_metadata, and server returns the current values for change, time_metadata, and
time_modify (for example) to the second client. time_modify (for example) to the second client.
o If the value cc is NOT equal to sc, the file is currently modified o If the value cc is NOT equal to sc, the file is currently modified
skipping to change at page 149, line 6 skipping to change at page 158, line 23
requester. The server replaces sc in the delegation record with requester. The server replaces sc in the delegation record with
nsc. To prevent the possibility of time_modify, time_metadata, nsc. To prevent the possibility of time_modify, time_metadata,
and change from appearing to go backward (which would happen if and change from appearing to go backward (which would happen if
the client holding the delegation fails to write its modified data the client holding the delegation fails to write its modified data
to the server before the delegation is revoked or returned), the to the server before the delegation is revoked or returned), the
server SHOULD update the file's metadata record with the server SHOULD update the file's metadata record with the
constructed attribute values. For reasons of reasonable constructed attribute values. For reasons of reasonable
performance, committing the constructed attribute values to stable performance, committing the constructed attribute values to stable
storage is OPTIONAL. storage is OPTIONAL.
As discussed earlier in this section, the client MAY return the As discussed earlier in this section, the client MAY return the same
same cc value on subsequent CB_GETATTR calls, even if the file was cc value on subsequent CB_GETATTR calls, even if the file was
modified in the client's cache yet again between successive modified in the client's cache yet again between successive
CB_GETATTR calls. Therefore, the server must assume that the file CB_GETATTR calls. Therefore, the server must assume that the file
has been modified yet again, and MUST take care to ensure that the has been modified yet again, and MUST take care to ensure that the
new nsc it constructs and returns is greater than the previous nsc new nsc it constructs and returns is greater than the previous nsc it
it returned. An example implementation's delegation record would returned. An example implementation's delegation record would
satisfy this mandate by including a boolean field (let us call it satisfy this mandate by including a boolean field (let us call it
"modified") that is set to false when the delegation is granted, "modified") that is set to FALSE when the delegation is granted, and
and an sc value set at the time of grant to the change attribute an sc value set at the time of grant to the change attribute value.
value. The modified field would be set to true the first time cc The modified field would be set to TRUE the first time cc != sc, and
!= sc, and would stay true until the delegation is returned or would stay TRUE until the delegation is returned or revoked. The
revoked. The processing for constructing nsc, time_modify, and processing for constructing nsc, time_modify, and time_metadata would
time_metadata would use this pseudo code: use this pseudo code:
if (!modified) {
do CB_GETATTR for change and size;
if (cc != sc) if (!modified) {
modified = TRUE; do CB_GETATTR for change and size;
} else {
do CB_GETATTR for size;
}
if (modified) { if (cc != sc)
sc = sc + 1; modified = TRUE;
time_modify = time_metadata = current_time; } else {
do CB_GETATTR for size;
}
update sc, time_modify, time_metadata into file's metadata; if (modified) {
} sc = sc + 1;
time_modify = time_metadata = current_time;
update sc, time_modify, time_metadata into file's metadata;
}
return to client (that sent GETATTR) the attributes This would return to the client (that sent GETATTR) the attributes it
it requested, but make sure size comes from what requested, but make sure size comes from what CB_GETATTR returned.
CB_GETATTR returned. Do not update the file's metadata The server would not update the file's metadata with the client's
with the client's modified size. modified size.
o In the case that the file attribute size is different than the In the case that the file attribute size is different than the
server's current value, the server treats this as a modification server's current value, the server treats this as a modification
regardless of the value of the change attribute retrieved via regardless of the value of the change attribute retrieved via
CB_GETATTR and responds to the second client as in the last step. CB_GETATTR and responds to the second client as in the last step.
This methodology resolves issues of clock differences between client This methodology resolves issues of clock differences between client
and server and other scenarios where the use of CB_GETATTR break and server and other scenarios where the use of CB_GETATTR break
down. down.
It should be noted that the server is under no obligation to use It should be noted that the server is under no obligation to use
CB_GETATTR and therefore the server MAY simply recall the delegation CB_GETATTR and therefore the server MAY simply recall the delegation
to avoid its use. to avoid its use.
10.4.4. Recall of Open Delegation 10.4.4. Recall of Open Delegation
skipping to change at page 151, line 6 skipping to change at page 160, line 19
o If a file has other open references at the client, then OPEN o If a file has other open references at the client, then OPEN
operations must be sent to the server. The appropriate stateids operations must be sent to the server. The appropriate stateids
will be provided by the server for subsequent use by the client will be provided by the server for subsequent use by the client
since the delegation stateid will not longer be valid. These OPEN since the delegation stateid will not longer be valid. These OPEN
requests are done with the claim type of CLAIM_DELEGATE_CUR. This requests are done with the claim type of CLAIM_DELEGATE_CUR. This
will allow the presentation of the delegation stateid so that the will allow the presentation of the delegation stateid so that the
client can establish the appropriate rights to perform the OPEN. client can establish the appropriate rights to perform the OPEN.
(see Section 15.18 for details.) (see Section 15.18 for details.)
o If there are granted file locks, the corresponding LOCK operations o If there are granted file locks, the corresponding LOCK operations
need to be performed. This applies to the write open delegation need to be performed. This applies to the OPEN_DELEGATE_WRITE
case only. delegation case only.
o For a write open delegation, if at the time of recall the file is o For a OPEN_DELEGATE_WRITE delegation, if at the time of recall the
not open for write, all modified data for the file must be flushed file is not open for write, all modified data for the file must be
to the server. If the delegation had not existed, the client flushed to the server. If the delegation had not existed, the
would have done this data flush before the CLOSE operation. client would have done this data flush before the CLOSE operation.
o For a write open delegation when a file is still open at the time o For a OPEN_DELEGATE_WRITE delegation when a file is still open at
of recall, any modified data for the file needs to be flushed to the time of recall, any modified data for the file needs to be
the server. flushed to the server.
o With the write open delegation in place, it is possible that the o With the OPEN_DELEGATE_WRITE delegation in place, it is possible
file was truncated during the duration of the delegation. For that the file was truncated during the duration of the delegation.
example, the truncation could have occurred as a result of an OPEN For example, the truncation could have occurred as a result of an
UNCHECKED with a size attribute value of zero. Therefore, if a OPEN UNCHECKED4 with a size attribute value of zero. Therefore,
truncation of the file has occurred and this operation has not if a truncation of the file has occurred and this operation has
been propagated to the server, the truncation must occur before not been propagated to the server, the truncation must occur
any modified data is written to the server. before any modified data is written to the server.
In the case of write open delegation, file locking imposes some In the case of OPEN_DELEGATE_WRITE delegation, file locking imposes
additional requirements. To precisely maintain the associated some additional requirements. To precisely maintain the associated
invariant, it is required to flush any modified data in any region invariant, it is required to flush any modified data in any region
for which a write lock was released while the write delegation was in for which a write lock was released while the OPEN_DELEGATE_WRITE
effect. However, because the write open delegation implies no other delegation was in effect. However, because the OPEN_DELEGATE_WRITE
locking by other clients, a simpler implementation is to flush all delegation implies no other locking by other clients, a simpler
modified data for the file (as described just above) if any write implementation is to flush all modified data for the file (as
lock has been released while the write open delegation was in effect. described just above) if any write lock has been released while the
OPEN_DELEGATE_WRITE delegation was in effect.
An implementation need not wait until delegation recall (or deciding An implementation need not wait until delegation recall (or deciding
to voluntarily return a delegation) to perform any of the above to voluntarily return a delegation) to perform any of the above
actions, if implementation considerations (e.g., resource actions, if implementation considerations (e.g., resource
availability constraints) make that desirable. Generally, however, availability constraints) make that desirable. Generally, however,
the fact that the actual open state of the file may continue to the fact that the actual open state of the file may continue to
change makes it not worthwhile to send information about opens and change makes it not worthwhile to send information about opens and
closes to the server, except as part of delegation return. Only in closes to the server, except as part of delegation return. Only in
the case of closing the open that resulted in obtaining the the case of closing the open that resulted in obtaining the
delegation would clients be likely to do this early, since, in that delegation would clients be likely to do this early, since, in that
case, the close once done will not be undone. Regardless of the case, the close once done will not be undone. Regardless of the
client's choices on scheduling these actions, all must be performed client's choices on scheduling these actions, all must be performed
before the delegation is returned, including (when applicable) the before the delegation is returned, including (when applicable) the
close that corresponds to the open that resulted in the delegation. close that corresponds to the open that resulted in the delegation.
These actions can be performed either in previous requests or in These actions can be performed either in previous requests or in
previous operations in the same COMPOUND request. previous operations in the same COMPOUND request.
10.4.5. Clients that Fail to Honor Delegation Recalls 10.4.5. OPEN Delegation Race with CB_RECALL
The server informs the client of recall via a CB_RECALL. A race case
which may develop is when the delegation is immediately recalled
before the COMPOUND which established the delegation is returned to
the client. As the CB_RECALL provides both a stateid and a
filehandle for which the client has no mapping, it cannot honor the
recall attempt. At this point, the client has two choices, either do
not respond or respond with NFS4ERR_BADHANDLE. If it does not
respond, then it runs the risk of the server deciding to not grant it
further delegations.
If instead it does reply with NFS4ERR_BADHANDLE, then both the client
and the server might be able to detect that a race condition is
occurring. The client can keep a list of pending delegations. When
it receives a CB_RECALL for an unknown delegation, it can cache the
stateid and filehandle on a list of pending recalls. When it is
provided with a delegation, it would only use it if it was not on the
pending recall list. Upon the next CB_RECALL, it could immediately
return the delegation.
In turn, the server can keep track of when it issues a delegation and
assume that if a client responds to the CB_RECALL with a
NFS4ERR_BADHANDLE, then the client has yet to receive the delegation.
The server SHOULD give the client a reasonable time both to get this
delegation and to return it before revoking the delegation. Unlike a
failed callback path, the server should periodically probe the client
with CB_RECALL to see if it has received the delegation and is ready
to return it.
When the server finally determines that enough time has lapsed, it
SHOULD revoke the delegation and it SHOULD NOT revoke the lease.
During this extended recall process, the server SHOULD be renewing
the client lease. The intent here is that the client not pay too
onerous a burden for a condition caused by the server.
10.4.6. Clients that Fail to Honor Delegation Recalls
A client may fail to respond to a recall for various reasons, such as A client may fail to respond to a recall for various reasons, such as
a failure of the callback path from server to the client. The client a failure of the callback path from server to the client. The client
may be unaware of a failure in the callback path. This lack of may be unaware of a failure in the callback path. This lack of
awareness could result in the client finding out long after the awareness could result in the client finding out long after the
failure that its delegation has been revoked, and another client has failure that its delegation has been revoked, and another client has
modified the data for which the client had a delegation. This is modified the data for which the client had a delegation. This is
especially a problem for the client that held a write delegation. especially a problem for the client that held a OPEN_DELEGATE_WRITE
delegation.
The server also has a dilemma in that the client that fails to The server also has a dilemma in that the client that fails to
respond to the recall might also be sending other NFS requests, respond to the recall might also be sending other NFS requests,
including those that renew the lease before the lease expires. including those that renew the lease before the lease expires.
Without returning an error for those lease renewing operations, the Without returning an error for those lease renewing operations, the
server leads the client to believe that the delegation it has is in server leads the client to believe that the delegation it has is in
force. force.
This difficulty is solved by the following rules: This difficulty is solved by the following rules:
o When the callback path is down, the server MUST NOT revoke the o When the callback path is down, the server MUST NOT revoke the
delegation if one of the following occurs: delegation if one of the following occurs:
* The client has issued a RENEW operation and the server has * The client has issued a RENEW operation and the server has
returned an NFS4ERR_CB_PATH_DOWN error. The server MUST renew returned an NFS4ERR_CB_PATH_DOWN error. The server MUST renew
the lease for any record locks and share reservations the the lease for any byte-range locks and share reservations the
client has that the server has known about (as opposed to those client has that the server has known about (as opposed to those
locks and share reservations the client has established but not locks and share reservations the client has established but not
yet sent to the server, due to the delegation). The server yet sent to the server, due to the delegation). The server
SHOULD give the client a reasonable time to return its SHOULD give the client a reasonable time to return its
delegations to the server before revoking the client's delegations to the server before revoking the client's
delegations. delegations.
* The client has not issued a RENEW operation for some period of * The client has not issued a RENEW operation for some period of
time after the server attempted to recall the delegation. This time after the server attempted to recall the delegation. This
period of time MUST NOT be less than the value of the period of time MUST NOT be less than the value of the
lease_time attribute. lease_time attribute.
o When the client holds a delegation, it cannot rely on operations, o When the client holds a delegation, it cannot rely on operations,
except for RENEW, that take a stateid, to renew delegation leases except for RENEW, that take a stateid, to renew delegation leases
across callback path failures. The client that wants to keep across callback path failures. The client that wants to keep
delegations in force across callback path failures must use RENEW delegations in force across callback path failures must use RENEW
to do so. to do so.
10.4.6. Delegation Revocation 10.4.7. Delegation Revocation
At the point a delegation is revoked, if there are associated opens At the point a delegation is revoked, if there are associated opens
on the client, the applications holding these opens need to be on the client, the applications holding these opens need to be
notified. This notification usually occurs by returning errors for notified. This notification usually occurs by returning errors for
READ/WRITE operations or when a close is attempted for the open file. READ/WRITE operations or when a close is attempted for the open file.
If no opens exist for the file at the point the delegation is If no opens exist for the file at the point the delegation is
revoked, then notification of the revocation is unnecessary. revoked, then notification of the revocation is unnecessary.
However, if there is modified data present at the client for the However, if there is modified data present at the client for the
file, the user of the application should be notified. Unfortunately, file, the user of the application should be notified. Unfortunately,
skipping to change at page 153, line 46 skipping to change at page 164, line 7
operations may not be returned, more drastic action such as signals operations may not be returned, more drastic action such as signals
or process termination may be appropriate. The justification for or process termination may be appropriate. The justification for
this is that an invariant for which an application depends on may be this is that an invariant for which an application depends on may be
violated. Depending on how errors are typically treated for the violated. Depending on how errors are typically treated for the
client operating environment, further levels of notification client operating environment, further levels of notification
including logging, console messages, and GUI pop-ups may be including logging, console messages, and GUI pop-ups may be
appropriate. appropriate.
10.5.1. Revocation Recovery for Write Open Delegation 10.5.1. Revocation Recovery for Write Open Delegation
Revocation recovery for a write open delegation poses the special Revocation recovery for a OPEN_DELEGATE_WRITE delegation poses the
issue of modified data in the client cache while the file is not special issue of modified data in the client cache while the file is
open. In this situation, any client which does not flush modified not open. In this situation, any client which does not flush
data to the server on each close must ensure that the user receives modified data to the server on each close must ensure that the user
appropriate notification of the failure as a result of the receives appropriate notification of the failure as a result of the
revocation. Since such situations may require human action to revocation. Since such situations may require human action to
correct problems, notification schemes in which the appropriate user correct problems, notification schemes in which the appropriate user
or administrator is notified may be necessary. Logging and console or administrator is notified may be necessary. Logging and console
messages are typical examples. messages are typical examples.
If there is modified data on the client, it must not be flushed If there is modified data on the client, it must not be flushed
normally to the server. A client may attempt to provide a copy of normally to the server. A client may attempt to provide a copy of
the file data as modified during the delegation under a different the file data as modified during the delegation under a different
name in the filesystem name space to ease recovery. Note that when name in the filesystem name space to ease recovery. Note that when
the client can determine that the file has not been modified by any the client can determine that the file has not been modified by any
skipping to change at page 155, line 13 skipping to change at page 165, line 20
may be returned to the server in the response to a CB_RECALL call. may be returned to the server in the response to a CB_RECALL call.
The result of local caching of attributes is that the attribute The result of local caching of attributes is that the attribute
caches maintained on individual clients will not be coherent. caches maintained on individual clients will not be coherent.
Changes made in one order on the server may be seen in a different Changes made in one order on the server may be seen in a different
order on one client and in a third order on a different client. order on one client and in a third order on a different client.
The typical filesystem application programming interfaces do not The typical filesystem application programming interfaces do not
provide means to atomically modify or interrogate attributes for provide means to atomically modify or interrogate attributes for
multiple files at the same time. The following rules provide an multiple files at the same time. The following rules provide an
environment where the potential incoherences mentioned above can be environment where the potential incoherency mentioned above can be
reasonably managed. These rules are derived from the practice of reasonably managed. These rules are derived from the practice of
previous NFS protocols. previous NFS protocols.
o All attributes for a given file (per-fsid attributes excepted) are o All attributes for a given file (per-fsid attributes excepted) are
cached as a unit at the client so that no non-serializability can cached as a unit at the client so that no non-serializability can
arise within the context of a single file. arise within the context of a single file.
o An upper time boundary is maintained on how long a client cache o An upper time boundary is maintained on how long a client cache
entry can be kept without being refreshed from the server. entry can be kept without being refreshed from the server.
skipping to change at page 157, line 17 skipping to change at page 167, line 25
OPTIONAL. OPTIONAL.
o If the memory mapped file is not being modified on the server, and o If the memory mapped file is not being modified on the server, and
instead is just being read by an application via the memory mapped instead is just being read by an application via the memory mapped
interface, the client will not see an updated time_access interface, the client will not see an updated time_access
attribute. However, in many operating environments, neither will attribute. However, in many operating environments, neither will
any process running on the server. Thus NFS clients are at no any process running on the server. Thus NFS clients are at no
disadvantage with respect to local processes. disadvantage with respect to local processes.
o If there is another client that is memory mapping the file, and if o If there is another client that is memory mapping the file, and if
that client is holding a write delegation, the same set of issues that client is holding a OPEN_DELEGATE_WRITE delegation, the same
as discussed in the previous two bullet items apply. So, when a set of issues as discussed in the previous two bullet items apply.
server does a CB_GETATTR to a file that the client has modified in So, when a server does a CB_GETATTR to a file that the client has
its cache, the response from CB_GETATTR will not necessarily be modified in its cache, the response from CB_GETATTR will not
accurate. As discussed earlier, the client's obligation is to necessarily be accurate. As discussed earlier, the client's
report that the file has been modified since the delegation was obligation is to report that the file has been modified since the
granted, not whether it has been modified again between successive delegation was granted, not whether it has been modified again
CB_GETATTR calls, and the server MUST assume that any file the between successive CB_GETATTR calls, and the server MUST assume
client has modified in cache has been modified again between that any file the client has modified in cache has been modified
successive CB_GETATTR calls. Depending on the nature of the again between successive CB_GETATTR calls. Depending on the
client's memory management system, this weak obligation may not be nature of the client's memory management system, this weak
possible. A client MAY return stale information in CB_GETATTR obligation may not be possible. A client MAY return stale
whenever the file is memory mapped. information in CB_GETATTR whenever the file is memory mapped.
o The mixture of memory mapping and file locking on the same file is o The mixture of memory mapping and file locking on the same file is
problematic. Consider the following scenario, where the page size problematic. Consider the following scenario, where the page size
on each client is 8192 bytes. on each client is 8192 bytes.
* Client A memory maps first page (8192 bytes) of file X * Client A memory maps first page (8192 bytes) of file X
* Client B memory maps first page (8192 bytes) of file X * Client B memory maps first page (8192 bytes) of file X
* Client A write locks first 4096 bytes * Client A write locks first 4096 bytes
skipping to change at page 158, line 13 skipping to change at page 168, line 22
virtual memory management systems on each client only know a page is virtual memory management systems on each client only know a page is
modified, not that a subset of the page corresponding to the modified, not that a subset of the page corresponding to the
respective lock regions has been modified. So it is not possible for respective lock regions has been modified. So it is not possible for
each client to do the right thing, which is to only write to the each client to do the right thing, which is to only write to the
server that portion of the page that is locked. For example, if server that portion of the page that is locked. For example, if
client A simply writes out the page, and then client B writes out the client A simply writes out the page, and then client B writes out the
page, client A's data is lost. page, client A's data is lost.
Moreover, if mandatory locking is enabled on the file, then we have a Moreover, if mandatory locking is enabled on the file, then we have a
different problem. When clients A and B issue the STORE different problem. When clients A and B issue the STORE
instructions, the resulting page faults require a record lock on the instructions, the resulting page faults require a byte-range lock on
entire page. Each client then tries to extend their locked range to the entire page. Each client then tries to extend their locked range
the entire page, which results in a deadlock. to the entire page, which results in a deadlock.
Communicating the NFS4ERR_DEADLOCK error to a STORE instruction is Communicating the NFS4ERR_DEADLOCK error to a STORE instruction is
difficult at best. difficult at best.
If a client is locking the entire memory mapped file, there is no If a client is locking the entire memory mapped file, there is no
problem with advisory or mandatory record locking, at least until the problem with advisory or mandatory byte-range locking, at least until
client unlocks a region in the middle of the file. the client unlocks a region in the middle of the file.
Given the above issues the following are permitted: Given the above issues the following are permitted:
o Clients and servers MAY deny memory mapping a file they know there o Clients and servers MAY deny memory mapping a file they know there
are record locks for. are byte-range locks for.
o Clients and servers MAY deny a record lock on a file they know is o Clients and servers MAY deny a byte-range lock on a file they know
memory mapped. is memory mapped.
o A client MAY deny memory mapping a file that it knows requires o A client MAY deny memory mapping a file that it knows requires
mandatory locking for I/O. If mandatory locking is enabled after mandatory locking for I/O. If mandatory locking is enabled after
the file is opened and mapped, the client MAY deny the application the file is opened and mapped, the client MAY deny the application
further access to its mapped file. further access to its mapped file.
10.8. Name Caching 10.8. Name Caching
The results of LOOKUP and READDIR operations may be cached to avoid The results of LOOKUP and READDIR operations may be cached to avoid
the cost of subsequent LOOKUP operations. Just as in the case of the cost of subsequent LOOKUP operations. Just as in the case of
skipping to change at page 160, line 36 skipping to change at page 170, line 46
operation change attribute values atomically. When the server is operation change attribute values atomically. When the server is
unable to report the before and after values atomically with respect unable to report the before and after values atomically with respect
to the directory operation, the server must indicate that fact in the to the directory operation, the server must indicate that fact in the
change_info4 return value. When the information is not atomically change_info4 return value. When the information is not atomically
reported, the client should not assume that other clients have not reported, the client should not assume that other clients have not
changed the directory. changed the directory.
11. Minor Versioning 11. Minor Versioning
To address the requirement of an NFS protocol that can evolve as the To address the requirement of an NFS protocol that can evolve as the
need arises, the NFS version 4 protocol contains the rules and need arises, the NFSv4 protocol contains the rules and framework to
framework to allow for future minor changes or versioning. allow for future minor changes or versioning.
The base assumption with respect to minor versioning is that any The base assumption with respect to minor versioning is that any
future accepted minor version must follow the IETF process and be future accepted minor version must follow the IETF process and be
documented in a standards track RFC. Therefore, each minor version documented in a standards track RFC. Therefore, each minor version
number will correspond to an RFC. Minor version zero of the NFS number will correspond to an RFC. Minor version zero of the NFS
version 4 protocol is represented by this RFC. The COMPOUND version 4 protocol is represented by this RFC. The COMPOUND and
procedure will support the encoding of the minor version being CB_COMPOUND procedures support the encoding of the minor version
requested by the client. being requested by the client.
The following items represent the basic rules for the development of The following items represent the basic rules for the development of
minor versions. Note that a future minor version may decide to minor versions. Note that a future minor version may decide to
modify or add to the following rules as part of the minor version modify or add to the following rules as part of the minor version
definition. definition.
1. Procedures are not added or deleted 1. Procedures are not added or deleted
To maintain the general RPC model, NFS version 4 minor versions To maintain the general RPC model, NFSv4 minor versions will not
will not add to or delete procedures from the NFS program. add to or delete procedures from the NFS program.
2. Minor versions may add operations to the COMPOUND and 2. Minor versions may add operations to the COMPOUND and
CB_COMPOUND procedures. CB_COMPOUND procedures.
The addition of operations to the COMPOUND and CB_COMPOUND The addition of operations to the COMPOUND and CB_COMPOUND
procedures does not affect the RPC model. procedures does not affect the RPC model.
1. Minor versions may append attributes to GETATTR4args, 1. Minor versions may append attributes to the bitmap4 that
bitmap4, and GETATTR4res. represents sets of attributes and to the fattr4 that
represents sets of attribute values.
This allows for the expansion of the attribute model to This allows for the expansion of the attribute model to
allow for future growth or adaptation. allow for future growth or adaptation.
2. Minor version X must append any new attributes after the 2. Minor version X must append any new attributes after the
last documented attribute. last documented attribute.
Since attribute results are specified as an opaque array of Since attribute results are specified as an opaque array of
per-attribute XDR encoded results, the complexity of adding per-attribute XDR encoded results, the complexity of adding
new attributes in the midst of the current definitions will new attributes in the midst of the current definitions would
be too burdensome. be too burdensome.
3. Minor versions must not modify the structure of an existing 3. Minor versions must not modify the structure of an existing
operation's arguments or results. operation's arguments or results.
Again the complexity of handling multiple structure definitions Again, the complexity of handling multiple structure definitions
for a single operation is too burdensome. New operations should for a single operation is too burdensome. New operations should
be added instead of modifying existing structures for a minor be added instead of modifying existing structures for a minor
version. version.
This rule does not preclude the following adaptations in a minor This rule does not preclude the following adaptations in a minor
version. version.
* adding bits to flag fields such as new attributes to * adding bits to flag fields, such as new attributes to
GETATTR's bitmap4 data type GETATTR's bitmap4 data type, and providing corresponding
variants of opaque arrays, such as a notify4 used together
with such bitmaps
* adding bits to existing attributes like ACLs that have flag * adding bits to existing attributes like ACLs that have flag
words words
* extending enumerated types (including NFS4ERR_*) with new * extending enumerated types (including NFS4ERR_*) with new
values values
4. Minor versions must not modify the structure of existing 4. Minor versions must not modify the structure of existing
attributes. attributes.
skipping to change at page 162, line 46 skipping to change at page 173, line 12
11. A client and server that support minor version X SHOULD support 11. A client and server that support minor version X SHOULD support
minor versions 0 (zero) through X-1 as well. minor versions 0 (zero) through X-1 as well.
12. Except for infrastructural changes, no new features may be 12. Except for infrastructural changes, no new features may be
introduced as REQUIRED in a minor version. introduced as REQUIRED in a minor version.
This rule allows for the introduction of new functionality and This rule allows for the introduction of new functionality and
forces the use of implementation experience before designating a forces the use of implementation experience before designating a
feature as REQUIRED. On the other hand, some classes of feature as REQUIRED. On the other hand, some classes of
features are infrastructural and have broad effects. Allowing features are infrastructural and have broad effects. Allowing
such features to not be REQUIRED complicates implementation of infrastructural features to be RECOMMENDED or OPTIONAL
the minor version. complicates implementation of the minor version.
13. A client MUST NOT attempt to use a stateid, filehandle, or 13. A client MUST NOT attempt to use a stateid, filehandle, or
similar returned object from the COMPOUND procedure with minor similar returned object from the COMPOUND procedure with minor
version X for another COMPOUND procedure with minor version Y, version X for another COMPOUND procedure with minor version Y,
where X != Y. where X != Y.
12. Internationalization 12. Internationalization
This chapter describes the string-handling aspects of the NFS version This chapter describes the string-handling aspects of the NFSv4
4 protocol, and how they address issues related to protocol, and how they address issues related to
internationalization, including issues related to UTF-8, internationalization, including issues related to UTF-8,
normalization, string preparation, case folding, and handling of normalization, string preparation, case folding, and handling of
internationalization issues related to domains. internationalization issues related to domains.
The NFS version 4 protocol needs to deal with internationalization, The NFSv4 protocol needs to deal with internationalization, or I18N,
or I18N, with respect to file names and other strings as used within with respect to file names and other strings as used within the
the protocol. The choice of string representation must allow for protocol. The choice of string representation must allow for
reasonable name/string access to clients, applications, and users reasonable name/string access to clients, applications, and users
which use various languages. The UTF-8 encoding of the UCS as which use various languages. The UTF-8 encoding of the UCS as
defined by [7] allows for this type of access and follows the policy defined by [7] allows for this type of access and follows the policy
described in "IETF Policy on Character Sets and Languages", [8]. described in "IETF Policy on Character Sets and Languages", [8].
In implementing such policies, it is important to understand and In implementing such policies, it is important to understand and
respect the nature of NFS version 4 as a means by which client respect the nature of NFSv4 as a means by which client
implementations may invoke operations on remote file systems. Server implementations may invoke operations on remote file systems. Server
implementations act as a conduit to a range of file system implementations act as a conduit to a range of file system
implementations that the NFS version 4 server typically invokes implementations that the NFSv4 server typically invokes through a
through a virtual-file-system interface. virtual-file-system interface.
Keeping this context in mind, one needs to understand that the file Keeping this context in mind, one needs to understand that the file
systems with which clients will be interacting will generally not be systems with which clients will be interacting will generally not be
devoted solely to access using NFS version 4. Local access and its devoted solely to access using NFS version 4. Local access and its
requirements will generally be important and often access over other requirements will generally be important and often access over other
remote file access protocols will be as well. It is generally a remote file access protocols will be as well. It is generally a
functional requirement in practice for the users of the NFS version 4 functional requirement in practice for the users of the NFSv4
protocol (although it may be formally out of scope for this document) protocol (although it may be formally out of scope for this document)
for the implementation to allow files created by other protocols and for the implementation to allow files created by other protocols and
by local operations on the file system to be accessed using NFS by local operations on the file system to be accessed using NFS
version 4 as well. version 4 as well.
It also needs to be understood that a considerable portion of file It also needs to be understood that a considerable portion of file
name processing will occur within the implementation of the file name processing will occur within the implementation of the file
system rather than within the limits of the NFS version 4 server system rather than within the limits of the NFSv4 server
implementation per se. As a result, cetain aspects of name implementation per se. As a result, cetain aspects of name
processing may change as the locus of processing moves from file processing may change as the locus of processing moves from file
system to file system. As a result of these factors, the protocol system to file system. As a result of these factors, the protocol
cannot enforce uniformity of name-related processing upon NFS version cannot enforce uniformity of name-related processing upon NFSv4
4 server requests on the server as a whole. Because the server server requests on the server as a whole. Because the server
interacts with existing file system implementations, the same server interacts with existing file system implementations, the same server
handling will produce different behavior when interacting with handling will produce different behavior when interacting with
different file system implementations. To attempt to require uniform different file system implementations. To attempt to require uniform
behavior, and treat the the protocol server and the file system as a behavior, and treat the the protocol server and the file system as a
unified application, would considerably limit the usefulness of the unified application, would considerably limit the usefulness of the
protocol. protocol.
12.1. Use of UTF-8 12.1. Use of UTF-8
As mentioned above, UTF-8 is used as a convenient way to encode As mentioned above, UTF-8 is used as a convenient way to encode
skipping to change at page 164, line 19 skipping to change at page 174, line 35
requirements to avoid these issues since the mapping of ASCII names requirements to avoid these issues since the mapping of ASCII names
to UTF-8 is the identity. to UTF-8 is the identity.
12.1.1. Relation to Stringprep 12.1.1. Relation to Stringprep
RFC 3454 [9], otherwise known as "stringprep", documents a framework RFC 3454 [9], otherwise known as "stringprep", documents a framework
for using Unicode/UTF-8 in networking protocols, intended "to for using Unicode/UTF-8 in networking protocols, intended "to
increase the likelihood that string input and string comparison work increase the likelihood that string input and string comparison work
in ways that make sense for typical users throughout the world." A in ways that make sense for typical users throughout the world." A
protocol conforming to this framework must define a profile of protocol conforming to this framework must define a profile of
stringprep "in order to fully specify the processing options." NFS stringprep "in order to fully specify the processing options."
version 4, while it does make normative references to stringprep and NFSv4, while it does make normative references to stringprep and uses
uses elements of that framework, it does not, for reasons that are elements of that framework, it does not, for reasons that are
explained below, conform to that framework, for all of the strings explained below, conform to that framework, for all of the strings
that are used within it. that are used within it.
In addition to some specific issues which have caused stringprep to In addition to some specific issues which have caused stringprep to
add confusion in handling certain characters for certain languages, add confusion in handling certain characters for certain languages,
there are a number of general reasons why stringprep profiles are not there are a number of general reasons why stringprep profiles are not
suitable for describing NFS version 4. suitable for describing NFSv4.
o Restricting the character repertoire to Unicode 3.2, as required o Restricting the character repertoire to Unicode 3.2, as required
by stringprep is unduly constricting. by stringprep is unduly constricting.
o Many of the character tables in stringprep are inappropriate o Many of the character tables in stringprep are inappropriate
because of this limited character repertoire, so that normative because of this limited character repertoire, so that normative
reference to stringprep is not desirable in many case and instead, reference to stringprep is not desirable in many case and instead,
we allow more flexibility in the definition of case mapping we allow more flexibility in the definition of case mapping
tables. tables.
o Because of the presence of different file systems, the specifics o Because of the presence of different file systems, the specifics
of processing are not fully defined and some aspects that are are of processing are not fully defined and some aspects that are are
RECOMMENDED, rather than REQUIRED. RECOMMENDED, rather than REQUIRED.
Despite these issues, in many cases the general structure of Despite these issues, in many cases the general structure of
stringprep profiles, consisting of sections which deal with the stringprep profiles, consisting of sections which deal with the
applicability of the description, the character repertoire, charcter applicability of the description, the character repertoire, character
mapping, normalization, prohibited characters, and issues of the mapping, normalization, prohibited characters, and issues of the
handling (i.e., possible prohibition) of bidirectional strings, is a handling (i.e., possible prohibition) of bidirectional strings, is a
convenient way to describe the string handling which is needed and convenient way to describe the string handling which is needed and
will be used where appropriate. will be used where appropriate.
12.1.2. Normalization, Equivalence, and Confusability 12.1.2. Normalization, Equivalence, and Confusability
Unicode has defined several equivalence relationships among the set Unicode has defined several equivalence relationships among the set
of possible strings. Understanding the nature and purpose of these of possible strings. Understanding the nature and purpose of these
equivalence relations is important to understand the handling of equivalence relations is important to understand the handling of
Unicode strings within NFS version 4. Unicode strings within NFSv4.
Some string pairs are thought as only differing in the way accents Some string pairs are thought as only differing in the way accents
and other diacritics are encoded, as illustrated in the examples and other diacritics are encoded, as illustrated in the examples
below. Such string pairs are called "canonically equivalent". below. Such string pairs are called "canonically equivalent".
Such equivalence can occur when there are precomposed characters, Such equivalence can occur when there are precomposed characters,
as an alternative to encoding a base character in addition to a as an alternative to encoding a base character in addition to a
combining accent. For example, the character LATIN SMALL LETTER E combining accent. For example, the character LATIN SMALL LETTER E
WITH ACUTE (U+00E9) is defined as canonically equivalent to the WITH ACUTE (U+00E9) is defined as canonically equivalent to the
string consisting of LATIN SMALL LETTER E followed by COMBINING string consisting of LATIN SMALL LETTER E followed by COMBINING
ACUTE ACCENT (U+0065, U+0301). ACUTE ACCENT (U+0065, U+0301).
When multiple combining diacritics are present, differences in the When multiple combining diacritics are present, differences in the
ordering are not reflected in resulting display and the strings ordering are not reflected in resulting display and the strings
are defined as canonically equivalent. For example, the string are defined as canonically equivalent. For example, the string
consisting of LATIN SMALL LETTER Q, COMBINING ACUTE ACCENT, consisting of LATIN SMALL LETTER Q, COMBINING ACUTE ACCENT,
COMBINING GRAVE ACCENT (U+0071, U+0301, U+0300) is canonically COMBINING GRAVE ACCENT (U+0071, U+0301, U+0300) is canonically
quivalent to the string consisting of LATIN SMALL LETTER Q, equivalent to the string consisting of LATIN SMALL LETTER Q,
COMBINING GRAVE ACCENT, COMBINING ACUTE ACCENT (U+0071, U+0300, COMBINING GRAVE ACCENT, COMBINING ACUTE ACCENT (U+0071, U+0300,
U+0301) U+0301)
When both situations are present, the number of canonically When both situations are present, the number of canonically
equivalent strings can be greater. Thus, the following strings equivalent strings can be greater. Thus, the following strings
are all canonically equivalent: are all canonically equivalent:
LATIN SMALL LETTER E, COMBINING MACRON, ACCENT, COMBINING ACUTE LATIN SMALL LETTER E, COMBINING MACRON, ACCENT, COMBINING ACUTE
ACCENT (U+0xxx, U+0304, U+0301) ACCENT (U+0xxx, U+0304, U+0301)
LATIN SMALL LETTER E, COMBINING ACUTE ACCENT, COMBINING MACRON LATIN SMALL LETTER E, COMBINING ACUTE ACCENT, COMBINING MACRON
(U+0xxx, U+0301, U+0304) (U+0xxx, U+0301, U+0304)
LATIN SMALL LETTER E WITH MACRON, COMBINING ACUTE ACCENT LATIN SMALL LETTER E WITH MACRON, COMBINING ACUTE ACCENT
(U+011E, U+0301) (U+011E, U+0301)
LATIN SMALL LETTER E WITH ACUTE, COMBINING MACRON (U+00E9, LATIN SMALL LETTER E WITH ACUTE, COMBINING MACRON (U+00E9,
U+0304) U+0304)
LATIN SMALL LETTER E WITH MACRON AND ACUTE (U+1E16) LATIN SMALL LETTER E WITH MACRON AND ACUTE (U+1E16)
skipping to change at page 166, line 8 skipping to change at page 176, line 22
LATIN SMALL LETTER E WITH MACRON AND ACUTE (U+1E16) LATIN SMALL LETTER E WITH MACRON AND ACUTE (U+1E16)
Additionally there is an equivalence relation of "compatibility Additionally there is an equivalence relation of "compatibility
equivalence". Two canonically equivalent strings are necessarily equivalence". Two canonically equivalent strings are necessarily
compatibility equivalent, although not the converse. An example of compatibility equivalent, although not the converse. An example of
compatibility equivalent strings which are not canonically equivalent compatibility equivalent strings which are not canonically equivalent
are GREEK CAPITAL LETTER OMEGA (U+03A9) and OHM SIGN (U+2129). These are GREEK CAPITAL LETTER OMEGA (U+03A9) and OHM SIGN (U+2129). These
are identical in appearance while other compatibility equivalent are identical in appearance while other compatibility equivalent
strings are not. Another example would be "x2" and the two character strings are not. Another example would be "x2" and the two character
string denoting x-squared which are clearly differnt in appearance string denoting x-squared which are clearly different in appearance
although compatibility equivalent and not canonically equivalent. although compatibility equivalent and not canonically equivalent.
These have Unicode encodings LATIN SMALL LETTER X, DIGIT TWO (U+0078, These have Unicode encodings LATIN SMALL LETTER X, DIGIT TWO (U+0078,
U+0032) and LATIN SMALL LETTER X, SUPERSCRIPT TWO (U+0078, U+00B2), U+0032) and LATIN SMALL LETTER X, SUPERSCRIPT TWO (U+0078, U+00B2),
One way to deal with these equivalence relations is via One way to deal with these equivalence relations is via
normalization. A normalization form maps all strings to a normalization. A normalization form maps all strings to a
correspondig normalized string in such a fashion that all strings corresponding normalized string in such a fashion that all strings
that are equivalent (canonically or compatibly, depending on the that are equivalent (canonically or compatibly, depending on the
form) are mapped to the same value. Thus the image of the mapping is form) are mapped to the same value. Thus the image of the mapping is
a subset of Unicode strings conceived as the representives of the a subset of Unicode strings conceived as the representatives of the
equivalence classes defined by the chosen equivalence relation. equivalence classes defined by the chosen equivalence relation.
In the NFS version 4 protocol, handling of issues related to In the NFSv4 protocol, handling of issues related to
internationalization with regard to normalization follows one of two internationalization with regard to normalization follows one of two
basic patterns: basic patterns:
o For strings whose function is related to other internet standards, o For strings whose function is related to other internet standards,
such as server and domain naming, the normalization form defined such as server and domain naming, the normalization form defined
by the appropriate internet standards is used. For server and by the appropriate internet standards is used. For server and
domain naming, this involves normalization form NFKC as specified domain naming, this involves normalization form NFKC as specified
in [10] in [10]
o For other strings, particular those passed by the server to file o For other strings, particular those passed by the server to file
system implementations, normalization requirements are the system implementations, normalization requirements are the
province of the file system and the job of this specification is province of the file system and the job of this specification is
not to specify a particular form but to make sure that not to specify a particular form but to make sure that
interoperability is maximmized, even when clients and server-based interoperability is maximized, even when clients and server-based
file systems have different preferences. file systems have different preferences.
A related but distinct issue concerns string confusability. This can A related but distinct issue concerns string confusability. This can
occur when two strings (including single-charcter strings) having a occur when two strings (including single-character strings) having a
similar appearance. There have been attempts to define uniform similar appearance. There have been attempts to define uniform
processing in an attempt to avoid such confusion (see stringprep [9]) processing in an attempt to avoid such confusion (see stringprep [9])
but the results have often added confusion. but the results have often added confusion.
Some examples of possible confusions and proposed processing intended Some examples of possible confusions and proposed processing intended
to reduce/avoid confusions: to reduce/avoid confusions:
o Deletion of characters believed to be invisible and appropriately o Deletion of characters believed to be invisible and appropriately
ignored, justifying their deletion, including, WORD JOINER ignored, justifying their deletion, including, WORD JOINER
(U+2060), and the ZERO WIDTH SPACE (U+200B). (U+2060), and the ZERO WIDTH SPACE (U+200B).
o Deletion of characters supposed to not bear semantics and only o Deletion of characters supposed to not bear semantics and only
affect glyph choice, including the ZERO WIDTH NON-JOINER (U+200C) affect glyph choice, including the ZERO WIDTH NON-JOINER (U+200C)
and the ZERO WIDTH JOINER (U+200D), where the deletion turns out and the ZERO WIDTH JOINER (U+200D), where the deletion turns out
to be a problem for Farsi speakers. to be a problem for Farsi speakers.
o Prohibition of space characters such as the EM SPACE (U+2003), the o Prohibition of space characters such as the EM SPACE (U+2003), the
EN SPACE (U+2002), and the THIN SPACE (U+2009). EN SPACE (U+2002), and the THIN SPACE (U+2009).
In addition, character pairs which apprear very similar and could and In addition, character pairs which appear very similar and could and
often do result in confusion. In addition to what Unicode defines as often do result in confusion. In addition to what Unicode defines as
"compatibility equivalence", there are a considerable number of "compatibility equivalence", there are a considerable number of
additional character pairs that could cause confusion. This includes additional character pairs that could cause confusion. This includes
characters such as LATIN CAPITAL LETTER O (U+004F) and DIGIT ZERO characters such as LATIN CAPITAL LETTER O (U+004F) and DIGIT ZERO
(U+0030), and CYRILLIC SMALL LETTER ER (U+0440) LATIN SMALL LETTER P (U+0030), and CYRILLIC SMALL LETTER ER (U+0440) LATIN SMALL LETTER P
(U+0070) (also with MATHEMATICAL BOLD SMALL P (U+1D429) and GREEK (U+0070) (also with MATHEMATICAL BOLD SMALL P (U+1D429) and GREEK
SMALL LETTER RHO (U+1D56, for good measure). SMALL LETTER RHO (U+1D56, for good measure).
NFS version 4, as it does with normalization, takes a two-part NFSv4, as it does with normalization, takes a two-part approach to
approach to this issue: this issue:
o For strings whose function is related to other internet standards, o For strings whose function is related to other internet standards,
such as server and domain naming, any string processing to address such as server and domain naming, any string processing to address
the confusability issue is defined by the appropriate internet the confusability issue is defined by the appropriate internet
standards is used. For server and domain naming, this is the standards is used. For server and domain naming, this is the
responsibility of IDNA as described in [10]. responsibility of IDNA as described in [10].
o For other strings, particularly those passed by the server to file o For other strings, particularly those passed by the server to file
system implementations, any such preparation requirements system implementations, any such preparation requirements
including the choice of how, or whether to address the including the choice of how, or whether to address the
confusability issue, are the responsibility of the file system to confusability issue, are the responsibility of the file system to
define, and for this specification to try to add its own set would define, and for this specification to try to add its own set would
add unacceptably to complexity, and make many files accessible add unacceptably to complexity, and make many files accessible
locally and by other remote file access protocols, inaccessible by locally and by other remote file access protocols, inaccessible by
NFS version 4. This specification defines how the protocol NFSv4. This specification defines how the protocol maximizes
maximizes interoperability in the face of different file system interoperability in the face of different file system
implementations . NFS version 4 does allow file systems to map implementations. NFSv4 does allow file systems to map and to
and to reject characters, including those likely to result in reject characters, including those likely to result in confusion,
confusion, since file systems may choose to do such things. It since file systems may choose to do such things. It defines what
defines what the client will see in such cases, in order to limit the client will see in such cases, in order to limit problems that
problems that can arise when a file name is created and it appears can arise when a file name is created and it appears to have a
to have a different name from the one it is assigned when the name different name from the one it is assigned when the name is
is created. created.
12.2. String Type Overview 12.2. String Type Overview
12.2.1. Overall String Class Divisions 12.2.1. Overall String Class Divisions
NFS version 4 has to deal with a large set of diffreent types of NFSv4 has to deal with a large set of different types of strings and
strings and because of the different role of each, because of the different role of each, internationalization issues
internationalization issues will be different for each: will be different for each:
o For some types of strings, the fundamental internationalization- o For some types of strings, the fundamental internationalization-
related decisions are the province of the file system or the related decisions are the province of the file system or the
security-handling functions of the server and the protocol's job security-handling functions of the server and the protocol's job
is to establish the rules under which file systems and servers are is to establish the rules under which file systems and servers are
allowed to exercise this freedom, to avoid adding to confusion. allowed to exercise this freedom, to avoid adding to confusion.
o In other cases, the fundamental internationalization issues are o In other cases, the fundamental internationalization issues are
the responsibility of other IETF groups and our jobis simply to the responsibility of other IETF groups and our job is simply to
reference those and perhaps make a few choices as to how they are reference those and perhaps make a few choices as to how they are
to be used (e.g., U-labels vs. A-labels). to be used (e.g., U-labels vs. A-labels).
o There are also cases in which a string has a small amount of NFS o There are also cases in which a string has a small amount of NFSv4
version 4 processing which results in one or more strings being processing which results in one or more strings being referred to
referred to one of the other categories. one of the other categories.
We will divide strings to be dealt with into the following classes: We will divide strings to be dealt with into the following classes:
MIX indicating that there is small amount of preparatory processing MIX indicating that there is small amount of preparatory processing
that either picks an internationalization hadling mode or divides that either picks an internationalization handling mode or divides
the string into a set of (two) strings with a different mode the string into a set of (two) strings with a different mode
internationalization handling for each. The details are discussed internationalization handling for each. The details are discussed
in the section "Types with Pre-processing to Resolve Mixture in the section "Types with Pre-processing to Resolve Mixture
Issues". Issues".
NIP indicating that, for various reasons, there is no need for NIP indicating that, for various reasons, there is no need for
internationalization-specific processing to be performed. The internationalization-specific processing to be performed. The
specifics of the various string types handled in this way are specifics of the various string types handled in this way are
described in the section "String Types without described in the section "String Types without
Internationalization Processing". Internationalization Processing".
INET indicating that the string needs to be processed in a fashion INET indicating that the string needs to be processed in a fashion
goverened by non-NFS-specific internet specifications. The governed by non-NFS-specific internet specifications. The details
details are discussed in the section "Types with Processing are discussed in the section "Types with Processing Defined by
Defined by Other Internet Areas". Other Internet Areas".
NFS indicating that the string needs to be processed in a fashion NFS indicating that the string needs to be processed in a fashion
governed by NFSv4-specific considerations. The primary focus is governed by NFSv4-specific considerations. The primary focus is
on enabling flexibility for the various file systems to be on enabling flexibility for the various file systems to be
accessed and is described in the section "String Types with NFS- accessed and is described in the section "String Types with NFS-
specific Processing". specific Processing".
12.2.2. Divisions by Typedef Parent types 12.2.2. Divisions by Typedef Parent types
There are a number of different string types within NFS version 4 and There are a number of different string types within NFSv4 and
internationalization handling will be different for different types internationalization handling will be different for different types
of strings. Each the types will be in one of four groups based on of strings. Each the types will be in one of four groups based on
the parent type that specifies the nature of its relationship to utf8 the parent type that specifies the nature of its relationship to utf8
and ascii. and ascii.
utf8_should/USHOULD: indicating that strings of this type SHOULD be utf8_should/USHOULD: indicating that strings of this type SHOULD be
UTF-8 but clients and servers will not check for valid UTF-8 UTF-8 but clients and servers will not check for valid UTF-8
encoding. encoding.
utf8val_should/UVSHOULD: indicating that strings of this type SHOULD utf8val_should/UVSHOULD: indicating that strings of this type SHOULD
skipping to change at page 172, line 43 skipping to change at page 182, line 48
are no at-signs or the at-sign appears at the start or end of the are no at-signs or the at-sign appears at the start or end of the
string see Interpreting owner and owner_group. Otherwise, the string see Interpreting owner and owner_group. Otherwise, the
portion before the at-sign is dealt with as a prinpfx4 and the portion before the at-sign is dealt with as a prinpfx4 and the
portion after is dealt with as a prinsfx4. portion after is dealt with as a prinsfx4.
12.4.2. Processing of Server Id Strings 12.4.2. Processing of Server Id Strings
Server id strings typically appear in responses (as attribute values) Server id strings typically appear in responses (as attribute values)
and only appear in requests as an attribute value presented to VERIFY and only appear in requests as an attribute value presented to VERIFY
and NVERIFY. With that exception, they are not subject to server and NVERIFY. With that exception, they are not subject to server
validation and posible rejection. It is not expected that clients validation and possible rejection. It is not expected that clients
will typically do such validation on receipt of responses but they will typically do such validation on receipt of responses but they
may as a way to check for proper server behavior. The responsibility may as a way to check for proper server behavior. The responsibility
for sending correct UTF-8 strings is with the server. for sending correct UTF-8 strings is with the server.
Servers are identified by either server names or IP addresses. Once Servers are identified by either server names or IP addresses. Once
an id has been identified as an IP address, then there is no an id has been identified as an IP address, then there is no
processing specific to internationalization to be done, since such an processing specific to internationalization to be done, since such an
address must be ASCII to be valid. address must be ASCII to be valid.
12.5. String Types without Internationalization Processing 12.5. String Types without Internationalization Processing
skipping to change at page 173, line 26 skipping to change at page 183, line 31
comptag4 strings are an aid to debugging and the sender should avoid comptag4 strings are an aid to debugging and the sender should avoid
confusion by not using anything but valid UTF-8. But any work confusion by not using anything but valid UTF-8. But any work
validating the string or modifying it would only add complication validating the string or modifying it would only add complication
to a mechanism whose basic function is best supported by making it to a mechanism whose basic function is best supported by making it
not subject to any checking and having data maximally available to not subject to any checking and having data maximally available to
be looked at in a network trace. be looked at in a network trace.
fattr4_mimetype strings need to be validated by matching against a fattr4_mimetype strings need to be validated by matching against a
list of valid mime types. Since these are all ASCII, no list of valid mime types. Since these are all ASCII, no
processing specific to internationaliztion is required since processing specific to internationalization is required since
anything that does not match is invalid and anything which does anything that does not match is invalid and anything which does
not obey the rules of UTF-8 will not be ASCII and consequently not obey the rules of UTF-8 will not be ASCII and consequently
will not match, and will be invalid. will not match, and will be invalid.
svraddr4 strings, in order to be valid, need to be ASCII, but if you svraddr4 strings, in order to be valid, need to be ASCII, but if you
check them for validity, you have inherently checked that that check them for validity, you have inherently checked that that
they are ASCII and thus UTF-8. they are ASCII and thus UTF-8.
12.6. Types with Processing Defined by Other Internet Areas 12.6. Types with Processing Defined by Other Internet Areas
There are two types of strings which NFS version 4 deals with whose There are two types of strings which NFSv4 deals with whose
processing is defined by other Internet standards, and where issues processing is defined by other Internet standards, and where issues
related to different handling choices by server operating systems or related to different handling choices by server operating systems or
server file systems do not apply. server file systems do not apply.
These are as follows: These are as follows:
o Server names as they appear in the fs_locations attribute. Note o Server names as they appear in the fs_locations attribute. Note
that for most purposes, such server names will only be sent by the that for most purposes, such server names will only be sent by the
server to the client. The exception is use of the fs_locations server to the client. The exception is use of the fs_locations
attribute in a VERIFY or NVERIFY operation. attribute in a VERIFY or NVERIFY operation.
skipping to change at page 174, line 37 skipping to change at page 184, line 42
domain returned on a GETATTR of the userid MUST be the same as that domain returned on a GETATTR of the userid MUST be the same as that
used when setting the userid by the SETATTTR. used when setting the userid by the SETATTTR.
The server MAY implement VERIFY and NVERIFY without translating The server MAY implement VERIFY and NVERIFY without translating
internal state to a string form, so that, for example, a user internal state to a string form, so that, for example, a user
principal which represents a specific numeric user id, will match a principal which represents a specific numeric user id, will match a
different principal string which represents the same numeric user id. different principal string which represents the same numeric user id.
12.7. String Types with NFS-specific Processing 12.7. String Types with NFS-specific Processing
For a number of data types within NFSv4, the primary responsbibility For a number of data types within NFSv4, the primary responsibility
for internationalization-related handling is that of some entity for internationalization-related handling is that of some entity
other than the server itself (see below for details). In these other than the server itself (see below for details). In these
situations, the primary responsibility of NFS version 4 is to provide situations, the primary responsibility of NFSv4 is to provide a
a framework in which that other entity (file system and server framework in which that other entity (file system and server
operating system principal naming framework) implements its own operating system principal naming framework) implements its own
decisions while establishing rules to limit interoperability issues. decisions while establishing rules to limit interoperability issues.
This pattern applies to the following data types: This pattern applies to the following data types:
o In the case of name components (strings of type component4), the o In the case of name components (strings of type component4), the
server-side file system implementation (of which there may be more server-side file system implementation (of which there may be more
than one for a particular server) deals with internationalization than one for a particular server) deals with internationalization
issues, in a fashion that is appropriate to NFS version 4, other issues, in a fashion that is appropriate to NFSv4, other remote
remote file access protocols, and local file access methods. See file access protocols, and local file access methods. See
"Handling of File Name Components" for the detailed treatment. "Handling of File Name Components" for the detailed treatment.
o In the case of link text strings (strings of type lintext4), the o In the case of link text strings (strings of type lintext4), the
issues are similar, but file systems are restricted in the set of issues are similar, but file systems are restricted in the set of
acceptable internationalization-related processing that they may acceptable internationalization-related processing that they may
do, principally because symbolic links may contain name componetns do, principally because symbolic links may contain name components
that, when used, are presented to other file systems and/or other that, when used, are presented to other file systems and/or other
servers. See "Processing of Link Text" for the detailed servers. See "Processing of Link Text" for the detailed
treatment. treatment.
o In the case of principal prefix strings, any decisions regarding o In the case of principal prefix strings, any decisions regarding
internationalization are the responsibility of the server internationalization are the responsibility of the server
operating systems which may make its own rules regarding user and operating systems which may make its own rules regarding user and
group name encoding. See "Processing of Principal Prefixes" for group name encoding. See "Processing of Principal Prefixes" for
the detailed treatment. the detailed treatment.
12.7.1. Handling of File Name Components 12.7.1. Handling of File Name Components
There are a number of places within client and server where file name There are a number of places within client and server where file name
components are processed: components are processed:
o On the client, file names may be processed as part of forming NFS o On the client, file names may be processed as part of forming
version 4 requests. Any such processing will reflect specific NFSv4 requests. Any such processing will reflect specific needs
needs of the client's environment and will be treated as out-of- of the client's environment and will be treated as out-of-scope
scope from the viewpoint of this specification. from the viewpoint of this specification.
o On the server, file names are processed as part of processing NFS o On the server, file names are processed as part of processing
version 4 requests. In practice, parts of the processing will be NFSv4 requests. In practice, parts of the processing will be
implemented within the NFS version 4 server while other parts will implemented within the NFS version 4 server while other parts will
be implemented within the file system. This processing is be implemented within the file system. This processing is
described in the sections below. These sections are organized in described in the sections below. These sections are organized in
a fashion parallel to a stringprep profile. The same sorts of a fashion parallel to a stringprep profile. The same sorts of
topics are dealt with but they differ in that there is a wider topics are dealt with but they differ in that there is a wider
range of possible processing choices. range of possible processing choices.
o On the server, file name components might potentially be subject o On the server, file name components might potentially be subject
to processing as part of generating NFS version 4 responses. This to processing as part of generating NFS version 4 responses. This
specification assumes that this processing will be empty and that specification assumes that this processing will be empty and that
skipping to change at page 177, line 24 skipping to change at page 187, line 28
the server when that character is encountered. the server when that character is encountered.
Strings are intended to be in UTF-8 format and servers SHOULD return Strings are intended to be in UTF-8 format and servers SHOULD return
NFS4ERR_INVAL, as discussed above, when the characters sent are not NFS4ERR_INVAL, as discussed above, when the characters sent are not
valid UTF-8. When the character repertoire consists of single-byte valid UTF-8. When the character repertoire consists of single-byte
characters, UTF-8 is not enforced. Such situations should be characters, UTF-8 is not enforced. Such situations should be
restricted to those where use is within a restricted environment restricted to those where use is within a restricted environment
where a single character mapping locale can be administratively where a single character mapping locale can be administratively
enforced, allowing a file name to be treated as a string of bytes, enforced, allowing a file name to be treated as a string of bytes,
rather than as a string of characters. Such an arrangement might be rather than as a string of characters. Such an arrangement might be
necessary when NFS version 4 access to a file system containing names necessary when NFSv4 access to a file system containing names which
which are not valid UTF-8 needs to be provided. are not valid UTF-8 needs to be provided.
However, in any of the following situations, file names have to be However, in any of the following situations, file names have to be
treated as strings of Unicode characters and servers MUST return treated as strings of Unicode characters and servers MUST return
NFS4ERR_INVAL when file names that are not in UTF-8 format: NFS4ERR_INVAL when file names that are not in UTF-8 format:
o Case-insensitive comparisons are specified by the file system and o Case-insensitive comparisons are specified by the file system and
any characters sent contain non-ASCII byte codes. any characters sent contain non-ASCII byte codes.
o Any normalization constraints are enforced by the server or file o Any normalization constraints are enforced by the server or file
system implementation. system implementation.
skipping to change at page 177, line 52 skipping to change at page 188, line 8
when the server does not enforce UTF-8 component4 strings and treats when the server does not enforce UTF-8 component4 strings and treats
them as strings of bytes. A client may determine that a given them as strings of bytes. A client may determine that a given
filesystem is operating in this mode by performing a LOOKUP using a filesystem is operating in this mode by performing a LOOKUP using a
non-UTF-8 string, if NFS4ERR_INVAL is not returned, then name non-UTF-8 string, if NFS4ERR_INVAL is not returned, then name
components will be treated as opaque and those sorts of modifications components will be treated as opaque and those sorts of modifications
will not be seen. will not be seen.
12.7.1.3. Case-based Mapping Used for Component4 Strings 12.7.1.3. Case-based Mapping Used for Component4 Strings
Case-based mapping is not always a required part of server processing Case-based mapping is not always a required part of server processing
of name components. However, if the NFS version 4 file server of name components. However, if the NFSv4 file server supports the
supports the case_insensitive file system attribute, and if the case_insensitive file system attribute, and if the case_insensitive
case_insensitive attribute is true for a given file system, the NFS attribute is true for a given file system, the NFS version 4 server
version 4 server MUST use the Unicode case mapping tables for the MUST use the Unicode case mapping tables for the version of Unicode
version of Unicode corresponding to the character repertoire. In the corresponding to the character repertoire. In the case where the
case where the character repertoire is UCS-2 or UCS-4, the case character repertoire is UCS-2 or UCS-4, the case mapping tables from
mapping tables from the latest available version of Unicode SHOULD be the latest available version of Unicode SHOULD be used.
used.
If the case_preserving attribute is present and set to false, then If the case_preserving attribute is present and set to false, then
the NFS version 4 server MUST use the corresponding Unicode case the NFSv4 server MUST use the corresponding Unicode case mapping
mapping table to map case when processing component4 strings. table to map case when processing component4 strings. Whether the
Whether the server maps from lower to upper case or the upper to server maps from lower to upper case or the upper to lower case is a
lower case is a matter for implementation choice. matter for implementation choice.
Stringprep Table B.2 should not be used for these purpose since it is Stringprep Table B.2 should not be used for these purpose since it is
limited to Unicode version 3.2 and also because it erroneously maps limited to Unicode version 3.2 and also because it erroneously maps
the German ligature eszett to the string "ss", whereas later versions the German ligature eszett to the string "ss", whereas later versions
of Unicode contain both lower-case and upper-case versions of Eszett of Unicode contain both lower-case and upper-case versions of Eszett
(SMALL LETTER SHARP S and CAPITAL LETTER SHARP S). (SMALL LETTER SHARP S and CAPITAL LETTER SHARP S).
Clients should be aware that servers may have mapped SMALL LETTER Clients should be aware that servers may have mapped SMALL LETTER
SHARP S to the string "ss" when case-insensitive mapping is in SHARP S to the string "ss" when case-insensitive mapping is in
effect, with result that file whose name contains SMALL LETTER SHARP effect, with result that file whose name contains SMALL LETTER SHARP
S may have that character replaced by "ss" or "SS". S may have that character replaced by "ss" or "SS".
12.7.1.4. Other Mapping Used for Component4 Strings 12.7.1.4. Other Mapping Used for Component4 Strings
Other than for issues of case mapping, an NFS version 4 server SHOULD Other than for issues of case mapping, an NFSv4 server SHOULD limit
limit visible (i.e., those that change the name of file to reflect visible (i.e., those that change the name of file to reflect those
those mappings to those from from a subset of the stringprep table mappings to those from from a subset of the stringprep table B.1.
B.1. Note particularly, the mapings from U+200C and U+200D to the Note particularly, the mappings from U+200C and U+200D to the empty
empty string should be avoided, due to their undesirable effect on string should be avoided, due to their undesirable effect on some
some strings in Farsi. strings in Farsi.
Table B.1 may be used but it should be used only if required by the Table B.1 may be used but it should be used only if required by the
local file system implementation. For example, if the file system in local file system implementation. For example, if the file system in
question accepts file names containing the MONGOLIAN TODO SOFT HYPHEN question accepts file names containing the MONGOLIAN TODO SOFT HYPHEN
character (U+1806) and they are distinct from the corresponding file character (U+1806) and they are distinct from the corresponding file
names with this character removed, then using Table B.1 will cause names with this character removed, then using Table B.1 will cause
functional problems when clients attempt to interact with that file functional problems when clients attempt to interact with that file
system. The NFS version 4 server implementation including the system. The NFSv4 server implementation including the filesystem
filesystem MUST NOT silently remove characters not within Table B.1. MUST NOT silently remove characters not within Table B.1.
If an implementation wishes to eliminate other characters because it If an implementation wishes to eliminate other characters because it
is believed that allowing component name versions that both include is believed that allowing component name versions that both include
the character and do not have while otherwise the same, will the character and do not have while otherwise the same, will
contribute to confusion, it has two options: contribute to confusion, it has two options:
o Treat the characters as prohibited and return NFS4ERR_BADCHAR. o Treat the characters as prohibited and return NFS4ERR_BADCHAR.
o Eliminate the character as part of the name matching processing, o Eliminate the character as part of the name matching processing,
while retaining it when a file is created. This would be while retaining it when a file is created. This would be
analogous to file systems that are both case-insensitive and case- analogous to file systems that are both case-insensitive and case-
preserving,as dicussed above, or those which are both preserving,as discussed above, or those which are both
normalization-insensitive and normalization-preserving, as normalization-insensitive and normalization-preserving, as
discussed below. The handling will be insensitive to the presence discussed below. The handling will be insensitive to the presence
of the chosen characters while preserving the presence or absence of the chosen characters while preserving the presence or absence
of such characters within names. of such characters within names.
Note that the second of these choices is a desirable way to handle Note that the second of these choices is a desirable way to handle
characters within table B.1, again with the exception of U+200C and characters within table B.1, again with the exception of U+200C and
U+200D, which can cause issues for Farsi. U+200D, which can cause issues for Farsi.
In addition to modification due to normalization, discussed below, In addition to modification due to normalization, discussed below,
skipping to change at page 179, line 35 skipping to change at page 189, line 37
The issues are best discussed separately for the server and the The issues are best discussed separately for the server and the
client. It is important to note that the server and client may have client. It is important to note that the server and client may have
different approaches to this area, and that the server choice may not different approaches to this area, and that the server choice may not
match the client operating environment. The issue of mismatches and match the client operating environment. The issue of mismatches and
how they may be best dealt with by the client is discussed in a later how they may be best dealt with by the client is discussed in a later
section. section.
12.7.1.5.1. Server Normalization Issues for Component Strings 12.7.1.5.1. Server Normalization Issues for Component Strings
The NFS version 4 does not specify required use of a particular The NFSv4 does not specify required use of a particular normalization
normalization form for component4 strings. Therefore, the server may form for component4 strings. Therefore, the server may receive
receive unnormalized strings or strings that reflect either unnormalized strings or strings that reflect either normalization
normalization form within protocol requests and responses. If the form within protocol requests and responses. If the file system
file system requires normalization, then the server implementation requires normalization, then the server implementation must normalize
must normalize component4 strings within the protocol server before component4 strings within the protocol server before presenting the
presenting the information to the local file system. information to the local file system.
With regard to normalization, servers have the following choices, With regard to normalization, servers have the following choices,
with the possibility that different choices may be selected for with the possibility that different choices may be selected for
different file systems. different file systems.
o Implement a particular normalization form, either NFC, or NFD, in o Implement a particular normalization form, either NFC, or NFD, in
which case file names received from a client are converted to that which case file names received from a client are converted to that
normalization form and as a consequence, the client will always normalization form and as a consequence, the client will always
receive names in that normalization form. If this option is receive names in that normalization form. If this option is
chosen, then it is impossible to create two files in the same chosen, then it is impossible to create two files in the same
skipping to change at page 180, line 48 skipping to change at page 190, line 51
normalization-unaware. normalization-unaware.
We discuss below issues that may arise when each of these types of We discuss below issues that may arise when each of these types of
environments interact with the various types of file systems, with environments interact with the various types of file systems, with
regard to normalization handling. Note that complexity for the regard to normalization handling. Note that complexity for the
client is increased given that there are no file system attributes to client is increased given that there are no file system attributes to
determine the normalization handling present for that file system. determine the normalization handling present for that file system.
Where the client has the ability to create files (file system not Where the client has the ability to create files (file system not
read-only and security allows it), attempting to create multiple read-only and security allows it), attempting to create multiple
files with canonically equivalent names and looking at success files with canonically equivalent names and looking at success
paaaters and the names assigned by the server to these files can patterns and the names assigned by the server to these files can
serve as a way to determine the relevant information. serve as a way to determine the relevant information.
Normalization-aware environments interoperate most normally with Normalization-aware environments interoperate most normally with
servers that either impose a given normalization form or those that servers that either impose a given normalization form or those that
implement name handling which is both normalization-insensitive and implement name handling which is both normalization-insensitive and
normalization-preserving name handling. However, clients need to be normalization-preserving name handling. However, clients need to be
prepared to interoperate with servers that have normalization- prepared to interoperate with servers that have normalization-
sensitive file naming. In this situation, the client needs to be sensitive file naming. In this situation, the client needs to be
prepared for the fact that a directory may contain multiple names prepared for the fact that a directory may contain multiple names
that it considers equivalent. that it considers equivalent.
skipping to change at page 181, line 33 skipping to change at page 191, line 36
When it cannot be determined that a normalization-insensitive When it cannot be determined that a normalization-insensitive
server file system is not involved, the client is generally best server file system is not involved, the client is generally best
advised to process incoming name components so as to allow all advised to process incoming name components so as to allow all
name components in a canonical equivalence class to be together. name components in a canonical equivalence class to be together.
When only a single member of class exists, it should generally When only a single member of class exists, it should generally
mapped directly to the preferred normalization form, whether the mapped directly to the preferred normalization form, whether the
name was of that form or not. name was of that form or not.
When the client sees multiple names that are canonically When the client sees multiple names that are canonically
equivalent, it is clear you have a file systen which is equivalent, it is clear you have a file system which is
normalization sensitive. Clients should generally replace each normalization sensitive. Clients should generally replace each
canonically equivalent name with one that appends some canonically equivalent name with one that appends some
distinguishing suffix, usually including a number. The numbers distinguishing suffix, usually including a number. The numbers
should be assigned so that each distinct possible name with the should be assigned so that each distinct possible name with the
set of canonically equivalent names has an assigned numeric value. set of canonically equivalent names has an assigned numeric value.
Note that for some cases in which there are multiple instances of Note that for some cases in which there are multiple instances of
strings that might be composed or decomposed and/or situations strings that might be composed or decomposed and/or situations
with multiple diacritics to be applied to the same character, the with multiple diacritics to be applied to the same character, the
class might be large. class might be large.
When interacting with a normalization-sensitive filesystem, it may When interacting with a normalization-sensitive filesystem, it may
be that the environment contains clients or implementations local be that the environment contains clients or implementations local
to the OS in which the file system is embedded, which use a to the OS in which the file system is embedded, which use a
different normalization form. In such situations, a LOOKUP may different normalization form. In such situations, a LOOKUP may
well fail, even though the directory contains a name canonically well fail, even though the directory contains a name canonically
equivalent to the name sought. One solution to this problem is to equivalent to the name sought. One solution to this problem is to
re-do the LOOKUP in that situation with name converted to the re-do the LOOKUP in that situation with name converted to the
alternate normalization form. alternate normalization form.
In the case in which normalization-unaware clients are involved in In the case in which normalization-unaware clients are involved in
the mix, LOOKUP can fail and then the second lOOKUP, described the mix, LOOKUP can fail and then the second LOOKUP, described
above can also fail, even though there may well be a oanonically above can also fail, even though there may well be a canonically
equivalent name in the directory. One possible approach in that equivalent name in the directory. One possible approach in that
case is to use a READDIR to find the equivalent name and lookup case is to use a READDIR to find the equivalent name and lookup
that, although this can greatly add to client implementation that, although this can greatly add to client implementation
complexity. complexity.
When interacting with a normalization-sensitive filesystem, the When interacting with a normalization-sensitive filesystem, the
situation where the environment contains clients or situation where the environment contains clients or
implementations local to the OS in which the file system is implementations local to the OS in which the file system is
embedded, which use a different normalization form can also cause embedded, which use a different normalization form can also cause
issues when a file (or symlink or directory, etc.) is being issues when a file (or symlink or directory, etc.) is being
created. In such cases, you may be able to create an object of created. In such cases, you may be able to create an object of
the specified name even though, the directory contains a the specified name even though, the directory contains a
canonically equivalent name. Similar issues can occur with LINK canonically equivalent name. Similar issues can occur with LINK