idnits 2.17.1 draft-ietf-nfsv4-rfc3530bis-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 2 instances of lines with non-RFC2606-compliant FQDNs in the document. -- The abstract seems to indicate that this document obsoletes RFC1813, but the header doesn't have an 'Obsoletes:' line to match this. -- The abstract seems to indicate that this document obsoletes RFC3530, but the header doesn't have an 'Obsoletes:' line to match this. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 940 has weird spacing: '...al_must ser...' == Line 1038 has weird spacing: '...ned int cb_...' == Line 1254 has weird spacing: '...otiated rpc_g...' == Line 1255 has weird spacing: '...otiated rpc_g...' == Line 1256 has weird spacing: '...otiated rpc_g...' == (19 more instances...) -- The exact meaning of the all-uppercase expression 'MAY NOT' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: The server can specify a root path by setting an array of zero path components. Other than this special case, the server MUST not present empty path components to the client. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: A problem exists if a client allows an open owner to have state on multiple filesystems on a server. If one of those filesystems is migrated, what happens to the sequence numbers? A client can avoid such a situation with the stipulation that any client which supports migration MUST ensure that any open owner is confined to a single filesystem. If the server finds itself migrating open owners that span multiple filesystems, then it MUST not migrate the state for the conflicting open owners on the non-migrated filesystems; instead it MUST return NFS4ERR_STALE_STATEID if the client tries to use those stateids. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: 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 communication has extended beyond the lease period. If the server 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 new request. If the server runs out of resources, it MAY free all courtesy locks. I.e., the client MUST not make an assumption that the server has issued courtesy locks. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: 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. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: If a COMPOUND contains an OPEN which establishes a OPEN_DELEGATE_WRITE delegation, then a subsequent GETATTR inside that COMPOUND SHOULD not result in a CB_GETATTR to the client. The server SHOULD understand the GETATTR to be for the same client ID and avoid querying the client, which will not be able to respond. This sequence of OPEN, GETATTR SHOULD be understood as an atomic retrieval of the initial size and change attribute. Further, the client SHOULD NOT construct a COMPOUND which mixes operations for different client IDs. == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (April 04, 2011) is 4769 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. '1' == Outdated reference: A later version (-24) exists of draft-ietf-nfsv4-rfc3530bis-dot-x-02 -- Possible downref: Non-RFC (?) normative reference: ref. '7' ** Obsolete normative reference: RFC 3454 (ref. '9') (Obsoleted by RFC 7564) -- Obsolete informational reference (is this intentional?): RFC 3530 (ref. '11') (Obsoleted by RFC 7530) -- Obsolete informational reference (is this intentional?): RFC 3010 (ref. '12') (Obsoleted by RFC 3530) -- Obsolete informational reference (is this intentional?): RFC 2373 (ref. '18') (Obsoleted by RFC 3513) -- Obsolete informational reference (is this intentional?): RFC 5661 (ref. '31') (Obsoleted by RFC 8881) -- Obsolete informational reference (is this intentional?): RFC 793 (ref. '33') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 5226 (ref. '41') (Obsoleted by RFC 8126) Summary: 1 error (**), 0 flaws (~~), 15 warnings (==), 13 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NFSv4 T. Haynes, Ed. 3 Internet-Draft NetApp 4 Intended status: Standards Track D. Noveck, Ed. 5 Expires: October 6, 2011 EMC 6 April 04, 2011 8 Network File System (NFS) Version 4 Protocol 9 draft-ietf-nfsv4-rfc3530bis-11.txt 11 Abstract 13 The Network File System (NFS) version 4 is a distributed filesystem 14 protocol which owes heritage to NFS protocol version 2, RFC 1094, and 15 version 3, RFC 1813. Unlike earlier versions, the NFS version 4 16 protocol supports traditional file access while integrating support 17 for file locking and the mount protocol. In addition, support for 18 strong security (and its negotiation), compound operations, client 19 caching, and internationalization have been added. Of course, 20 attention has been applied to making NFS version 4 operate well in an 21 Internet environment. 23 This document, together with the companion XDR description document, 24 replaces RFC 3530 as the definition of the NFS version 4 protocol. 26 Requirements Language 28 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 29 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 30 document are to be interpreted as described in RFC 2119 [1]. 32 Status of this Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at http://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on October 6, 2011. 49 Copyright Notice 51 Copyright (c) 2011 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (http://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 This document may contain material from IETF Documents or IETF 65 Contributions published or made publicly available before November 66 10, 2008. The person(s) controlling the copyright in some of this 67 material may not have granted the IETF Trust the right to allow 68 modifications of such material outside the IETF Standards Process. 69 Without obtaining an adequate license from the person(s) controlling 70 the copyright in such materials, this document may not be modified 71 outside the IETF Standards Process, and derivative works of it may 72 not be created outside the IETF Standards Process, except to format 73 it for publication as an RFC or to translate it into languages other 74 than English. 76 Table of Contents 78 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 9 79 1.1. Changes since RFC 3530 . . . . . . . . . . . . . . . . . 9 80 1.2. Changes since RFC 3010 . . . . . . . . . . . . . . . . . 10 81 1.3. NFS Version 4 Goals . . . . . . . . . . . . . . . . . . 11 82 1.4. Inconsistencies of this Document with the companion 83 document NFS Version 4 Protocol . . . . . . . . . . . . 11 84 1.5. Overview of NFSv4 Features . . . . . . . . . . . . . . . 12 85 1.5.1. RPC and Security . . . . . . . . . . . . . . . . . . 12 86 1.5.2. Procedure and Operation Structure . . . . . . . . . 12 87 1.5.3. Filesystem Model . . . . . . . . . . . . . . . . . . 13 88 1.5.4. OPEN and CLOSE . . . . . . . . . . . . . . . . . . . 15 89 1.5.5. File Locking . . . . . . . . . . . . . . . . . . . . 15 90 1.5.6. Client Caching and Delegation . . . . . . . . . . . 15 91 1.6. General Definitions . . . . . . . . . . . . . . . . . . 16 92 2. Protocol Data Types . . . . . . . . . . . . . . . . . . . . . 18 93 2.1. Basic Data Types . . . . . . . . . . . . . . . . . . . . 18 94 2.2. Structured Data Types . . . . . . . . . . . . . . . . . 20 95 3. RPC and Security Flavor . . . . . . . . . . . . . . . . . . . 25 96 3.1. Ports and Transports . . . . . . . . . . . . . . . . . . 25 97 3.1.1. Client Retransmission Behavior . . . . . . . . . . . 26 98 3.2. Security Flavors . . . . . . . . . . . . . . . . . . . . 27 99 3.2.1. Security mechanisms for NFSv4 . . . . . . . . . . . 27 100 3.3. Security Negotiation . . . . . . . . . . . . . . . . . . 29 101 3.3.1. SECINFO . . . . . . . . . . . . . . . . . . . . . . 30 102 3.3.2. Security Error . . . . . . . . . . . . . . . . . . . 30 103 3.3.3. Callback RPC Authentication . . . . . . . . . . . . 30 104 4. Filehandles . . . . . . . . . . . . . . . . . . . . . . . . . 32 105 4.1. Obtaining the First Filehandle . . . . . . . . . . . . . 32 106 4.1.1. Root Filehandle . . . . . . . . . . . . . . . . . . 33 107 4.1.2. Public Filehandle . . . . . . . . . . . . . . . . . 33 108 4.2. Filehandle Types . . . . . . . . . . . . . . . . . . . . 33 109 4.2.1. General Properties of a Filehandle . . . . . . . . . 34 110 4.2.2. Persistent Filehandle . . . . . . . . . . . . . . . 34 111 4.2.3. Volatile Filehandle . . . . . . . . . . . . . . . . 35 112 4.2.4. One Method of Constructing a Volatile Filehandle . . 36 113 4.3. Client Recovery from Filehandle Expiration . . . . . . . 36 114 5. File Attributes . . . . . . . . . . . . . . . . . . . . . . . 37 115 5.1. REQUIRED Attributes . . . . . . . . . . . . . . . . . . 38 116 5.2. RECOMMENDED Attributes . . . . . . . . . . . . . . . . . 39 117 5.3. Named Attributes . . . . . . . . . . . . . . . . . . . . 39 118 5.4. Classification of Attributes . . . . . . . . . . . . . . 41 119 5.5. Set-Only and Get-Only Attributes . . . . . . . . . . . . 41 120 5.6. REQUIRED Attributes - List and Definition References . . 42 121 5.7. RECOMMENDED Attributes - List and Definition 122 References . . . . . . . . . . . . . . . . . . . . . . . 43 123 5.8. Attribute Definitions . . . . . . . . . . . . . . . . . 44 124 5.8.1. Definitions of REQUIRED Attributes . . . . . . . . . 44 125 5.8.2. Definitions of Uncategorized RECOMMENDED 126 Attributes . . . . . . . . . . . . . . . . . . . . . 46 127 5.9. Interpreting owner and owner_group . . . . . . . . . . . 52 128 5.10. Character Case Attributes . . . . . . . . . . . . . . . 55 129 6. Access Control Attributes . . . . . . . . . . . . . . . . . . 55 130 6.1. Goals . . . . . . . . . . . . . . . . . . . . . . . . . 55 131 6.2. File Attributes Discussion . . . . . . . . . . . . . . . 56 132 6.2.1. Attribute 12: acl . . . . . . . . . . . . . . . . . 56 133 6.2.2. Attribute 33: mode . . . . . . . . . . . . . . . . . 70 134 6.3. Common Methods . . . . . . . . . . . . . . . . . . . . . 71 135 6.3.1. Interpreting an ACL . . . . . . . . . . . . . . . . 71 136 6.3.2. Computing a Mode Attribute from an ACL . . . . . . . 72 137 6.4. Requirements . . . . . . . . . . . . . . . . . . . . . . 73 138 6.4.1. Setting the mode and/or ACL Attributes . . . . . . . 73 139 6.4.2. Retrieving the mode and/or ACL Attributes . . . . . 75 140 6.4.3. Creating New Objects . . . . . . . . . . . . . . . . 75 141 7. Multi-Server Namespace . . . . . . . . . . . . . . . . . . . 77 142 7.1. Location Attributes . . . . . . . . . . . . . . . . . . 77 143 7.2. File System Presence or Absence . . . . . . . . . . . . 77 144 7.3. Getting Attributes for an Absent File System . . . . . . 78 145 7.3.1. GETATTR Within an Absent File System . . . . . . . . 79 146 7.3.2. READDIR and Absent File Systems . . . . . . . . . . 80 147 7.4. Uses of Location Information . . . . . . . . . . . . . . 80 148 7.4.1. File System Replication . . . . . . . . . . . . . . 81 149 7.4.2. File System Migration . . . . . . . . . . . . . . . 82 150 7.4.3. Referrals . . . . . . . . . . . . . . . . . . . . . 82 151 7.5. Location Entries and Server Identity . . . . . . . . . . 83 152 7.6. Additional Client-Side Considerations . . . . . . . . . 84 153 7.7. Effecting File System Transitions . . . . . . . . . . . 85 154 7.7.1. File System Transitions and Simultaneous Access . . 86 155 7.7.2. Filehandles and File System Transitions . . . . . . 86 156 7.7.3. Fileids and File System Transitions . . . . . . . . 87 157 7.7.4. Fsids and File System Transitions . . . . . . . . . 88 158 7.7.5. The Change Attribute and File System Transitions . . 88 159 7.7.6. Lock State and File System Transitions . . . . . . . 89 160 7.7.7. Write Verifiers and File System Transitions . . . . 91 161 7.7.8. Readdir Cookies and Verifiers and File System 162 Transitions . . . . . . . . . . . . . . . . . . . . 91 163 7.7.9. File System Data and File System Transitions . . . . 91 164 7.8. Effecting File System Referrals . . . . . . . . . . . . 93 165 7.8.1. Referral Example (LOOKUP) . . . . . . . . . . . . . 93 166 7.8.2. Referral Example (READDIR) . . . . . . . . . . . . . 97 167 7.9. The Attribute fs_locations . . . . . . . . . . . . . . . 99 168 7.9.1. Inferring Transition Modes . . . . . . . . . . . . . 101 169 8. NFS Server Name Space . . . . . . . . . . . . . . . . . . . . 102 170 8.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 103 171 8.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 103 172 8.3. Server Pseudo Filesystem . . . . . . . . . . . . . . . . 103 173 8.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 104 174 8.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 104 175 8.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 104 176 8.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 105 177 8.8. Security Policy and Name Space Presentation . . . . . . 105 178 9. File Locking and Share Reservations . . . . . . . . . . . . . 106 179 9.1. Opens and Byte-Range Locks . . . . . . . . . . . . . . . 107 180 9.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . 107 181 9.1.2. Server Release of Client ID . . . . . . . . . . . . 110 182 9.1.3. Stateid Definition . . . . . . . . . . . . . . . . . 111 183 9.1.4. lock-owner . . . . . . . . . . . . . . . . . . . . . 118 184 9.1.5. Use of the Stateid and Locking . . . . . . . . . . . 119 185 9.1.6. Sequencing of Lock Requests . . . . . . . . . . . . 121 186 9.1.7. Recovery from Replayed Requests . . . . . . . . . . 122 187 9.1.8. Releasing lock-owner State . . . . . . . . . . . . . 122 188 9.1.9. Use of Open Confirmation . . . . . . . . . . . . . . 123 189 9.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 124 190 9.3. Upgrading and Downgrading Locks . . . . . . . . . . . . 124 191 9.4. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 125 192 9.5. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 126 193 9.6. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 126 194 9.6.1. Client Failure and Recovery . . . . . . . . . . . . 127 195 9.6.2. Server Failure and Recovery . . . . . . . . . . . . 127 196 9.6.3. Network Partitions and Recovery . . . . . . . . . . 129 197 9.7. Recovery from a Lock Request Timeout or Abort . . . . . 136 198 9.8. Server Revocation of Locks . . . . . . . . . . . . . . . 136 199 9.9. Share Reservations . . . . . . . . . . . . . . . . . . . 137 200 9.10. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 138 201 9.10.1. Close and Retention of State Information . . . . . . 139 202 9.11. Open Upgrade and Downgrade . . . . . . . . . . . . . . . 139 203 9.12. Short and Long Leases . . . . . . . . . . . . . . . . . 140 204 9.13. Clocks, Propagation Delay, and Calculating Lease 205 Expiration . . . . . . . . . . . . . . . . . . . . . . . 141 206 9.14. Migration, Replication and State . . . . . . . . . . . . 141 207 9.14.1. Migration and State . . . . . . . . . . . . . . . . 142 208 9.14.2. Replication and State . . . . . . . . . . . . . . . 142 209 9.14.3. Notification of Migrated Lease . . . . . . . . . . . 143 210 9.14.4. Migration and the Lease_time Attribute . . . . . . . 144 211 10. Client-Side Caching . . . . . . . . . . . . . . . . . . . . . 144 212 10.1. Performance Challenges for Client-Side Caching . . . . . 145 213 10.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 146 214 10.2.1. Delegation Recovery . . . . . . . . . . . . . . . . 147 215 10.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 149 216 10.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . 150 217 10.3.2. Data Caching and File Locking . . . . . . . . . . . 151 218 10.3.3. Data Caching and Mandatory File Locking . . . . . . 152 219 10.3.4. Data Caching and File Identity . . . . . . . . . . . 153 221 10.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 154 222 10.4.1. Open Delegation and Data Caching . . . . . . . . . . 156 223 10.4.2. Open Delegation and File Locks . . . . . . . . . . . 158 224 10.4.3. Handling of CB_GETATTR . . . . . . . . . . . . . . . 158 225 10.4.4. Recall of Open Delegation . . . . . . . . . . . . . 161 226 10.4.5. OPEN Delegation Race with CB_RECALL . . . . . . . . 163 227 10.4.6. Clients that Fail to Honor Delegation Recalls . . . 164 228 10.4.7. Delegation Revocation . . . . . . . . . . . . . . . 165 229 10.5. Data Caching and Revocation . . . . . . . . . . . . . . 165 230 10.5.1. Revocation Recovery for Write Open Delegation . . . 166 231 10.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 166 232 10.7. Data and Metadata Caching and Memory Mapped Files . . . 168 233 10.8. Name Caching . . . . . . . . . . . . . . . . . . . . . . 170 234 10.9. Directory Caching . . . . . . . . . . . . . . . . . . . 171 235 11. Minor Versioning . . . . . . . . . . . . . . . . . . . . . . 172 236 12. Internationalization . . . . . . . . . . . . . . . . . . . . 175 237 12.1. Use of UTF-8 . . . . . . . . . . . . . . . . . . . . . . 176 238 12.1.1. Relation to Stringprep . . . . . . . . . . . . . . . 176 239 12.1.2. Normalization, Equivalence, and Confusability . . . 177 240 12.2. String Type Overview . . . . . . . . . . . . . . . . . . 180 241 12.2.1. Overall String Class Divisions . . . . . . . . . . . 180 242 12.2.2. Divisions by Typedef Parent types . . . . . . . . . 181 243 12.2.3. Individual Types and Their Handling . . . . . . . . 182 244 12.3. Errors Related to Strings . . . . . . . . . . . . . . . 183 245 12.4. Types with Pre-processing to Resolve Mixture Issues . . 184 246 12.4.1. Processing of Principal Strings . . . . . . . . . . 184 247 12.4.2. Processing of Server Id Strings . . . . . . . . . . 184 248 12.5. String Types without Internationalization Processing . . 185 249 12.6. Types with Processing Defined by Other Internet Areas . 185 250 12.7. String Types with NFS-specific Processing . . . . . . . 186 251 12.7.1. Handling of File Name Components . . . . . . . . . . 187 252 12.7.2. Processing of Link Text . . . . . . . . . . . . . . 196 253 12.7.3. Processing of Principal Prefixes . . . . . . . . . . 197 254 13. Error Values . . . . . . . . . . . . . . . . . . . . . . . . 198 255 13.1. Error Definitions . . . . . . . . . . . . . . . . . . . 198 256 13.1.1. General Errors . . . . . . . . . . . . . . . . . . . 200 257 13.1.2. Filehandle Errors . . . . . . . . . . . . . . . . . 201 258 13.1.3. Compound Structure Errors . . . . . . . . . . . . . 202 259 13.1.4. File System Errors . . . . . . . . . . . . . . . . . 203 260 13.1.5. State Management Errors . . . . . . . . . . . . . . 205 261 13.1.6. Security Errors . . . . . . . . . . . . . . . . . . 206 262 13.1.7. Name Errors . . . . . . . . . . . . . . . . . . . . 206 263 13.1.8. Locking Errors . . . . . . . . . . . . . . . . . . . 207 264 13.1.9. Reclaim Errors . . . . . . . . . . . . . . . . . . . 208 265 13.1.10. Client Management Errors . . . . . . . . . . . . . . 209 266 13.1.11. Attribute Handling Errors . . . . . . . . . . . . . 209 267 13.2. Operations and their valid errors . . . . . . . . . . . 210 268 13.3. Callback operations and their valid errors . . . . . . . 217 269 13.4. Errors and the operations that use them . . . . . . . . 217 270 14. NFSv4 Requests . . . . . . . . . . . . . . . . . . . . . . . 222 271 14.1. Compound Procedure . . . . . . . . . . . . . . . . . . . 222 272 14.2. Evaluation of a Compound Request . . . . . . . . . . . . 223 273 14.3. Synchronous Modifying Operations . . . . . . . . . . . . 224 274 14.4. Operation Values . . . . . . . . . . . . . . . . . . . . 224 275 15. NFSv4 Procedures . . . . . . . . . . . . . . . . . . . . . . 224 276 15.1. Procedure 0: NULL - No Operation . . . . . . . . . . . . 224 277 15.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 225 278 15.3. Operation 3: ACCESS - Check Access Rights . . . . . . . 230 279 15.4. Operation 4: CLOSE - Close File . . . . . . . . . . . . 233 280 15.5. Operation 5: COMMIT - Commit Cached Data . . . . . . . . 234 281 15.6. Operation 6: CREATE - Create a Non-Regular File Object . 236 282 15.7. Operation 7: DELEGPURGE - Purge Delegations Awaiting 283 Recovery . . . . . . . . . . . . . . . . . . . . . . . . 239 284 15.8. Operation 8: DELEGRETURN - Return Delegation . . . . . . 240 285 15.9. Operation 9: GETATTR - Get Attributes . . . . . . . . . 240 286 15.10. Operation 10: GETFH - Get Current Filehandle . . . . . . 242 287 15.11. Operation 11: LINK - Create Link to a File . . . . . . . 243 288 15.12. Operation 12: LOCK - Create Lock . . . . . . . . . . . . 244 289 15.13. Operation 13: LOCKT - Test For Lock . . . . . . . . . . 248 290 15.14. Operation 14: LOCKU - Unlock File . . . . . . . . . . . 250 291 15.15. Operation 15: LOOKUP - Lookup Filename . . . . . . . . . 251 292 15.16. Operation 16: LOOKUPP - Lookup Parent Directory . . . . 253 293 15.17. Operation 17: NVERIFY - Verify Difference in 294 Attributes . . . . . . . . . . . . . . . . . . . . . . . 253 295 15.18. Operation 18: OPEN - Open a Regular File . . . . . . . . 255 296 15.19. Operation 19: OPENATTR - Open Named Attribute 297 Directory . . . . . . . . . . . . . . . . . . . . . . . 265 298 15.20. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . . . 266 299 15.21. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access . 268 300 15.22. Operation 22: PUTFH - Set Current Filehandle . . . . . . 269 301 15.23. Operation 23: PUTPUBFH - Set Public Filehandle . . . . . 270 302 15.24. Operation 24: PUTROOTFH - Set Root Filehandle . . . . . 271 303 15.25. Operation 25: READ - Read from File . . . . . . . . . . 272 304 15.26. Operation 26: READDIR - Read Directory . . . . . . . . . 274 305 15.27. Operation 27: READLINK - Read Symbolic Link . . . . . . 278 306 15.28. Operation 28: REMOVE - Remove Filesystem Object . . . . 279 307 15.29. Operation 29: RENAME - Rename Directory Entry . . . . . 281 308 15.30. Operation 30: RENEW - Renew a Lease . . . . . . . . . . 283 309 15.31. Operation 31: RESTOREFH - Restore Saved Filehandle . . . 284 310 15.32. Operation 32: SAVEFH - Save Current Filehandle . . . . . 285 311 15.33. Operation 33: SECINFO - Obtain Available Security . . . 285 312 15.34. Operation 34: SETATTR - Set Attributes . . . . . . . . . 288 313 15.35. Operation 35: SETCLIENTID - Negotiate Client ID . . . . 291 314 15.36. Operation 36: SETCLIENTID_CONFIRM - Confirm Client ID . 295 315 15.37. Operation 37: VERIFY - Verify Same Attributes . . . . . 298 316 15.38. Operation 38: WRITE - Write to File . . . . . . . . . . 300 317 15.39. Operation 39: RELEASE_LOCKOWNER - Release Lockowner 318 State . . . . . . . . . . . . . . . . . . . . . . . . . 304 319 15.40. Operation 10044: ILLEGAL - Illegal operation . . . . . . 305 320 16. NFSv4 Callback Procedures . . . . . . . . . . . . . . . . . . 305 321 16.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 306 322 16.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . . 306 323 16.2.6. Operation 3: CB_GETATTR - Get Attributes . . . . . . 308 324 16.2.7. Operation 4: CB_RECALL - Recall an Open Delegation . 309 325 16.2.8. Operation 10044: CB_ILLEGAL - Illegal Callback 326 Operation . . . . . . . . . . . . . . . . . . . . . 310 327 17. Security Considerations . . . . . . . . . . . . . . . . . . . 311 328 18. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 312 329 18.1. Named Attribute Definitions . . . . . . . . . . . . . . 312 330 18.1.1. Initial Registry . . . . . . . . . . . . . . . . . . 313 331 18.1.2. Updating Registrations . . . . . . . . . . . . . . . 313 332 18.2. ONC RPC Network Identifiers (netids) . . . . . . . . . . 313 333 18.2.1. Initial Registry . . . . . . . . . . . . . . . . . . 315 334 18.2.2. Updating Registrations . . . . . . . . . . . . . . . 315 335 19. References . . . . . . . . . . . . . . . . . . . . . . . . . 315 336 19.1. Normative References . . . . . . . . . . . . . . . . . . 315 337 19.2. Informative References . . . . . . . . . . . . . . . . . 316 338 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 318 339 Appendix B. RFC Editor Notes . . . . . . . . . . . . . . . . . . 319 340 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 319 342 1. Introduction 344 1.1. Changes since RFC 3530 346 This document, together with the companion XDR description document 347 [2], obsoletes RFC 3530 [11] as the authoritative document describing 348 NFSv4. It does not introduce any over-the-wire protocol changes, in 349 the sense that previously valid requests requests remain valid. 350 However, some requests previously defined as invalid, although not 351 generally rejected, are now explicitly allowed, in that 352 internationalization handling has been generalized and liberalized. 353 The main changes from RFC 3530 are: 355 o The XDR definition has been moved to a companion document [2] 357 o Updates for the latest IETF intellectual property statements 359 o There is a restructured and more complete explanation of multi- 360 server namespace features. In particular, this explanation 361 explicitly describes handling of inter-server referrals, even 362 where neither migration nor replication is involved. 364 o More liberal handling of internationalization for file names and 365 user and group names, with the elimination of restrictions imposed 366 by stringprep, with the recognition that rules for the forms of 367 these name are the province of the receiving entity. 369 o Updating handling of domain names to reflect IDNA. 371 o Restructuring of string types to more appropriately reflect the 372 reality of required string processing. 374 o LIPKEY SPKM/3 has been moved from being REQUIRED to OPTIONAL. 376 o Some clarification on a client re-establishing callback 377 information to the new server if state has been migrated. 379 o A third edge case was added for Courtesy locks and network 380 partitions. 382 o The definition of stateid was strengthened, which had the side 383 effect of introducing a semantic change in a COMPOUND structure 384 having a current stateid and a saved stateid. 386 1.2. Changes since RFC 3010 388 This definition of the NFSv4 protocol replaces or obsoletes the 389 definition present in [12]. While portions of the two documents have 390 remained the same, there have been substantive changes in others. 391 The changes made between [12] and this document represent 392 implementation experience and further review of the protocol. While 393 some modifications were made for ease of implementation or 394 clarification, most updates represent errors or situations where the 395 [12] definition were untenable. 397 The following list is not all inclusive of all changes but presents 398 some of the most notable changes or additions made: 400 o The state model has added an open_owner4 identifier. This was 401 done to accommodate Posix based clients and the model they use for 402 file locking. For Posix clients, an open_owner4 would correspond 403 to a file descriptor potentially shared amongst a set of processes 404 and the lock_owner4 identifier would correspond to a process that 405 is locking a file. 407 o Clarifications and error conditions were added for the handling of 408 the owner and group attributes. Since these attributes are string 409 based (as opposed to the numeric uid/gid of previous versions of 410 NFS), translations may not be available and hence the changes 411 made. 413 o Clarifications for the ACL and mode attributes to address 414 evaluation and partial support. 416 o For identifiers that are defined as XDR opaque, limits were set on 417 their size. 419 o Added the mounted_on_filed attribute to allow Posix clients to 420 correctly construct local mounts. 422 o Modified the SETCLIENTID/SETCLIENTID_CONFIRM operations to deal 423 correctly with confirmation details along with adding the ability 424 to specify new client callback information. Also added 425 clarification of the callback information itself. 427 o Added a new operation LOCKOWNER_RELEASE to enable notifying the 428 server that a lock_owner4 will no longer be used by the client. 430 o RENEW operation changes to identify the client correctly and allow 431 for additional error returns. 433 o Verify error return possibilities for all operations. 435 o Remove use of the pathname4 data type from LOOKUP and OPEN in 436 favor of having the client construct a sequence of LOOKUP 437 operations to achieve the same effect. 439 o Clarification of the internationalization issues and adoption of 440 the new stringprep profile framework. 442 1.3. NFS Version 4 Goals 444 The NFSv4 protocol is a further revision of the NFS protocol defined 445 already by versions 2 [13] and 3 [14]. It retains the essential 446 characteristics of previous versions: design for easy recovery, 447 independent of transport protocols, operating systems and 448 filesystems, simplicity, and good performance. The NFSv4 revision 449 has the following goals: 451 o Improved access and good performance on the Internet. 453 The protocol is designed to transit firewalls easily, perform well 454 where latency is high and bandwidth is low, and scale to very 455 large numbers of clients per server. 457 o Strong security with negotiation built into the protocol. 459 The protocol builds on the work of the ONCRPC working group in 460 supporting the RPCSEC_GSS protocol. Additionally, the NFS version 461 4 protocol provides a mechanism to allow clients and servers the 462 ability to negotiate security and require clients and servers to 463 support a minimal set of security schemes. 465 o Good cross-platform interoperability. 467 The protocol features a filesystem model that provides a useful, 468 common set of features that does not unduly favor one filesystem 469 or operating system over another. 471 o Designed for protocol extensions. 473 The protocol is designed to accept standard extensions that do not 474 compromise backward compatibility. 476 1.4. Inconsistencies of this Document with the companion document NFS 477 Version 4 Protocol 479 [2], NFS Version 4 Protocol, contains the definitions in XDR 480 description language of the constructs used by the protocol. Inside 481 this document, several of the constructs are reproduced for purposes 482 of explanation. The reader is warned of the possibility of errors in 483 the reproduced constructs outside of [2]. For any part of the 484 document that is inconsistent with [2], [2] is to be considered 485 authoritative. 487 1.5. Overview of NFSv4 Features 489 To provide a reasonable context for the reader, the major features of 490 NFSv4 protocol will be reviewed in brief. This will be done to 491 provide an appropriate context for both the reader who is familiar 492 with the previous versions of the NFS protocol and the reader that is 493 new to the NFS protocols. For the reader new to the NFS protocols, 494 there is still a fundamental knowledge that is expected. The reader 495 should be familiar with the XDR and RPC protocols as described in [3] 496 and [15]. A basic knowledge of filesystems and distributed 497 filesystems is expected as well. 499 1.5.1. RPC and Security 501 As with previous versions of NFS, the External Data Representation 502 (XDR) and Remote Procedure Call (RPC) mechanisms used for the NFSv4 503 protocol are those defined in [3] and [15]. To meet end to end 504 security requirements, the RPCSEC_GSS framework [4] will be used to 505 extend the basic RPC security. With the use of RPCSEC_GSS, various 506 mechanisms can be provided to offer authentication, integrity, and 507 privacy to the NFS version 4 protocol. Kerberos V5 will be used as 508 described in [16] to provide one security framework. The LIPKEY GSS- 509 API mechanism described in [5] will be used to provide for the use of 510 user password and server public key by the NFSv4 protocol. With the 511 use of RPCSEC_GSS, other mechanisms may also be specified and used 512 for NFS version 4 security. 514 To enable in-band security negotiation, the NFSv4 protocol has added 515 a new operation which provides the client a method of querying the 516 server about its policies regarding which security mechanisms must be 517 used for access to the server's filesystem resources. With this, the 518 client can securely match the security mechanism that meets the 519 policies specified at both the client and server. 521 1.5.2. Procedure and Operation Structure 523 A significant departure from the previous versions of the NFS 524 protocol is the introduction of the COMPOUND procedure. For the 525 NFSv4 protocol, there are two RPC procedures, NULL and COMPOUND. The 526 COMPOUND procedure is defined in terms of operations and these 527 operations correspond more closely to the traditional NFS procedures. 529 With the use of the COMPOUND procedure, the client is able to build 530 simple or complex requests. These COMPOUND requests allow for a 531 reduction in the number of RPCs needed for logical filesystem 532 operations. For example, without previous contact with a server a 533 client will be able to read data from a file in one request by 534 combining LOOKUP, OPEN, and READ operations in a single COMPOUND RPC. 535 With previous versions of the NFS protocol, this type of single 536 request was not possible. 538 The model used for COMPOUND is very simple. There is no logical OR 539 or ANDing of operations. The operations combined within a COMPOUND 540 request are evaluated in order by the server. Once an operation 541 returns a failing result, the evaluation ends and the results of all 542 evaluated operations are returned to the client. 544 The NFSv4 protocol continues to have the client refer to a file or 545 directory at the server by a "filehandle". The COMPOUND procedure 546 has a method of passing a filehandle from one operation to another 547 within the sequence of operations. There is a concept of a "current 548 filehandle" and "saved filehandle". Most operations use the "current 549 filehandle" as the filesystem object to operate upon. The "saved 550 filehandle" is used as temporary filehandle storage within a COMPOUND 551 procedure as well as an additional operand for certain operations. 553 1.5.3. Filesystem Model 555 The general filesystem model used for the NFSv4 protocol is the same 556 as previous versions. The server filesystem is hierarchical with the 557 regular files contained within being treated as opaque byte streams. 558 In a slight departure, file and directory names are encoded with 559 UTF-8 to deal with the basics of internationalization. 561 The NFSv4 protocol does not require a separate protocol to provide 562 for the initial mapping between path name and filehandle. Instead of 563 using the older MOUNT protocol for this mapping, the server provides 564 a ROOT filehandle that represents the logical root or top of the 565 filesystem tree provided by the server. The server provides multiple 566 filesystems by gluing them together with pseudo filesystems. These 567 pseudo filesystems provide for potential gaps in the path names 568 between real filesystems. 570 1.5.3.1. Filehandle Types 572 In previous versions of the NFS protocol, the filehandle provided by 573 the server was guaranteed to be valid or persistent for the lifetime 574 of the filesystem object to which it referred. For some server 575 implementations, this persistence requirement has been difficult to 576 meet. For the NFSv4 protocol, this requirement has been relaxed by 577 introducing another type of filehandle, volatile. With persistent 578 and volatile filehandle types, the server implementation can match 579 the abilities of the filesystem at the server along with the 580 operating environment. The client will have knowledge of the type of 581 filehandle being provided by the server and can be prepared to deal 582 with the semantics of each. 584 1.5.3.2. Attribute Types 586 The NFSv4 protocol has a rich and extensible file object attribute 587 structure, which is divided into REQUIRED, RECOMMENDED, and named 588 attributes (see Section 5). 590 Several (but not all) of the REQUIRED attributes are derived from the 591 attributes of NFSv3 (see definition of the fattr3 data type in [14]). 592 An example of a REQUIRED attribute is the file object's type 593 (Section 5.8.1.2) so that regular files can be distinguished from 594 directories (also known as folders in some operating environments) 595 and other types of objects. REQUIRED attributes are discussed in 596 Section 5.1. 598 An example of three RECOMMENDED attributes are acl, sacl, and dacl. 599 These attributes define an Access Control List (ACL) on a file object 600 ((Section 6). An ACL provides directory and file access control 601 beyond the model used in NFSv3. The ACL definition allows for 602 specification of specific sets of permissions for individual users 603 and groups. In addition, ACL inheritance allows propagation of 604 access permissions and restriction down a directory tree as file 605 system objects are created. RECOMMENDED attributes are discussed in 606 Section 5.2. 608 A named attribute is an opaque byte stream that is associated with a 609 directory or file and referred to by a string name. Named attributes 610 are meant to be used by client applications as a method to associate 611 application-specific data with a regular file or directory. NFSv4.1 612 modifies named attributes relative to NFSv4.0 by tightening the 613 allowed operations in order to prevent the development of non- 614 interoperable implementations. Named attributes are discussed in 615 Section 5.3. 617 1.5.3.3. Multi-server Namespace 619 NFSv4 contains a number of features to allow implementation of 620 namespaces that cross server boundaries and that allow and facilitate 621 a non-disruptive transfer of support for individual file systems 622 between servers. They are all based upon attributes that allow one 623 file system to specify alternate or new locations for that file 624 system. 626 These attributes may be used together with the concept of absent file 627 systems, which provide specifications for additional locations but no 628 actual file system content. This allows a number of important 629 facilities: 631 o Location attributes may be used with absent file systems to 632 implement referrals whereby one server may direct the client to a 633 file system provided by another server. This allows extensive 634 multi-server namespaces to be constructed. 636 o Location attributes may be provided for present file systems to 637 provide the locations of alternate file system instances or 638 replicas to be used in the event that the current file system 639 instance becomes unavailable. 641 o Location attributes may be provided when a previously present file 642 system becomes absent. This allows non-disruptive migration of 643 file systems to alternate servers. 645 1.5.4. OPEN and CLOSE 647 The NFSv4 protocol introduces OPEN and CLOSE operations. The OPEN 648 operation provides a single point where file lookup, creation, and 649 share semantics can be combined. The CLOSE operation also provides 650 for the release of state accumulated by OPEN. 652 1.5.5. File Locking 654 With the NFSv4 protocol, the support for byte range file locking is 655 part of the NFS protocol. The file locking support is structured so 656 that an RPC callback mechanism is not required. This is a departure 657 from the previous versions of the NFS file locking protocol, Network 658 Lock Manager (NLM). The state associated with file locks is 659 maintained at the server under a lease-based model. The server 660 defines a single lease period for all state held by a NFS client. If 661 the client does not renew its lease within the defined period, all 662 state associated with the client's lease may be released by the 663 server. The client may renew its lease with use of the RENEW 664 operation or implicitly by use of other operations (primarily READ). 666 1.5.6. Client Caching and Delegation 668 The file, attribute, and directory caching for the NFSv4 protocol is 669 similar to previous versions. Attributes and directory information 670 are cached for a duration determined by the client. At the end of a 671 predefined timeout, the client will query the server to see if the 672 related filesystem object has been updated. 674 For file data, the client checks its cache validity when the file is 675 opened. A query is sent to the server to determine if the file has 676 been changed. Based on this information, the client determines if 677 the data cache for the file should kept or released. Also, when the 678 file is closed, any modified data is written to the server. 680 If an application wants to serialize access to file data, file 681 locking of the file data ranges in question should be used. 683 The major addition to NFSv4 in the area of caching is the ability of 684 the server to delegate certain responsibilities to the client. When 685 the server grants a delegation for a file to a client, the client is 686 guaranteed certain semantics with respect to the sharing of that file 687 with other clients. At OPEN, the server may provide the client 688 either a OPEN_DELEGATE_READ or OPEN_DELEGATE_WRITE delegation for the 689 file. If the client is granted a OPEN_DELEGATE_READ delegation, it 690 is assured that no other client has the ability to write to the file 691 for the duration of the delegation. If the client is granted a 692 OPEN_DELEGATE_WRITE delegation, the client is assured that no other 693 client has read or write access to the file. 695 Delegations can be recalled by the server. If another client 696 requests access to the file in such a way that the access conflicts 697 with the granted delegation, the server is able to notify the initial 698 client and recall the delegation. This requires that a callback path 699 exist between the server and client. If this callback path does not 700 exist, then delegations cannot be granted. The essence of a 701 delegation is that it allows the client to locally service operations 702 such as OPEN, CLOSE, LOCK, LOCKU, READ, or WRITE without immediate 703 interaction with the server. 705 1.6. General Definitions 707 The following definitions are provided for the purpose of providing 708 an appropriate context for the reader. 710 Byte: In this document, a byte is an octet, i.e., a datum exactly 8 711 bits in length. 713 Client: The client is the entity that accesses the NFS server's 714 resources. The client may be an application that contains the 715 logic to access the NFS server directly. The client may also be 716 the traditional operating system client that provides remote 717 filesystem services for a set of applications. 719 With reference to byte-range locking, the client is also the 720 entity that maintains a set of locks on behalf of one or more 721 applications. This client is responsible for crash or failure 722 recovery for those locks it manages. 724 Note that multiple clients may share the same transport and 725 connection and multiple clients may exist on the same network 726 node. 728 Client ID: A 64-bit quantity used as a unique, short-hand reference 729 to a client supplied Verifier and ID. The server is responsible 730 for supplying the Client ID. 732 File System: The file system is the collection of objects on a 733 server that share the same fsid attribute (see Section 5.8.1.9). 735 Lease: An interval of time defined by the server for which the 736 client is irrevocably granted a lock. At the end of a lease 737 period the lock may be revoked if the lease has not been extended. 738 The lock must be revoked if a conflicting lock has been granted 739 after the lease interval. 741 All leases granted by a server have the same fixed interval. Note 742 that the fixed interval was chosen to alleviate the expense a 743 server would have in maintaining state about variable length 744 leases across server failures. 746 Lock: The term "lock" is used to refer to both record (byte-range) 747 locks as well as share reservations unless specifically stated 748 otherwise. 750 Server: The "Server" is the entity responsible for coordinating 751 client access to a set of filesystems. 753 Stable Storage: NFSv4 servers must be able to recover without data 754 loss from multiple power failures (including cascading power 755 failures, that is, several power failures in quick succession), 756 operating system failures, and hardware failure of components 757 other than the storage medium itself (for example, disk, 758 nonvolatile RAM). 760 Some examples of stable storage that are allowable for an NFS 761 server include: 763 (1) Media commit of data, that is, the modified data has been 764 successfully written to the disk media, for example, the disk 765 platter. 767 (2) An immediate reply disk drive with battery-backed on-drive 768 intermediate storage or uninterruptible power system (UPS). 770 (3) Server commit of data with battery-backed intermediate 771 storage and recovery software. 773 (4) Cache commit with uninterruptible power system (UPS) and 774 recovery software. 776 Stateid: A stateid is a 128-bit quantity returned by a server that 777 uniquely defines the open and locking states provided by the 778 server for a specific open-owner or lock-owner/open-owner pair for 779 a specific file and type of lock. 781 Verifier: A 64-bit quantity generated by the client that the server 782 can use to determine if the client has restarted and lost all 783 previous lock state. 785 2. Protocol Data Types 787 The syntax and semantics to describe the data types of the NFS 788 version 4 protocol are defined in the XDR [15] and RPC [3] documents. 789 The next sections build upon the XDR data types to define types and 790 structures specific to this protocol. 792 2.1. Basic Data Types 794 These are the base NFSv4 data types. 796 +----------------+--------------------------------------------------+ 797 | Data Type | Definition | 798 +----------------+--------------------------------------------------+ 799 | int32_t | typedef int int32_t; | 800 | uint32_t | typedef unsigned int uint32_t; | 801 | int64_t | typedef hyper int64_t; | 802 | uint64_t | typedef unsigned hyper uint64_t; | 803 | attrlist4 | typedef opaque attrlist4<>; | 804 | | Used for file/directory attributes. | 805 | bitmap4 | typedef uint32_t bitmap4<>; | 806 | | Used in attribute array encoding. | 807 | changeid4 | typedef uint64_t changeid4; | 808 | | Used in the definition of change_info4. | 809 | clientid4 | typedef uint64_t clientid4; | 810 | | Shorthand reference to client identification. | 811 | count4 | typedef uint32_t count4; | 812 | | Various count parameters (READ, WRITE, COMMIT). | 813 | length4 | typedef uint64_t length4; | 814 | | Describes LOCK lengths. | 815 | mode4 | typedef uint32_t mode4; | 816 | | Mode attribute data type. | 817 | nfs_cookie4 | typedef uint64_t nfs_cookie4; | 818 | | Opaque cookie value for READDIR. | 819 | nfs_fh4 | typedef opaque nfs_fh4; | 820 | | Filehandle definition. | 821 | nfs_ftype4 | enum nfs_ftype4; | 822 | | Various defined file types. | 823 | nfsstat4 | enum nfsstat4; | 824 | | Return value for operations. | 825 | offset4 | typedef uint64_t offset4; | 826 | | Various offset designations (READ, WRITE, LOCK, | 827 | | COMMIT). | 828 | qop4 | typedef uint32_t qop4; | 829 | | Quality of protection designation in SECINFO. | 830 | sec_oid4 | typedef opaque sec_oid4<>; | 831 | | Security Object Identifier. The sec_oid4 data | 832 | | type is not really opaque. Instead it contains | 833 | | an ASN.1 OBJECT IDENTIFIER as used by GSS-API in | 834 | | the mech_type argument to GSS_Init_sec_context. | 835 | | See [6] for details. | 836 | seqid4 | typedef uint32_t seqid4; | 837 | | Sequence identifier used for file locking. | 838 | utf8string | typedef opaque utf8string<>; | 839 | | UTF-8 encoding for strings. | 840 | utf8_should | typedef utf8string utf8_should; | 841 | | String expected to be UTF8 but no validation | 842 | utf8val_should | typedef utf8string utf8val_should; | 843 | | String SHOULD be sent UTF8 and SHOULD be | 844 | | validated | 845 | utf8val_must | typedef utf8string utf8val_must; | 846 | | String MUST be sent UTF8 and MUST be validated | 847 | ascii_must | typedef utf8string ascii_must; | 848 | | String MUST be sent as ASCII and thus is | 849 | | automatically UTF8 | 850 | comptag4 | typedef utf8_should comptag4; | 851 | | Tag should be UTF8 but is not checked | 852 | component4 | typedef utf8val_should component4; | 853 | | Represents path name components. | 854 | linktext4 | typedef utf8val_should linktext4; | 855 | | Symbolic link contents. | 856 | pathname4 | typedef component4 pathname4<>; | 857 | | Represents path name for fs_locations. | 858 | nfs_lockid4 | typedef uint64_t nfs_lockid4; | 859 | verifier4 | typedef opaque verifier4[NFS4_VERIFIER_SIZE]; | 860 | | Verifier used for various operations (COMMIT, | 861 | | CREATE, EXCHANGE_ID, OPEN, READDIR, WRITE) | 862 | | NFS4_VERIFIER_SIZE is defined as 8. | 863 +----------------+--------------------------------------------------+ 865 End of Base Data Types 867 Table 1 869 2.2. Structured Data Types 871 2.2.1. nfstime4 873 struct nfstime4 { 874 int64_t seconds; 875 uint32_t nseconds; 876 }; 878 The nfstime4 structure gives the number of seconds and nanoseconds 879 since midnight or 0 hour January 1, 1970 Coordinated Universal Time 880 (UTC). Values greater than zero for the seconds field denote dates 881 after the 0 hour January 1, 1970. Values less than zero for the 882 seconds field denote dates before the 0 hour January 1, 1970. In 883 both cases, the nseconds field is to be added to the seconds field 884 for the final time representation. For example, if the time to be 885 represented is one-half second before 0 hour January 1, 1970, the 886 seconds field would have a value of negative one (-1) and the 887 nseconds fields would have a value of one-half second (500000000). 888 Values greater than 999,999,999 for nseconds are considered invalid. 890 This data type is used to pass time and date information. A server 891 converts to and from its local representation of time when processing 892 time values, preserving as much accuracy as possible. If the 893 precision of timestamps stored for a filesystem object is less than 894 defined, loss of precision can occur. An adjunct time maintenance 895 protocol is recommended to reduce client and server time skew. 897 2.2.2. time_how4 899 enum time_how4 { 900 SET_TO_SERVER_TIME4 = 0, 901 SET_TO_CLIENT_TIME4 = 1 902 }; 904 2.2.3. settime4 906 union settime4 switch (time_how4 set_it) { 907 case SET_TO_CLIENT_TIME4: 908 nfstime4 time; 909 default: 910 void; 911 }; 913 The above definitions are used as the attribute definitions to set 914 time values. If set_it is SET_TO_SERVER_TIME4, then the server uses 915 its local representation of time for the time value. 917 2.2.4. specdata4 919 struct specdata4 { 920 uint32_t specdata1; /* major device number */ 921 uint32_t specdata2; /* minor device number */ 922 }; 924 This data type represents additional information for the device file 925 types NF4CHR and NF4BLK. 927 2.2.5. fsid4 929 struct fsid4 { 930 uint64_t major; 931 uint64_t minor; 932 }; 934 This type is the filesystem identifier that is used as a mandatory 935 attribute. 937 2.2.6. fs_location4 939 struct fs_location4 { 940 utf8val_must server<>; 941 pathname4 rootpath; 942 }; 944 2.2.7. fs_locations4 946 struct fs_locations4 { 947 pathname4 fs_root; 948 fs_location4 locations<>; 949 }; 951 The fs_location4 and fs_locations4 data types are used for the 952 fs_locations recommended attribute which is used for migration and 953 replication support. 955 2.2.8. fattr4 957 struct fattr4 { 958 bitmap4 attrmask; 959 attrlist4 attr_vals; 960 }; 962 The fattr4 structure is used to represent file and directory 963 attributes. 965 The bitmap is a counted array of 32 bit integers used to contain bit 966 values. The position of the integer in the array that contains bit n 967 can be computed from the expression (n / 32) and its bit within that 968 integer is (n mod 32). 970 0 1 971 +-----------+-----------+-----------+-- 972 | count | 31 .. 0 | 63 .. 32 | 973 +-----------+-----------+-----------+-- 975 2.2.9. change_info4 977 struct change_info4 { 978 bool atomic; 979 changeid4 before; 980 changeid4 after; 981 }; 983 This structure is used with the CREATE, LINK, REMOVE, RENAME 984 operations to let the client know the value of the change attribute 985 for the directory in which the target filesystem object resides. 987 2.2.10. clientaddr4 989 struct clientaddr4 { 990 /* see struct rpcb in RFC 1833 */ 991 string r_netid<>; /* network id */ 992 string r_addr<>; /* universal address */ 993 }; 995 The clientaddr4 structure is used as part of the SETCLIENTID 996 operation to either specify the address of the client that is using a 997 client ID or as part of the callback registration. The r_netid and 998 r_addr fields are specified in [17], but they are underspecified in 1000 [17] as far as what they should look like for specific protocols. 1002 For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the 1003 US-ASCII string: 1005 h1.h2.h3.h4.p1.p2 1007 The prefix, "h1.h2.h3.h4", is the standard textual form for 1008 representing an IPv4 address, which is always four octets long. 1009 Assuming big-endian ordering, h1, h2, h3, and h4, are respectively, 1010 the first through fourth octets each converted to ASCII-decimal. 1011 Assuming big-endian ordering, p1 and p2 are, respectively, the first 1012 and second octets each converted to ASCII-decimal. For example, if a 1013 host, in big-endian order, has an address of 0x0A010307 and there is 1014 a service listening on, in big endian order, port 0x020F (decimal 1015 527), then the complete universal address is "10.1.3.7.2.15". 1017 For TCP over IPv4 the value of r_netid is the string "tcp". For UDP 1018 over IPv4 the value of r_netid is the string "udp". 1020 For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the 1021 US-ASCII string: 1023 x1:x2:x3:x4:x5:x6:x7:x8.p1.p2 1025 The suffix "p1.p2" is the service port, and is computed the same way 1026 as with universal addresses for TCP and UDP over IPv4. The prefix, 1027 "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for 1028 representing an IPv6 address as defined in Section 2.2 of [18]. 1029 Additionally, the two alternative forms specified in Section 2.2 of 1030 [18] are also acceptable. 1032 For TCP over IPv6 the value of r_netid is the string "tcp6". For UDP 1033 over IPv6 the value of r_netid is the string "udp6". 1035 2.2.11. cb_client4 1037 struct cb_client4 { 1038 unsigned int cb_program; 1039 clientaddr4 cb_location; 1040 }; 1042 This structure is used by the client to inform the server of its call 1043 back address; includes the program number and client address. 1045 2.2.12. nfs_client_id4 1047 struct nfs_client_id4 { 1048 verifier4 verifier; 1049 opaque id; 1050 }; 1052 This structure is part of the arguments to the SETCLIENTID operation. 1053 NFS4_OPAQUE_LIMIT is defined as 1024. 1055 2.2.13. open_owner4 1057 struct open_owner4 { 1058 clientid4 clientid; 1059 opaque owner; 1060 }; 1062 This structure is used to identify the owner of open state. 1063 NFS4_OPAQUE_LIMIT is defined as 1024. 1065 2.2.14. lock_owner4 1067 struct lock_owner4 { 1068 clientid4 clientid; 1069 opaque owner; 1070 }; 1072 This structure is used to identify the owner of file locking state. 1073 NFS4_OPAQUE_LIMIT is defined as 1024. 1075 2.2.15. open_to_lock_owner4 1077 struct open_to_lock_owner4 { 1078 seqid4 open_seqid; 1079 stateid4 open_stateid; 1080 seqid4 lock_seqid; 1081 lock_owner4 lock_owner; 1082 }; 1084 This structure is used for the first LOCK operation done for an 1085 open_owner4. It provides both the open_stateid and lock_owner such 1086 that the transition is made from a valid open_stateid sequence to 1087 that of the new lock_stateid sequence. Using this mechanism avoids 1088 the confirmation of the lock_owner/lock_seqid pair since it is tied 1089 to established state in the form of the open_stateid/open_seqid. 1091 2.2.16. stateid4 1093 struct stateid4 { 1094 uint32_t seqid; 1095 opaque other[12]; 1096 }; 1098 This structure is used for the various state sharing mechanisms 1099 between the client and server. For the client, this data structure 1100 is read-only. The starting value of the seqid field is undefined. 1101 The server is required to increment the seqid field monotonically at 1102 each transition of the stateid. This is important since the client 1103 will inspect the seqid in OPEN stateids to determine the order of 1104 OPEN processing done by the server. 1106 3. RPC and Security Flavor 1108 The NFSv4 protocol is a Remote Procedure Call (RPC) application that 1109 uses RPC version 2 and the corresponding eXternal Data Representation 1110 (XDR) as defined in [3] and [15]. The RPCSEC_GSS security flavor as 1111 defined in [4] MUST be used as the mechanism to deliver stronger 1112 security for the NFSv4 protocol. 1114 3.1. Ports and Transports 1116 Historically, NFSv2 and NFSv3 servers have resided on port 2049. The 1117 registered port 2049 [19] for the NFS protocol SHOULD be the default 1118 configuration. Using the registered port for NFS services means the 1119 NFS client will not need to use the RPC binding protocols as 1120 described in [17]; this will allow NFS to transit firewalls. 1122 Where an NFSv4 implementation supports operation over the IP network 1123 protocol, the supported transports between NFS and IP MUST be among 1124 the IETF-approved congestion control transport protocols, which 1125 include TCP and SCTP. To enhance the possibilities for 1126 interoperability, an NFSv4 implementation MUST support operation over 1127 the TCP transport protocol, at least until such time as a standards 1128 track RFC revises this requirement to use a different IETF-approved 1129 congestion control transport protocol. 1131 If TCP is used as the transport, the client and server SHOULD use 1132 persistent connections. This will prevent the weakening of TCP's 1133 congestion control via short lived connections and will improve 1134 performance for the WAN environment by eliminating the need for SYN 1135 handshakes. 1137 As noted in Section 17, the authentication model for NFSv4 has moved 1138 from machine-based to principal-based. However, this modification of 1139 the authentication model does not imply a technical requirement to 1140 move the TCP connection management model from whole machine-based to 1141 one based on a per user model. In particular, NFS over TCP client 1142 implementations have traditionally multiplexed traffic for multiple 1143 users over a common TCP connection between an NFS client and server. 1144 This has been true, regardless whether the NFS client is using 1145 AUTH_SYS, AUTH_DH, RPCSEC_GSS or any other flavor. Similarly, NFS 1146 over TCP server implementations have assumed such a model and thus 1147 scale the implementation of TCP connection management in proportion 1148 to the number of expected client machines. It is intended that NFSv4 1149 will not modify this connection management model. NFSv4 clients that 1150 violate this assumption can expect scaling issues on the server and 1151 hence reduced service. 1153 Note that for various timers, the client and server should avoid 1154 inadvertent synchronization of those timers. For further discussion 1155 of the general issue refer to [20]. 1157 3.1.1. Client Retransmission Behavior 1159 When processing a request received over a reliable transport such as 1160 TCP, the NFSv4 server MUST NOT silently drop the request, except if 1161 the transport connection has been broken. Given such a contract 1162 between NFSv4 clients and servers, clients MUST NOT retry a request 1163 unless one or both of the following are true: 1165 o The transport connection has been broken 1167 o The procedure being retried is the NULL procedure 1169 Since reliable transports, such as TCP, do not always synchronously 1170 inform a peer when the other peer has broken the connection (for 1171 example, when an NFS server reboots), the NFSv4 client may want to 1172 actively "probe" the connection to see if has been broken. Use of 1173 the NULL procedure is one recommended way to do so. So, when a 1174 client experiences a remote procedure call timeout (of some arbitrary 1175 implementation specific amount), rather than retrying the remote 1176 procedure call, it could instead issue a NULL procedure call to the 1177 server. If the server has died, the transport connection break will 1178 eventually be indicated to the NFSv4 client. The client can then 1179 reconnect, and then retry the original request. If the NULL 1180 procedure call gets a response, the connection has not broken. The 1181 client can decide to wait longer for the original request's response, 1182 or it can break the transport connection and reconnect before re- 1183 sending the original request. 1185 For callbacks from the server to the client, the same rules apply, 1186 but the server doing the callback becomes the client, and the client 1187 receiving the callback becomes the server. 1189 3.2. Security Flavors 1191 Traditional RPC implementations have included AUTH_NONE, AUTH_SYS, 1192 AUTH_DH, and AUTH_KRB4 as security flavors. With [4] an additional 1193 security flavor of RPCSEC_GSS has been introduced which uses the 1194 functionality of GSS-API [6]. This allows for the use of various 1195 security mechanisms by the RPC layer without the additional 1196 implementation overhead of adding RPC security flavors. For NFSv4, 1197 the RPCSEC_GSS security flavor MUST be used to enable the mandatory 1198 security mechanism. Other flavors, such as, AUTH_NONE, AUTH_SYS, and 1199 AUTH_DH MAY be implemented as well. 1201 3.2.1. Security mechanisms for NFSv4 1203 The use of RPCSEC_GSS requires selection of: mechanism, quality of 1204 protection, and service (authentication, integrity, privacy). The 1205 remainder of this document will refer to these three parameters of 1206 the RPCSEC_GSS security as the security triple. 1208 3.2.1.1. Kerberos V5 as a security triple 1210 The Kerberos V5 GSS-API mechanism as described in [16] MUST be 1211 implemented and provide the following security triples. 1213 column descriptions: 1215 1 == number of pseudo flavor 1216 2 == name of pseudo flavor 1217 3 == mechanism's OID 1218 4 == mechanism's algorithm(s) 1219 5 == RPCSEC_GSS service 1221 1 2 3 4 5 1222 -------------------------------------------------------------------- 1223 390003 krb5 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_none 1224 390004 krb5i 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_integrity 1225 390005 krb5p 1.2.840.113554.1.2.2 DES MAC MD5 rpc_gss_svc_privacy 1226 for integrity, 1227 and 56 bit DES 1228 for privacy. 1230 Note that the pseudo flavor is presented here as a mapping aid to the 1231 implementor. Because this NFS protocol includes a method to 1232 negotiate security and it understands the GSS-API mechanism, the 1233 pseudo flavor is not needed. The pseudo flavor is needed for NFSv3 1234 since the security negotiation is done via the MOUNT protocol. 1236 For a discussion of NFS' use of RPCSEC_GSS and Kerberos V5, please 1237 see [21]. 1239 Users and implementors are warned that 56 bit DES is no longer 1240 considered state of the art in terms of resistance to brute force 1241 attacks. Once a revision to [16] is available that adds support for 1242 AES, implementors are urged to incorporate AES into their NFSv4 over 1243 Kerberos V5 protocol stacks, and users are similarly urged to migrate 1244 to the use of AES. 1246 3.2.1.2. LIPKEY as a security triple 1248 The LIPKEY GSS-API mechanism as described in [5] MAY be implemented 1249 and provide the following security triples. The definition of the 1250 columns matches those in Section 3.2.1.1. 1252 1 2 3 4 5 1253 -------------------------------------------------------------------- 1254 390006 lipkey 1.3.6.1.5.5.9 negotiated rpc_gss_svc_none 1255 390007 lipkey-i 1.3.6.1.5.5.9 negotiated rpc_gss_svc_integrity 1256 390008 lipkey-p 1.3.6.1.5.5.9 negotiated rpc_gss_svc_privacy 1258 The mechanism algorithm is listed as "negotiated". This is because 1259 LIPKEY is layered on SPKM-3 and in SPKM-3 [5] the confidentiality and 1260 integrity algorithms are negotiated. Since SPKM-3 specifies HMAC-MD5 1261 for integrity as MANDATORY, 128 bit cast5CBC for confidentiality for 1262 privacy as MANDATORY, and further specifies that HMAC-MD5 and 1263 cast5CBC MUST be listed first before weaker algorithms, specifying 1264 "negotiated" in column 4 does not impair interoperability. In the 1265 event an SPKM-3 peer does not support the mandatory algorithms, the 1266 other peer is free to accept or reject the GSS-API context creation. 1268 Because SPKM-3 negotiates the algorithms, subsequent calls to 1269 LIPKEY's GSS_Wrap() and GSS_GetMIC() by RPCSEC_GSS will use a quality 1270 of protection value of 0 (zero). See section 5.2 of [22] for an 1271 explanation. 1273 LIPKEY uses SPKM-3 to create a secure channel in which to pass a user 1274 name and password from the client to the server. Once the user name 1275 and password have been accepted by the server, calls to the LIPKEY 1276 context are redirected to the SPKM-3 context. See [5] for more 1277 details. 1279 3.2.1.3. SPKM-3 as a security triple 1281 The SPKM-3 GSS-API mechanism as described in [5] MAY be implemented 1282 and provide the following security triples. The definition of the 1283 columns matches those in Section 3.2.1.1. 1285 1 2 3 4 5 1286 -------------------------------------------------------------------- 1287 390009 spkm3 1.3.6.1.5.5.1.3 negotiated rpc_gss_svc_none 1288 390010 spkm3i 1.3.6.1.5.5.1.3 negotiated rpc_gss_svc_integrity 1289 390011 spkm3p 1.3.6.1.5.5.1.3 negotiated rpc_gss_svc_privacy 1291 For a discussion as to why the mechanism algorithm is listed as 1292 "negotiated", see Section 3.2.1.2. 1294 Because SPKM-3 negotiates the algorithms, subsequent calls to 1295 SPKM-3's GSS_Wrap() and GSS_GetMIC() by RPCSEC_GSS will use a quality 1296 of protection value of 0 (zero). See section 5.2 of [22] for an 1297 explanation. 1299 Even though LIPKEY is layered over SPKM-3, SPKM-3 is specified as a 1300 mandatory set of triples to handle the situations where the initiator 1301 (the client) is anonymous or where the initiator has its own 1302 certificate. If the initiator is anonymous, there will not be a user 1303 name and password to send to the target (the server). If the 1304 initiator has its own certificate, then using passwords is 1305 superfluous. 1307 3.3. Security Negotiation 1309 With the NFSv4 server potentially offering multiple security 1310 mechanisms, the client needs a method to determine or negotiate which 1311 mechanism is to be used for its communication with the server. The 1312 NFS server may have multiple points within its filesystem name space 1313 that are available for use by NFS clients. In turn the NFS server 1314 may be configured such that each of these entry points may have 1315 different or multiple security mechanisms in use. 1317 The security negotiation between client and server SHOULD be done 1318 with a secure channel to eliminate the possibility of a third party 1319 intercepting the negotiation sequence and forcing the client and 1320 server to choose a lower level of security than required or desired. 1321 See Section 17 for further discussion. 1323 3.3.1. SECINFO 1325 The new SECINFO operation will allow the client to determine, on a 1326 per filehandle basis, what security triple is to be used for server 1327 access. In general, the client will not have to use the SECINFO 1328 operation except during initial communication with the server or when 1329 the client crosses policy boundaries at the server. It is possible 1330 that the server's policies change during the client's interaction 1331 therefore forcing the client to negotiate a new security triple. 1333 3.3.2. Security Error 1335 Based on the assumption that each NFSv4 client and server MUST 1336 support a minimum set of security (i.e., LIPKEY, SPKM-3, and 1337 Kerberos-V5 all under RPCSEC_GSS), the NFS client will start its 1338 communication with the server with one of the minimal security 1339 triples. During communication with the server, the client may 1340 receive an NFS error of NFS4ERR_WRONGSEC. This error allows the 1341 server to notify the client that the security triple currently being 1342 used is not appropriate for access to the server's filesystem 1343 resources. The client is then responsible for determining what 1344 security triples are available at the server and choose one which is 1345 appropriate for the client. See Section 15.33 for further discussion 1346 of how the client will respond to the NFS4ERR_WRONGSEC error and use 1347 SECINFO. 1349 3.3.3. Callback RPC Authentication 1351 Except as noted elsewhere in this section, the callback RPC 1352 (described later) MUST mutually authenticate the NFS server to the 1353 principal that acquired the client ID (also described later), using 1354 the security flavor the original SETCLIENTID operation used. 1356 For AUTH_NONE, there are no principals, so this is a non-issue. 1358 AUTH_SYS has no notions of mutual authentication or a server 1359 principal, so the callback from the server simply uses the AUTH_SYS 1360 credential that the user used when he set up the delegation. 1362 For AUTH_DH, one commonly used convention is that the server uses the 1363 credential corresponding to this AUTH_DH principal: 1365 unix.host@domain 1367 where host and domain are variables corresponding to the name of 1368 server host and directory services domain in which it lives such as a 1369 Network Information System domain or a DNS domain. 1371 Because LIPKEY is layered over SPKM-3, it is permissible for the 1372 server to use SPKM-3 and not LIPKEY for the callback even if the 1373 client used LIPKEY for SETCLIENTID. 1375 Regardless of what security mechanism under RPCSEC_GSS is being used, 1376 the NFS server, MUST identify itself in GSS-API via a 1377 GSS_C_NT_HOSTBASED_SERVICE name type. GSS_C_NT_HOSTBASED_SERVICE 1378 names are of the form: 1380 service@hostname 1382 For NFS, the "service" element is 1384 nfs 1386 Implementations of security mechanisms will convert nfs@hostname to 1387 various different forms. For Kerberos V5 and LIPKEY, the following 1388 form is RECOMMENDED: 1390 nfs/hostname 1392 For Kerberos V5, nfs/hostname would be a server principal in the 1393 Kerberos Key Distribution Center database. This is the same 1394 principal the client acquired a GSS-API context for when it issued 1395 the SETCLIENTID operation, therefore, the realm name for the server 1396 principal must be the same for the callback as it was for the 1397 SETCLIENTID. 1399 For LIPKEY, this would be the username passed to the target (the NFS 1400 version 4 client that receives the callback). 1402 It should be noted that LIPKEY may not work for callbacks, since the 1403 LIPKEY client uses a user id/password. If the NFS client receiving 1404 the callback can authenticate the NFS server's user name/password 1405 pair, and if the user that the NFS server is authenticating to has a 1406 public key certificate, then it works. 1408 In situations where the NFS client uses LIPKEY and uses a per-host 1409 principal for the SETCLIENTID operation, instead of using LIPKEY for 1410 SETCLIENTID, it is RECOMMENDED that SPKM-3 with mutual authentication 1411 be used. This effectively means that the client will use a 1412 certificate to authenticate and identify the initiator to the target 1413 on the NFS server. Using SPKM-3 and not LIPKEY has the following 1414 advantages: 1416 o When the server does a callback, it must authenticate to the 1417 principal used in the SETCLIENTID. Even if LIPKEY is used, 1418 because LIPKEY is layered over SPKM-3, the NFS client will need to 1419 have a certificate that corresponds to the principal used in the 1420 SETCLIENTID operation. From an administrative perspective, having 1421 a user name, password, and certificate for both the client and 1422 server is redundant. 1424 o LIPKEY was intended to minimize additional infrastructure 1425 requirements beyond a certificate for the target, and the 1426 expectation is that existing password infrastructure can be 1427 leveraged for the initiator. In some environments, a per-host 1428 password does not exist yet. If certificates are used for any 1429 per-host principals, then additional password infrastructure is 1430 not needed. 1432 o In cases when a host is both an NFS client and server, it can 1433 share the same per-host certificate. 1435 4. Filehandles 1437 The filehandle in the NFS protocol is a per server unique identifier 1438 for a filesystem object. The contents of the filehandle are opaque 1439 to the client. Therefore, the server is responsible for translating 1440 the filehandle to an internal representation of the filesystem 1441 object. 1443 4.1. Obtaining the First Filehandle 1445 The operations of the NFS protocol are defined in terms of one or 1446 more filehandles. Therefore, the client needs a filehandle to 1447 initiate communication with the server. With the NFSv2 protocol [13] 1448 and the NFSv3 protocol [14], there exists an ancillary protocol to 1449 obtain this first filehandle. The MOUNT protocol, RPC program number 1450 100005, provides the mechanism of translating a string based 1451 filesystem path name to a filehandle which can then be used by the 1452 NFS protocols. 1454 The MOUNT protocol has deficiencies in the area of security and use 1455 via firewalls. This is one reason that the use of the public 1456 filehandle was introduced in [23] and [24]. With the use of the 1457 public filehandle in combination with the LOOKUP operation in the 1458 NFSv2 and NFSv3 protocols, it has been demonstrated that the MOUNT 1459 protocol is unnecessary for viable interaction between NFS client and 1460 server. 1462 Therefore, the NFSv4 protocol will not use an ancillary protocol for 1463 translation from string based path names to a filehandle. Two 1464 special filehandles will be used as starting points for the NFS 1465 client. 1467 4.1.1. Root Filehandle 1469 The first of the special filehandles is the ROOT filehandle. The 1470 ROOT filehandle is the "conceptual" root of the filesystem name space 1471 at the NFS server. The client uses or starts with the ROOT 1472 filehandle by employing the PUTROOTFH operation. The PUTROOTFH 1473 operation instructs the server to set the "current" filehandle to the 1474 ROOT of the server's file tree. Once this PUTROOTFH operation is 1475 used, the client can then traverse the entirety of the server's file 1476 tree with the LOOKUP operation. A complete discussion of the server 1477 name space is in Section 8. 1479 4.1.2. Public Filehandle 1481 The second special filehandle is the PUBLIC filehandle. Unlike the 1482 ROOT filehandle, the PUBLIC filehandle may be bound or represent an 1483 arbitrary filesystem object at the server. The server is responsible 1484 for this binding. It may be that the PUBLIC filehandle and the ROOT 1485 filehandle refer to the same filesystem object. However, it is up to 1486 the administrative software at the server and the policies of the 1487 server administrator to define the binding of the PUBLIC filehandle 1488 and server filesystem object. The client may not make any 1489 assumptions about this binding. The client uses the PUBLIC 1490 filehandle via the PUTPUBFH operation. 1492 4.2. Filehandle Types 1494 In the NFSv2 and NFSv3 protocols, there was one type of filehandle 1495 with a single set of semantics. This type of filehandle is termed 1496 "persistent" in NFS Version 4. The semantics of a persistent 1497 filehandle remain the same as before. A new type of filehandle 1498 introduced in NFS Version 4 is the "volatile" filehandle, which 1499 attempts to accommodate certain server environments. 1501 The volatile filehandle type was introduced to address server 1502 functionality or implementation issues which make correct 1503 implementation of a persistent filehandle infeasible. Some server 1504 environments do not provide a filesystem level invariant that can be 1505 used to construct a persistent filehandle. The underlying server 1506 filesystem may not provide the invariant or the server's filesystem 1507 programming interfaces may not provide access to the needed 1508 invariant. Volatile filehandles may ease the implementation of 1509 server functionality such as hierarchical storage management or 1510 filesystem reorganization or migration. However, the volatile 1511 filehandle increases the implementation burden for the client. 1513 Since the client will need to handle persistent and volatile 1514 filehandles differently, a file attribute is defined which may be 1515 used by the client to determine the filehandle types being returned 1516 by the server. 1518 4.2.1. General Properties of a Filehandle 1520 The filehandle contains all the information the server needs to 1521 distinguish an individual file. To the client, the filehandle is 1522 opaque. The client stores filehandles for use in a later request and 1523 can compare two filehandles from the same server for equality by 1524 doing a byte-by-byte comparison. However, the client MUST NOT 1525 otherwise interpret the contents of filehandles. If two filehandles 1526 from the same server are equal, they MUST refer to the same file. 1527 Servers SHOULD try to maintain a one-to-one correspondence between 1528 filehandles and files but this is not required. Clients MUST use 1529 filehandle comparisons only to improve performance, not for correct 1530 behavior. All clients need to be prepared for situations in which it 1531 cannot be determined whether two filehandles denote the same object 1532 and in such cases, avoid making invalid assumptions which might cause 1533 incorrect behavior. Further discussion of filehandle and attribute 1534 comparison in the context of data caching is presented in 1535 Section 10.3.4. 1537 As an example, in the case that two different path names when 1538 traversed at the server terminate at the same filesystem object, the 1539 server SHOULD return the same filehandle for each path. This can 1540 occur if a hard link is used to create two file names which refer to 1541 the same underlying file object and associated data. For example, if 1542 paths /a/b/c and /a/d/c refer to the same file, the server SHOULD 1543 return the same filehandle for both path names traversals. 1545 4.2.2. Persistent Filehandle 1547 A persistent filehandle is defined as having a fixed value for the 1548 lifetime of the filesystem object to which it refers. Once the 1549 server creates the filehandle for a filesystem object, the server 1550 MUST accept the same filehandle for the object for the lifetime of 1551 the object. If the server restarts or reboots the NFS server must 1552 honor the same filehandle value as it did in the server's previous 1553 instantiation. Similarly, if the filesystem is migrated, the new NFS 1554 server must honor the same filehandle as the old NFS server. 1556 The persistent filehandle will be become stale or invalid when the 1557 filesystem object is removed. When the server is presented with a 1558 persistent filehandle that refers to a deleted object, it MUST return 1559 an error of NFS4ERR_STALE. A filehandle may become stale when the 1560 filesystem containing the object is no longer available. The file 1561 system may become unavailable if it exists on removable media and the 1562 media is no longer available at the server or the filesystem in whole 1563 has been destroyed or the filesystem has simply been removed from the 1564 server's name space (i.e., unmounted in a UNIX environment). 1566 4.2.3. Volatile Filehandle 1568 A volatile filehandle does not share the same longevity 1569 characteristics of a persistent filehandle. The server may determine 1570 that a volatile filehandle is no longer valid at many different 1571 points in time. If the server can definitively determine that a 1572 volatile filehandle refers to an object that has been removed, the 1573 server should return NFS4ERR_STALE to the client (as is the case for 1574 persistent filehandles). In all other cases where the server 1575 determines that a volatile filehandle can no longer be used, it 1576 should return an error of NFS4ERR_FHEXPIRED. 1578 The mandatory attribute "fh_expire_type" is used by the client to 1579 determine what type of filehandle the server is providing for a 1580 particular filesystem. This attribute is a bitmask with the 1581 following values: 1583 FH4_PERSISTENT: The value of FH4_PERSISTENT is used to indicate a 1584 persistent filehandle, which is valid until the object is removed 1585 from the filesystem. The server will not return NFS4ERR_FHEXPIRED 1586 for this filehandle. FH4_PERSISTENT is defined as a value in 1587 which none of the bits specified below are set. 1589 FH4_VOLATILE_ANY: The filehandle may expire at any time, except as 1590 specifically excluded (i.e., FH4_NOEXPIRE_WITH_OPEN). 1592 FH4_NOEXPIRE_WITH_OPEN: May only be set when FH4_VOLATILE_ANY is 1593 set. If this bit is set, then the meaning of FH4_VOLATILE_ANY is 1594 qualified to exclude any expiration of the filehandle when it is 1595 open. 1597 FH4_VOL_MIGRATION: The filehandle will expire as a result of 1598 migration. If FH4_VOLATILE_ANY is set, FH4_VOL_MIGRATION is 1599 redundant. 1601 FH4_VOL_RENAME: The filehandle will expire during rename. This 1602 includes a rename by the requesting client or a rename by any 1603 other client. If FH4_VOLATILE_ANY is set, FH4_VOL_RENAME is 1604 redundant. 1606 Servers which provide volatile filehandles that may expire while open 1607 (i.e., if FH4_VOL_MIGRATION or FH4_VOL_RENAME is set or if 1608 FH4_VOLATILE_ANY is set and FH4_NOEXPIRE_WITH_OPEN not set), should 1609 deny a RENAME or REMOVE that would affect an OPEN file of any of the 1610 components leading to the OPEN file. In addition, the server should 1611 deny all RENAME or REMOVE requests during the grace period upon 1612 server restart. 1614 Note that the bits FH4_VOL_MIGRATION and FH4_VOL_RENAME allow the 1615 client to determine that expiration has occurred whenever a specific 1616 event occurs, without an explicit filehandle expiration error from 1617 the server. FH4_VOLATILE_ANY does not provide this form of 1618 information. In situations where the server will expire many, but 1619 not all filehandles upon migration (e.g., all but those that are 1620 open), FH4_VOLATILE_ANY (in this case with FH4_NOEXPIRE_WITH_OPEN) is 1621 a better choice since the client may not assume that all filehandles 1622 will expire when migration occurs, and it is likely that additional 1623 expirations will occur (as a result of file CLOSE) that are separated 1624 in time from the migration event itself. 1626 4.2.4. One Method of Constructing a Volatile Filehandle 1628 A volatile filehandle, while opaque to the client could contain: 1630 [volatile bit = 1 | server boot time | slot | generation number] 1632 o slot is an index in the server volatile filehandle table 1634 o generation number is the generation number for the table entry/ 1635 slot 1637 When the client presents a volatile filehandle, the server makes the 1638 following checks, which assume that the check for the volatile bit 1639 has passed. If the server boot time is less than the current server 1640 boot time, return NFS4ERR_FHEXPIRED. If slot is out of range, return 1641 NFS4ERR_BADHANDLE. If the generation number does not match, return 1642 NFS4ERR_FHEXPIRED. 1644 When the server reboots, the table is gone (it is volatile). 1646 If volatile bit is 0, then it is a persistent filehandle with a 1647 different structure following it. 1649 4.3. Client Recovery from Filehandle Expiration 1651 If possible, the client SHOULD recover from the receipt of an 1652 NFS4ERR_FHEXPIRED error. The client must take on additional 1653 responsibility so that it may prepare itself to recover from the 1654 expiration of a volatile filehandle. If the server returns 1655 persistent filehandles, the client does not need these additional 1656 steps. 1658 For volatile filehandles, most commonly the client will need to store 1659 the component names leading up to and including the filesystem object 1660 in question. With these names, the client should be able to recover 1661 by finding a filehandle in the name space that is still available or 1662 by starting at the root of the server's filesystem name space. 1664 If the expired filehandle refers to an object that has been removed 1665 from the filesystem, obviously the client will not be able to recover 1666 from the expired filehandle. 1668 It is also possible that the expired filehandle refers to a file that 1669 has been renamed. If the file was renamed by another client, again 1670 it is possible that the original client will not be able to recover. 1671 However, in the case that the client itself is renaming the file and 1672 the file is open, it is possible that the client may be able to 1673 recover. The client can determine the new path name based on the 1674 processing of the rename request. The client can then regenerate the 1675 new filehandle based on the new path name. The client could also use 1676 the compound operation mechanism to construct a set of operations 1677 like: 1679 RENAME A B 1680 LOOKUP B 1681 GETFH 1683 Note that the COMPOUND procedure does not provide atomicity. This 1684 example only reduces the overhead of recovering from an expired 1685 filehandle. 1687 5. File Attributes 1689 To meet the requirements of extensibility and increased 1690 interoperability with non-UNIX platforms, attributes need to be 1691 handled in a flexible manner. The NFSv3 fattr3 structure contains a 1692 fixed list of attributes that not all clients and servers are able to 1693 support or care about. The fattr3 structure cannot be extended as 1694 new needs arise and it provides no way to indicate non-support. With 1695 the NFSv4.0 protocol, the client is able to query what attributes the 1696 server supports and construct requests with only those supported 1697 attributes (or a subset thereof). 1699 To this end, attributes are divided into three groups: REQUIRED, 1700 RECOMMENDED, and named. Both REQUIRED and RECOMMENDED attributes are 1701 supported in the NFSv4.0 protocol by a specific and well-defined 1702 encoding and are identified by number. They are requested by setting 1703 a bit in the bit vector sent in the GETATTR request; the server 1704 response includes a bit vector to list what attributes were returned 1705 in the response. New REQUIRED or RECOMMENDED attributes may be added 1706 to the NFSv4 protocol as part of a new minor version by publishing a 1707 Standards Track RFC which allocates a new attribute number value and 1708 defines the encoding for the attribute. See Section 11 for further 1709 discussion. 1711 Named attributes are accessed by the new OPENATTR operation, which 1712 accesses a hidden directory of attributes associated with a file 1713 system object. OPENATTR takes a filehandle for the object and 1714 returns the filehandle for the attribute hierarchy. The filehandle 1715 for the named attributes is a directory object accessible by LOOKUP 1716 or READDIR and contains files whose names represent the named 1717 attributes and whose data bytes are the value of the attribute. For 1718 example: 1720 +----------+-----------+---------------------------------+ 1721 | LOOKUP | "foo" | ; look up file | 1722 | GETATTR | attrbits | | 1723 | OPENATTR | | ; access foo's named attributes | 1724 | LOOKUP | "x11icon" | ; look up specific attribute | 1725 | READ | 0,4096 | ; read stream of bytes | 1726 +----------+-----------+---------------------------------+ 1728 Named attributes are intended for data needed by applications rather 1729 than by an NFS client implementation. NFS implementors are strongly 1730 encouraged to define their new attributes as RECOMMENDED attributes 1731 by bringing them to the IETF Standards Track process. 1733 The set of attributes that are classified as REQUIRED is deliberately 1734 small since servers need to do whatever it takes to support them. A 1735 server should support as many of the RECOMMENDED attributes as 1736 possible but, by their definition, the server is not required to 1737 support all of them. Attributes are deemed REQUIRED if the data is 1738 both needed by a large number of clients and is not otherwise 1739 reasonably computable by the client when support is not provided on 1740 the server. 1742 Note that the hidden directory returned by OPENATTR is a convenience 1743 for protocol processing. The client should not make any assumptions 1744 about the server's implementation of named attributes and whether or 1745 not the underlying file system at the server has a named attribute 1746 directory. Therefore, operations such as SETATTR and GETATTR on the 1747 named attribute directory are undefined. 1749 5.1. REQUIRED Attributes 1751 These MUST be supported by every NFSv4.0 client and server in order 1752 to ensure a minimum level of interoperability. The server MUST store 1753 and return these attributes, and the client MUST be able to function 1754 with an attribute set limited to these attributes. With just the 1755 REQUIRED attributes some client functionality may be impaired or 1756 limited in some ways. A client may ask for any of these attributes 1757 to be returned by setting a bit in the GETATTR request, and the 1758 server must return their value. 1760 5.2. RECOMMENDED Attributes 1762 These attributes are understood well enough to warrant support in the 1763 NFSv4.0 protocol. However, they may not be supported on all clients 1764 and servers. A client MAY ask for any of these attributes to be 1765 returned by setting a bit in the GETATTR request but must handle the 1766 case where the server does not return them. A client MAY ask for the 1767 set of attributes the server supports and SHOULD NOT request 1768 attributes the server does not support. A server should be tolerant 1769 of requests for unsupported attributes and simply not return them 1770 rather than considering the request an error. It is expected that 1771 servers will support all attributes they comfortably can and only 1772 fail to support attributes that are difficult to support in their 1773 operating environments. A server should provide attributes whenever 1774 they don't have to "tell lies" to the client. For example, a file 1775 modification time should be either an accurate time or should not be 1776 supported by the server. At times this will be difficult for 1777 clients, but a client is better positioned to decide whether and how 1778 to fabricate or construct an attribute or whether to do without the 1779 attribute. 1781 5.3. Named Attributes 1783 These attributes are not supported by direct encoding in the NFSv4 1784 protocol but are accessed by string names rather than numbers and 1785 correspond to an uninterpreted stream of bytes that are stored with 1786 the file system object. The name space for these attributes may be 1787 accessed by using the OPENATTR operation. The OPENATTR operation 1788 returns a filehandle for a virtual "named attribute directory", and 1789 further perusal and modification of the name space may be done using 1790 operations that work on more typical directories. In particular, 1791 READDIR may be used to get a list of such named attributes, and 1792 LOOKUP and OPEN may select a particular attribute. Creation of a new 1793 named attribute may be the result of an OPEN specifying file 1794 creation. 1796 Once an OPEN is done, named attributes may be examined and changed by 1797 normal READ and WRITE operations using the filehandles and stateids 1798 returned by OPEN. 1800 Named attributes and the named attribute directory may have their own 1801 (non-named) attributes. Each of these objects must have all of the 1802 REQUIRED attributes and may have additional RECOMMENDED attributes. 1803 However, the set of attributes for named attributes and the named 1804 attribute directory need not be, and typically will not be, as large 1805 as that for other objects in that file system. 1807 Named attributes and the named attribute directory might be the 1808 target of delegations (in the case of the named attribute directory 1809 these will be directory delegations). However, since granting of 1810 delegations is at the server's discretion, a server need not support 1811 delegations on named attributes or the named attribute directory. 1813 It is RECOMMENDED that servers support arbitrary named attributes. A 1814 client should not depend on the ability to store any named attributes 1815 in the server's file system. If a server does support named 1816 attributes, a client that is also able to handle them should be able 1817 to copy a file's data and metadata with complete transparency from 1818 one location to another; this would imply that names allowed for 1819 regular directory entries are valid for named attribute names as 1820 well. 1822 In NFSv4.0, the structure of named attribute directories is 1823 restricted in a number of ways, in order to prevent the development 1824 of non-interoperable implementations in which some servers support a 1825 fully general hierarchical directory structure for named attributes 1826 while others support a limited but adequate structure for named 1827 attributes. In such an environment, clients or applications might 1828 come to depend on non-portable extensions. The restrictions are: 1830 o CREATE is not allowed in a named attribute directory. Thus, such 1831 objects as symbolic links and special files are not allowed to be 1832 named attributes. Further, directories may not be created in a 1833 named attribute directory, so no hierarchical structure of named 1834 attributes for a single object is allowed. 1836 o If OPENATTR is done on a named attribute directory or on a named 1837 attribute, the server MUST return NFS4ERR_WRONG_TYPE. 1839 o Doing a RENAME of a named attribute to a different named attribute 1840 directory or to an ordinary (i.e., non-named-attribute) directory 1841 is not allowed. 1843 o Creating hard links between named attribute directories or between 1844 named attribute directories and ordinary directories is not 1845 allowed. 1847 Names of attributes will not be controlled by this document or other 1848 IETF Standards Track documents. See Section 18 for further 1849 discussion. 1851 5.4. Classification of Attributes 1853 Each of the REQUIRED and RECOMMENDED attributes can be classified in 1854 one of three categories: per server (i.e., the value of the attribute 1855 will be the same for all file objects that share the same server), 1856 per file system (i.e., the value of the attribute will be the same 1857 for some or all file objects that share the same fsid attribute 1858 (Section 5.8.1.9) and server owner), or per file system object. Note 1859 that it is possible that some per file system attributes may vary 1860 within the file system. Note that it is possible that some per file 1861 system attributes may vary within the file system, depending on the 1862 value of the "homogeneous" (Section 5.8.2.16) attribute. Note that 1863 the attributes time_access_set and time_modify_set are not listed in 1864 this section because they are write-only attributes corresponding to 1865 time_access and time_modify, and are used in a special instance of 1866 SETATTR. 1868 o The per-server attribute is: 1870 lease_time 1872 o The per-file system attributes are: 1874 supported_attrs, fh_expire_type, link_support, symlink_support, 1875 unique_handles, aclsupport, cansettime, case_insensitive, 1876 case_preserving, chown_restricted, files_avail, files_free, 1877 files_total, fs_locations, homogeneous, maxfilesize, maxname, 1878 maxread, maxwrite, no_trunc, space_avail, space_free, 1879 space_total, time_delta, 1881 o The per-file system object attributes are: 1883 type, change, size, named_attr, fsid, rdattr_error, filehandle, 1884 acl, archive, fileid, hidden, maxlink, mimetype, mode, 1885 numlinks, owner, owner_group, rawdev, space_used, system, 1886 time_access, time_backup, time_create, time_metadata, 1887 time_modify, mounted_on_fileid 1889 For quota_avail_hard, quota_avail_soft, and quota_used, see their 1890 definitions below for the appropriate classification. 1892 5.5. Set-Only and Get-Only Attributes 1894 Some REQUIRED and RECOMMENDED attributes are set-only; i.e., they can 1895 be set via SETATTR but not retrieved via GETATTR. Similarly, some 1896 REQUIRED and RECOMMENDED attributes are get-only; i.e., they can be 1897 retrieved via GETATTR but not set via SETATTR. If a client attempts 1898 to set a get-only attribute or get a set-only attribute, the server 1899 MUST return NFS4ERR_INVAL. 1901 5.6. REQUIRED Attributes - List and Definition References 1903 The list of REQUIRED attributes appears in Table 2. The meaning of 1904 the columns of the table are: 1906 o Name: The name of attribute 1908 o Id: The number assigned to the attribute. In the event of 1909 conflicts between the assigned number and [2], the latter is 1910 likely authoritative, but should be resolved with Errata to this 1911 document and/or [2]. See [25] for the Errata process. 1913 o Data Type: The XDR data type of the attribute. 1915 o Acc: Access allowed to the attribute. R means read-only (GETATTR 1916 may retrieve, SETATTR may not set). W means write-only (SETATTR 1917 may set, GETATTR may not retrieve). R W means read/write (GETATTR 1918 may retrieve, SETATTR may set). 1920 o Defined in: The section of this specification that describes the 1921 attribute. 1923 +-----------------+----+------------+-----+------------------+ 1924 | Name | Id | Data Type | Acc | Defined in: | 1925 +-----------------+----+------------+-----+------------------+ 1926 | supported_attrs | 0 | bitmap4 | R | Section 5.8.1.1 | 1927 | type | 1 | nfs_ftype4 | R | Section 5.8.1.2 | 1928 | fh_expire_type | 2 | uint32_t | R | Section 5.8.1.3 | 1929 | change | 3 | uint64_t | R | Section 5.8.1.4 | 1930 | size | 4 | uint64_t | R W | Section 5.8.1.5 | 1931 | link_support | 5 | bool | R | Section 5.8.1.6 | 1932 | symlink_support | 6 | bool | R | Section 5.8.1.7 | 1933 | named_attr | 7 | bool | R | Section 5.8.1.8 | 1934 | fsid | 8 | fsid4 | R | Section 5.8.1.9 | 1935 | unique_handles | 9 | bool | R | Section 5.8.1.10 | 1936 | lease_time | 10 | nfs_lease4 | R | Section 5.8.1.11 | 1937 | rdattr_error | 11 | enum | R | Section 5.8.1.12 | 1938 | filehandle | 19 | nfs_fh4 | R | Section 5.8.1.13 | 1939 +-----------------+----+------------+-----+------------------+ 1941 Table 2 1943 5.7. RECOMMENDED Attributes - List and Definition References 1945 The RECOMMENDED attributes are defined in Table 3. The meanings of 1946 the column headers are the same as Table 2; see Section 5.6 for the 1947 meanings. 1949 +-------------------+----+--------------+-----+------------------+ 1950 | Name | Id | Data Type | Acc | Defined in: | 1951 +-------------------+----+--------------+-----+------------------+ 1952 | acl | 12 | nfsace4<> | R W | Section 6.2.1 | 1953 | aclsupport | 13 | uint32_t | R | Section 6.2.1.2 | 1954 | archive | 14 | bool | R W | Section 5.8.2.1 | 1955 | cansettime | 15 | bool | R | Section 5.8.2.2 | 1956 | case_insensitive | 16 | bool | R | Section 5.8.2.3 | 1957 | case_preserving | 17 | bool | R | Section 5.8.2.4 | 1958 | chown_restricted | 18 | bool | R | Section 5.8.2.5 | 1959 | fileid | 20 | uint64_t | R | Section 5.8.2.6 | 1960 | files_avail | 21 | uint64_t | R | Section 5.8.2.7 | 1961 | files_free | 22 | uint64_t | R | Section 5.8.2.8 | 1962 | files_total | 23 | uint64_t | R | Section 5.8.2.9 | 1963 | fs_locations | 24 | fs_locations | R | Section 5.8.2.10 | 1964 | hidden | 25 | bool | R W | Section 5.8.2.11 | 1965 | homogeneous | 26 | bool | R | Section 5.8.2.12 | 1966 | maxfilesize | 27 | uint64_t | R | Section 5.8.2.13 | 1967 | maxlink | 28 | uint32_t | R | Section 5.8.2.14 | 1968 | maxname | 29 | uint32_t | R | Section 5.8.2.15 | 1969 | maxread | 30 | uint64_t | R | Section 5.8.2.16 | 1970 | maxwrite | 31 | uint64_t | R | Section 5.8.2.17 | 1971 | mimetype | 32 | utf8<> | R W | Section 5.8.2.18 | 1972 | mode | 33 | mode4 | R W | Section 6.2.2 | 1973 | mounted_on_fileid | 55 | uint64_t | R | Section 5.8.2.19 | 1974 | no_trunc | 34 | bool | R | Section 5.8.2.20 | 1975 | numlinks | 35 | uint32_t | R | Section 5.8.2.21 | 1976 | owner | 36 | utf8<> | R W | Section 5.8.2.22 | 1977 | owner_group | 37 | utf8<> | R W | Section 5.8.2.23 | 1978 | quota_avail_hard | 38 | uint64_t | R | Section 5.8.2.24 | 1979 | quota_avail_soft | 39 | uint64_t | R | Section 5.8.2.25 | 1980 | quota_used | 40 | uint64_t | R | Section 5.8.2.26 | 1981 | rawdev | 41 | specdata4 | R | Section 5.8.2.27 | 1982 | space_avail | 42 | uint64_t | R | Section 5.8.2.28 | 1983 | space_free | 43 | uint64_t | R | Section 5.8.2.29 | 1984 | space_total | 44 | uint64_t | R | Section 5.8.2.30 | 1985 | space_used | 45 | uint64_t | R | Section 5.8.2.31 | 1986 | system | 46 | bool | R W | Section 5.8.2.32 | 1987 | time_access | 47 | nfstime4 | R | Section 5.8.2.33 | 1988 | time_access_set | 48 | settime4 | W | Section 5.8.2.34 | 1989 | time_backup | 49 | nfstime4 | R W | Section 5.8.2.35 | 1990 | time_create | 50 | nfstime4 | R W | Section 5.8.2.36 | 1991 | time_delta | 51 | nfstime4 | R | Section 5.8.2.37 | 1992 | time_metadata | 52 | nfstime4 | R | Section 5.8.2.38 | 1993 | time_modify | 53 | nfstime4 | R | Section 5.8.2.39 | 1994 | time_modify_set | 54 | settime4 | W | Section 5.8.2.40 | 1995 +-------------------+----+--------------+-----+------------------+ 1997 Table 3 1999 5.8. Attribute Definitions 2001 5.8.1. Definitions of REQUIRED Attributes 2003 5.8.1.1. Attribute 0: supported_attrs 2005 The bit vector that would retrieve all REQUIRED and RECOMMENDED 2006 attributes that are supported for this object. The scope of this 2007 attribute applies to all objects with a matching fsid. 2009 5.8.1.2. Attribute 1: type 2011 Designates the type of an object in terms of one of a number of 2012 special constants: 2014 o NF4REG designates a regular file. 2016 o NF4DIR designates a directory. 2018 o NF4BLK designates a block device special file. 2020 o NF4CHR designates a character device special file. 2022 o NF4LNK designates a symbolic link. 2024 o NF4SOCK designates a named socket special file. 2026 o NF4FIFO designates a fifo special file. 2028 o NF4ATTRDIR designates a named attribute directory. 2030 o NF4NAMEDATTR designates a named attribute. 2032 Within the explanatory text and operation descriptions, the following 2033 phrases will be used with the meanings given below: 2035 o The phrase "is a directory" means that the object's type attribute 2036 is NF4DIR or NF4ATTRDIR. 2038 o The phrase "is a special file" means that the object's type 2039 attribute is NF4BLK, NF4CHR, NF4SOCK, or NF4FIFO. 2041 o The phrase "is an ordinary file" means that the object's type 2042 attribute is NF4REG or NF4NAMEDATTR. 2044 5.8.1.3. Attribute 2: fh_expire_type 2046 Server uses this to specify filehandle expiration behavior to the 2047 client. See Section 4 for additional description. 2049 5.8.1.4. Attribute 3: change 2051 A value created by the server that the client can use to determine if 2052 file data, directory contents, or attributes of the object have been 2053 modified. The server may return the object's time_metadata attribute 2054 for this attribute's value but only if the file system object cannot 2055 be updated more frequently than the resolution of time_metadata. 2057 5.8.1.5. Attribute 4: size 2059 The size of the object in bytes. 2061 5.8.1.6. Attribute 5: link_support 2063 TRUE, if the object's file system supports hard links. 2065 5.8.1.7. Attribute 6: symlink_support 2067 TRUE, if the object's file system supports symbolic links. 2069 5.8.1.8. Attribute 7: named_attr 2071 TRUE, if this object has named attributes. In other words, object 2072 has a non-empty named attribute directory. 2074 5.8.1.9. Attribute 8: fsid 2076 Unique file system identifier for the file system holding this 2077 object. The fsid attribute has major and minor components, each of 2078 which are of data type uint64_t. 2080 5.8.1.10. Attribute 9: unique_handles 2082 TRUE, if two distinct filehandles are guaranteed to refer to two 2083 different file system objects. 2085 5.8.1.11. Attribute 10: lease_time 2087 Duration of the lease at server in seconds. 2089 5.8.1.12. Attribute 11: rdattr_error 2091 Error returned from an attempt to retrieve attributes during a 2092 READDIR operation. 2094 5.8.1.13. Attribute 19: filehandle 2096 The filehandle of this object (primarily for READDIR requests). 2098 5.8.2. Definitions of Uncategorized RECOMMENDED Attributes 2100 The definitions of most of the RECOMMENDED attributes follow. 2101 Collections that share a common category are defined in other 2102 sections. 2104 5.8.2.1. Attribute 14: archive 2106 TRUE, if this file has been archived since the time of last 2107 modification (deprecated in favor of time_backup). 2109 5.8.2.2. Attribute 15: cansettime 2111 TRUE, if the server is able to change the times for a file system 2112 object as specified in a SETATTR operation. 2114 5.8.2.3. Attribute 16: case_insensitive 2116 TRUE, if file name comparisons on this file system are case 2117 insensitive. 2119 5.8.2.4. Attribute 17: case_preserving 2121 TRUE, if file name case on this file system is preserved. 2123 5.8.2.5. Attribute 18: chown_restricted 2125 If TRUE, the server will reject any request to change either the 2126 owner or the group associated with a file if the caller is not a 2127 privileged user (for example, "root" in UNIX operating environments 2128 or in Windows 2000, the "Take Ownership" privilege). 2130 5.8.2.6. Attribute 20: fileid 2132 A number uniquely identifying the file within the file system. 2134 5.8.2.7. Attribute 21: files_avail 2136 File slots available to this user on the file system containing this 2137 object -- this should be the smallest relevant limit. 2139 5.8.2.8. Attribute 22: files_free 2141 Free file slots on the file system containing this object - this 2142 should be the smallest relevant limit. 2144 5.8.2.9. Attribute 23: files_total 2146 Total file slots on the file system containing this object. 2148 5.8.2.10. Attribute 24: fs_locations 2150 Locations where this file system may be found. If the server returns 2151 NFS4ERR_MOVED as an error, this attribute MUST be supported. 2153 The server can specify a root path by setting an array of zero path 2154 components. Other than this special case, the server MUST not 2155 present empty path components to the client. 2157 5.8.2.11. Attribute 25: hidden 2159 TRUE, if the file is considered hidden with respect to the Windows 2160 API. 2162 5.8.2.12. Attribute 26: homogeneous 2164 TRUE, if this object's file system is homogeneous, i.e., all objects 2165 in the file system (all objects on the server with the same fsid) 2166 have common values for all per-file-system attributes. 2168 5.8.2.13. Attribute 27: maxfilesize 2170 Maximum supported file size for the file system of this object. 2172 5.8.2.14. Attribute 28: maxlink 2174 Maximum number of links for this object. 2176 5.8.2.15. Attribute 29: maxname 2178 Maximum file name size supported for this object. 2180 5.8.2.16. Attribute 30: maxread 2182 Maximum amount of data the READ operation will return for this 2183 object. 2185 5.8.2.17. Attribute 31: maxwrite 2187 Maximum amount of data the WRITE operation will accept for this 2188 object. This attribute SHOULD be supported if the file is writable. 2189 Lack of this attribute can lead to the client either wasting 2190 bandwidth or not receiving the best performance. 2192 5.8.2.18. Attribute 32: mimetype 2194 MIME body type/subtype of this object. 2196 5.8.2.19. Attribute 55: mounted_on_fileid 2198 Like fileid, but if the target filehandle is the root of a file 2199 system, this attribute represents the fileid of the underlying 2200 directory. 2202 UNIX-based operating environments connect a file system into the 2203 namespace by connecting (mounting) the file system onto the existing 2204 file object (the mount point, usually a directory) of an existing 2205 file system. When the mount point's parent directory is read via an 2206 API like readdir(), the return results are directory entries, each 2207 with a component name and a fileid. The fileid of the mount point's 2208 directory entry will be different from the fileid that the stat() 2209 system call returns. The stat() system call is returning the fileid 2210 of the root of the mounted file system, whereas readdir() is 2211 returning the fileid that stat() would have returned before any file 2212 systems were mounted on the mount point. 2214 Unlike NFSv3, NFSv4.0 allows a client's LOOKUP request to cross other 2215 file systems. The client detects the file system crossing whenever 2216 the filehandle argument of LOOKUP has an fsid attribute different 2217 from that of the filehandle returned by LOOKUP. A UNIX-based client 2218 will consider this a "mount point crossing". UNIX has a legacy 2219 scheme for allowing a process to determine its current working 2220 directory. This relies on readdir() of a mount point's parent and 2221 stat() of the mount point returning fileids as previously described. 2222 The mounted_on_fileid attribute corresponds to the fileid that 2223 readdir() would have returned as described previously. 2225 While the NFSv4.0 client could simply fabricate a fileid 2226 corresponding to what mounted_on_fileid provides (and if the server 2227 does not support mounted_on_fileid, the client has no choice), there 2228 is a risk that the client will generate a fileid that conflicts with 2229 one that is already assigned to another object in the file system. 2230 Instead, if the server can provide the mounted_on_fileid, the 2231 potential for client operational problems in this area is eliminated. 2233 If the server detects that there is no mounted point at the target 2234 file object, then the value for mounted_on_fileid that it returns is 2235 the same as that of the fileid attribute. 2237 The mounted_on_fileid attribute is RECOMMENDED, so the server SHOULD 2238 provide it if possible, and for a UNIX-based server, this is 2239 straightforward. Usually, mounted_on_fileid will be requested during 2240 a READDIR operation, in which case it is trivial (at least for UNIX- 2241 based servers) to return mounted_on_fileid since it is equal to the 2242 fileid of a directory entry returned by readdir(). If 2243 mounted_on_fileid is requested in a GETATTR operation, the server 2244 should obey an invariant that has it returning a value that is equal 2245 to the file object's entry in the object's parent directory, i.e., 2246 what readdir() would have returned. Some operating environments 2247 allow a series of two or more file systems to be mounted onto a 2248 single mount point. In this case, for the server to obey the 2249 aforementioned invariant, it will need to find the base mount point, 2250 and not the intermediate mount points. 2252 5.8.2.20. Attribute 34: no_trunc 2254 If this attribute is TRUE, then if the client uses a file name longer 2255 than name_max, an error will be returned instead of the name being 2256 truncated. 2258 5.8.2.21. Attribute 35: numlinks 2260 Number of hard links to this object. 2262 5.8.2.22. Attribute 36: owner 2264 The string name of the owner of this object. 2266 5.8.2.23. Attribute 37: owner_group 2268 The string name of the group ownership of this object. 2270 5.8.2.24. Attribute 38: quota_avail_hard 2272 The value in bytes that represents the amount of additional disk 2273 space beyond the current allocation that can be allocated to this 2274 file or directory before further allocations will be refused. It is 2275 understood that this space may be consumed by allocations to other 2276 files or directories. 2278 5.8.2.25. Attribute 39: quota_avail_soft 2280 The value in bytes that represents the amount of additional disk 2281 space that can be allocated to this file or directory before the user 2282 may reasonably be warned. It is understood that this space may be 2283 consumed by allocations to other files or directories though there is 2284 a rule as to which other files or directories. 2286 5.8.2.26. Attribute 40: quota_used 2288 The value in bytes that represents the amount of disc space used by 2289 this file or directory and possibly a number of other similar files 2290 or directories, where the set of "similar" meets at least the 2291 criterion that allocating space to any file or directory in the set 2292 will reduce the "quota_avail_hard" of every other file or directory 2293 in the set. 2295 Note that there may be a number of distinct but overlapping sets of 2296 files or directories for which a quota_used value is maintained, e.g. 2297 "all files with a given owner", "all files with a given group owner". 2298 etc. The server is at liberty to choose any of those sets when 2299 providing the content of the quota_used attribute, but should do so 2300 in a repeatable way. The rule may be configured per file system or 2301 may be "choose the set with the smallest quota". 2303 5.8.2.27. Attribute 41: rawdev 2305 Raw device number of file of type NF4BLK or NF4CHR. The device 2306 number is split into major and minor numbers. If the file's type 2307 attribute is not NF4BLK or NF4CHR, the value returned SHOULD NOT be 2308 considered useful. 2310 5.8.2.28. Attribute 42: space_avail 2312 Disk space in bytes available to this user on the file system 2313 containing this object -- this should be the smallest relevant limit. 2315 5.8.2.29. Attribute 43: space_free 2317 Free disk space in bytes on the file system containing this object -- 2318 this should be the smallest relevant limit. 2320 5.8.2.30. Attribute 44: space_total 2322 Total disk space in bytes on the file system containing this object. 2324 5.8.2.31. Attribute 45: space_used 2326 Number of file system bytes allocated to this object. 2328 5.8.2.32. Attribute 46: system 2330 This attribute is TRUE if this file is a "system" file with respect 2331 to the Windows operating environment. 2333 5.8.2.33. Attribute 47: time_access 2335 The time_access attribute represents the time of last access to the 2336 object by a READ operation sent to the server. The notion of what is 2337 an "access" depends on the server's operating environment and/or the 2338 server's file system semantics. For example, for servers obeying 2339 Portable Operating System Interface (POSIX) semantics, time_access 2340 would be updated only by the READ and READDIR operations and not any 2341 of the operations that modify the content of the object [16], [17], 2342 [26], [27], [28]. Of course, setting the corresponding 2343 time_access_set attribute is another way to modify the time_access 2344 attribute. 2346 Whenever the file object resides on a writable file system, the 2347 server should make its best efforts to record time_access into stable 2348 storage. However, to mitigate the performance effects of doing so, 2349 and most especially whenever the server is satisfying the read of the 2350 object's content from its cache, the server MAY cache access time 2351 updates and lazily write them to stable storage. It is also 2352 acceptable to give administrators of the server the option to disable 2353 time_access updates. 2355 5.8.2.34. Attribute 48: time_access_set 2357 Sets the time of last access to the object. SETATTR use only. 2359 5.8.2.35. Attribute 49: time_backup 2361 The time of last backup of the object. 2363 5.8.2.36. Attribute 50: time_create 2365 The time of creation of the object. This attribute does not have any 2366 relation to the traditional UNIX file attribute "ctime" or "change 2367 time". 2369 5.8.2.37. Attribute 51: time_delta 2371 Smallest useful server time granularity. 2373 5.8.2.38. Attribute 52: time_metadata 2375 The time of last metadata modification of the object. 2377 5.8.2.39. Attribute 53: time_modify 2379 The time of last modification to the object. 2381 5.8.2.40. Attribute 54: time_modify_set 2383 Sets the time of last modification to the object. SETATTR use only. 2385 5.9. Interpreting owner and owner_group 2387 The RECOMMENDED attributes "owner" and "owner_group" (and also users 2388 and groups within the "acl" attribute) are represented in terms of a 2389 UTF-8 string. To avoid a representation that is tied to a particular 2390 underlying implementation at the client or server, the use of the 2391 UTF-8 string has been chosen. Note that section 6.1 of RFC 2624 [29] 2392 provides additional rationale. It is expected that the client and 2393 server will have their own local representation of owner and 2394 owner_group that is used for local storage or presentation to the end 2395 user. Therefore, it is expected that when these attributes are 2396 transferred between the client and server, the local representation 2397 is translated to a syntax of the form "user@dns_domain". This will 2398 allow for a client and server that do not use the same local 2399 representation the ability to translate to a common syntax that can 2400 be interpreted by both. 2402 Similarly, security principals may be represented in different ways 2403 by different security mechanisms. Servers normally translate these 2404 representations into a common format, generally that used by local 2405 storage, to serve as a means of identifying the users corresponding 2406 to these security principals. When these local identifiers are 2407 translated to the form of the owner attribute, associated with files 2408 created by such principals, they identify, in a common format, the 2409 users associated with each corresponding set of security principals. 2411 The translation used to interpret owner and group strings is not 2412 specified as part of the protocol. This allows various solutions to 2413 be employed. For example, a local translation table may be consulted 2414 that maps a numeric identifier to the user@dns_domain syntax. A name 2415 service may also be used to accomplish the translation. A server may 2416 provide a more general service, not limited by any particular 2417 translation (which would only translate a limited set of possible 2418 strings) by storing the owner and owner_group attributes in local 2419 storage without any translation or it may augment a translation 2420 method by storing the entire string for attributes for which no 2421 translation is available while using the local representation for 2422 those cases in which a translation is available. 2424 Servers that do not provide support for all possible values of the 2425 owner and owner_group attributes SHOULD return an error 2426 (NFS4ERR_BADOWNER) when a string is presented that has no 2427 translation, as the value to be set for a SETATTR of the owner, 2428 owner_group, or acl attributes. When a server does accept an owner 2429 or owner_group value as valid on a SETATTR (and similarly for the 2430 owner and group strings in an acl), it is promising to return that 2431 same string for which see below) when a corresponding GETATTR is 2432 done. For some internationalization-related exceptions where this is 2433 not possible, see below. Configuration changes (including changes 2434 from the mapping of the string to the local representation) and ill- 2435 constructed name translations (those that contain aliasing) may make 2436 that promise impossible to honor. Servers should make appropriate 2437 efforts to avoid a situation in which these attributes have their 2438 values changed when no real change to ownership has occurred. 2440 The "dns_domain" portion of the owner string is meant to be a DNS 2441 domain name. For example, user@example.org. Servers should accept 2442 as valid a set of users for at least one domain. A server may treat 2443 other domains as having no valid translations. A more general 2444 service is provided when a server is capable of accepting users for 2445 multiple domains, or for all domains, subject to security 2446 constraints. 2448 As an implementation guide, both clients and servers may provide a 2449 means to configure the "dns_domain" portion of the owner string. For 2450 example, the DNS domain name might be "lab.example.org", but the user 2451 names are defined in "example.org". In the absence of such a 2452 configuration, or as a default, the current DNS domain name should be 2453 the value used for the "dns_domain". 2455 As mentioned above, it is desirable that a server when accepting a 2456 string of the form user@domain or group@domain in an attribute, 2457 return this same string when that corresponding attribute is fetched. 2458 Internationalization issues (for a general discussion of which see 2459 Section 12) make this impossible and the client needs to take note of 2460 the following situations: 2462 o The string representing the domain may be converted to equivalent 2463 U-label, if presented using a form other a a U-label. See 2464 Section 12.6 for details. 2466 o The user or group may be returned in a different form, due to 2467 normalization issues, although it will always be a canonically 2468 equivalent string. See See Section 12.7.3 for details. 2470 In the case where there is no translation available to the client or 2471 server, the attribute value will be constructed without the "@". 2472 Therefore, the absence of the "@" from the owner or owner_group 2473 attribute signifies that no translation was available at the sender 2474 and that the receiver of the attribute should not use that string as 2475 a basis for translation into its own internal format. Even though 2476 the attribute value cannot be translated, it may still be useful. In 2477 the case of a client, the attribute string may be used for local 2478 display of ownership. 2480 To provide a greater degree of compatibility with NFSv3, which 2481 identified users and groups by 32-bit unsigned user identifiers and 2482 group identifiers, owner and group strings that consist of decimal 2483 numeric values with no leading zeros can be given a special 2484 interpretation by clients and servers that choose to provide such 2485 support. The receiver may treat such a user or group string as 2486 representing the same user as would be represented by an NFSv3 uid or 2487 gid having the corresponding numeric value. 2489 A server SHOULD reject such a numeric value if the security mechanism 2490 is kerberized. I.e., in such a scenario, the client will already 2491 need to form "user@domain" strings. For any other security 2492 mechanism, the server SHOULD accept such numeric values. As an 2493 implementation note, the server could make such an acceptance be 2494 configurable. If the server does not support numeric values or if it 2495 is configured off, then it MUST return an NFS4ERR_BADOWNER error. If 2496 the security mechanism is kerberized and the client attempts to use 2497 the special form, then the server SHOULD return an NFS4ERR_BADOWNER 2498 error when there is a valid translation for the user or owner 2499 designated in this way. In that case, the client must use the 2500 appropriate user@domain string and not the special form for 2501 compatibility. 2503 The client MUST always accept numeric values if the security 2504 mechanism is not kerberized. A client can determine if a server 2505 supports such a mechanism by first attempting to provide a numeric 2506 value and only if it is rejected with an NFS4ERR_BADOWNER error, then 2507 providing a name value. After the first detection of such an error, 2508 the client should only use the special form. 2510 The owner string "nobody" may be used to designate an anonymous user, 2511 which will be associated with a file created by a security principal 2512 that cannot be mapped through normal means to the owner attribute. 2514 5.10. Character Case Attributes 2516 With respect to the case_insensitive and case_preserving attributes, 2517 each UCS-4 character (which UTF-8 encodes) has a "long descriptive 2518 name" RFC1345 [30] which may or may not include the word "CAPITAL" or 2519 "SMALL". The presence of SMALL or CAPITAL allows an NFS server to 2520 implement unambiguous and efficient table driven mappings for case 2521 insensitive comparisons, and non-case-preserving storage, although 2522 there are variations that occur additional characters with a name 2523 including "SMALL" or "CAPITAL" are added in a subsequent version of 2524 Unicode. 2526 For general character handling and internationalization issues, see 2527 Section 12. For details regarding case mapping, see the section 2528 Case-based Mapping Used for Component4 Strings. 2530 6. Access Control Attributes 2532 Access Control Lists (ACLs) are file attributes that specify fine 2533 grained access control. This chapter covers the "acl", "aclsupport", 2534 "mode", file attributes, and their interactions. Note that file 2535 attributes may apply to any file system object. 2537 6.1. Goals 2539 ACLs and modes represent two well established models for specifying 2540 permissions. This chapter specifies requirements that attempt to 2541 meet the following goals: 2543 o If a server supports the mode attribute, it should provide 2544 reasonable semantics to clients that only set and retrieve the 2545 mode attribute. 2547 o If a server supports ACL attributes, it should provide reasonable 2548 semantics to clients that only set and retrieve those attributes. 2550 o On servers that support the mode attribute, if ACL attributes have 2551 never been set on an object, via inheritance or explicitly, the 2552 behavior should be traditional UNIX-like behavior. 2554 o On servers that support the mode attribute, if the ACL attributes 2555 have been previously set on an object, either explicitly or via 2556 inheritance: 2558 * Setting only the mode attribute should effectively control the 2559 traditional UNIX-like permissions of read, write, and execute 2560 on owner, owner_group, and other. 2562 * Setting only the mode attribute should provide reasonable 2563 security. For example, setting a mode of 000 should be enough 2564 to ensure that future opens for read or write by any principal 2565 fail, regardless of a previously existing or inherited ACL. 2567 o When a mode attribute is set on an object, the ACL attributes may 2568 need to be modified so as to not conflict with the new mode. In 2569 such cases, it is desirable that the ACL keep as much information 2570 as possible. This includes information about inheritance, AUDIT 2571 and ALARM ACEs, and permissions granted and denied that do not 2572 conflict with the new mode. 2574 6.2. File Attributes Discussion 2576 6.2.1. Attribute 12: acl 2578 The NFSv4.0 ACL attribute contains an array of access control entries 2579 (ACEs) that are associated with the file system object. Although the 2580 client can read and write the acl attribute, the server is 2581 responsible for using the ACL to perform access control. The client 2582 can use the OPEN or ACCESS operations to check access without 2583 modifying or reading data or metadata. 2585 The NFS ACE structure is defined as follows: 2587 typedef uint32_t acetype4; 2589 typedef uint32_t aceflag4; 2591 typedef uint32_t acemask4; 2593 struct nfsace4 { 2594 acetype4 type; 2595 aceflag4 flag; 2596 acemask4 access_mask; 2597 utf8val_must who; 2598 }; 2599 To determine if a request succeeds, the server processes each nfsace4 2600 entry in order. Only ACEs which have a "who" that matches the 2601 requester are considered. Each ACE is processed until all of the 2602 bits of the requester's access have been ALLOWED. Once a bit (see 2603 below) has been ALLOWED by an ACCESS_ALLOWED_ACE, it is no longer 2604 considered in the processing of later ACEs. If an ACCESS_DENIED_ACE 2605 is encountered where the requester's access still has unALLOWED bits 2606 in common with the "access_mask" of the ACE, the request is denied. 2607 When the ACL is fully processed, if there are bits in the requester's 2608 mask that have not been ALLOWED or DENIED, access is denied. 2610 Unlike the ALLOW and DENY ACE types, the ALARM and AUDIT ACE types do 2611 not affect a requester's access, and instead are for triggering 2612 events as a result of a requester's access attempt. Therefore, AUDIT 2613 and ALARM ACEs are processed only after processing ALLOW and DENY 2614 ACEs. 2616 The NFSv4.0 ACL model is quite rich. Some server platforms may 2617 provide access control functionality that goes beyond the UNIX-style 2618 mode attribute, but which is not as rich as the NFS ACL model. So 2619 that users can take advantage of this more limited functionality, the 2620 server may support the acl attributes by mapping between its ACL 2621 model and the NFSv4.0 ACL model. Servers must ensure that the ACL 2622 they actually store or enforce is at least as strict as the NFSv4 ACL 2623 that was set. It is tempting to accomplish this by rejecting any ACL 2624 that falls outside the small set that can be represented accurately. 2625 However, such an approach can render ACLs unusable without special 2626 client-side knowledge of the server's mapping, which defeats the 2627 purpose of having a common NFSv4 ACL protocol. Therefore servers 2628 should accept every ACL that they can without compromising security. 2629 To help accomplish this, servers may make a special exception, in the 2630 case of unsupported permission bits, to the rule that bits not 2631 ALLOWED or DENIED by an ACL must be denied. For example, a UNIX- 2632 style server might choose to silently allow read attribute 2633 permissions even though an ACL does not explicitly allow those 2634 permissions. (An ACL that explicitly denies permission to read 2635 attributes should still be rejected.) 2637 The situation is complicated by the fact that a server may have 2638 multiple modules that enforce ACLs. For example, the enforcement for 2639 NFSv4.0 access may be different from, but not weaker than, the 2640 enforcement for local access, and both may be different from the 2641 enforcement for access through other protocols such as SMB. So it 2642 may be useful for a server to accept an ACL even if not all of its 2643 modules are able to support it. 2645 The guiding principle with regard to NFSv4 access is that the server 2646 must not accept ACLs that appear to make access to the file more 2647 restrictive than it really is. 2649 6.2.1.1. ACE Type 2651 The constants used for the type field (acetype4) are as follows: 2653 const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; 2654 const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; 2655 const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; 2656 const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; 2658 All four but types are permitted in the acl attribute. 2660 +------------------------------+--------------+---------------------+ 2661 | Value | Abbreviation | Description | 2662 +------------------------------+--------------+---------------------+ 2663 | ACE4_ACCESS_ALLOWED_ACE_TYPE | ALLOW | Explicitly grants | 2664 | | | the access defined | 2665 | | | in acemask4 to the | 2666 | | | file or directory. | 2667 | ACE4_ACCESS_DENIED_ACE_TYPE | DENY | Explicitly denies | 2668 | | | the access defined | 2669 | | | in acemask4 to the | 2670 | | | file or directory. | 2671 | ACE4_SYSTEM_AUDIT_ACE_TYPE | AUDIT | LOG (in a system | 2672 | | | dependent way) any | 2673 | | | access attempt to a | 2674 | | | file or directory | 2675 | | | which uses any of | 2676 | | | the access methods | 2677 | | | specified in | 2678 | | | acemask4. | 2679 | ACE4_SYSTEM_ALARM_ACE_TYPE | ALARM | Generate a system | 2680 | | | ALARM (system | 2681 | | | dependent) when any | 2682 | | | access attempt is | 2683 | | | made to a file or | 2684 | | | directory for the | 2685 | | | access methods | 2686 | | | specified in | 2687 | | | acemask4. | 2688 +------------------------------+--------------+---------------------+ 2690 The "Abbreviation" column denotes how the types will be referred to 2691 throughout the rest of this chapter. 2693 6.2.1.2. Attribute 13: aclsupport 2695 A server need not support all of the above ACE types. This attribute 2696 indicates which ACE types are supported for the current file system. 2697 The bitmask constants used to represent the above definitions within 2698 the aclsupport attribute are as follows: 2700 const ACL4_SUPPORT_ALLOW_ACL = 0x00000001; 2701 const ACL4_SUPPORT_DENY_ACL = 0x00000002; 2702 const ACL4_SUPPORT_AUDIT_ACL = 0x00000004; 2703 const ACL4_SUPPORT_ALARM_ACL = 0x00000008; 2705 Servers which support either the ALLOW or DENY ACE type SHOULD 2706 support both ALLOW and DENY ACE types. 2708 Clients should not attempt to set an ACE unless the server claims 2709 support for that ACE type. If the server receives a request to set 2710 an ACE that it cannot store, it MUST reject the request with 2711 NFS4ERR_ATTRNOTSUPP. If the server receives a request to set an ACE 2712 that it can store but cannot enforce, the server SHOULD reject the 2713 request with NFS4ERR_ATTRNOTSUPP. 2715 Support for any of the ACL attributes is optional (albeit, 2716 RECOMMENDED). 2718 6.2.1.3. ACE Access Mask 2720 The bitmask constants used for the access mask field are as follows: 2722 const ACE4_READ_DATA = 0x00000001; 2723 const ACE4_LIST_DIRECTORY = 0x00000001; 2724 const ACE4_WRITE_DATA = 0x00000002; 2725 const ACE4_ADD_FILE = 0x00000002; 2726 const ACE4_APPEND_DATA = 0x00000004; 2727 const ACE4_ADD_SUBDIRECTORY = 0x00000004; 2728 const ACE4_READ_NAMED_ATTRS = 0x00000008; 2729 const ACE4_WRITE_NAMED_ATTRS = 0x00000010; 2730 const ACE4_EXECUTE = 0x00000020; 2731 const ACE4_DELETE_CHILD = 0x00000040; 2732 const ACE4_READ_ATTRIBUTES = 0x00000080; 2733 const ACE4_WRITE_ATTRIBUTES = 0x00000100; 2735 const ACE4_DELETE = 0x00010000; 2736 const ACE4_READ_ACL = 0x00020000; 2737 const ACE4_WRITE_ACL = 0x00040000; 2738 const ACE4_WRITE_OWNER = 0x00080000; 2739 const ACE4_SYNCHRONIZE = 0x00100000; 2740 Note that some masks have coincident values, for example, 2741 ACE4_READ_DATA and ACE4_LIST_DIRECTORY. The mask entries 2742 ACE4_LIST_DIRECTORY, ACE4_ADD_FILE, and ACE4_ADD_SUBDIRECTORY are 2743 intended to be used with directory objects, while ACE4_READ_DATA, 2744 ACE4_WRITE_DATA, and ACE4_APPEND_DATA are intended to be used with 2745 non-directory objects. 2747 6.2.1.3.1. Discussion of Mask Attributes 2749 ACE4_READ_DATA 2751 Operation(s) affected: 2753 READ 2755 OPEN 2757 Discussion: 2759 Permission to read the data of the file. 2761 Servers SHOULD allow a user the ability to read the data of the 2762 file when only the ACE4_EXECUTE access mask bit is allowed. 2764 ACE4_LIST_DIRECTORY 2766 Operation(s) affected: 2768 READDIR 2770 Discussion: 2772 Permission to list the contents of a directory. 2774 ACE4_WRITE_DATA 2776 Operation(s) affected: 2778 WRITE 2780 OPEN 2782 SETATTR of size 2784 Discussion: 2786 Permission to modify a file's data. 2788 ACE4_ADD_FILE 2790 Operation(s) affected: 2792 CREATE 2794 LINK 2796 OPEN 2798 RENAME 2800 Discussion: 2802 Permission to add a new file in a directory. The CREATE 2803 operation is affected when nfs_ftype4 is NF4LNK, NF4BLK, 2804 NF4CHR, NF4SOCK, or NF4FIFO. (NF4DIR is not listed because it 2805 is covered by ACE4_ADD_SUBDIRECTORY.) OPEN is affected when 2806 used to create a regular file. LINK and RENAME are always 2807 affected. 2809 ACE4_APPEND_DATA 2811 Operation(s) affected: 2813 WRITE 2815 OPEN 2817 SETATTR of size 2819 Discussion: 2821 The ability to modify a file's data, but only starting at EOF. 2822 This allows for the notion of append-only files, by allowing 2823 ACE4_APPEND_DATA and denying ACE4_WRITE_DATA to the same user 2824 or group. If a file has an ACL such as the one described above 2825 and a WRITE request is made for somewhere other than EOF, the 2826 server SHOULD return NFS4ERR_ACCESS. 2828 ACE4_ADD_SUBDIRECTORY 2830 Operation(s) affected: 2832 CREATE 2834 RENAME 2836 Discussion: 2838 Permission to create a subdirectory in a directory. The CREATE 2839 operation is affected when nfs_ftype4 is NF4DIR. The RENAME 2840 operation is always affected. 2842 ACE4_READ_NAMED_ATTRS 2844 Operation(s) affected: 2846 OPENATTR 2848 Discussion: 2850 Permission to read the named attributes of a file or to lookup 2851 the named attributes directory. OPENATTR is affected when it 2852 is not used to create a named attribute directory. This is 2853 when 1.) createdir is TRUE, but a named attribute directory 2854 already exists, or 2.) createdir is FALSE. 2856 ACE4_WRITE_NAMED_ATTRS 2858 Operation(s) affected: 2860 OPENATTR 2862 Discussion: 2864 Permission to write the named attributes of a file or to create 2865 a named attribute directory. OPENATTR is affected when it is 2866 used to create a named attribute directory. This is when 2867 createdir is TRUE and no named attribute directory exists. The 2868 ability to check whether or not a named attribute directory 2869 exists depends on the ability to look it up, therefore, users 2870 also need the ACE4_READ_NAMED_ATTRS permission in order to 2871 create a named attribute directory. 2873 ACE4_EXECUTE 2875 Operation(s) affected: 2877 READ 2879 OPEN 2881 REMOVE 2883 RENAME 2885 LINK 2887 CREATE 2889 Discussion: 2891 Permission to execute a file. 2893 Servers SHOULD allow a user the ability to read the data of the 2894 file when only the ACE4_EXECUTE access mask bit is allowed. 2895 This is because there is no way to execute a file without 2896 reading the contents. Though a server may treat ACE4_EXECUTE 2897 and ACE4_READ_DATA bits identically when deciding to permit a 2898 READ operation, it SHOULD still allow the two bits to be set 2899 independently in ACLs, and MUST distinguish between them when 2900 replying to ACCESS operations. In particular, servers SHOULD 2901 NOT silently turn on one of the two bits when the other is set, 2902 as that would make it impossible for the client to correctly 2903 enforce the distinction between read and execute permissions. 2905 As an example, following a SETATTR of the following ACL: 2907 nfsuser:ACE4_EXECUTE:ALLOW 2909 A subsequent GETATTR of ACL for that file SHOULD return: 2911 nfsuser:ACE4_EXECUTE:ALLOW 2913 Rather than: 2915 nfsuser:ACE4_EXECUTE/ACE4_READ_DATA:ALLOW 2917 ACE4_EXECUTE 2919 Operation(s) affected: 2921 LOOKUP 2923 Discussion: 2925 Permission to traverse/search a directory. 2927 ACE4_DELETE_CHILD 2929 Operation(s) affected: 2931 REMOVE 2933 RENAME 2935 Discussion: 2937 Permission to delete a file or directory within a directory. 2938 See Section 6.2.1.3.2 for information on ACE4_DELETE and 2939 ACE4_DELETE_CHILD interact. 2941 ACE4_READ_ATTRIBUTES 2943 Operation(s) affected: 2945 GETATTR of file system object attributes 2947 VERIFY 2949 NVERIFY 2951 READDIR 2953 Discussion: 2955 The ability to read basic attributes (non-ACLs) of a file. On 2956 a UNIX system, basic attributes can be thought of as the stat 2957 level attributes. Allowing this access mask bit would mean the 2958 entity can execute "ls -l" and stat. If a READDIR operation 2959 requests attributes, this mask must be allowed for the READDIR 2960 to succeed. 2962 ACE4_WRITE_ATTRIBUTES 2964 Operation(s) affected: 2966 SETATTR of time_access_set, time_backup, 2968 time_create, time_modify_set, mimetype, hidden, system 2970 Discussion: 2972 Permission to change the times associated with a file or 2973 directory to an arbitrary value. Also permission to change the 2974 mimetype, hidden and system attributes. A user having 2975 ACE4_WRITE_DATA or ACE4_WRITE_ATTRIBUTES will be allowed to set 2976 the times associated with a file to the current server time. 2978 ACE4_DELETE 2980 Operation(s) affected: 2982 REMOVE 2984 Discussion: 2986 Permission to delete the file or directory. See 2987 Section 6.2.1.3.2 for information on ACE4_DELETE and 2988 ACE4_DELETE_CHILD interact. 2990 ACE4_READ_ACL 2992 Operation(s) affected: 2994 GETATTR of acl 2996 NVERIFY 2998 VERIFY 3000 Discussion: 3002 Permission to read the ACL. 3004 ACE4_WRITE_ACL 3006 Operation(s) affected: 3008 SETATTR of acl and mode 3010 Discussion: 3012 Permission to write the acl and mode attributes. 3014 ACE4_WRITE_OWNER 3016 Operation(s) affected: 3018 SETATTR of owner and owner_group 3020 Discussion: 3022 Permission to write the owner and owner_group attributes. On 3023 UNIX systems, this is the ability to execute chown() and 3024 chgrp(). 3026 ACE4_SYNCHRONIZE 3028 Operation(s) affected: 3030 NONE 3032 Discussion: 3034 Permission to access file locally at the server with 3035 synchronized reads and writes. 3037 Server implementations need not provide the granularity of control 3038 that is implied by this list of masks. For example, POSIX-based 3039 systems might not distinguish ACE4_APPEND_DATA (the ability to append 3040 to a file) from ACE4_WRITE_DATA (the ability to modify existing 3041 contents); both masks would be tied to a single "write" permission. 3042 When such a server returns attributes to the client, it would show 3043 both ACE4_APPEND_DATA and ACE4_WRITE_DATA if and only if the write 3044 permission is enabled. 3046 If a server receives a SETATTR request that it cannot accurately 3047 implement, it should err in the direction of more restricted access, 3048 except in the previously discussed cases of execute and read. For 3049 example, suppose a server cannot distinguish overwriting data from 3050 appending new data, as described in the previous paragraph. If a 3051 client submits an ALLOW ACE where ACE4_APPEND_DATA is set but 3052 ACE4_WRITE_DATA is not (or vice versa), the server should either turn 3053 off ACE4_APPEND_DATA or reject the request with NFS4ERR_ATTRNOTSUPP. 3055 6.2.1.3.2. ACE4_DELETE vs. ACE4_DELETE_CHILD 3057 Two access mask bits govern the ability to delete a directory entry: 3058 ACE4_DELETE on the object itself (the "target"), and 3059 ACE4_DELETE_CHILD on the containing directory (the "parent"). 3061 Many systems also take the "sticky bit" (MODE4_SVTX) on a directory 3062 to allow unlink only to a user that owns either the target or the 3063 parent; on some such systems the decision also depends on whether the 3064 target is writable. 3066 Servers SHOULD allow unlink if either ACE4_DELETE is permitted on the 3067 target, or ACE4_DELETE_CHILD is permitted on the parent. (Note that 3068 this is true even if the parent or target explicitly denies one of 3069 these permissions.) 3071 If the ACLs in question neither explicitly ALLOW nor DENY either of 3072 the above, and if MODE4_SVTX is not set on the parent, then the 3073 server SHOULD allow the removal if and only if ACE4_ADD_FILE is 3074 permitted. In the case where MODE4_SVTX is set, the server may also 3075 require the remover to own either the parent or the target, or may 3076 require the target to be writable. 3078 This allows servers to support something close to traditional UNIX- 3079 like semantics, with ACE4_ADD_FILE taking the place of the write bit. 3081 6.2.1.4. ACE flag 3083 The bitmask constants used for the flag field are as follows: 3085 const ACE4_FILE_INHERIT_ACE = 0x00000001; 3086 const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; 3087 const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; 3088 const ACE4_INHERIT_ONLY_ACE = 0x00000008; 3089 const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; 3090 const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; 3091 const ACE4_IDENTIFIER_GROUP = 0x00000040; 3093 A server need not support any of these flags. If the server supports 3094 flags that are similar to, but not exactly the same as, these flags, 3095 the implementation may define a mapping between the protocol-defined 3096 flags and the implementation-defined flags. 3098 For example, suppose a client tries to set an ACE with 3099 ACE4_FILE_INHERIT_ACE set but not ACE4_DIRECTORY_INHERIT_ACE. If the 3100 server does not support any form of ACL inheritance, the server 3101 should reject the request with NFS4ERR_ATTRNOTSUPP. If the server 3102 supports a single "inherit ACE" flag that applies to both files and 3103 directories, the server may reject the request (i.e., requiring the 3104 client to set both the file and directory inheritance flags). The 3105 server may also accept the request and silently turn on the 3106 ACE4_DIRECTORY_INHERIT_ACE flag. 3108 6.2.1.4.1. Discussion of Flag Bits 3110 ACE4_FILE_INHERIT_ACE 3111 Any non-directory file in any sub-directory will get this ACE 3112 inherited. 3114 ACE4_DIRECTORY_INHERIT_ACE 3115 Can be placed on a directory and indicates that this ACE should be 3116 added to each new directory created. 3117 If this flag is set in an ACE in an ACL attribute to be set on a 3118 non-directory file system object, the operation attempting to set 3119 the ACL SHOULD fail with NFS4ERR_ATTRNOTSUPP. 3121 ACE4_INHERIT_ONLY_ACE 3122 Can be placed on a directory but does not apply to the directory; 3123 ALLOW and DENY ACEs with this bit set do not affect access to the 3124 directory, and AUDIT and ALARM ACEs with this bit set do not 3125 trigger log or alarm events. Such ACEs only take effect once they 3126 are applied (with this bit cleared) to newly created files and 3127 directories as specified by the above two flags. 3128 If this flag is present on an ACE, but neither 3129 ACE4_DIRECTORY_INHERIT_ACE nor ACE4_FILE_INHERIT_ACE is present, 3130 then an operation attempting to set such an attribute SHOULD fail 3131 with NFS4ERR_ATTRNOTSUPP. 3133 ACE4_NO_PROPAGATE_INHERIT_ACE 3134 Can be placed on a directory. This flag tells the server that 3135 inheritance of this ACE should stop at newly created child 3136 directories. 3138 ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 3140 ACE4_FAILED_ACCESS_ACE_FLAG 3141 The ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (SUCCESS) and 3142 ACE4_FAILED_ACCESS_ACE_FLAG (FAILED) flag bits may be set only on 3143 ACE4_SYSTEM_AUDIT_ACE_TYPE (AUDIT) and ACE4_SYSTEM_ALARM_ACE_TYPE 3144 (ALARM) ACE types. If during the processing of the file's ACL, 3145 the server encounters an AUDIT or ALARM ACE that matches the 3146 principal attempting the OPEN, the server notes that fact, and the 3147 presence, if any, of the SUCCESS and FAILED flags encountered in 3148 the AUDIT or ALARM ACE. Once the server completes the ACL 3149 processing, it then notes if the operation succeeded or failed. 3150 If the operation succeeded, and if the SUCCESS flag was set for a 3151 matching AUDIT or ALARM ACE, then the appropriate AUDIT or ALARM 3152 event occurs. If the operation failed, and if the FAILED flag was 3153 set for the matching AUDIT or ALARM ACE, then the appropriate 3154 AUDIT or ALARM event occurs. Either or both of the SUCCESS or 3155 FAILED can be set, but if neither is set, the AUDIT or ALARM ACE 3156 is not useful. 3158 The previously described processing applies to ACCESS operations 3159 even when they return NFS4_OK. For the purposes of AUDIT and 3160 ALARM, we consider an ACCESS operation to be a "failure" if it 3161 fails to return a bit that was requested and supported. 3163 ACE4_IDENTIFIER_GROUP 3164 Indicates that the "who" refers to a GROUP as defined under UNIX 3165 or a GROUP ACCOUNT as defined under Windows. Clients and servers 3166 MUST ignore the ACE4_IDENTIFIER_GROUP flag on ACEs with a who 3167 value equal to one of the special identifiers outlined in 3168 Section 6.2.1.5. 3170 6.2.1.5. ACE Who 3172 The "who" field of an ACE is an identifier that specifies the 3173 principal or principals to whom the ACE applies. It may refer to a 3174 user or a group, with the flag bit ACE4_IDENTIFIER_GROUP specifying 3175 which. 3177 There are several special identifiers which need to be understood 3178 universally, rather than in the context of a particular DNS domain. 3179 Some of these identifiers cannot be understood when an NFS client 3180 accesses the server, but have meaning when a local process accesses 3181 the file. The ability to display and modify these permissions is 3182 permitted over NFS, even if none of the access methods on the server 3183 understands the identifiers. 3185 +---------------+--------------------------------------------------+ 3186 | Who | Description | 3187 +---------------+--------------------------------------------------+ 3188 | OWNER | The owner of the file | 3189 | GROUP | The group associated with the file. | 3190 | EVERYONE | The world, including the owner and owning group. | 3191 | INTERACTIVE | Accessed from an interactive terminal. | 3192 | NETWORK | Accessed via the network. | 3193 | DIALUP | Accessed as a dialup user to the server. | 3194 | BATCH | Accessed from a batch job. | 3195 | ANONYMOUS | Accessed without any authentication. | 3196 | AUTHENTICATED | Any authenticated user (opposite of ANONYMOUS) | 3197 | SERVICE | Access from a system service. | 3198 +---------------+--------------------------------------------------+ 3200 Table 4 3202 To avoid conflict, these special identifiers are distinguished by an 3203 appended "@" and should appear in the form "xxxx@" (with no domain 3204 name after the "@"). For example: ANONYMOUS@. 3206 The ACE4_IDENTIFIER_GROUP flag MUST be ignored on entries with these 3207 special identifiers. When encoding entries with these special 3208 identifiers, the ACE4_IDENTIFIER_GROUP flag SHOULD be set to zero. 3210 6.2.1.5.1. Discussion of EVERYONE@ 3212 It is important to note that "EVERYONE@" is not equivalent to the 3213 UNIX "other" entity. This is because, by definition, UNIX "other" 3214 does not include the owner or owning group of a file. "EVERYONE@" 3215 means literally everyone, including the owner or owning group. 3217 6.2.2. Attribute 33: mode 3219 The NFSv4.0 mode attribute is based on the UNIX mode bits. The 3220 following bits are defined: 3222 const MODE4_SUID = 0x800; /* set user id on execution */ 3223 const MODE4_SGID = 0x400; /* set group id on execution */ 3224 const MODE4_SVTX = 0x200; /* save text even after use */ 3225 const MODE4_RUSR = 0x100; /* read permission: owner */ 3226 const MODE4_WUSR = 0x080; /* write permission: owner */ 3227 const MODE4_XUSR = 0x040; /* execute permission: owner */ 3228 const MODE4_RGRP = 0x020; /* read permission: group */ 3229 const MODE4_WGRP = 0x010; /* write permission: group */ 3230 const MODE4_XGRP = 0x008; /* execute permission: group */ 3231 const MODE4_ROTH = 0x004; /* read permission: other */ 3232 const MODE4_WOTH = 0x002; /* write permission: other */ 3233 const MODE4_XOTH = 0x001; /* execute permission: other */ 3235 Bits MODE4_RUSR, MODE4_WUSR, and MODE4_XUSR apply to the principal 3236 identified in the owner attribute. Bits MODE4_RGRP, MODE4_WGRP, and 3237 MODE4_XGRP apply to principals identified in the owner_group 3238 attribute but who are not identified in the owner attribute. Bits 3239 MODE4_ROTH, MODE4_WOTH, MODE4_XOTH apply to any principal that does 3240 not match that in the owner attribute, and does not have a group 3241 matching that of the owner_group attribute. 3243 Bits within the mode other than those specified above are not defined 3244 by this protocol. A server MUST NOT return bits other than those 3245 defined above in a GETATTR or READDIR operation, and it MUST return 3246 NFS4ERR_INVAL if bits other than those defined above are set in a 3247 SETATTR, CREATE, OPEN, VERIFY or NVERIFY operation. 3249 6.3. Common Methods 3251 The requirements in this section will be referred to in future 3252 sections, especially Section 6.4. 3254 6.3.1. Interpreting an ACL 3256 6.3.1.1. Server Considerations 3258 The server uses the algorithm described in Section 6.2.1 to determine 3259 whether an ACL allows access to an object. However, the ACL may not 3260 be the sole determiner of access. For example: 3262 o In the case of a file system exported as read-only, the server may 3263 deny write permissions even though an object's ACL grants it. 3265 o Server implementations MAY grant ACE4_WRITE_ACL and ACE4_READ_ACL 3266 permissions to prevent a situation from arising in which there is 3267 no valid way to ever modify the ACL. 3269 o All servers will allow a user the ability to read the data of the 3270 file when only the execute permission is granted (i.e., If the ACL 3271 denies the user the ACE4_READ_DATA access and allows the user 3272 ACE4_EXECUTE, the server will allow the user to read the data of 3273 the file). 3275 o Many servers have the notion of owner-override in which the owner 3276 of the object is allowed to override accesses that are denied by 3277 the ACL. This may be helpful, for example, to allow users 3278 continued access to open files on which the permissions have 3279 changed. 3281 o Many servers have the notion of a "superuser" that has privileges 3282 beyond an ordinary user. The superuser may be able to read or 3283 write data or metadata in ways that would not be permitted by the 3284 ACL. 3286 6.3.1.2. Client Considerations 3288 Clients SHOULD NOT do their own access checks based on their 3289 interpretation the ACL, but rather use the OPEN and ACCESS operations 3290 to do access checks. This allows the client to act on the results of 3291 having the server determine whether or not access should be granted 3292 based on its interpretation of the ACL. 3294 Clients must be aware of situations in which an object's ACL will 3295 define a certain access even though the server will not enforce it. 3296 In general, but especially in these situations, the client needs to 3297 do its part in the enforcement of access as defined by the ACL. To 3298 do this, the client MAY send the appropriate ACCESS operation prior 3299 to servicing the request of the user or application in order to 3300 determine whether the user or application should be granted the 3301 access requested. For examples in which the ACL may define accesses 3302 that the server doesn't enforce see Section 6.3.1.1. 3304 6.3.2. Computing a Mode Attribute from an ACL 3306 The following method can be used to calculate the MODE4_R*, MODE4_W* 3307 and MODE4_X* bits of a mode attribute, based upon an ACL. 3309 First, for each of the special identifiers OWNER@, GROUP@, and 3310 EVERYONE@, evaluate the ACL in order, considering only ALLOW and DENY 3311 ACEs for the identifier EVERYONE@ and for the identifier under 3312 consideration. The result of the evaluation will be an NFSv4 ACL 3313 mask showing exactly which bits are permitted to that identifier. 3315 Then translate the calculated mask for OWNER@, GROUP@, and EVERYONE@ 3316 into mode bits for, respectively, the user, group, and other, as 3317 follows: 3319 1. Set the read bit (MODE4_RUSR, MODE4_RGRP, or MODE4_ROTH) if and 3320 only if ACE4_READ_DATA is set in the corresponding mask. 3322 2. Set the write bit (MODE4_WUSR, MODE4_WGRP, or MODE4_WOTH) if and 3323 only if ACE4_WRITE_DATA and ACE4_APPEND_DATA are both set in the 3324 corresponding mask. 3326 3. Set the execute bit (MODE4_XUSR, MODE4_XGRP, or MODE4_XOTH), if 3327 and only if ACE4_EXECUTE is set in the corresponding mask. 3329 6.3.2.1. Discussion 3331 Some server implementations also add bits permitted to named users 3332 and groups to the group bits (MODE4_RGRP, MODE4_WGRP, and 3333 MODE4_XGRP). 3335 Implementations are discouraged from doing this, because it has been 3336 found to cause confusion for users who see members of a file's group 3337 denied access that the mode bits appear to allow. (The presence of 3338 DENY ACEs may also lead to such behavior, but DENY ACEs are expected 3339 to be more rarely used.) 3341 The same user confusion seen when fetching the mode also results if 3342 setting the mode does not effectively control permissions for the 3343 owner, group, and other users; this motivates some of the 3344 requirements that follow. 3346 6.4. Requirements 3348 The server that supports both mode and ACL must take care to 3349 synchronize the MODE4_*USR, MODE4_*GRP, and MODE4_*OTH bits with the 3350 ACEs which have respective who fields of "OWNER@", "GROUP@", and 3351 "EVERYONE@" so that the client can see semantically equivalent access 3352 permissions exist whether the client asks for owner, owner_group and 3353 mode attributes, or for just the ACL. 3355 In this section, much is made of the methods in Section 6.3.2. Many 3356 requirements refer to this section. But note that the methods have 3357 behaviors specified with "SHOULD". This is intentional, to avoid 3358 invalidating existing implementations that compute the mode according 3359 to the withdrawn POSIX ACL draft (1003.1e draft 17), rather than by 3360 actual permissions on owner, group, and other. 3362 6.4.1. Setting the mode and/or ACL Attributes 3364 6.4.1.1. Setting mode and not ACL 3366 When any of the nine low-order mode bits are subject to change, 3367 either because the mode attribute was set or because the 3368 mode_set_masked attribute was set and the mask included one or more 3369 bits from the nine low-order mode bits, and no ACL attribute is 3370 explicitly set, the acl attribute must be modified in accordance with 3371 the updated value of those bits. This must happen even if the value 3372 of the low-order bits is the same after the mode is set as before. 3374 Note that any AUDIT or ALARM ACEs are unaffected by changes to the 3375 mode. 3377 In cases in which the permissions bits are subject to change, the acl 3378 attribute MUST be modified such that the mode computed via the method 3379 in Section 6.3.2 yields the low-order nine bits (MODE4_R*, MODE4_W*, 3380 MODE4_X*) of the mode attribute as modified by the attribute change. 3381 The ACL attributes SHOULD also be modified such that: 3383 1. If MODE4_RGRP is not set, entities explicitly listed in the ACL 3384 other than OWNER@ and EVERYONE@ SHOULD NOT be granted 3385 ACE4_READ_DATA. 3387 2. If MODE4_WGRP is not set, entities explicitly listed in the ACL 3388 other than OWNER@ and EVERYONE@ SHOULD NOT be granted 3389 ACE4_WRITE_DATA or ACE4_APPEND_DATA. 3391 3. If MODE4_XGRP is not set, entities explicitly listed in the ACL 3392 other than OWNER@ and EVERYONE@ SHOULD NOT be granted 3393 ACE4_EXECUTE. 3395 Access mask bits other those listed above, appearing in ALLOW ACEs, 3396 MAY also be disabled. 3398 Note that ACEs with the flag ACE4_INHERIT_ONLY_ACE set do not affect 3399 the permissions of the ACL itself, nor do ACEs of the type AUDIT and 3400 ALARM. As such, it is desirable to leave these ACEs unmodified when 3401 modifying the ACL attributes. 3403 Also note that the requirement may be met by discarding the acl in 3404 favor of an ACL that represents the mode and only the mode. This is 3405 permitted, but it is preferable for a server to preserve as much of 3406 the ACL as possible without violating the above requirements. 3407 Discarding the ACL makes it effectively impossible for a file created 3408 with a mode attribute to inherit an ACL (see Section 6.4.3). 3410 6.4.1.2. Setting ACL and not mode 3412 When setting the acl and not setting the mode or mode_set_masked 3413 attributes, the permission bits of the mode need to be derived from 3414 the ACL. In this case, the ACL attribute SHOULD be set as given. 3415 The nine low-order bits of the mode attribute (MODE4_R*, MODE4_W*, 3416 MODE4_X*) MUST be modified to match the result of the method 3417 Section 6.3.2. The three high-order bits of the mode (MODE4_SUID, 3418 MODE4_SGID, MODE4_SVTX) SHOULD remain unchanged. 3420 6.4.1.3. Setting both ACL and mode 3422 When setting both the mode (includes use of either the mode attribute 3423 or the mode_set_masked attribute) and the acl attribute in the same 3424 operation, the attributes MUST be applied in this order: mode (or 3425 mode_set_masked), then ACL. The mode-related attribute is set as 3426 given, then the ACL attribute is set as given, possibly changing the 3427 final mode, as described above in Section 6.4.1.2. 3429 6.4.2. Retrieving the mode and/or ACL Attributes 3431 This section applies only to servers that support both the mode and 3432 ACL attributes. 3434 Some server implementations may have a concept of "objects without 3435 ACLs", meaning that all permissions are granted and denied according 3436 to the mode attribute, and that no ACL attribute is stored for that 3437 object. If an ACL attribute is requested of such a server, the 3438 server SHOULD return an ACL that does not conflict with the mode; 3439 that is to say, the ACL returned SHOULD represent the nine low-order 3440 bits of the mode attribute (MODE4_R*, MODE4_W*, MODE4_X*) as 3441 described in Section 6.3.2. 3443 For other server implementations, the ACL attribute is always present 3444 for every object. Such servers SHOULD store at least the three high- 3445 order bits of the mode attribute (MODE4_SUID, MODE4_SGID, 3446 MODE4_SVTX). The server SHOULD return a mode attribute if one is 3447 requested, and the low-order nine bits of the mode (MODE4_R*, 3448 MODE4_W*, MODE4_X*) MUST match the result of applying the method in 3449 Section 6.3.2 to the ACL attribute. 3451 6.4.3. Creating New Objects 3453 If a server supports any ACL attributes, it may use the ACL 3454 attributes on the parent directory to compute an initial ACL 3455 attribute for a newly created object. This will be referred to as 3456 the inherited ACL within this section. The act of adding one or more 3457 ACEs to the inherited ACL that are based upon ACEs in the parent 3458 directory's ACL will be referred to as inheriting an ACE within this 3459 section. 3461 Implementors should standardize on what the behavior of CREATE and 3462 OPEN must be depending on the presence or absence of the mode and ACL 3463 attributes. 3465 1. If just the mode is given in the call: 3467 In this case, inheritance SHOULD take place, but the mode MUST be 3468 applied to the inherited ACL as described in Section 6.4.1.1, 3469 thereby modifying the ACL. 3471 2. If just the ACL is given in the call: 3473 In this case, inheritance SHOULD NOT take place, and the ACL as 3474 defined in the CREATE or OPEN will be set without modification, 3475 and the mode modified as in Section 6.4.1.2 3477 3. If both mode and ACL are given in the call: 3479 In this case, inheritance SHOULD NOT take place, and both 3480 attributes will be set as described in Section 6.4.1.3. 3482 4. If neither mode nor ACL are given in the call: 3484 In the case where an object is being created without any initial 3485 attributes at all, e.g., an OPEN operation with an opentype4 of 3486 OPEN4_CREATE and a createmode4 of EXCLUSIVE4, inheritance SHOULD 3487 NOT take place. Instead, the server SHOULD set permissions to 3488 deny all access to the newly created object. It is expected that 3489 the appropriate client will set the desired attributes in a 3490 subsequent SETATTR operation, and the server SHOULD allow that 3491 operation to succeed, regardless of what permissions the object 3492 is created with. For example, an empty ACL denies all 3493 permissions, but the server should allow the owner's SETATTR to 3494 succeed even though WRITE_ACL is implicitly denied. 3496 In other cases, inheritance SHOULD take place, and no 3497 modifications to the ACL will happen. The mode attribute, if 3498 supported, MUST be as computed in Section 6.3.2, with the 3499 MODE4_SUID, MODE4_SGID and MODE4_SVTX bits clear. If no 3500 inheritable ACEs exist on the parent directory, the rules for 3501 creating acl attributes are implementation defined. 3503 6.4.3.1. The Inherited ACL 3505 If the object being created is not a directory, the inherited ACL 3506 SHOULD NOT inherit ACEs from the parent directory ACL unless the 3507 ACE4_FILE_INHERIT_FLAG is set. 3509 If the object being created is a directory, the inherited ACL should 3510 inherit all inheritable ACEs from the parent directory, those that 3511 have ACE4_FILE_INHERIT_ACE or ACE4_DIRECTORY_INHERIT_ACE flag set. 3512 If the inheritable ACE has ACE4_FILE_INHERIT_ACE set, but 3513 ACE4_DIRECTORY_INHERIT_ACE is clear, the inherited ACE on the newly 3514 created directory MUST have the ACE4_INHERIT_ONLY_ACE flag set to 3515 prevent the directory from being affected by ACEs meant for non- 3516 directories. 3518 When a new directory is created, the server MAY split any inherited 3519 ACE which is both inheritable and effective (in other words, which 3520 has neither ACE4_INHERIT_ONLY_ACE nor ACE4_NO_PROPAGATE_INHERIT_ACE 3521 set), into two ACEs, one with no inheritance flags, and one with 3522 ACE4_INHERIT_ONLY_ACE set. This makes it simpler to modify the 3523 effective permissions on the directory without modifying the ACE 3524 which is to be inherited to the new directory's children. 3526 7. Multi-Server Namespace 3528 NFSv4 supports attributes that allow a namespace to extend beyond the 3529 boundaries of a single server. It is RECOMMENDED that clients and 3530 servers support construction of such multi-server namespaces. Use of 3531 such multi-server namespaces is OPTIONAL, however, and for many 3532 purposes, single-server namespaces are perfectly acceptable. Use of 3533 multi-server namespaces can provide many advantages, however, by 3534 separating a file system's logical position in a namespace from the 3535 (possibly changing) logistical and administrative considerations that 3536 result in particular file systems being located on particular 3537 servers. 3539 7.1. Location Attributes 3541 NFSv4 contains RECOMMENDED attributes that allow file systems on one 3542 server to be associated with one or more instances of that file 3543 system on other servers. These attributes specify such file system 3544 instances by specifying a server address target (either as a DNS name 3545 representing one or more IP addresses or as a literal IP address) 3546 together with the path of that file system within the associated 3547 single-server namespace. 3549 The fs_locations RECOMMENDED attribute allows specification of the 3550 file system locations where the data corresponding to a given file 3551 system may be found. 3553 7.2. File System Presence or Absence 3555 A given location in an NFSv4 namespace (typically but not necessarily 3556 a multi-server namespace) can have a number of file system instance 3557 locations associated with it via the fs_locations attribute. There 3558 may also be an actual current file system at that location, 3559 accessible via normal namespace operations (e.g., LOOKUP). In this 3560 case, the file system is said to be "present" at that position in the 3561 namespace, and clients will typically use it, reserving use of 3562 additional locations specified via the location-related attributes to 3563 situations in which the principal location is no longer available. 3565 When there is no actual file system at the namespace location in 3566 question, the file system is said to be "absent". An absent file 3567 system contains no files or directories other than the root. Any 3568 reference to it, except to access a small set of attributes useful in 3569 determining alternate locations, will result in an error, 3570 NFS4ERR_MOVED. Note that if the server ever returns the error 3571 NFS4ERR_MOVED, it MUST support the fs_locations attribute. 3573 While the error name suggests that we have a case of a file system 3574 that once was present, and has only become absent later, this is only 3575 one possibility. A position in the namespace may be permanently 3576 absent with the set of file system(s) designated by the location 3577 attributes being the only realization. The name NFS4ERR_MOVED 3578 reflects an earlier, more limited conception of its function, but 3579 this error will be returned whenever the referenced file system is 3580 absent, whether it has moved or not. 3582 Except in the case of GETATTR-type operations (to be discussed 3583 later), when the current filehandle at the start of an operation is 3584 within an absent file system, that operation is not performed and the 3585 error NFS4ERR_MOVED is returned, to indicate that the file system is 3586 absent on the current server. 3588 Because a GETFH cannot succeed if the current filehandle is within an 3589 absent file system, filehandles within an absent file system cannot 3590 be transferred to the client. When a client does have filehandles 3591 within an absent file system, it is the result of obtaining them when 3592 the file system was present, and having the file system become absent 3593 subsequently. 3595 It should be noted that because the check for the current filehandle 3596 being within an absent file system happens at the start of every 3597 operation, operations that change the current filehandle so that it 3598 is within an absent file system will not result in an error. This 3599 allows such combinations as PUTFH-GETATTR and LOOKUP-GETATTR to be 3600 used to get attribute information, particularly location attribute 3601 information, as discussed below. 3603 7.3. Getting Attributes for an Absent File System 3605 When a file system is absent, most attributes are not available, but 3606 it is necessary to allow the client access to the small set of 3607 attributes that are available, and most particularly that which gives 3608 information about the correct current locations for this file system, 3609 fs_locations. 3611 7.3.1. GETATTR Within an Absent File System 3613 As mentioned above, an exception is made for GETATTR in that 3614 attributes may be obtained for a filehandle within an absent file 3615 system. This exception only applies if the attribute mask contains 3616 at least the fs_locations attribute bit, which indicates the client 3617 is interested in a result regarding an absent file system. If it is 3618 not requested, GETATTR will result in an NFS4ERR_MOVED error. 3620 When a GETATTR is done on an absent file system, the set of supported 3621 attributes is very limited. Many attributes, including those that 3622 are normally REQUIRED, will not be available on an absent file 3623 system. In addition to the fs_locations attribute, the following 3624 attributes SHOULD be available on absent file systems. In the case 3625 of RECOMMENDED attributes, they should be available at least to the 3626 same degree that they are available on present file systems. 3628 fsid: This attribute should be provided so that the client can 3629 determine file system boundaries, including, in particular, the 3630 boundary between present and absent file systems. This value must 3631 be different from any other fsid on the current server and need 3632 have no particular relationship to fsids on any particular 3633 destination to which the client might be directed. 3635 mounted_on_fileid: For objects at the top of an absent file system, 3636 this attribute needs to be available. Since the fileid is within 3637 the present parent file system, there should be no need to 3638 reference the absent file system to provide this information. 3640 Other attributes SHOULD NOT be made available for absent file 3641 systems, even when it is possible to provide them. The server should 3642 not assume that more information is always better and should avoid 3643 gratuitously providing additional information. 3645 When a GETATTR operation includes a bit mask for the attribute 3646 fs_locations, but where the bit mask includes attributes that are not 3647 supported, GETATTR will not return an error, but will return the mask 3648 of the actual attributes supported with the results. 3650 Handling of VERIFY/NVERIFY is similar to GETATTR in that if the 3651 attribute mask does not include fs_locations the error NFS4ERR_MOVED 3652 will result. It differs in that any appearance in the attribute mask 3653 of an attribute not supported for an absent file system (and note 3654 that this will include some normally REQUIRED attributes) will also 3655 cause an NFS4ERR_MOVED result. 3657 7.3.2. READDIR and Absent File Systems 3659 A READDIR performed when the current filehandle is within an absent 3660 file system will result in an NFS4ERR_MOVED error, since, unlike the 3661 case of GETATTR, no such exception is made for READDIR. 3663 Attributes for an absent file system may be fetched via a READDIR for 3664 a directory in a present file system, when that directory contains 3665 the root directories of one or more absent file systems. In this 3666 case, the handling is as follows: 3668 o If the attribute set requested includes fs_locations, then 3669 fetching of attributes proceeds normally and no NFS4ERR_MOVED 3670 indication is returned, even when the rdattr_error attribute is 3671 requested. 3673 o If the attribute set requested does not include fs_locations, then 3674 if the rdattr_error attribute is requested, each directory entry 3675 for the root of an absent file system will report NFS4ERR_MOVED as 3676 the value of the rdattr_error attribute. 3678 o If the attribute set requested does not include either of the 3679 attributes fs_locations or rdattr_error then the occurrence of the 3680 root of an absent file system within the directory will result in 3681 the READDIR failing with an NFS4ERR_MOVED error. 3683 o The unavailability of an attribute because of a file system's 3684 absence, even one that is ordinarily REQUIRED, does not result in 3685 any error indication. The set of attributes returned for the root 3686 directory of the absent file system in that case is simply 3687 restricted to those actually available. 3689 7.4. Uses of Location Information 3691 The location-bearing attribute of fs_locations provides, together 3692 with the possibility of absent file systems, a number of important 3693 facilities in providing reliable, manageable, and scalable data 3694 access. 3696 When a file system is present, these attributes can provide 3697 alternative locations, to be used to access the same data, in the 3698 event of server failures, communications problems, or other 3699 difficulties that make continued access to the current file system 3700 impossible or otherwise impractical. Under some circumstances, 3701 multiple alternative locations may be used simultaneously to provide 3702 higher-performance access to the file system in question. Provision 3703 of such alternate locations is referred to as "replication" although 3704 there are cases in which replicated sets of data are not in fact 3705 present, and the replicas are instead different paths to the same 3706 data. 3708 When a file system is present and becomes absent, clients can be 3709 given the opportunity to have continued access to their data, at an 3710 alternate location. In this case, a continued attempt to use the 3711 data in the now-absent file system will result in an NFS4ERR_MOVED 3712 error and, at that point, the successor locations (typically only one 3713 although multiple choices are possible) can be fetched and used to 3714 continue access. Transfer of the file system contents to the new 3715 location is referred to as "migration", but it should be kept in mind 3716 that there are cases in which this term can be used, like 3717 "replication", when there is no actual data migration per se. 3719 Where a file system was not previously present, specification of file 3720 system location provides a means by which file systems located on one 3721 server can be associated with a namespace defined by another server, 3722 thus allowing a general multi-server namespace facility. A 3723 designation of such a location, in place of an absent file system, is 3724 called a "referral". 3726 Because client support for location-related attributes is OPTIONAL, a 3727 server may (but is not required to) take action to hide migration and 3728 referral events from such clients, by acting as a proxy, for example. 3730 7.4.1. File System Replication 3732 The fs_locations attribute provides alternative locations, to be used 3733 to access data in place of or in addition to the current file system 3734 instance. On first access to a file system, the client should obtain 3735 the value of the set of alternate locations by interrogating the 3736 fs_locations attribute. 3738 In the event that server failures, communications problems, or other 3739 difficulties make continued access to the current file system 3740 impossible or otherwise impractical, the client can use the alternate 3741 locations as a way to get continued access to its data. Multiple 3742 locations may be used simultaneously, to provide higher performance 3743 through the exploitation of multiple paths between client and target 3744 file system. 3746 The alternate locations may be physical replicas of the (typically 3747 read-only) file system data, or they may reflect alternate paths to 3748 the same server or provide for the use of various forms of server 3749 clustering in which multiple servers provide alternate ways of 3750 accessing the same physical file system. How these different modes 3751 of file system transition are represented within the fs_locations 3752 attribute and how the client deals with file system transition issues 3753 will be discussed in detail below. 3755 Multiple server addresses, whether they are derived from a single 3756 entry with a DNS name representing a set of IP addresses or from 3757 multiple entries each with its own server address, may correspond to 3758 the same actual server. 3760 7.4.2. File System Migration 3762 When a file system is present and becomes absent, clients can be 3763 given the opportunity to have continued access to their data, at an 3764 alternate location, as specified by the fs_locations attribute. 3765 Typically, a client will be accessing the file system in question, 3766 get an NFS4ERR_MOVED error, and then use the fs_locations attribute 3767 to determine the new location of the data. 3769 Such migration can be helpful in providing load balancing or general 3770 resource reallocation. The protocol does not specify how the file 3771 system will be moved between servers. It is anticipated that a 3772 number of different server-to-server transfer mechanisms might be 3773 used with the choice left to the server implementor. The NFSv4 3774 protocol specifies the method used to communicate the migration event 3775 between client and server. 3777 The new location may be an alternate communication path to the same 3778 server or, in the case of various forms of server clustering, another 3779 server providing access to the same physical file system. The 3780 client's responsibilities in dealing with this transition depend on 3781 the specific nature of the new access path as well as how and whether 3782 data was in fact migrated. These issues will be discussed in detail 3783 below. 3785 When an alternate location is designated as the target for migration, 3786 it must designate the same data. Where file systems are writable, a 3787 change made on the original file system must be visible on all 3788 migration targets. Where a file system is not writable but 3789 represents a read-only copy (possibly periodically updated) of a 3790 writable file system, similar requirements apply to the propagation 3791 of updates. Any change visible in the original file system must 3792 already be effected on all migration targets, to avoid any 3793 possibility that a client, in effecting a transition to the migration 3794 target, will see any reversion in file system state. 3796 7.4.3. Referrals 3798 Referrals provide a way of placing a file system in a location within 3799 the namespace essentially without respect to its physical location on 3800 a given server. This allows a single server or a set of servers to 3801 present a multi-server namespace that encompasses file systems 3802 located on multiple servers. Some likely uses of this include 3803 establishment of site-wide or organization-wide namespaces, or even 3804 knitting such together into a truly global namespace. 3806 Referrals occur when a client determines, upon first referencing a 3807 position in the current namespace, that it is part of a new file 3808 system and that the file system is absent. When this occurs, 3809 typically by receiving the error NFS4ERR_MOVED, the actual location 3810 or locations of the file system can be determined by fetching the 3811 fs_locations attribute. 3813 The locations-related attribute may designate a single file system 3814 location or multiple file system locations, to be selected based on 3815 the needs of the client. 3817 Use of multi-server namespaces is enabled by NFSv4 but is not 3818 required. The use of multi-server namespaces and their scope will 3819 depend on the applications used and system administration 3820 preferences. 3822 Multi-server namespaces can be established by a single server 3823 providing a large set of referrals to all of the included file 3824 systems. Alternatively, a single multi-server namespace may be 3825 administratively segmented with separate referral file systems (on 3826 separate servers) for each separately administered portion of the 3827 namespace. The top-level referral file system or any segment may use 3828 replicated referral file systems for higher availability. 3830 Generally, multi-server namespaces are for the most part uniform, in 3831 that the same data made available to one client at a given location 3832 in the namespace is made available to all clients at that location. 3834 7.5. Location Entries and Server Identity 3836 As mentioned above, a single location entry may have a server address 3837 target in the form of a DNS name that may represent multiple IP 3838 addresses, while multiple location entries may have their own server 3839 address targets that reference the same server. 3841 When multiple addresses for the same server exist, the client may 3842 assume that for each file system in the namespace of a given server 3843 network address, there exist file systems at corresponding namespace 3844 locations for each of the other server network addresses. It may do 3845 this even in the absence of explicit listing in fs_locations. Such 3846 corresponding file system locations can be used as alternate 3847 locations, just as those explicitly specified via the fs_locations 3848 attribute. 3850 If a single location entry designates multiple server IP addresses, 3851 the client cannot assume that these addresses are multiple paths to 3852 the same server. In most cases, they will be, but the client MUST 3853 verify that before acting on that assumption. When two server 3854 addresses are designated by a single location entry and they 3855 correspond to different servers, this normally indicates some sort of 3856 misconfiguration, and so the client should avoid using such location 3857 entries when alternatives are available. When they are not, clients 3858 should pick one of IP addresses and use it, without using others that 3859 are not directed to the same server. 3861 7.6. Additional Client-Side Considerations 3863 When clients make use of servers that implement referrals, 3864 replication, and migration, care should be taken that a user who 3865 mounts a given file system that includes a referral or a relocated 3866 file system continues to see a coherent picture of that user-side 3867 file system despite the fact that it contains a number of server-side 3868 file systems that may be on different servers. 3870 One important issue is upward navigation from the root of a server- 3871 side file system to its parent (specified as ".." in UNIX), in the 3872 case in which it transitions to that file system as a result of 3873 referral, migration, or a transition as a result of replication. 3874 When the client is at such a point, and it needs to ascend to the 3875 parent, it must go back to the parent as seen within the multi-server 3876 namespace rather than sending a LOOKUPP operation to the server, 3877 which would result in the parent within that server's single-server 3878 namespace. In order to do this, the client needs to remember the 3879 filehandles that represent such file system roots and use these 3880 instead of issuing a LOOKUPP operation to the current server. This 3881 will allow the client to present to applications a consistent 3882 namespace, where upward navigation and downward navigation are 3883 consistent. 3885 Another issue concerns refresh of referral locations. When referrals 3886 are used extensively, they may change as server configurations 3887 change. It is expected that clients will cache information related 3888 to traversing referrals so that future client-side requests are 3889 resolved locally without server communication. This is usually 3890 rooted in client-side name look up caching. Clients should 3891 periodically purge this data for referral points in order to detect 3892 changes in location information. 3894 A problem exists if a client allows an open owner to have state on 3895 multiple filesystems on a server. If one of those filesystems is 3896 migrated, what happens to the sequence numbers? A client can avoid 3897 such a situation with the stipulation that any client which supports 3898 migration MUST ensure that any open owner is confined to a single 3899 filesystem. If the server finds itself migrating open owners that 3900 span multiple filesystems, then it MUST not migrate the state for the 3901 conflicting open owners on the non-migrated filesystems; instead it 3902 MUST return NFS4ERR_STALE_STATEID if the client tries to use those 3903 stateids. 3905 7.7. Effecting File System Transitions 3907 Transitions between file system instances, whether due to switching 3908 between replicas upon server unavailability or to server-initiated 3909 migration events, are best dealt with together. This is so even 3910 though, for the server, pragmatic considerations will normally force 3911 different implementation strategies for planned and unplanned 3912 transitions. Even though the prototypical use cases of replication 3913 and migration contain distinctive sets of features, when all 3914 possibilities for these operations are considered, there is an 3915 underlying unity of these operations, from the client's point of 3916 view, that makes treating them together desirable. 3918 A number of methods are possible for servers to replicate data and to 3919 track client state in order to allow clients to transition between 3920 file system instances with a minimum of disruption. Such methods 3921 vary between those that use inter-server clustering techniques to 3922 limit the changes seen by the client, to those that are less 3923 aggressive, use more standard methods of replicating data, and impose 3924 a greater burden on the client to adapt to the transition. 3926 The NFSv4 protocol does not impose choices on clients and servers 3927 with regard to that spectrum of transition methods. In fact, there 3928 are many valid choices, depending on client and application 3929 requirements and their interaction with server implementation 3930 choices. The NFSv4.0 protocol does not provide the servers a means 3931 of communicating the transition methods. In the NFSv4.1 protocol 3932 [31], an additional attribute "fs_locations_info" is presented, which 3933 will define the specific choices that can be made, how these choices 3934 are communicated to the client, and how the client is to deal with 3935 any discontinuities. 3937 In the sections below, references will be made to various possible 3938 server implementation choices as a way of illustrating the transition 3939 scenarios that clients may deal with. The intent here is not to 3940 define or limit server implementations but rather to illustrate the 3941 range of issues that clients may face. Again, as the NFSv4.0 3942 protocol does not have an explicit means of communicating these 3943 issues to the client, the intent is to document the problems that can 3944 be faced in a multi-server name space and allow the client to use the 3945 inferred transitions available via fs_locations and other attributes 3946 (see Section 7.9.1). 3948 In the discussion below, references will be made to a file system 3949 having a particular property or to two file systems (typically the 3950 source and destination) belonging to a common class of any of several 3951 types. Two file systems that belong to such a class share some 3952 important aspects of file system behavior that clients may depend 3953 upon when present, to easily effect a seamless transition between 3954 file system instances. Conversely, where the file systems do not 3955 belong to such a common class, the client has to deal with various 3956 sorts of implementation discontinuities that may cause performance or 3957 other issues in effecting a transition. 3959 While fs_locations is available, default assumptions with regard to 3960 such classifications have to be inferred (see Section 7.9.1 for 3961 details). 3963 In cases in which one server is expected to accept opaque values from 3964 the client that originated from another server, the servers SHOULD 3965 encode the "opaque" values in big-endian byte order. If this is 3966 done, servers acting as replicas or immigrating file systems will be 3967 able to parse values like stateids, directory cookies, filehandles, 3968 etc., even if their native byte order is different from that of other 3969 servers cooperating in the replication and migration of the file 3970 system. 3972 7.7.1. File System Transitions and Simultaneous Access 3974 When a single file system may be accessed at multiple locations, 3975 either because of an indication of file system identity as reported 3976 by the fs_locations attribute, the client will, depending on specific 3977 circumstances as discussed below, either: 3979 o Access multiple instances simultaneously, each of which represents 3980 an alternate path to the same data and metadata. 3982 o Accesses one instance (or set of instances) and then transition to 3983 an alternative instance (or set of instances) as a result of 3984 network issues, server unresponsiveness, or server-directed 3985 migration. 3987 7.7.2. Filehandles and File System Transitions 3989 There are a number of ways in which filehandles can be handled across 3990 a file system transition. These can be divided into two broad 3991 classes depending upon whether the two file systems across which the 3992 transition happens share sufficient state to effect some sort of 3993 continuity of file system handling. 3995 When there is no such cooperation in filehandle assignment, the two 3996 file systems are reported as being in different handle classes. In 3997 this case, all filehandles are assumed to expire as part of the file 3998 system transition. Note that this behavior does not depend on 3999 fh_expire_type attribute and depends on the specification of the 4000 FH4_VOL_MIGRATION bit. 4002 When there is co-operation in filehandle assignment, the two file 4003 systems are reported as being in the same handle classes. In this 4004 case, persistent filehandles remain valid after the file system 4005 transition, while volatile filehandles (excluding those that are only 4006 volatile due to the FH4_VOL_MIGRATION bit) are subject to expiration 4007 on the target server. 4009 7.7.3. Fileids and File System Transitions 4011 The issue of continuity of fileids in the event of a file system 4012 transition needs to be addressed. The general expectation is that in 4013 situations in which the two file system instances are created by a 4014 single vendor using some sort of file system image copy, fileids will 4015 be consistent across the transition, while in the analogous multi- 4016 vendor transitions they will not. This poses difficulties, 4017 especially for the client without special knowledge of the transition 4018 mechanisms adopted by the server. Note that although fileid is not a 4019 REQUIRED attribute, many servers support fileids and many clients 4020 provide APIs that depend on fileids. 4022 It is important to note that while clients themselves may have no 4023 trouble with a fileid changing as a result of a file system 4024 transition event, applications do typically have access to the fileid 4025 (e.g., via stat). The result is that an application may work 4026 perfectly well if there is no file system instance transition or if 4027 any such transition is among instances created by a single vendor, 4028 yet be unable to deal with the situation in which a multi-vendor 4029 transition occurs at the wrong time. 4031 Providing the same fileids in a multi-vendor (multiple server 4032 vendors) environment has generally been held to be quite difficult. 4033 While there is work to be done, it needs to be pointed out that this 4034 difficulty is partly self-imposed. Servers have typically identified 4035 fileid with inode number, i.e., with a quantity used to find the file 4036 in question. This identification poses special difficulties for 4037 migration of a file system between vendors where assigning the same 4038 index to a given file may not be possible. Note here that a fileid 4039 is not required to be useful to find the file in question, only that 4040 it is unique within the given file system. Servers prepared to 4041 accept a fileid as a single piece of metadata and store it apart from 4042 the value used to index the file information can relatively easily 4043 maintain a fileid value across a migration event, allowing a truly 4044 transparent migration event. 4046 In any case, where servers can provide continuity of fileids, they 4047 should, and the client should be able to find out that such 4048 continuity is available and take appropriate action. Information 4049 about the continuity (or lack thereof) of fileids across a file 4050 system transition is represented by specifying whether the file 4051 systems in question are of the same fileid class. 4053 Note that when consistent fileids do not exist across a transition 4054 (either because there is no continuity of fileids or because fileid 4055 is not a supported attribute on one of instances involved), and there 4056 are no reliable filehandles across a transition event (either because 4057 there is no filehandle continuity or because the filehandles are 4058 volatile), the client is in a position where it cannot verify that 4059 files it was accessing before the transition are the same objects. 4060 It is forced to assume that no object has been renamed, and, unless 4061 there are guarantees that provide this (e.g., the file system is 4062 read-only), problems for applications may occur. Therefore, use of 4063 such configurations should be limited to situations where the 4064 problems that this may cause can be tolerated. 4066 7.7.4. Fsids and File System Transitions 4068 Since fsids are generally only unique within a per-server basis, it 4069 is likely that they will change during a file system transition. 4070 Clients should not make the fsids received from the server visible to 4071 applications since they may not be globally unique, and because they 4072 may change during a file system transition event. Applications are 4073 best served if they are isolated from such transitions to the extent 4074 possible. 4076 7.7.5. The Change Attribute and File System Transitions 4078 Since the change attribute is defined as a server-specific one, 4079 change attributes fetched from one server are normally presumed to be 4080 invalid on another server. Such a presumption is troublesome since 4081 it would invalidate all cached change attributes, requiring 4082 refetching. Even more disruptive, the absence of any assured 4083 continuity for the change attribute means that even if the same value 4084 is retrieved on refetch, no conclusions can be drawn as to whether 4085 the object in question has changed. The identical change attribute 4086 could be merely an artifact of a modified file with a different 4087 change attribute construction algorithm, with that new algorithm just 4088 happening to result in an identical change value. 4090 When the two file systems have consistent change attribute formats, 4091 and we say that they are in the same change class, the client may 4092 assume a continuity of change attribute construction and handle this 4093 situation just as it would be handled without any file system 4094 transition. 4096 7.7.6. Lock State and File System Transitions 4098 In a file system transition, the client needs to handle cases in 4099 which the two servers have cooperated in state management and in 4100 which they have not. Cooperation by two servers in state management 4101 requires coordination of client IDs. Before the client attempts to 4102 use a client ID associated with one server in a request to the server 4103 of the other file system, it must eliminate the possibility that two 4104 non-cooperating servers have assigned the same client ID by accident. 4106 In the case of migration, the servers involved in the migration of a 4107 file system SHOULD transfer all server state from the original to the 4108 new server. When this is done, it must be done in a way that is 4109 transparent to the client. With replication, such a degree of common 4110 state is typically not the case. 4112 This state transfer will reduce disruption to the client when a file 4113 system transition occurs. If the servers are successful in 4114 transferring all state, the client can attempt to establish sessions 4115 associated with the client ID used for the source file system 4116 instance. If the server accepts that as a valid client ID, then the 4117 client may use the existing stateids associated with that client ID 4118 for the old file system instance in connection with that same client 4119 ID in connection with the transitioned file system instance. 4121 File systems cooperating in state management may actually share state 4122 or simply divide the identifier space so as to recognize (and reject 4123 as stale) each other's stateids and client IDs. Servers that do 4124 share state may not do so under all conditions or at all times. If 4125 the server cannot be sure when accepting a client ID that it reflects 4126 the locks the client was given, the server must treat all associated 4127 state as stale and report it as such to the client. 4129 The client must establish a new client ID on the destination, if it 4130 does not have one already, and reclaim locks if allowed by the 4131 server. In this case, old stateids and client IDs should not be 4132 presented to the new server since there is no assurance that they 4133 will not conflict with IDs valid on that server. 4135 When actual locks are not known to be maintained, the destination 4136 server may establish a grace period specific to the given file 4137 system, with non-reclaim locks being rejected for that file system, 4138 even though normal locks are being granted for other file systems. 4140 Clients should not infer the absence of a grace period for file 4141 systems being transitioned to a server from responses to requests for 4142 other file systems. 4144 In the case of lock reclamation for a given file system after a file 4145 system transition, edge conditions can arise similar to those for 4146 reclaim after server restart (although in the case of the planned 4147 state transfer associated with migration, these can be avoided by 4148 securely recording lock state as part of state migration). Unless 4149 the destination server can guarantee that locks will not be 4150 incorrectly granted, the destination server should not allow lock 4151 reclaims and should avoid establishing a grace period. (See 4152 Section 9.14 for further details.) 4154 Information about client identity may be propagated between servers 4155 in the form of client_owner4 and associated verifiers, under the 4156 assumption that the client presents the same values to all the 4157 servers with which it deals. 4159 Servers are encouraged to provide facilities to allow locks to be 4160 reclaimed on the new server after a file system transition. Often 4161 such facilities may not be available and client should be prepared to 4162 re-obtain locks, even though it is possible that the client may have 4163 its LOCK or OPEN request denied due to a conflicting lock. 4165 The consequences of having no facilities available to reclaim locks 4166 on the new server will depend on the type of environment. In some 4167 environments, such as the transition between read-only file systems, 4168 such denial of locks should not pose large difficulties in practice. 4169 When an attempt to re-establish a lock on a new server is denied, the 4170 client should treat the situation as if its original lock had been 4171 revoked. Note that when the lock is granted, the client cannot 4172 assume that no conflicting lock could have been granted in the 4173 interim. Where change attribute continuity is present, the client 4174 may check the change attribute to check for unwanted file 4175 modifications. Where even this is not available, and the file system 4176 is not read-only, a client may reasonably treat all pending locks as 4177 having been revoked. 4179 7.7.6.1. Transitions and the Lease_time Attribute 4181 In order that the client may appropriately manage its lease in the 4182 case of a file system transition, the destination server must 4183 establish proper values for the lease_time attribute. 4185 When state is transferred transparently, that state should include 4186 the correct value of the lease_time attribute. The lease_time 4187 attribute on the destination server must never be less than that on 4188 the source, since this would result in premature expiration of a 4189 lease granted by the source server. Upon transitions in which state 4190 is transferred transparently, the client is under no obligation to 4191 refetch the lease_time attribute and may continue to use the value 4192 previously fetched (on the source server). 4194 If state has not been transferred transparently because the client ID 4195 is rejected when presented to the new server, the client should fetch 4196 the value of lease_time on the new (i.e., destination) server, and 4197 use it for subsequent locking requests. However, the server must 4198 respect a grace period of at least as long as the lease_time on the 4199 source server, in order to ensure that clients have ample time to 4200 reclaim their lock before potentially conflicting non-reclaimed locks 4201 are granted. 4203 7.7.7. Write Verifiers and File System Transitions 4205 In a file system transition, the two file systems may be clustered in 4206 the handling of unstably written data. When this is the case, and 4207 the two file systems belong to the same write-verifier class, write 4208 verifiers returned from one system may be compared to those returned 4209 by the other and superfluous writes avoided. 4211 When two file systems belong to different write-verifier classes, any 4212 verifier generated by one must not be compared to one provided by the 4213 other. Instead, it should be treated as not equal even when the 4214 values are identical. 4216 7.7.8. Readdir Cookies and Verifiers and File System Transitions 4218 In a file system transition, the two file systems may be consistent 4219 in their handling of READDIR cookies and verifiers. When this is the 4220 case, and the two file systems belong to the same readdir class, 4221 READDIR cookies and verifiers from one system may be recognized by 4222 the other and READDIR operations started on one server may be validly 4223 continued on the other, simply by presenting the cookie and verifier 4224 returned by a READDIR operation done on the first file system to the 4225 second. 4227 When two file systems belong to different readdir classes, any 4228 READDIR cookie and verifier generated by one is not valid on the 4229 second, and must not be presented to that server by the client. The 4230 client should act as if the verifier was rejected. 4232 7.7.9. File System Data and File System Transitions 4234 When multiple replicas exist and are used simultaneously or in 4235 succession by a client, applications using them will normally expect 4236 that they contain either the same data or data that is consistent 4237 with the normal sorts of changes that are made by other clients 4238 updating the data of the file system (with metadata being the same to 4239 the degree inferred by the fs_locations attribute). However, when 4240 multiple file systems are presented as replicas of one another, the 4241 precise relationship between the data of one and the data of another 4242 is not, as a general matter, specified by the NFSv4 protocol. It is 4243 quite possible to present as replicas file systems where the data of 4244 those file systems is sufficiently different that some applications 4245 have problems dealing with the transition between replicas. The 4246 namespace will typically be constructed so that applications can 4247 choose an appropriate level of support, so that in one position in 4248 the namespace a varied set of replicas will be listed, while in 4249 another only those that are up-to-date may be considered replicas. 4250 The protocol does define four special cases of the relationship among 4251 replicas to be specified by the server and relied upon by clients: 4253 o When multiple server addresses correspond to the same actual 4254 server, the client may depend on the fact that changes to data, 4255 metadata, or locks made on one file system are immediately 4256 reflected on others. 4258 o When multiple replicas exist and are used simultaneously by a 4259 client, they must designate the same data. Where file systems are 4260 writable, a change made on one instance must be visible on all 4261 instances, immediately upon the earlier of the return of the 4262 modifying requester or the visibility of that change on any of the 4263 associated replicas. This allows a client to use these replicas 4264 simultaneously without any special adaptation to the fact that 4265 there are multiple replicas. In this case, locks (whether share 4266 reservations or byte-range locks), and delegations obtained on one 4267 replica are immediately reflected on all replicas, even though 4268 these locks will be managed under a set of client IDs. 4270 o When one replica is designated as the successor instance to 4271 another existing instance after return NFS4ERR_MOVED (i.e., the 4272 case of migration), the client may depend on the fact that all 4273 changes written to stable storage on the original instance are 4274 written to stable storage of the successor (uncommitted writes are 4275 dealt with in Section 7.7.7). 4277 o Where a file system is not writable but represents a read-only 4278 copy (possibly periodically updated) of a writable file system, 4279 clients have similar requirements with regard to the propagation 4280 of updates. They may need a guarantee that any change visible on 4281 the original file system instance must be immediately visible on 4282 any replica before the client transitions access to that replica, 4283 in order to avoid any possibility that a client, in effecting a 4284 transition to a replica, will see any reversion in file system 4285 state. Since these file systems are presumed to be unsuitable for 4286 simultaneous use, there is no specification of how locking is 4287 handled; in general, locks obtained on one file system will be 4288 separate from those on others. Since these are going to be read- 4289 only file systems, this is not expected to pose an issue for 4290 clients or applications. 4292 7.8. Effecting File System Referrals 4294 Referrals are effected when an absent file system is encountered, and 4295 one or more alternate locations are made available by the 4296 fs_locations attribute. The client will typically get an 4297 NFS4ERR_MOVED error, fetch the appropriate location information, and 4298 proceed to access the file system on a different server, even though 4299 it retains its logical position within the original namespace. 4300 Referrals differ from migration events in that they happen only when 4301 the client has not previously referenced the file system in question 4302 (so there is nothing to transition). Referrals can only come into 4303 effect when an absent file system is encountered at its root. 4305 The examples given in the sections below are somewhat artificial in 4306 that an actual client will not typically do a multi-component look 4307 up, but will have cached information regarding the upper levels of 4308 the name hierarchy. However, these example are chosen to make the 4309 required behavior clear and easy to put within the scope of a small 4310 number of requests, without getting unduly into details of how 4311 specific clients might choose to cache things. 4313 7.8.1. Referral Example (LOOKUP) 4315 Let us suppose that the following COMPOUND is sent in an environment 4316 in which /this/is/the/path is absent from the target server. This 4317 may be for a number of reasons. It may be the case that the file 4318 system has moved, or it may be the case that the target server is 4319 functioning mainly, or solely, to refer clients to the servers on 4320 which various file systems are located. 4322 o PUTROOTFH 4324 o LOOKUP "this" 4326 o LOOKUP "is" 4328 o LOOKUP "the" 4330 o LOOKUP "path" 4331 o GETFH 4333 o GETATTR(fsid,fileid,size,time_modify) 4335 Under the given circumstances, the following will be the result. 4337 o PUTROOTFH --> NFS_OK. The current fh is now the root of the 4338 pseudo-fs. 4340 o LOOKUP "this" --> NFS_OK. The current fh is for /this and is 4341 within the pseudo-fs. 4343 o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is 4344 within the pseudo-fs. 4346 o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and 4347 is within the pseudo-fs. 4349 o LOOKUP "path" --> NFS_OK. The current fh is for /this/is/the/path 4350 and is within a new, absent file system, but ... the client will 4351 never see the value of that fh. 4353 o GETFH --> NFS4ERR_MOVED. Fails because current fh is in an absent 4354 file system at the start of the operation, and the specification 4355 makes no exception for GETFH. 4357 o GETATTR(fsid,fileid,size,time_modify) Not executed because the 4358 failure of the GETFH stops processing of the COMPOUND. 4360 Given the failure of the GETFH, the client has the job of determining 4361 the root of the absent file system and where to find that file 4362 system, i.e., the server and path relative to that server's root fh. 4363 Note here that in this example, the client did not obtain filehandles 4364 and attribute information (e.g., fsid) for the intermediate 4365 directories, so that it would not be sure where the absent file 4366 system starts. It could be the case, for example, that /this/is/the 4367 is the root of the moved file system and that the reason that the 4368 look up of "path" succeeded is that the file system was not absent on 4369 that operation but was moved between the last LOOKUP and the GETFH 4370 (since COMPOUND is not atomic). Even if we had the fsids for all of 4371 the intermediate directories, we could have no way of knowing that 4372 /this/is/the/path was the root of a new file system, since we don't 4373 yet have its fsid. 4375 In order to get the necessary information, let us re-send the chain 4376 of LOOKUPs with GETFHs and GETATTRs to at least get the fsids so we 4377 can be sure where the appropriate file system boundaries are. The 4378 client could choose to get fs_locations at the same time but in most 4379 cases the client will have a good guess as to where file system 4380 boundaries are (because of where NFS4ERR_MOVED was, and was not, 4381 received) making fetching of fs_locations unnecessary. 4383 OP01: PUTROOTFH --> NFS_OK 4385 - Current fh is root of pseudo-fs. 4387 OP02: GETATTR(fsid) --> NFS_OK 4389 - Just for completeness. Normally, clients will know the fsid of 4390 the pseudo-fs as soon as they establish communication with a 4391 server. 4393 OP03: LOOKUP "this" --> NFS_OK 4395 OP04: GETATTR(fsid) --> NFS_OK 4397 - Get current fsid to see where file system boundaries are. The 4398 fsid will be that for the pseudo-fs in this example, so no 4399 boundary. 4401 OP05: GETFH --> NFS_OK 4403 - Current fh is for /this and is within pseudo-fs. 4405 OP06: LOOKUP "is" --> NFS_OK 4407 - Current fh is for /this/is and is within pseudo-fs. 4409 OP07: GETATTR(fsid) --> NFS_OK 4411 - Get current fsid to see where file system boundaries are. The 4412 fsid will be that for the pseudo-fs in this example, so no 4413 boundary. 4415 OP08: GETFH --> NFS_OK 4417 - Current fh is for /this/is and is within pseudo-fs. 4419 OP09: LOOKUP "the" --> NFS_OK 4421 - Current fh is for /this/is/the and is within pseudo-fs. 4423 OP10: GETATTR(fsid) --> NFS_OK 4424 - Get current fsid to see where file system boundaries are. The 4425 fsid will be that for the pseudo-fs in this example, so no 4426 boundary. 4428 OP11: GETFH --> NFS_OK 4430 - Current fh is for /this/is/the and is within pseudo-fs. 4432 OP12: LOOKUP "path" --> NFS_OK 4434 - Current fh is for /this/is/the/path and is within a new, absent 4435 file system, but ... 4437 - The client will never see the value of that fh. 4439 OP13: GETATTR(fsid, fs_locations) --> NFS_OK 4441 - We are getting the fsid to know where the file system boundaries 4442 are. In this operation, the fsid will be different than that of 4443 the parent directory (which in turn was retrieved in OP10). Note 4444 that the fsid we are given will not necessarily be preserved at 4445 the new location. That fsid might be different, and in fact the 4446 fsid we have for this file system might be a valid fsid of a 4447 different file system on that new server. 4449 - In this particular case, we are pretty sure anyway that what has 4450 moved is /this/is/the/path rather than /this/is/the since we have 4451 the fsid of the latter and it is that of the pseudo-fs, which 4452 presumably cannot move. However, in other examples, we might not 4453 have this kind of information to rely on (e.g., /this/is/the might 4454 be a non-pseudo file system separate from /this/is/the/path), so 4455 we need to have other reliable source information on the boundary 4456 of the file system that is moved. If, for example, the file 4457 system /this/is had moved, we would have a case of migration 4458 rather than referral, and once the boundaries of the migrated file 4459 system was clear we could fetch fs_locations. 4461 - We are fetching fs_locations because the fact that we got an 4462 NFS4ERR_MOVED at this point means that it is most likely that this 4463 is a referral and we need the destination. Even if it is the case 4464 that /this/is/the is a file system that has migrated, we will 4465 still need the location information for that file system. 4467 OP14: GETFH --> NFS4ERR_MOVED 4468 - Fails because current fh is in an absent file system at the start 4469 of the operation, and the specification makes no exception for 4470 GETFH. Note that this means the server will never send the client 4471 a filehandle from within an absent file system. 4473 Given the above, the client knows where the root of the absent file 4474 system is (/this/is/the/path) by noting where the change of fsid 4475 occurred (between "the" and "path"). The fs_locations attribute also 4476 gives the client the actual location of the absent file system, so 4477 that the referral can proceed. The server gives the client the bare 4478 minimum of information about the absent file system so that there 4479 will be very little scope for problems of conflict between 4480 information sent by the referring server and information of the file 4481 system's home. No filehandles and very few attributes are present on 4482 the referring server, and the client can treat those it receives as 4483 transient information with the function of enabling the referral. 4485 7.8.2. Referral Example (READDIR) 4487 Another context in which a client may encounter referrals is when it 4488 does a READDIR on a directory in which some of the sub-directories 4489 are the roots of absent file systems. 4491 Suppose such a directory is read as follows: 4493 o PUTROOTFH 4495 o LOOKUP "this" 4497 o LOOKUP "is" 4499 o LOOKUP "the" 4501 o READDIR (fsid, size, time_modify, mounted_on_fileid) 4503 In this case, because rdattr_error is not requested, fs_locations is 4504 not requested, and some of the attributes cannot be provided, the 4505 result will be an NFS4ERR_MOVED error on the READDIR, with the 4506 detailed results as follows: 4508 o PUTROOTFH --> NFS_OK. The current fh is at the root of the 4509 pseudo-fs. 4511 o LOOKUP "this" --> NFS_OK. The current fh is for /this and is 4512 within the pseudo-fs. 4514 o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is 4515 within the pseudo-fs. 4517 o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and 4518 is within the pseudo-fs. 4520 o READDIR (fsid, size, time_modify, mounted_on_fileid) --> 4521 NFS4ERR_MOVED. Note that the same error would have been returned 4522 if /this/is/the had migrated, but it is returned because the 4523 directory contains the root of an absent file system. 4525 So now suppose that we re-send with rdattr_error: 4527 o PUTROOTFH 4529 o LOOKUP "this" 4531 o LOOKUP "is" 4533 o LOOKUP "the" 4535 o READDIR (rdattr_error, fsid, size, time_modify, mounted_on_fileid) 4537 The results will be: 4539 o PUTROOTFH --> NFS_OK. The current fh is at the root of the 4540 pseudo-fs. 4542 o LOOKUP "this" --> NFS_OK. The current fh is for /this and is 4543 within the pseudo-fs. 4545 o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is 4546 within the pseudo-fs. 4548 o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and 4549 is within the pseudo-fs. 4551 o READDIR (rdattr_error, fsid, size, time_modify, mounted_on_fileid) 4552 --> NFS_OK. The attributes for directory entry with the component 4553 named "path" will only contain rdattr_error with the value 4554 NFS4ERR_MOVED, together with an fsid value and a value for 4555 mounted_on_fileid. 4557 So suppose we do another READDIR to get fs_locations (although we 4558 could have used a GETATTR directly, as in Section 7.8.1). 4560 o PUTROOTFH 4562 o LOOKUP "this" 4563 o LOOKUP "is" 4565 o LOOKUP "the" 4567 o READDIR (rdattr_error, fs_locations, mounted_on_fileid, fsid, 4568 size, time_modify) 4570 The results would be: 4572 o PUTROOTFH --> NFS_OK. The current fh is at the root of the 4573 pseudo-fs. 4575 o LOOKUP "this" --> NFS_OK. The current fh is for /this and is 4576 within the pseudo-fs. 4578 o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is 4579 within the pseudo-fs. 4581 o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and 4582 is within the pseudo-fs. 4584 o READDIR (rdattr_error, fs_locations, mounted_on_fileid, fsid, 4585 size, time_modify) --> NFS_OK. The attributes will be as shown 4586 below. 4588 The attributes for the directory entry with the component named 4589 "path" will only contain: 4591 o rdattr_error (value: NFS_OK) 4593 o fs_locations 4595 o mounted_on_fileid (value: unique fileid within referring file 4596 system) 4598 o fsid (value: unique value within referring server) 4600 The attributes for entry "path" will not contain size or time_modify 4601 because these attributes are not available within an absent file 4602 system. 4604 7.9. The Attribute fs_locations 4606 The fs_locations attribute is structured in the following way: 4608 struct fs_location4 { 4609 utf8val_must server<>; 4610 pathname4 rootpath; 4611 }; 4613 struct fs_locations4 { 4614 pathname4 fs_root; 4615 fs_location4 locations<>; 4616 }; 4618 The fs_location4 data type is used to represent the location of a 4619 file system by providing a server name and the path to the root of 4620 the file system within that server's namespace. When a set of 4621 servers have corresponding file systems at the same path within their 4622 namespaces, an array of server names may be provided. An entry in 4623 the server array is a UTF-8 string and represents one of a 4624 traditional DNS host name, IPv4 address, IPv6 address, or an zero- 4625 length string. A zero-length string SHOULD be used to indicate the 4626 current address being used for the RPC call. It is not a requirement 4627 that all servers that share the same rootpath be listed in one 4628 fs_location4 instance. The array of server names is provided for 4629 convenience. Servers that share the same rootpath may also be listed 4630 in separate fs_location4 entries in the fs_locations attribute. 4632 The fs_locations4 data type and fs_locations attribute contain an 4633 array of such locations. Since the namespace of each server may be 4634 constructed differently, the "fs_root" field is provided. The path 4635 represented by fs_root represents the location of the file system in 4636 the current server's namespace, i.e., that of the server from which 4637 the fs_locations attribute was obtained. The fs_root path is meant 4638 to aid the client by clearly referencing the root of the file system 4639 whose locations are being reported, no matter what object within the 4640 current file system the current filehandle designates. The fs_root 4641 is simply the pathname the client used to reach the object on the 4642 current server (i.e., the object to which the fs_locations attribute 4643 applies). 4645 When the fs_locations attribute is interrogated and there are no 4646 alternate file system locations, the server SHOULD return a zero- 4647 length array of fs_location4 structures, together with a valid 4648 fs_root. 4650 As an example, suppose there is a replicated file system located at 4651 two servers (servA and servB). At servA, the file system is located 4652 at path /a/b/c. At, servB the file system is located at path /x/y/z. 4653 If the client were to obtain the fs_locations value for the directory 4654 at /a/b/c/d, it might not necessarily know that the file system's 4655 root is located in servA's namespace at /a/b/c. When the client 4656 switches to servB, it will need to determine that the directory it 4657 first referenced at servA is now represented by the path /x/y/z/d on 4658 servB. To facilitate this, the fs_locations attribute provided by 4659 servA would have an fs_root value of /a/b/c and two entries in 4660 fs_locations. One entry in fs_locations will be for itself (servA) 4661 and the other will be for servB with a path of /x/y/z. With this 4662 information, the client is able to substitute /x/y/z for the /a/b/c 4663 at the beginning of its access path and construct /x/y/z/d to use for 4664 the new server. 4666 Note that: there is no requirement that the number of components in 4667 each rootpath be the same; there is no relation between the number of 4668 components in rootpath or fs_root, and none of the components in each 4669 rootpath and fs_root have to be the same. In the above example, we 4670 could have had a third element in the locations array, with server 4671 equal to "servC", and rootpath equal to "/I/II", and a fourth element 4672 in locations with server equal to "servD" and rootpath equal to 4673 "/aleph/beth/gimel/daleth/he". 4675 The relationship between fs_root to a rootpath is that the client 4676 replaces the pathname indicated in fs_root for the current server for 4677 the substitute indicated in rootpath for the new server. 4679 For an example of a referred or migrated file system, suppose there 4680 is a file system located at serv1. At serv1, the file system is 4681 located at /az/buky/vedi/glagoli. The client finds that object at 4682 glagoli has migrated (or is a referral). The client gets the 4683 fs_locations attribute, which contains an fs_root of /az/buky/vedi/ 4684 glagoli, and one element in the locations array, with server equal to 4685 serv2, and rootpath equal to /izhitsa/fita. The client replaces /az/ 4686 buky/vedi/glagoli with /izhitsa/fita, and uses the latter pathname on 4687 serv2. 4689 Thus, the server MUST return an fs_root that is equal to the path the 4690 client used to reach the object to which the fs_locations attribute 4691 applies. Otherwise, the client cannot determine the new path to use 4692 on the new server. 4694 7.9.1. Inferring Transition Modes 4696 When fs_locations is used, information about the specific locations 4697 should be assumed based on the following rules. 4699 The following rules are general and apply irrespective of the 4700 context. 4702 o All listed file system instances should be considered as of the 4703 same handle class if and only if the current fh_expire_type 4704 attribute does not include the FH4_VOL_MIGRATION bit. Note that 4705 in the case of referral, filehandle issues do not apply since 4706 there can be no filehandles known within the current file system 4707 nor is there any access to the fh_expire_type attribute on the 4708 referring (absent) file system. 4710 o All listed file system instances should be considered as of the 4711 same fileid class if and only if the fh_expire_type attribute 4712 indicates persistent filehandles and does not include the 4713 FH4_VOL_MIGRATION bit. Note that in the case of referral, fileid 4714 issues do not apply since there can be no fileids known within the 4715 referring (absent) file system nor is there any access to the 4716 fh_expire_type attribute. 4718 o All file system instances servers should be considered as of 4719 different change classes. 4721 o All file system instances servers should be considered as of 4722 different readdir classes. 4724 For other class assignments, handling of file system transitions 4725 depends on the reasons for the transition: 4727 o When the transition is due to migration, that is, the client was 4728 directed to a new file system after receiving an NFS4ERR_MOVED 4729 error, the target should be treated as being of the same write- 4730 verifier class as the source. 4732 o When the transition is due to failover to another replica, that 4733 is, the client selected another replica without receiving and 4734 NFS4ERR_MOVED error, the target should be treated as being of a 4735 different write-verifier class from the source. 4737 The specific choices reflect typical implementation patterns for 4738 failover and controlled migration, respectively. 4740 See Section 17 for a discussion on the recommendations for the 4741 security flavor to be used by any GETATTR operation that requests the 4742 "fs_locations" attribute. 4744 8. NFS Server Name Space 4745 8.1. Server Exports 4747 On a UNIX server the name space describes all the files reachable by 4748 pathnames under the root directory or "/". On a Windows NT server 4749 the name space constitutes all the files on disks named by mapped 4750 disk letters. NFS server administrators rarely make the entire 4751 server's filesystem name space available to NFS clients. More often 4752 portions of the name space are made available via an "export" 4753 feature. In previous versions of the NFS protocol, the root 4754 filehandle for each export is obtained through the MOUNT protocol; 4755 the client sends a string that identifies the export of name space 4756 and the server returns the root filehandle for it. The MOUNT 4757 protocol supports an EXPORTS procedure that will enumerate the 4758 server's exports. 4760 8.2. Browsing Exports 4762 The NFSv4 protocol provides a root filehandle that clients can use to 4763 obtain filehandles for these exports via a multi-component LOOKUP. A 4764 common user experience is to use a graphical user interface (perhaps 4765 a file "Open" dialog window) to find a file via progressive browsing 4766 through a directory tree. The client must be able to move from one 4767 export to another export via single-component, progressive LOOKUP 4768 operations. 4770 This style of browsing is not well supported by the NFSv2 and NFSv3 4771 protocols. The client expects all LOOKUP operations to remain within 4772 a single server filesystem. For example, the device attribute will 4773 not change. This prevents a client from taking name space paths that 4774 span exports. 4776 An automounter on the client can obtain a snapshot of the server's 4777 name space using the EXPORTS procedure of the MOUNT protocol. If it 4778 understands the server's pathname syntax, it can create an image of 4779 the server's name space on the client. The parts of the name space 4780 that are not exported by the server are filled in with a "pseudo 4781 filesystem" that allows the user to browse from one mounted 4782 filesystem to another. There is a drawback to this representation of 4783 the server's name space on the client: it is static. If the server 4784 administrator adds a new export the client will be unaware of it. 4786 8.3. Server Pseudo Filesystem 4788 NFSv4 servers avoid this name space inconsistency by presenting all 4789 the exports within the framework of a single server name space. An 4790 NFSv4 client uses LOOKUP and READDIR operations to browse seamlessly 4791 from one export to another. Portions of the server name space that 4792 are not exported are bridged via a "pseudo filesystem" that provides 4793 a view of exported directories only. A pseudo filesystem has a 4794 unique fsid and behaves like a normal, read only filesystem. 4796 Based on the construction of the server's name space, it is possible 4797 that multiple pseudo filesystems may exist. For example, 4799 /a pseudo filesystem 4800 /a/b real filesystem 4801 /a/b/c pseudo filesystem 4802 /a/b/c/d real filesystem 4804 Each of the pseudo filesystems are considered separate entities and 4805 therefore will have a unique fsid. 4807 8.4. Multiple Roots 4809 The DOS and Windows operating environments are sometimes described as 4810 having "multiple roots". Filesystems are commonly represented as 4811 disk letters. MacOS represents filesystems as top level names. 4812 NFSv4 servers for these platforms can construct a pseudo file system 4813 above these root names so that disk letters or volume names are 4814 simply directory names in the pseudo root. 4816 8.5. Filehandle Volatility 4818 The nature of the server's pseudo filesystem is that it is a logical 4819 representation of filesystem(s) available from the server. 4820 Therefore, the pseudo filesystem is most likely constructed 4821 dynamically when the server is first instantiated. It is expected 4822 that the pseudo filesystem may not have an on disk counterpart from 4823 which persistent filehandles could be constructed. Even though it is 4824 preferable that the server provide persistent filehandles for the 4825 pseudo filesystem, the NFS client should expect that pseudo file 4826 system filehandles are volatile. This can be confirmed by checking 4827 the associated "fh_expire_type" attribute for those filehandles in 4828 question. If the filehandles are volatile, the NFS client must be 4829 prepared to recover a filehandle value (e.g., with a multi-component 4830 LOOKUP) when receiving an error of NFS4ERR_FHEXPIRED. 4832 8.6. Exported Root 4834 If the server's root filesystem is exported, one might conclude that 4835 a pseudo-filesystem is not needed. This would be wrong. Assume the 4836 following filesystems on a server: 4838 / disk1 (exported) 4839 /a disk2 (not exported) 4840 /a/b disk3 (exported) 4841 Because disk2 is not exported, disk3 cannot be reached with simple 4842 LOOKUPs. The server must bridge the gap with a pseudo-filesystem. 4844 8.7. Mount Point Crossing 4846 The server filesystem environment may be constructed in such a way 4847 that one filesystem contains a directory which is 'covered' or 4848 mounted upon by a second filesystem. For example: 4850 /a/b (filesystem 1) 4851 /a/b/c/d (filesystem 2) 4853 The pseudo filesystem for this server may be constructed to look 4854 like: 4856 / (place holder/not exported) 4857 /a/b (filesystem 1) 4858 /a/b/c/d (filesystem 2) 4860 It is the server's responsibility to present the pseudo filesystem 4861 that is complete to the client. If the client sends a lookup request 4862 for the path "/a/b/c/d", the server's response is the filehandle of 4863 the filesystem "/a/b/c/d". In previous versions of the NFS protocol, 4864 the server would respond with the filehandle of directory "/a/b/c/d" 4865 within the filesystem "/a/b". 4867 The NFS client will be able to determine if it crosses a server mount 4868 point by a change in the value of the "fsid" attribute. 4870 8.8. Security Policy and Name Space Presentation 4872 The application of the server's security policy needs to be carefully 4873 considered by the implementor. One may choose to limit the 4874 viewability of portions of the pseudo filesystem based on the 4875 server's perception of the client's ability to authenticate itself 4876 properly. However, with the support of multiple security mechanisms 4877 and the ability to negotiate the appropriate use of these mechanisms, 4878 the server is unable to properly determine if a client will be able 4879 to authenticate itself. If, based on its policies, the server 4880 chooses to limit the contents of the pseudo filesystem, the server 4881 may effectively hide filesystems from a client that may otherwise 4882 have legitimate access. 4884 As suggested practice, the server should apply the security policy of 4885 a shared resource in the server's namespace to the components of the 4886 resource's ancestors. For example: 4888 / 4889 /a/b 4890 /a/b/c 4892 The /a/b/c directory is a real filesystem and is the shared resource. 4893 The security policy for /a/b/c is Kerberos with integrity. The 4894 server should apply the same security policy to /, /a, and /a/b. 4895 This allows for the extension of the protection of the server's 4896 namespace to the ancestors of the real shared resource. 4898 For the case of the use of multiple, disjoint security mechanisms in 4899 the server's resources, the security for a particular object in the 4900 server's namespace should be the union of all security mechanisms of 4901 all direct descendants. 4903 9. File Locking and Share Reservations 4905 Integrating locking into the NFS protocol necessarily causes it to be 4906 stateful. With the inclusion of share reservations the protocol 4907 becomes substantially more dependent on state than the traditional 4908 combination of NFS and NLM (Network Lock Manager) [32]. There are 4909 three components to making this state manageable: 4911 o clear division between client and server 4913 o ability to reliably detect inconsistency in state between client 4914 and server 4916 o simple and robust recovery mechanisms 4918 In this model, the server owns the state information. The client 4919 requests changes in locks and the server responds with the changes 4920 made. Non-client-initiated changes in locking state are infrequent. 4921 The client receives prompt notification of such changes and can 4922 adjust its view of the locking state to reflect the server's changes. 4924 Individual pieces of state created by the server and passed to the 4925 client at its request are represented by 128-bit stateids. These 4926 stateids may represent a particular open file, a set of byte-range 4927 locks held by a particular owner, or a recallable delegation of 4928 privileges to access a file in particular ways or at a particular 4929 location. 4931 In all cases, there is a transition from the most general information 4932 that represents a client as a whole to the eventual lightweight 4933 stateid used for most client and server locking interactions. The 4934 details of this transition will vary with the type of object but it 4935 always starts with a client ID. 4937 To support Win32 share reservations it is necessary to atomically 4938 OPEN or CREATE files. Having a separate share/unshare operation 4939 would not allow correct implementation of the Win32 OpenFile API. In 4940 order to correctly implement share semantics, the previous NFS 4941 protocol mechanisms used when a file is opened or created (LOOKUP, 4942 CREATE, ACCESS) need to be replaced. The NFSv4 protocol has an OPEN 4943 operation that subsumes the NFSv3 methodology of LOOKUP, CREATE, and 4944 ACCESS. However, because many operations require a filehandle, the 4945 traditional LOOKUP is preserved to map a file name to filehandle 4946 without establishing state on the server. The policy of granting 4947 access or modifying files is managed by the server based on the 4948 client's state. These mechanisms can implement policy ranging from 4949 advisory only locking to full mandatory locking. 4951 9.1. Opens and Byte-Range Locks 4953 It is assumed that manipulating a byte-range lock is rare when 4954 compared to READ and WRITE operations. It is also assumed that 4955 server restarts and network partitions are relatively rare. 4956 Therefore it is important that the READ and WRITE operations have a 4957 lightweight mechanism to indicate if they possess a held lock. A 4958 byte-range lock request contains the heavyweight information required 4959 to establish a lock and uniquely define the owner of the lock. 4961 The following sections describe the transition from the heavy weight 4962 information to the eventual stateid used for most client and server 4963 locking and lease interactions. 4965 9.1.1. Client ID 4967 For each LOCK request, the client must identify itself to the server. 4968 This is done in such a way as to allow for correct lock 4969 identification and crash recovery. A sequence of a SETCLIENTID 4970 operation followed by a SETCLIENTID_CONFIRM operation is required to 4971 establish the identification onto the server. Establishment of 4972 identification by a new incarnation of the client also has the effect 4973 of immediately breaking any leased state that a previous incarnation 4974 of the client might have had on the server, as opposed to forcing the 4975 new client incarnation to wait for the leases to expire. Breaking 4976 the lease state amounts to the server removing all lock, share 4977 reservation, and, where the server is not supporting the 4978 CLAIM_DELEGATE_PREV claim type, all delegation state associated with 4979 same client with the same identity. For discussion of delegation 4980 state recovery, see Section 10.2.1. 4982 Owners of opens and owners of byte-range locks are separate entities 4983 and remain separate even if the same opaque arrays are used to 4984 designate owners of each. The protocol distinguishes between open- 4985 owners (represented by open_owner4 structures) and lock-owners 4986 (represented by lock_owner4 structures). 4988 Each open is associated with a specific open-owner while each byte- 4989 range lock is associated with a lock-owner and an open-owner, the 4990 latter being the open-owner associated with the open file under which 4991 the LOCK operation was done. 4993 Unlike the text in NFSv4.1 [31], this text treats "lock-owner" as 4994 meaning both a open-owner and a lock-owner. Also, a "lock" can refer 4995 to both a byte-range and share lock. 4997 Client identification is encapsulated in the following structure: 4999 struct nfs_client_id4 { 5000 verifier4 verifier; 5001 opaque id; 5002 }; 5004 The first field, verifier is a client incarnation verifier that is 5005 used to detect client reboots. Only if the verifier is different 5006 from that which the server has previously recorded the client (as 5007 identified by the second field of the structure, id) does the server 5008 start the process of canceling the client's leased state. 5010 The second field, id is a variable length string that uniquely 5011 defines the client. 5013 There are several considerations for how the client generates the id 5014 string: 5016 o The string should be unique so that multiple clients do not 5017 present the same string. The consequences of two clients 5018 presenting the same string range from one client getting an error 5019 to one client having its leased state abruptly and unexpectedly 5020 canceled. 5022 o The string should be selected so the subsequent incarnations 5023 (e.g., reboots) of the same client cause the client to present the 5024 same string. The implementor is cautioned against an approach 5025 that requires the string to be recorded in a local file because 5026 this precludes the use of the implementation in an environment 5027 where there is no local disk and all file access is from an NFSv4 5028 server. 5030 o The string should be different for each server network address 5031 that the client accesses, rather than common to all server network 5032 addresses. The reason is that it may not be possible for the 5033 client to tell if the same server is listening on multiple network 5034 addresses. If the client issues SETCLIENTID with the same id 5035 string to each network address of such a server, the server will 5036 think it is the same client, and each successive SETCLIENTID will 5037 cause the server to begin the process of removing the client's 5038 previous leased state. 5040 o The algorithm for generating the string should not assume that the 5041 client's network address won't change. This includes changes 5042 between client incarnations and even changes while the client is 5043 stilling running in its current incarnation. This means that if 5044 the client includes just the client's and server's network address 5045 in the id string, there is a real risk, after the client gives up 5046 the network address, that another client, using a similar 5047 algorithm for generating the id string, will generate a 5048 conflicting id string. 5050 Given the above considerations, an example of a well generated id 5051 string is one that includes: 5053 o The server's network address. 5055 o The client's network address. 5057 o For a user level NFSv4 client, it should contain additional 5058 information to distinguish the client from other user level 5059 clients running on the same host, such as an universally unique 5060 identifier (UUID). 5062 o Additional information that tends to be unique, such as one or 5063 more of: 5065 * The client machine's serial number (for privacy reasons, it is 5066 best to perform some one way function on the serial number). 5068 * A MAC address. 5070 * The timestamp of when the NFSv4 software was first installed on 5071 the client (though this is subject to the previously mentioned 5072 caution about using information that is stored in a file, 5073 because the file might only be accessible over NFSv4). 5075 * A true random number. However since this number ought to be 5076 the same between client incarnations, this shares the same 5077 problem as that of the using the timestamp of the software 5078 installation. 5080 As a security measure, the server MUST NOT cancel a client's leased 5081 state if the principal that established the state for a given id 5082 string is not the same as the principal issuing the SETCLIENTID. 5084 Note that SETCLIENTID and SETCLIENTID_CONFIRM has a secondary purpose 5085 of establishing the information the server needs to make callbacks to 5086 the client for purpose of supporting delegations. It is permitted to 5087 change this information via SETCLIENTID and SETCLIENTID_CONFIRM 5088 within the same incarnation of the client without removing the 5089 client's leased state. 5091 Once a SETCLIENTID and SETCLIENTID_CONFIRM sequence has successfully 5092 completed, the client uses the shorthand client identifier, of type 5093 clientid4, instead of the longer and less compact nfs_client_id4 5094 structure. This shorthand client identifier (a client ID) is 5095 assigned by the server and should be chosen so that it will not 5096 conflict with a client ID previously assigned by the server. This 5097 applies across server restarts or reboots. When a client ID is 5098 presented to a server and that client ID is not recognized, as would 5099 happen after a server reboot, the server will reject the request with 5100 the error NFS4ERR_STALE_CLIENTID. When this happens, the client must 5101 obtain a new client ID by use of the SETCLIENTID operation and then 5102 proceed to any other necessary recovery for the server reboot case 5103 (See Section 9.6.2). 5105 The client must also employ the SETCLIENTID operation when it 5106 receives a NFS4ERR_STALE_STATEID error using a stateid derived from 5107 its current client ID, since this also indicates a server reboot 5108 which has invalidated the existing client ID (see Section 9.1.4 for 5109 details). 5111 See the detailed descriptions of SETCLIENTID and SETCLIENTID_CONFIRM 5112 for a complete specification of the operations. 5114 9.1.2. Server Release of Client ID 5116 If the server determines that the client holds no associated state 5117 for its client ID, the server may choose to release the client ID. 5118 The server may make this choice for an inactive client so that 5119 resources are not consumed by those intermittently active clients. 5120 If the client contacts the server after this release, the server must 5121 ensure the client receives the appropriate error so that it will use 5122 the SETCLIENTID/SETCLIENTID_CONFIRM sequence to establish a new 5123 identity. It should be clear that the server must be very hesitant 5124 to release a client ID since the resulting work on the client to 5125 recover from such an event will be the same burden as if the server 5126 had failed and restarted. Typically a server would not release a 5127 client ID unless there had been no activity from that client for many 5128 minutes. 5130 Note that if the id string in a SETCLIENTID request is properly 5131 constructed, and if the client takes care to use the same principal 5132 for each successive use of SETCLIENTID, then, barring an active 5133 denial of service attack, NFS4ERR_CLID_INUSE should never be 5134 returned. 5136 However, client bugs, server bugs, or perhaps a deliberate change of 5137 the principal owner of the id string (such as the case of a client 5138 that changes security flavors, and under the new flavor, there is no 5139 mapping to the previous owner) will in rare cases result in 5140 NFS4ERR_CLID_INUSE. 5142 In that event, when the server gets a SETCLIENTID for a client ID 5143 that currently has no state, or it has state, but the lease has 5144 expired, rather than returning NFS4ERR_CLID_INUSE, the server MUST 5145 allow the SETCLIENTID, and confirm the new client ID if followed by 5146 the appropriate SETCLIENTID_CONFIRM. 5148 9.1.3. Stateid Definition 5150 When the server grants a lock of any type (including opens, byte- 5151 range locks, and delegations), it responds with a unique stateid that 5152 represents a set of locks (often a single lock) for the same file, of 5153 the same type, and sharing the same ownership characteristics. Thus, 5154 opens of the same file by different open- owners each have an 5155 identifying stateid. Similarly, each set of byte-range locks on a 5156 file owned by a specific lock-owner has its own identifying stateid. 5157 Delegations also have associated stateids by which they may be 5158 referenced. The stateid is used as a shorthand reference to a lock 5159 or set of locks, and given a stateid, the server can determine the 5160 associated state-owner or state-owners (in the case of an open-owner/ 5161 lock-owner pair) and the associated filehandle. When stateids are 5162 used, the current filehandle must be the one associated with that 5163 stateid. 5165 All stateids associated with a given client ID are associated with a 5166 common lease that represents the claim of those stateids and the 5167 objects they represent to be maintained by the server. See 5168 Section 9.5 for a discussion of the lease. 5170 The server may assign stateids independently for different clients. 5171 A stateid with the same bit pattern for one client may designate an 5172 entirely different set of locks for a different client. The stateid 5173 is always interpreted with respect to the client ID associated with 5174 the current session. 5176 9.1.3.1. Stateid Types 5178 With the exception of special stateids (see Section 9.1.3.3), each 5179 stateid represents locking objects of one of a set of types defined 5180 by the NFSv4 protocol. Note that in all these cases, where we speak 5181 of guarantee, it is understood there are situations such as a client 5182 restart, or lock revocation, that allow the guarantee to be voided. 5184 o Stateids may represent opens of files. 5186 Each stateid in this case represents the OPEN state for a given 5187 client ID/open-owner/filehandle triple. Such stateids are subject 5188 to change (with consequent incrementing of the stateid's seqid) in 5189 response to OPENs that result in upgrade and OPEN_DOWNGRADE 5190 operations. 5192 o Stateids may represent sets of byte-range locks. 5194 All locks held on a particular file by a particular owner and all 5195 gotten under the aegis of a particular open file are associated 5196 with a single stateid with the seqid being incremented whenever 5197 LOCK and LOCKU operations affect that set of locks. 5199 o Stateids may represent file delegations, which are recallable 5200 guarantees by the server to the client, that other clients will 5201 not reference, or will not modify a particular file, until the 5202 delegation is returned. 5204 A stateid represents a single delegation held by a client for a 5205 particular filehandle. 5207 9.1.3.2. Stateid Structure 5209 Stateids are divided into two fields, a 96-bit "other" field 5210 identifying the specific set of locks and a 32-bit "seqid" sequence 5211 value. Except in the case of special stateids (see Section 9.1.3.3), 5212 a particular value of the "other" field denotes a set of locks of the 5213 same type (for example, byte-range locks, opens, delegations, or 5214 layouts), for a specific file or directory, and sharing the same 5215 ownership characteristics. The seqid designates a specific instance 5216 of such a set of locks, and is incremented to indicate changes in 5217 such a set of locks, either by the addition or deletion of locks from 5218 the set, a change in the byte-range they apply to, or an upgrade or 5219 downgrade in the type of one or more locks. 5221 When such a set of locks is first created, the server returns a 5222 stateid with seqid value of one. On subsequent operations that 5223 modify the set of locks, the server is required to increment the 5224 "seqid" field by one whenever it returns a stateid for the same 5225 state-owner/file/type combination and there is some change in the set 5226 of locks actually designated. In this case, the server will return a 5227 stateid with an "other" field the same as previously used for that 5228 state-owner/file/type combination, with an incremented "seqid" field. 5229 This pattern continues until the seqid is incremented past 5230 NFS4_UINT32_MAX, and one (not zero) is the next seqid value. The 5231 purpose of the incrementing of the seqid is to allow the server to 5232 communicate to the client the order in which operations that modified 5233 locking state associated with a stateid have been processed and to 5234 make it possible for the client to send requests that are conditional 5235 on the set of locks not having changed since the stateid in question 5236 was returned. 5238 When a client sends a stateid to the server, it has two choices with 5239 regard to the seqid sent. It may set the seqid to zero to indicate 5240 to the server that it wishes the most up-to-date seqid for that 5241 stateid's "other" field to be used. This would be the common choice 5242 in the case of a stateid sent with a READ or WRITE operation. It 5243 also may set a non-zero value, in which case the server checks if 5244 that seqid is the correct one. In that case, the server is required 5245 to return NFS4ERR_OLD_STATEID if the seqid is lower than the most 5246 current value and NFS4ERR_BAD_STATEID if the seqid is greater than 5247 the most current value. This would be the common choice in the case 5248 of stateids sent with a CLOSE or OPEN_DOWNGRADE. Because OPENs may 5249 be sent in parallel for the same owner, a client might close a file 5250 without knowing that an OPEN upgrade had been done by the server, 5251 changing the lock in question. If CLOSE were sent with a zero seqid, 5252 the OPEN upgrade would be canceled before the client even received an 5253 indication that an upgrade had happened. 5255 When a stateid is sent by the server to the client as part of a 5256 callback operation, it is not subject to checking for a current seqid 5257 and returning NFS4ERR_OLD_STATEID. This is because the client is not 5258 in a position to know the most up-to-date seqid and thus cannot 5259 verify it. Unless specially noted, the seqid value for a stateid 5260 sent by the server to the client as part of a callback is required to 5261 be zero with NFS4ERR_BAD_STATEID returned if it is not. 5263 In making comparisons between seqids, both by the client in 5264 determining the order of operations and by the server in determining 5265 whether the NFS4ERR_OLD_STATEID is to be returned, the possibility of 5266 the seqid being swapped around past the NFS4_UINT32_MAX value needs 5267 to be taken into account. 5269 9.1.3.3. Special Stateids 5271 Stateid values whose "other" field is either all zeros or all ones 5272 are reserved. They may not be assigned by the server but have 5273 special meanings defined by the protocol. The particular meaning 5274 depends on whether the "other" field is all zeros or all ones and the 5275 specific value of the "seqid" field. 5277 The following combinations of "other" and "seqid" are defined in 5278 NFSv4: 5280 o When "other" and "seqid" are both zero, the stateid is treated as 5281 a special anonymous stateid, which can be used in READ, WRITE, and 5282 SETATTR requests to indicate the absence of any open state 5283 associated with the request. When an anonymous stateid value is 5284 used, and an existing open denies the form of access requested, 5285 then access will be denied to the request. 5287 o When "other" and "seqid" are both all ones, the stateid is a 5288 special READ bypass stateid. When this value is used in WRITE or 5289 SETATTR, it is treated like the anonymous value. When used in 5290 READ, the server MAY grant access, even if access would normally 5291 be denied to READ requests. 5293 o When "other" is zero and "seqid" is one, the stateid represents 5294 the current stateid, which is whatever value is the last stateid 5295 returned by an operation within the COMPOUND. In the case of an 5296 OPEN, the stateid returned for the open file, and not the 5297 delegation is used. The stateid passed to the operation in place 5298 of the special value has its "seqid" value set to zero, except 5299 when the current stateid is used by the operation CLOSE or 5300 OPEN_DOWNGRADE. If there is no operation in the COMPOUND which 5301 has returned a stateid value, the server MUST return the error 5302 NFS4ERR_BAD_STATEID. As illustrated in Figure 5, if the value of 5303 a current stateid is a special stateid, and the stateid of an 5304 operation's arguments has "other" set to zero, and "seqid" set to 5305 one, then the server MUST return the error NFS4ERR_BAD_STATEID. 5307 o When "other" is zero and "seqid" is NFS4_UINT32_MAX, the stateid 5308 represents a reserved stateid value defined to be invalid. When 5309 this stateid is used, the server MUST return the error 5310 NFS4ERR_BAD_STATEID. 5312 If a stateid value is used which has all zero or all ones in the 5313 "other" field, but does not match one of the cases above, the server 5314 MUST return the error NFS4ERR_BAD_STATEID. 5316 Special stateids, unlike other stateids, are not associated with 5317 individual client IDs or filehandles and can be used with all valid 5318 client IDs and filehandles. In the case of a special stateid 5319 designating the current stateid, the current stateid value 5320 substituted for the special stateid is associated with a particular 5321 client ID and filehandle, and so, if it is used where current 5322 filehandle does not match that associated with the current stateid, 5323 the operation to which the stateid is passed will return 5324 NFS4ERR_BAD_STATEID. 5326 9.1.3.4. Stateid Lifetime and Validation 5328 Stateids must remain valid until either a client restart or a server 5329 restart or until the client returns all of the locks associated with 5330 the stateid by means of an operation such as CLOSE or DELEGRETURN. 5331 If the locks are lost due to revocation as long as the client ID is 5332 valid, the stateid remains a valid designation of that revoked state. 5333 Stateids associated with byte-range locks are an exception. They 5334 remain valid even if a LOCKU frees all remaining locks, so long as 5335 the open file with which they are associated remains open. 5337 It should be noted that there are situations in which the client's 5338 locks become invalid, without the client requesting they be returned. 5339 These include lease expiration and a number of forms of lock 5340 revocation within the lease period. It is important to note that in 5341 these situations, the stateid remains valid and the client can use it 5342 to determine the disposition of the associated lost locks. 5344 An "other" value must never be reused for a different purpose (i.e. 5345 different filehandle, owner, or type of locks) within the context of 5346 a single client ID. A server may retain the "other" value for the 5347 same purpose beyond the point where it may otherwise be freed but if 5348 it does so, it must maintain "seqid" continuity with previous values. 5350 One mechanism that may be used to satisfy the requirement that the 5351 server recognize invalid and out-of-date stateids is for the server 5352 to divide the "other" field of the stateid into two fields. 5354 o An index into a table of locking-state structures. 5356 o A generation number which is incremented on each allocation of a 5357 table entry for a particular use. 5359 And then store in each table entry, 5361 o The client ID with which the stateid is associated. 5363 o The current generation number for the (at most one) valid stateid 5364 sharing this index value. 5366 o The filehandle of the file on which the locks are taken. 5368 o An indication of the type of stateid (open, byte-range lock, file 5369 delegation). 5371 o The last "seqid" value returned corresponding to the current 5372 "other" value. 5374 o An indication of the current status of the locks associated with 5375 this stateid. In particular, whether these have been revoked and 5376 if so, for what reason. 5378 With this information, an incoming stateid can be validated and the 5379 appropriate error returned when necessary. Special and non-special 5380 stateids are handled separately. (See Section 9.1.3.3 for a 5381 discussion of special stateids.) 5383 When a stateid is being tested, and the "other" field is all zeros or 5384 all ones, a check that the "other" and "seqid" fields match a defined 5385 combination for a special stateid is done and the results determined 5386 as follows: 5388 o If the "other" and "seqid" fields do not match a defined 5389 combination associated with a special stateid, the error 5390 NFS4ERR_BAD_STATEID is returned. 5392 o If the special stateid is one designating the current stateid, and 5393 there is a current stateid, then the current stateid is 5394 substituted for the special stateid and the checks appropriate to 5395 non-special stateids in performed. 5397 o If the combination is valid in general but is not appropriate to 5398 the context in which the stateid is used (e.g. an all-zero stateid 5399 is used when an open stateid is required in a LOCK operation), the 5400 error NFS4ERR_BAD_STATEID is also returned. 5402 o Otherwise, the check is completed and the special stateid is 5403 accepted as valid. 5405 When a stateid is being tested, and the "other" field is neither all 5406 zeros or all ones, the following procedure could be used to validate 5407 an incoming stateid and return an appropriate error, when necessary, 5408 assuming that the "other" field would be divided into a table index 5409 and an entry generation. 5411 o If the table index field is outside the range of the associated 5412 table, return NFS4ERR_BAD_STATEID. 5414 o If the selected table entry is of a different generation than that 5415 specified in the incoming stateid, return NFS4ERR_BAD_STATEID. 5417 o If the selected table entry does not match the current filehandle, 5418 return NFS4ERR_BAD_STATEID. 5420 o If the client ID in the table entry does not match the client ID 5421 associated with the current session, return NFS4ERR_BAD_STATEID. 5423 o If the stateid represents revoked state, then return 5424 NFS4ERR_EXPIRED, NFS4ERR_ADMIN_REVOKED, or NFS4ERR_DELEG_REVOKED, 5425 as appropriate. 5427 o If the stateid type is not valid for the context in which the 5428 stateid appears, return NFS4ERR_BAD_STATEID. Note that a stateid 5429 may be valid in general, but be invalid for a particular 5430 operation, as, for example, when a stateid which doesn't represent 5431 byte-range locks is passed to the non-from_open case of LOCK or to 5432 LOCKU, or when a stateid which does not represent an open is 5433 passed to CLOSE or OPEN_DOWNGRADE. In such cases, the server MUST 5434 return NFS4ERR_BAD_STATEID. 5436 o If the "seqid" field is not zero, and it is greater than the 5437 current sequence value corresponding the current "other" field, 5438 return NFS4ERR_BAD_STATEID. 5440 o If the "seqid" field is not zero, and it is less than the current 5441 sequence value corresponding the current "other" field, return 5442 NFS4ERR_OLD_STATEID. 5444 o Otherwise, the stateid is valid and the table entry should contain 5445 any additional information about the type of stateid and 5446 information associated with that particular type of stateid, such 5447 as the associated set of locks, such as open-owner and lock-owner 5448 information, as well as information on the specific locks, such as 5449 open modes and byte ranges. 5451 9.1.3.5. Stateid Use for I/O Operations 5453 Clients performing I/O operations need to select an appropriate 5454 stateid based on the locks (including opens and delegations) held by 5455 the client and the various types of state-owners sending the I/O 5456 requests. SETATTR operations that change the file size are treated 5457 like I/O operations in this regard. 5459 The following rules, applied in order of decreasing priority, govern 5460 the selection of the appropriate stateid. In following these rules, 5461 the client will only consider locks of which it has actually received 5462 notification by an appropriate operation response or callback. 5464 o If the client holds a delegation for the file in question, the 5465 delegation stateid SHOULD be used. 5467 o Otherwise, if the entity corresponding to the lock-owner (e.g., a 5468 process) sending the I/O has a byte-range lock stateid for the 5469 associated open file, then the byte-range lock stateid for that 5470 lock-owner and open file SHOULD be used. 5472 o If there is no byte-range lock stateid, then the OPEN stateid for 5473 the open file in question SHOULD be used. 5475 o Finally, if none of the above apply, then a special stateid SHOULD 5476 be used. 5478 Ignoring these rules may result in situations in which the server 5479 does not have information necessary to properly process the request. 5480 For example, when mandatory byte-range locks are in effect, if the 5481 stateid does not indicate the proper lock-owner, via a lock stateid, 5482 a request might be avoidably rejected. 5484 The server however should not try to enforce these ordering rules and 5485 should use whatever information is available to properly process I/O 5486 requests. In particular, when a client has a delegation for a given 5487 file, it SHOULD take note of this fact in processing a request, even 5488 if it is sent with a special stateid. 5490 9.1.3.6. Stateid Use for SETATTR Operations 5492 In the case of SETATTR operations, a stateid is present. In cases 5493 other than those that set the file size, the client may send either a 5494 special stateid or, when a delegation is held for the file in 5495 question, a delegation stateid. While the server SHOULD validate the 5496 stateid and may use the stateid to optimize the determination as to 5497 whether a delegation is held, it SHOULD note the presence of a 5498 delegation even when a special stateid is sent, and MUST accept a 5499 valid delegation stateid when sent. 5501 9.1.4. lock-owner 5503 When requesting a lock, the client must present to the server the 5504 client ID and an identifier for the owner of the requested lock. 5505 These two fields are referred to as the lock-owner and the definition 5506 of those fields are: 5508 o A client ID returned by the server as part of the client's use of 5509 the SETCLIENTID operation. 5511 o A variable length opaque array used to uniquely define the owner 5512 of a lock managed by the client. 5514 This may be a thread id, process id, or other unique value. 5516 When the server grants the lock, it responds with a unique stateid. 5517 The stateid is used as a shorthand reference to the lock-owner, since 5518 the server will be maintaining the correspondence between them. 5520 9.1.5. Use of the Stateid and Locking 5522 All READ, WRITE and SETATTR operations contain a stateid. For the 5523 purposes of this section, SETATTR operations which change the size 5524 attribute of a file are treated as if they are writing the area 5525 between the old and new size (i.e., the range truncated or added to 5526 the file by means of the SETATTR), even where SETATTR is not 5527 explicitly mentioned in the text. The stateid passed to one of these 5528 operations must be one that represents an OPEN, a set of byte-range 5529 locks, or a delegation, or it may be a special stateid representing 5530 anonymous access or the special bypass stateid. 5532 If the lock-owner performs a READ or WRITE in a situation in which it 5533 has established a lock or share reservation on the server (any OPEN 5534 constitutes a share reservation) the stateid (previously returned by 5535 the server) must be used to indicate what locks, including both byte- 5536 range locks and share reservations, are held by the lockowner. If no 5537 state is established by the client, either byte-range lock or share 5538 reservation, a stateid of all bits 0 is used. Regardless whether a 5539 stateid of all bits 0, or a stateid returned by the server is used, 5540 if there is a conflicting share reservation or mandatory byte-range 5541 lock held on the file, the server MUST refuse to service the READ or 5542 WRITE operation. 5544 Share reservations are established by OPEN operations and by their 5545 nature are mandatory in that when the OPEN denies READ or WRITE 5546 operations, that denial results in such operations being rejected 5547 with error NFS4ERR_LOCKED. Byte-range locks may be implemented by 5548 the server as either mandatory or advisory, or the choice of 5549 mandatory or advisory behavior may be determined by the server on the 5550 basis of the file being accessed (for example, some UNIX-based 5551 servers support a "mandatory lock bit" on the mode attribute such 5552 that if set, byte-range locks are required on the file before I/O is 5553 possible). When byte-range locks are advisory, they only prevent the 5554 granting of conflicting lock requests and have no effect on READs or 5555 WRITEs. Mandatory byte-range locks, however, prevent conflicting I/O 5556 operations. When they are attempted, they are rejected with 5557 NFS4ERR_LOCKED. When the client gets NFS4ERR_LOCKED on a file it 5558 knows it has the proper share reservation for, it will need to issue 5559 a LOCK request on the region of the file that includes the region the 5560 I/O was to be performed on, with an appropriate locktype (i.e., 5561 READ*_LT for a READ operation, WRITE*_LT for a WRITE operation). 5563 With NFSv3, there was no notion of a stateid so there was no way to 5564 tell if the application process of the client sending the READ or 5565 WRITE operation had also acquired the appropriate byte-range lock on 5566 the file. Thus there was no way to implement mandatory locking. 5567 With the stateid construct, this barrier has been removed. 5569 Note that for UNIX environments that support mandatory file locking, 5570 the distinction between advisory and mandatory locking is subtle. In 5571 fact, advisory and mandatory byte-range locks are exactly the same in 5572 so far as the APIs and requirements on implementation. If the 5573 mandatory lock attribute is set on the file, the server checks to see 5574 if the lockowner has an appropriate shared (read) or exclusive 5575 (write) byte-range lock on the region it wishes to read or write to. 5576 If there is no appropriate lock, the server checks if there is a 5577 conflicting lock (which can be done by attempting to acquire the 5578 conflicting lock on the behalf of the lockowner, and if successful, 5579 release the lock after the READ or WRITE is done), and if there is, 5580 the server returns NFS4ERR_LOCKED. 5582 For Windows environments, there are no advisory byte-range locks, so 5583 the server always checks for byte-range locks during I/O requests. 5585 Thus, the NFSv4 LOCK operation does not need to distinguish between 5586 advisory and mandatory byte-range locks. It is the NFS version 4 5587 server's processing of the READ and WRITE operations that introduces 5588 the distinction. 5590 Every stateid other than the special stateid values noted in this 5591 section, whether returned by an OPEN-type operation (i.e., OPEN, 5592 OPEN_DOWNGRADE), or by a LOCK-type operation (i.e., LOCK or LOCKU), 5593 defines an access mode for the file (i.e., READ, WRITE, or READ- 5594 WRITE) as established by the original OPEN which began the stateid 5595 sequence, and as modified by subsequent OPENs and OPEN_DOWNGRADEs 5596 within that stateid sequence. When a READ, WRITE, or SETATTR which 5597 specifies the size attribute, is done, the operation is subject to 5598 checking against the access mode to verify that the operation is 5599 appropriate given the OPEN with which the operation is associated. 5601 In the case of WRITE-type operations (i.e., WRITEs and SETATTRs which 5602 set size), the server must verify that the access mode allows writing 5603 and return an NFS4ERR_OPENMODE error if it does not. In the case, of 5604 READ, the server may perform the corresponding check on the access 5605 mode, or it may choose to allow READ on opens for WRITE only, to 5606 accommodate clients whose write implementation may unavoidably do 5607 reads (e.g., due to buffer cache constraints). However, even if 5608 READs are allowed in these circumstances, the server MUST still check 5609 for locks that conflict with the READ (e.g., another open specify 5610 denial of READs). Note that a server which does enforce the access 5611 mode check on READs need not explicitly check for conflicting share 5612 reservations since the existence of OPEN for read access guarantees 5613 that no conflicting share reservation can exist. 5615 A stateid of all bits 1 (one) MAY allow READ operations to bypass 5616 locking checks at the server. However, WRITE operations with a 5617 stateid with bits all 1 (one) MUST NOT bypass locking checks and are 5618 treated exactly the same as if a stateid of all bits 0 were used. 5620 A lock may not be granted while a READ or WRITE operation using one 5621 of the special stateids is being performed and the range of the lock 5622 request conflicts with the range of the READ or WRITE operation. For 5623 the purposes of this paragraph, a conflict occurs when a shared lock 5624 is requested and a WRITE operation is being performed, or an 5625 exclusive lock is requested and either a READ or a WRITE operation is 5626 being performed. A SETATTR that sets size is treated similarly to a 5627 WRITE as discussed above. 5629 9.1.6. Sequencing of Lock Requests 5631 Locking is different than most NFS operations as it requires "at- 5632 most-one" semantics that are not provided by ONCRPC. ONCRPC over a 5633 reliable transport is not sufficient because a sequence of locking 5634 requests may span multiple TCP connections. In the face of 5635 retransmission or reordering, lock or unlock requests must have a 5636 well defined and consistent behavior. To accomplish this, each lock 5637 request contains a sequence number that is a consecutively increasing 5638 integer. Different lock-owners have different sequences. The server 5639 maintains the last sequence number (L) received and the response that 5640 was returned. The server is free to assign any value for the first 5641 request issued for any given lock-owner. 5643 Note that for requests that contain a sequence number, for each lock- 5644 owner, there should be no more than one outstanding request. 5646 If a request (r) with a previous sequence number (r < L) is received, 5647 it is rejected with the return of error NFS4ERR_BAD_SEQID. Given a 5648 properly-functioning client, the response to (r) must have been 5649 received before the last request (L) was sent. If a duplicate of 5650 last request (r == L) is received, the stored response is returned. 5651 If a request beyond the next sequence (r == L + 2) is received, it is 5652 rejected with the return of error NFS4ERR_BAD_SEQID. Sequence 5653 history is reinitialized whenever the SETCLIENTID/SETCLIENTID_CONFIRM 5654 sequence changes the client verifier. 5656 Since the sequence number is represented with an unsigned 32-bit 5657 integer, the arithmetic involved with the sequence number is mod 5658 2^32. For an example of modulo arithmetic involving sequence numbers 5659 see [33]. 5661 It is critical the server maintain the last response sent to the 5662 client to provide a more reliable cache of duplicate non-idempotent 5663 requests than that of the traditional cache described in [34]. The 5664 traditional duplicate request cache uses a least recently used 5665 algorithm for removing unneeded requests. However, the last lock 5666 request and response on a given lock-owner must be cached as long as 5667 the lock state exists on the server. 5669 The client MUST monotonically increment the sequence number for the 5670 CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE 5671 operations. This is true even in the event that the previous 5672 operation that used the sequence number received an error. The only 5673 exception to this rule is if the previous operation received one of 5674 the following errors: NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID, 5675 NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID, NFS4ERR_BADXDR, 5676 NFS4ERR_RESOURCE, NFS4ERR_NOFILEHANDLE, or NFS4ERR_MOVED. 5678 9.1.7. Recovery from Replayed Requests 5680 As described above, the sequence number is per lock-owner. As long 5681 as the server maintains the last sequence number received and follows 5682 the methods described above, there are no risks of a Byzantine router 5683 re-sending old requests. The server need only maintain the (lock- 5684 owner, sequence number) state as long as there are open files or 5685 closed files with locks outstanding. 5687 LOCK, LOCKU, OPEN, OPEN_DOWNGRADE, and CLOSE each contain a sequence 5688 number and therefore the risk of the replay of these operations 5689 resulting in undesired effects is non-existent while the server 5690 maintains the lock-owner state. 5692 9.1.8. Releasing lock-owner State 5694 When a particular lock-owner no longer holds open or file locking 5695 state at the server, the server may choose to release the sequence 5696 number state associated with the lock-owner. The server may make 5697 this choice based on lease expiration, for the reclamation of server 5698 memory, or other implementation specific details. In any event, the 5699 server is able to do this safely only when the lock-owner no longer 5700 is being utilized by the client. The server may choose to hold the 5701 lock-owner state in the event that retransmitted requests are 5702 received. However, the period to hold this state is implementation 5703 specific. 5705 In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is 5706 retransmitted after the server has previously released the lock-owner 5707 state, the server will find that the lock-owner has no files open and 5708 an error will be returned to the client. If the lock-owner does have 5709 a file open, the stateid will not match and again an error is 5710 returned to the client. 5712 9.1.9. Use of Open Confirmation 5714 In the case that an OPEN is retransmitted and the lock-owner is being 5715 used for the first time or the lock-owner state has been previously 5716 released by the server, the use of the OPEN_CONFIRM operation will 5717 prevent incorrect behavior. When the server observes the use of the 5718 lock-owner for the first time, it will direct the client to perform 5719 the OPEN_CONFIRM for the corresponding OPEN. This sequence 5720 establishes the use of a lock-owner and associated sequence number. 5721 Since the OPEN_CONFIRM sequence connects a new open-owner on the 5722 server with an existing open-owner on a client, the sequence number 5723 may have any value. The OPEN_CONFIRM step assures the server that 5724 the value received is the correct one. (see Section 15.20 for further 5725 details.) 5727 There are a number of situations in which the requirement to confirm 5728 an OPEN would pose difficulties for the client and server, in that 5729 they would be prevented from acting in a timely fashion on 5730 information received, because that information would be provisional, 5731 subject to deletion upon non-confirmation. Fortunately, these are 5732 situations in which the server can avoid the need for confirmation 5733 when responding to open requests. The two constraints are: 5735 o The server must not bestow a delegation for any open which would 5736 require confirmation. 5738 o The server MUST NOT require confirmation on a reclaim-type open 5739 (i.e., one specifying claim type CLAIM_PREVIOUS or 5740 CLAIM_DELEGATE_PREV). 5742 These constraints are related in that reclaim-type opens are the only 5743 ones in which the server may be required to send a delegation. For 5744 CLAIM_NULL, sending the delegation is optional while for 5745 CLAIM_DELEGATE_CUR, no delegation is sent. 5747 Delegations being sent with an open requiring confirmation are 5748 troublesome because recovering from non-confirmation adds undue 5749 complexity to the protocol while requiring confirmation on reclaim- 5750 type opens poses difficulties in that the inability to resolve the 5751 status of the reclaim until lease expiration may make it difficult to 5752 have timely determination of the set of locks being reclaimed (since 5753 the grace period may expire). 5755 Requiring open confirmation on reclaim-type opens is avoidable 5756 because of the nature of the environments in which such opens are 5757 done. For CLAIM_PREVIOUS opens, this is immediately after server 5758 reboot, so there should be no time for lockowners to be created, 5759 found to be unused, and recycled. For CLAIM_DELEGATE_PREV opens, we 5760 are dealing with a client reboot situation. A server which supports 5761 delegation can be sure that no lockowners for that client have been 5762 recycled since client initialization and thus can ensure that 5763 confirmation will not be required. 5765 9.2. Lock Ranges 5767 The protocol allows a lock owner to request a lock with a byte range 5768 and then either upgrade or unlock a sub-range of the initial lock. 5769 It is expected that this will be an uncommon type of request. In any 5770 case, servers or server filesystems may not be able to support sub- 5771 range lock semantics. In the event that a server receives a locking 5772 request that represents a sub-range of current locking state for the 5773 lock owner, the server is allowed to return the error 5774 NFS4ERR_LOCK_RANGE to signify that it does not support sub-range lock 5775 operations. Therefore, the client should be prepared to receive this 5776 error and, if appropriate, report the error to the requesting 5777 application. 5779 The client is discouraged from combining multiple independent locking 5780 ranges that happen to be adjacent into a single request since the 5781 server may not support sub-range requests and for reasons related to 5782 the recovery of file locking state in the event of server failure. 5783 As discussed in the Section 9.6.2 below, the server may employ 5784 certain optimizations during recovery that work effectively only when 5785 the client's behavior during lock recovery is similar to the client's 5786 locking behavior prior to server failure. 5788 9.3. Upgrading and Downgrading Locks 5790 If a client has a write lock on a record, it can request an atomic 5791 downgrade of the lock to a read lock via the LOCK request, by setting 5792 the type to READ_LT. If the server supports atomic downgrade, the 5793 request will succeed. If not, it will return NFS4ERR_LOCK_NOTSUPP. 5794 The client should be prepared to receive this error, and if 5795 appropriate, report the error to the requesting application. 5797 If a client has a read lock on a record, it can request an atomic 5798 upgrade of the lock to a write lock via the LOCK request by setting 5799 the type to WRITE_LT or WRITEW_LT. If the server does not support 5800 atomic upgrade, it will return NFS4ERR_LOCK_NOTSUPP. If the upgrade 5801 can be achieved without an existing conflict, the request will 5802 succeed. Otherwise, the server will return either NFS4ERR_DENIED or 5803 NFS4ERR_DEADLOCK. The error NFS4ERR_DEADLOCK is returned if the 5804 client issued the LOCK request with the type set to WRITEW_LT and the 5805 server has detected a deadlock. The client should be prepared to 5806 receive such errors and if appropriate, report the error to the 5807 requesting application. 5809 9.4. Blocking Locks 5811 Some clients require the support of blocking locks. The NFS version 5812 4 protocol must not rely on a callback mechanism and therefore is 5813 unable to notify a client when a previously denied lock has been 5814 granted. Clients have no choice but to continually poll for the 5815 lock. This presents a fairness problem. Two new lock types are 5816 added, READW and WRITEW, and are used to indicate to the server that 5817 the client is requesting a blocking lock. The server should maintain 5818 an ordered list of pending blocking locks. When the conflicting lock 5819 is released, the server may wait the lease period for the first 5820 waiting client to re-request the lock. After the lease period 5821 expires the next waiting client request is allowed the lock. Clients 5822 are required to poll at an interval sufficiently small that it is 5823 likely to acquire the lock in a timely manner. The server is not 5824 required to maintain a list of pending blocked locks as it is used to 5825 increase fairness and not correct operation. Because of the 5826 unordered nature of crash recovery, storing of lock state to stable 5827 storage would be required to guarantee ordered granting of blocking 5828 locks. 5830 Servers may also note the lock types and delay returning denial of 5831 the request to allow extra time for a conflicting lock to be 5832 released, allowing a successful return. In this way, clients can 5833 avoid the burden of needlessly frequent polling for blocking locks. 5834 The server should take care in the length of delay in the event the 5835 client retransmits the request. 5837 If a server receives a blocking lock request, denies it, and then 5838 later receives a nonblocking request for the same lock, which is also 5839 denied, then it should remove the lock in question from its list of 5840 pending blocking locks. Clients should use such a nonblocking 5841 request to indicate to the server that this is the last time they 5842 intend to poll for the lock, as may happen when the process 5843 requesting the lock is interrupted. This is a courtesy to the 5844 server, to prevent it from unnecessarily waiting a lease period 5845 before granting other lock requests. However, clients are not 5846 required to perform this courtesy, and servers must not depend on 5847 them doing so. Also, clients must be prepared for the possibility 5848 that this final locking request will be accepted. 5850 9.5. Lease Renewal 5852 The purpose of a lease is to allow a server to remove stale locks 5853 that are held by a client that has crashed or is otherwise 5854 unreachable. It is not a mechanism for cache consistency and lease 5855 renewals may not be denied if the lease interval has not expired. 5857 The following events cause implicit renewal of all of the leases for 5858 a given client (i.e., all those sharing a given client ID). Each of 5859 these is a positive indication that the client is still active and 5860 that the associated state held at the server, for the client, is 5861 still valid. 5863 o An OPEN with a valid client ID. 5865 o Any operation made with a valid stateid (CLOSE, DELEGPURGE, 5866 DELEGRETURN, LOCK, LOCKU, OPEN, OPEN_CONFIRM, OPEN_DOWNGRADE, 5867 READ, RENEW, SETATTR, or WRITE). This does not include the 5868 special stateids of all bits 0 or all bits 1. 5870 Note that if the client had restarted or rebooted, the client 5871 would not be making these requests without issuing the 5872 SETCLIENTID/SETCLIENTID_CONFIRM sequence. The use of the 5873 SETCLIENTID/SETCLIENTID_CONFIRM sequence (one that changes the 5874 client verifier) notifies the server to drop the locking state 5875 associated with the client. SETCLIENTID/SETCLIENTID_CONFIRM never 5876 renews a lease. 5878 If the server has rebooted, the stateids (NFS4ERR_STALE_STATEID 5879 error) or the client ID (NFS4ERR_STALE_CLIENTID error) will not be 5880 valid hence preventing spurious renewals. 5882 This approach allows for low overhead lease renewal which scales 5883 well. In the typical case no extra RPC calls are required for lease 5884 renewal and in the worst case one RPC is required every lease period 5885 (i.e., a RENEW operation). The number of locks held by the client is 5886 not a factor since all state for the client is involved with the 5887 lease renewal action. 5889 Since all operations that create a new lease also renew existing 5890 leases, the server must maintain a common lease expiration time for 5891 all valid leases for a given client. This lease time can then be 5892 easily updated upon implicit lease renewal actions. 5894 9.6. Crash Recovery 5896 The important requirement in crash recovery is that both the client 5897 and the server know when the other has failed. Additionally, it is 5898 required that a client sees a consistent view of data across server 5899 restarts or reboots. All READ and WRITE operations that may have 5900 been queued within the client or network buffers must wait until the 5901 client has successfully recovered the locks protecting the READ and 5902 WRITE operations. 5904 9.6.1. Client Failure and Recovery 5906 In the event that a client fails, the server may recover the client's 5907 locks when the associated leases have expired. Conflicting locks 5908 from another client may only be granted after this lease expiration. 5909 If the client is able to restart or reinitialize within the lease 5910 period the client may be forced to wait the remainder of the lease 5911 period before obtaining new locks. 5913 To minimize client delay upon restart, lock requests are associated 5914 with an instance of the client by a client supplied verifier. This 5915 verifier is part of the initial SETCLIENTID call made by the client. 5916 The server returns a client ID as a result of the SETCLIENTID 5917 operation. The client then confirms the use of the client ID with 5918 SETCLIENTID_CONFIRM. The client ID in combination with an opaque 5919 owner field is then used by the client to identify the lock owner for 5920 OPEN. This chain of associations is then used to identify all locks 5921 for a particular client. 5923 Since the verifier will be changed by the client upon each 5924 initialization, the server can compare a new verifier to the verifier 5925 associated with currently held locks and determine that they do not 5926 match. This signifies the client's new instantiation and subsequent 5927 loss of locking state. As a result, the server is free to release 5928 all locks held which are associated with the old client ID which was 5929 derived from the old verifier. 5931 Note that the verifier must have the same uniqueness properties of 5932 the verifier for the COMMIT operation. 5934 9.6.2. Server Failure and Recovery 5936 If the server loses locking state (usually as a result of a restart 5937 or reboot), it must allow clients time to discover this fact and re- 5938 establish the lost locking state. The client must be able to re- 5939 establish the locking state without having the server deny valid 5940 requests because the server has granted conflicting access to another 5941 client. Likewise, if there is the possibility that clients have not 5942 yet re-established their locking state for a file, the server must 5943 disallow READ and WRITE operations for that file. The duration of 5944 this recovery period is equal to the duration of the lease period. 5946 A client can determine that server failure (and thus loss of locking 5947 state) has occurred, when it receives one of two errors. The 5948 NFS4ERR_STALE_STATEID error indicates a stateid invalidated by a 5949 reboot or restart. The NFS4ERR_STALE_CLIENTID error indicates a 5950 client ID invalidated by reboot or restart. When either of these are 5951 received, the client must establish a new client ID (see 5952 Section 9.1.1) and re-establish the locking state as discussed below. 5954 The period of special handling of locking and READs and WRITEs, equal 5955 in duration to the lease period, is referred to as the "grace 5956 period". During the grace period, clients recover locks and the 5957 associated state by reclaim-type locking requests (i.e., LOCK 5958 requests with reclaim set to true and OPEN operations with a claim 5959 type of CLAIM_PREVIOUS). During the grace period, the server must 5960 reject READ and WRITE operations and non-reclaim locking requests 5961 (i.e., other LOCK and OPEN operations) with an error of 5962 NFS4ERR_GRACE. 5964 If the server can reliably determine that granting a non-reclaim 5965 request will not conflict with reclamation of locks by other clients, 5966 the NFS4ERR_GRACE error does not have to be returned and the non- 5967 reclaim client request can be serviced. For the server to be able to 5968 service READ and WRITE operations during the grace period, it must 5969 again be able to guarantee that no possible conflict could arise 5970 between an impending reclaim locking request and the READ or WRITE 5971 operation. If the server is unable to offer that guarantee, the 5972 NFS4ERR_GRACE error must be returned to the client. 5974 For a server to provide simple, valid handling during the grace 5975 period, the easiest method is to simply reject all non-reclaim 5976 locking requests and READ and WRITE operations by returning the 5977 NFS4ERR_GRACE error. However, a server may keep information about 5978 granted locks in stable storage. With this information, the server 5979 could determine if a regular lock or READ or WRITE operation can be 5980 safely processed. 5982 For example, if a count of locks on a given file is available in 5983 stable storage, the server can track reclaimed locks for the file and 5984 when all reclaims have been processed, non-reclaim locking requests 5985 may be processed. This way the server can ensure that non-reclaim 5986 locking requests will not conflict with potential reclaim requests. 5987 With respect to I/O requests, if the server is able to determine that 5988 there are no outstanding reclaim requests for a file by information 5989 from stable storage or another similar mechanism, the processing of 5990 I/O requests could proceed normally for the file. 5992 To reiterate, for a server that allows non-reclaim lock and I/O 5993 requests to be processed during the grace period, it MUST determine 5994 that no lock subsequently reclaimed will be rejected and that no lock 5995 subsequently reclaimed would have prevented any I/O operation 5996 processed during the grace period. 5998 Clients should be prepared for the return of NFS4ERR_GRACE errors for 5999 non-reclaim lock and I/O requests. In this case the client should 6000 employ a retry mechanism for the request. A delay (on the order of 6001 several seconds) between retries should be used to avoid overwhelming 6002 the server. Further discussion of the general issue is included in 6003 [20]. The client must account for the server that is able to perform 6004 I/O and non-reclaim locking requests within the grace period as well 6005 as those that cannot do so. 6007 A reclaim-type locking request outside the server's grace period can 6008 only succeed if the server can guarantee that no conflicting lock or 6009 I/O request has been granted since reboot or restart. 6011 A server may, upon restart, establish a new value for the lease 6012 period. Therefore, clients should, once a new client ID is 6013 established, refetch the lease_time attribute and use it as the basis 6014 for lease renewal for the lease associated with that server. 6015 However, the server must establish, for this restart event, a grace 6016 period at least as long as the lease period for the previous server 6017 instantiation. This allows the client state obtained during the 6018 previous server instance to be reliably re-established. 6020 9.6.3. Network Partitions and Recovery 6022 If the duration of a network partition is greater than the lease 6023 period provided by the server, the server will have not received a 6024 lease renewal from the client. If this occurs, the server may free 6025 all locks held for the client. As a result, all stateids held by the 6026 client will become invalid or stale. Once the client is able to 6027 reach the server after such a network partition, all I/O submitted by 6028 the client with the now invalid stateids will fail with the server 6029 returning the error NFS4ERR_EXPIRED. Once this error is received, 6030 the client will suitably notify the application that held the lock. 6032 9.6.3.1. Courtesy Locks 6034 As a courtesy to the client or as an optimization, the server may 6035 continue to hold locks on behalf of a client for which recent 6036 communication has extended beyond the lease period. If the server 6037 receives a lock or I/O request that conflicts with one of these 6038 courtesy locks, the server MUST free the courtesy lock and grant the 6039 new request. If the server runs out of resources, it MAY free all 6040 courtesy locks. I.e., the client MUST not make an assumption that 6041 the server has issued courtesy locks. 6043 If the server does not reboot before the network partition is healed, 6044 when the original client tries to access a courtesy lock which was 6045 freed, the server SHOULD send back a NFS4ERR_BAD_STATEID to the 6046 client. If the client tries to access a courtesy lock which was not 6047 freed, then the server SHOULD mark all of the courtesy locks as 6048 implicitly being renewed. 6050 When a network partition is combined with a server reboot, then both 6051 the server and client have responsibilities to ensure that the client 6052 does not reclaim a lock which it should no longer be able to access. 6053 Briefly those are: 6055 o Client's responsibility: A client MUST NOT attempt to reclaim any 6056 locks which it did not hold at the end of its most recent 6057 successfully established client lease. 6059 o Server's responsibility: A server MUST NOT allow a client to 6060 reclaim a lock unless it knows that it could not have since 6061 granted a conflicting lock. However, in deciding whether a 6062 conflicting lock could have been granted, it is permitted to 6063 assume its clients are responsible, as above. 6065 A server may consider a client's lease "successfully established" 6066 once it has received an open operation from that client. 6068 The next sections give examples showing what can go wrong if these 6069 responsibilites are neglected, and provides examples of server 6070 implementation strategies that could meet a server's 6071 responsibilities. 6073 9.6.3.1.1. First Server Edge Condition 6075 The first edge condition has the following scenario: 6077 1. Client A acquires a lock. 6079 2. Client A and server experience mutual network partition, such 6080 that client A is unable to renew its lease. 6082 3. Client A's lease expires, so server releases lock. 6084 4. Client B acquires a lock that would have conflicted with that of 6085 Client A. 6087 5. Client B releases the lock 6089 6. Server reboots 6090 7. Network partition between client A and server heals. 6092 8. Client A issues a RENEW operation, and gets back a 6093 NFS4ERR_STALE_CLIENTID. 6095 9. Client A reclaims its lock within the server's grace period. 6097 Thus, at the final step, the server has erroneously granted client 6098 A's lock reclaim. If client B modified the object the lock was 6099 protecting, client A will experience object corruption. 6101 9.6.3.1.2. Second Server Edge Condition 6103 The second known edge condition follows: 6105 1. Client A acquires a lock. 6107 2. Server reboots. 6109 3. Client A and server experience mutual network partition, such 6110 that client A is unable to reclaim its lock within the grace 6111 period. 6113 4. Server's reclaim grace period ends. Client A has no locks 6114 recorded on server. 6116 5. Client B acquires a lock that would have conflicted with that of 6117 Client A. 6119 6. Client B releases the lock. 6121 7. Server reboots a second time. 6123 8. Network partition between client A and server heals. 6125 9. Client A issues a RENEW operation, and gets back a 6126 NFS4ERR_STALE_CLIENTID. 6128 10. Client A reclaims its lock within the server's grace period. 6130 As with the first edge condition, the final step of the scenario of 6131 the second edge condition has the server erroneously granting client 6132 A's lock reclaim. 6134 9.6.3.1.3. Handling Server Edge Conditions 6136 In both of the above examples, the client attempts reclaim of a lock 6137 that it held at the end of its most recent successfully established 6138 lease; thus, it has fulfilled its responsibility. 6140 The server, however, has failed, by granting a reclaim, despite 6141 having granted a conflicting lock since the reclaimed lock was last 6142 held. 6144 Solving these edge conditions requires that the server either assume 6145 after it reboots that edge condition occurs, and thus return 6146 NFS4ERR_NO_GRACE for all reclaim attempts, or that the server record 6147 some information in stable storage. The amount of information the 6148 server records in stable storage is in inverse proportion to how 6149 harsh the server wants to be whenever the edge conditions occur. The 6150 server that is completely tolerant of all edge conditions will record 6151 in stable storage every lock that is acquired, removing the lock 6152 record from stable storage only when the lock is unlocked by the 6153 client and the lock's lockowner advances the sequence number such 6154 that the lock release is not the last stateful event for the 6155 lockowner's sequence. For the two aforementioned edge conditions, 6156 the harshest a server can be, and still support a grace period for 6157 reclaims, requires that the server record in stable storage 6158 information some minimal information. For example, a server 6159 implementation could, for each client, save in stable storage a 6160 record containing: 6162 o the client's id string 6164 o a boolean that indicates if the client's lease expired or if there 6165 was administrative intervention (see Section 9.8) to revoke a 6166 byte-range lock, share reservation, or delegation 6168 o a timestamp that is updated the first time after a server boot or 6169 reboot the client acquires byte-range locking, share reservation, 6170 or delegation state on the server. The timestamp need not be 6171 updated on subsequent lock requests until the server reboots. 6173 The server implementation would also record in the stable storage the 6174 timestamps from the two most recent server reboots. 6176 Assuming the above record keeping, for the first edge condition, 6177 after the server reboots, the record that client A's lease expired 6178 means that another client could have acquired a conflicting record 6179 lock, share reservation, or delegation. Hence the server must reject 6180 a reclaim from client A with the error NFS4ERR_NO_GRACE. 6182 For the second edge condition, after the server reboots for a second 6183 time, the record that the client had an unexpired record lock, share 6184 reservation, or delegation established before the server's previous 6185 incarnation means that the server must reject a reclaim from client A 6186 with the error NFS4ERR_NO_GRACE. 6188 Regardless of the level and approach to record keeping, the server 6189 MUST implement one of the following strategies (which apply to 6190 reclaims of share reservations, byte-range locks, and delegations): 6192 1. Reject all reclaims with NFS4ERR_NO_GRACE. This is super harsh, 6193 but necessary if the server does not want to record lock state in 6194 stable storage. 6196 2. Record sufficient state in stable storage to meet its 6197 responsibilities. In doubt, the server should err on the side of 6198 being harsh. 6200 In the event that, after a server reboot, the server determines 6201 that there is unrecoverable damage or corruption to the the 6202 stable storage, then for all clients and/or locks affected, the 6203 server MUST return NFS4ERR_NO_GRACE. 6205 9.6.3.1.4. Client Edge Condition 6207 A third edge condition effects the client and not the server. If the 6208 server reboots in the middle of the client reclaiming some locks and 6209 then a network partition is established, the client might be in the 6210 situation of having reclaimed some, but not all locks. In that case, 6211 a conservative client would assume that the non-reclaimed locks were 6212 revoked. 6214 The third known edge condition follows: 6216 1. Client A acquires a lock 1. 6218 2. Client A acquires a lock 2. 6220 3. Server reboots. 6222 4. Client A issues a RENEW operation, and gets back a 6223 NFS4ERR_STALE_CLIENTID. 6225 5. Client A reclaims its lock 1 within the server's grace period. 6227 6. Client A and server experience mutual network partition, such 6228 that client A is unable to reclaim its remaining locks within 6229 the grace period. 6231 7. Server's reclaim grace period ends. 6233 8. Client B acquires a lock that would have conflicted with Client 6234 A's lock 2. 6236 9. Client B releases the lock. 6238 10. Server reboots a second time. 6240 11. Network partition between client A and server heals. 6242 12. Client A issues a RENEW operation, and gets back a 6243 NFS4ERR_STALE_CLIENTID. 6245 13. Client A reclaims both lock 1 and lock 2 within the server's 6246 grace period. 6248 At the last step, the client reclaims lock 2 as if it had held that 6249 lock continuously, when in fact a conflicting lock was granted to 6250 client B. 6252 This occurs because the client failed its responsibility, by 6253 attempting to reclaim lock 2 even though it had not held that lock at 6254 the end of the lease that was established by the SETCLIENTID after 6255 the first server reboot. (The client did hold lock 2 on a previous 6256 lease. But it is only the most recent lease that matters.) 6258 A server could avoid this situation by rejecting the reclaim of lock 6259 2. However, to do so accurately it would have to ensure that 6260 additional information about individual locks held survives reboot. 6261 Server implementations are not required to do that, so the client 6262 must not assume that the server will. 6264 Instead, a client MUST reclaim only those locks which it successfully 6265 acquired from the previous server instance, omitting any that it 6266 failed to reclaim before a new reboot. Thus, in the last step above, 6267 client A should reclaim only lock 1. 6269 9.6.3.1.5. Client's Handling of NFS4ERR_NO_GRACE 6271 A mandate for the client's handling of the NFS4ERR_NO_GRACE error is 6272 outside the scope of this specification, since the strategies for 6273 such handling are very dependent on the client's operating 6274 environment. However, one potential approach is described below. 6276 When the client receives NFS4ERR_NO_GRACE, it could examine the 6277 change attribute of the objects the client is trying to reclaim state 6278 for, and use that to determine whether to re-establish the state via 6279 normal OPEN or LOCK requests. This is acceptable provided the 6280 client's operating environment allows it. In other words, the client 6281 implementor is advised to document for his users the behavior. The 6282 client could also inform the application that its byte-range lock or 6283 share reservations (whether they were delegated or not) have been 6284 lost, such as via a UNIX signal, a GUI pop-up window, etc. See 6285 Section 10.5, for a discussion of what the client should do for 6286 dealing with unreclaimed delegations on client state. 6288 For further discussion of revocation of locks see Section 9.8. 6290 9.6.3.2. Client's Reaction to a Freed Lock 6292 There is no way for a client to predetermine how a given server is 6293 going to behave during a network partition. When the partition 6294 heals, either the client still has all of its locks, it has some of 6295 its locks, or it has none of them. The client will be able to 6296 examine the various error return values to determine its response. 6298 NFS4ERR_EXPIRED: 6300 All locks has been revoked during the partition. The client 6301 should use a SETCLIENTID to recover. 6303 NFS4ERR_ADMIN_REVOKED: 6305 The current lock has been revoked during the partition and there 6306 is no clue as to whether the server rebooted. 6308 NFS4ERR_BAD_STATEID: 6310 The current lock has been revoked during the partition and the 6311 server did not reboot. Other locks MAY still be renewed. The 6312 client MAY NOT want to do a SETCLIENTID and instead SHOULD probe 6313 via a RENEW call. 6315 NFS4ERR_NO_GRACE: 6317 The current lock has been revoked during the partition and the 6318 server rebooted. The server might have no information on the 6319 other locks. They may still be renewable. 6321 NFS4ERR_OLD_STATEID: 6323 The server has not rebooted. The client SHOULD handle this error 6324 as it normally would. 6326 9.7. Recovery from a Lock Request Timeout or Abort 6328 In the event a lock request times out, a client may decide to not 6329 retry the request. The client may also abort the request when the 6330 process for which it was issued is terminated (e.g., in UNIX due to a 6331 signal). It is possible though that the server received the request 6332 and acted upon it. This would change the state on the server without 6333 the client being aware of the change. It is paramount that the 6334 client re-synchronize state with server before it attempts any other 6335 operation that takes a seqid and/or a stateid with the same lock- 6336 owner. This is straightforward to do without a special re- 6337 synchronize operation. 6339 Since the server maintains the last lock request and response 6340 received on the lock-owner, for each lock-owner, the client should 6341 cache the last lock request it sent such that the lock request did 6342 not receive a response. From this, the next time the client does a 6343 lock operation for the lock-owner, it can send the cached request, if 6344 there is one, and if the request was one that established state 6345 (e.g., a LOCK or OPEN operation), the server will return the cached 6346 result or if never saw the request, perform it. The client can 6347 follow up with a request to remove the state (e.g., a LOCKU or CLOSE 6348 operation). With this approach, the sequencing and stateid 6349 information on the client and server for the given lock-owner will 6350 re-synchronize and in turn the lock state will re-synchronize. 6352 9.8. Server Revocation of Locks 6354 At any point, the server can revoke locks held by a client and the 6355 client must be prepared for this event. When the client detects that 6356 its locks have been or may have been revoked, the client is 6357 responsible for validating the state information between itself and 6358 the server. Validating locking state for the client means that it 6359 must verify or reclaim state for each lock currently held. 6361 The first instance of lock revocation is upon server reboot or re- 6362 initialization. In this instance the client will receive an error 6363 (NFS4ERR_STALE_STATEID or NFS4ERR_STALE_CLIENTID) and the client will 6364 proceed with normal crash recovery as described in the previous 6365 section. 6367 The second lock revocation event is the inability to renew the lease 6368 before expiration. While this is considered a rare or unusual event, 6369 the client must be prepared to recover. Both the server and client 6370 will be able to detect the failure to renew the lease and are capable 6371 of recovering without data corruption. For the server, it tracks the 6372 last renewal event serviced for the client and knows when the lease 6373 will expire. Similarly, the client must track operations which will 6374 renew the lease period. Using the time that each such request was 6375 sent and the time that the corresponding reply was received, the 6376 client should bound the time that the corresponding renewal could 6377 have occurred on the server and thus determine if it is possible that 6378 a lease period expiration could have occurred. 6380 The third lock revocation event can occur as a result of 6381 administrative intervention within the lease period. While this is 6382 considered a rare event, it is possible that the server's 6383 administrator has decided to release or revoke a particular lock held 6384 by the client. As a result of revocation, the client will receive an 6385 error of NFS4ERR_ADMIN_REVOKED. In this instance the client may 6386 assume that only the lock-owner's locks have been lost. The client 6387 notifies the lock holder appropriately. The client may not assume 6388 the lease period has been renewed as a result of a failed operation. 6390 When the client determines the lease period may have expired, the 6391 client must mark all locks held for the associated lease as 6392 "unvalidated". This means the client has been unable to re-establish 6393 or confirm the appropriate lock state with the server. As described 6394 in Section 9.6, there are scenarios in which the server may grant 6395 conflicting locks after the lease period has expired for a client. 6396 When it is possible that the lease period has expired, the client 6397 must validate each lock currently held to ensure that a conflicting 6398 lock has not been granted. The client may accomplish this task by 6399 issuing an I/O request, either a pending I/O or a zero-length read, 6400 specifying the stateid associated with the lock in question. If the 6401 response to the request is success, the client has validated all of 6402 the locks governed by that stateid and re-established the appropriate 6403 state between itself and the server. 6405 If the I/O request is not successful, then one or more of the locks 6406 associated with the stateid was revoked by the server and the client 6407 must notify the owner. 6409 9.9. Share Reservations 6411 A share reservation is a mechanism to control access to a file. It 6412 is a separate and independent mechanism from byte-range locking. 6413 When a client opens a file, it issues an OPEN operation to the server 6414 specifying the type of access required (READ, WRITE, or BOTH) and the 6415 type of access to deny others (OPEN4_SHARE_DENY_NONE, 6416 OPEN4_SHARE_DENY_READ, OPEN4_SHARE_DENY_WRITE, or 6417 OPEN4_SHARE_DENY_BOTH). If the OPEN fails the client will fail the 6418 application's open request. 6420 Pseudo-code definition of the semantics: 6422 if (request.access == 0) 6423 return (NFS4ERR_INVAL) 6424 else if ((request.access & file_state.deny)) || 6425 (request.deny & file_state.access)) 6426 return (NFS4ERR_DENIED) 6428 This checking of share reservations on OPEN is done with no exception 6429 for an existing OPEN for the same open-owner. 6431 The constants used for the OPEN and OPEN_DOWNGRADE operations for the 6432 access and deny fields are as follows: 6434 const OPEN4_SHARE_ACCESS_READ = 0x00000001; 6435 const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; 6436 const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; 6438 const OPEN4_SHARE_DENY_NONE = 0x00000000; 6439 const OPEN4_SHARE_DENY_READ = 0x00000001; 6440 const OPEN4_SHARE_DENY_WRITE = 0x00000002; 6441 const OPEN4_SHARE_DENY_BOTH = 0x00000003; 6443 9.10. OPEN/CLOSE Operations 6445 To provide correct share semantics, a client MUST use the OPEN 6446 operation to obtain the initial filehandle and indicate the desired 6447 access and what access, if any, to deny. Even if the client intends 6448 to use a stateid of all 0's or all 1's, it must still obtain the 6449 filehandle for the regular file with the OPEN operation so the 6450 appropriate share semantics can be applied. Clients that do not have 6451 a deny mode built into their programming interfaces for opening a 6452 file should request a deny mode of OPEN4_SHARE_DENY_NONE. 6454 The OPEN operation with the CREATE flag, also subsumes the CREATE 6455 operation for regular files as used in previous versions of the NFS 6456 protocol. This allows a create with a share to be done atomically. 6458 The CLOSE operation removes all share reservations held by the lock- 6459 owner on that file. If byte-range locks are held, the client SHOULD 6460 release all locks before issuing a CLOSE. The server MAY free all 6461 outstanding locks on CLOSE but some servers may not support the CLOSE 6462 of a file that still has byte-range locks held. The server MUST 6463 return failure, NFS4ERR_LOCKS_HELD, if any locks would exist after 6464 the CLOSE. 6466 The LOOKUP operation will return a filehandle without establishing 6467 any lock state on the server. Without a valid stateid, the server 6468 will assume the client has the least access. For example, if one 6469 client opened a file with OPEN4_SHARE_DENY_BOTH and another client 6470 accesses the file via a filehandle obtained through LOOKUP, the 6471 second client could only read the file using the special read bypass 6472 stateid. The second client could not WRITE the file at all because 6473 it would not have a valid stateid from OPEN and the special anonymous 6474 stateid would not be allowed access. 6476 9.10.1. Close and Retention of State Information 6478 Since a CLOSE operation requests deallocation of a stateid, dealing 6479 with retransmission of the CLOSE, may pose special difficulties, 6480 since the state information, which normally would be used to 6481 determine the state of the open file being designated, might be 6482 deallocated, resulting in an NFS4ERR_BAD_STATEID error. 6484 Servers may deal with this problem in a number of ways. To provide 6485 the greatest degree assurance that the protocol is being used 6486 properly, a server should, rather than deallocate the stateid, mark 6487 it as close-pending, and retain the stateid with this status, until 6488 later deallocation. In this way, a retransmitted CLOSE can be 6489 recognized since the stateid points to state information with this 6490 distinctive status, so that it can be handled without error. 6492 When adopting this strategy, a server should retain the state 6493 information until the earliest of: 6495 o Another validly sequenced request for the same lockowner, that is 6496 not a retransmission. 6498 o The time that a lockowner is freed by the server due to period 6499 with no activity. 6501 o All locks for the client are freed as a result of a SETCLIENTID. 6503 Servers may avoid this complexity, at the cost of less complete 6504 protocol error checking, by simply responding NFS4_OK in the event of 6505 a CLOSE for a deallocated stateid, on the assumption that this case 6506 must be caused by a retransmitted close. When adopting this 6507 approach, it is desirable to at least log an error when returning a 6508 no-error indication in this situation. If the server maintains a 6509 reply-cache mechanism, it can verify the CLOSE is indeed a 6510 retransmission and avoid error logging in most cases. 6512 9.11. Open Upgrade and Downgrade 6514 When an OPEN is done for a file and the lockowner for which the open 6515 is being done already has the file open, the result is to upgrade the 6516 open file status maintained on the server to include the access and 6517 deny bits specified by the new OPEN as well as those for the existing 6518 OPEN. The result is that there is one open file, as far as the 6519 protocol is concerned, and it includes the union of the access and 6520 deny bits for all of the OPEN requests completed. Only a single 6521 CLOSE will be done to reset the effects of both OPENs. Note that the 6522 client, when issuing the OPEN, may not know that the same file is in 6523 fact being opened. The above only applies if both OPENs result in 6524 the OPENed object being designated by the same filehandle. 6526 When the server chooses to export multiple filehandles corresponding 6527 to the same file object and returns different filehandles on two 6528 different OPENs of the same file object, the server MUST NOT "OR" 6529 together the access and deny bits and coalesce the two open files. 6530 Instead the server must maintain separate OPENs with separate 6531 stateids and will require separate CLOSEs to free them. 6533 When multiple open files on the client are merged into a single open 6534 file object on the server, the close of one of the open files (on the 6535 client) may necessitate change of the access and deny status of the 6536 open file on the server. This is because the union of the access and 6537 deny bits for the remaining opens may be smaller (i.e., a proper 6538 subset) than previously. The OPEN_DOWNGRADE operation is used to 6539 make the necessary change and the client should use it to update the 6540 server so that share reservation requests by other clients are 6541 handled properly. The stateid returned has the same "other" field as 6542 that passed to the server. The "seqid" value in the returned stateid 6543 MUST be incremented, even in situations in which there is no change 6544 to the access and deny bits for the file. 6546 9.12. Short and Long Leases 6548 When determining the time period for the server lease, the usual 6549 lease tradeoffs apply. Short leases are good for fast server 6550 recovery at a cost of increased RENEW or READ (with zero length) 6551 requests. Longer leases are certainly kinder and gentler to servers 6552 trying to handle very large numbers of clients. The number of RENEW 6553 requests drop in proportion to the lease time. The disadvantages of 6554 long leases are slower recovery after server failure (the server must 6555 wait for the leases to expire and the grace period to elapse before 6556 granting new lock requests) and increased file contention (if client 6557 fails to transmit an unlock request then server must wait for lease 6558 expiration before granting new locks). 6560 Long leases are usable if the server is able to store lease state in 6561 non-volatile memory. Upon recovery, the server can reconstruct the 6562 lease state from its non-volatile memory and continue operation with 6563 its clients and therefore long leases would not be an issue. 6565 9.13. Clocks, Propagation Delay, and Calculating Lease Expiration 6567 To avoid the need for synchronized clocks, lease times are granted by 6568 the server as a time delta. However, there is a requirement that the 6569 client and server clocks do not drift excessively over the duration 6570 of the lock. There is also the issue of propagation delay across the 6571 network which could easily be several hundred milliseconds as well as 6572 the possibility that requests will be lost and need to be 6573 retransmitted. 6575 To take propagation delay into account, the client should subtract it 6576 from lease times (e.g., if the client estimates the one-way 6577 propagation delay as 200 msec, then it can assume that the lease is 6578 already 200 msec old when it gets it). In addition, it will take 6579 another 200 msec to get a response back to the server. So the client 6580 must send a lock renewal or write data back to the server 400 msec 6581 before the lease would expire. 6583 The server's lease period configuration should take into account the 6584 network distance of the clients that will be accessing the server's 6585 resources. It is expected that the lease period will take into 6586 account the network propagation delays and other network delay 6587 factors for the client population. Since the protocol does not allow 6588 for an automatic method to determine an appropriate lease period, the 6589 server's administrator may have to tune the lease period. 6591 9.14. Migration, Replication and State 6593 When responsibility for handling a given file system is transferred 6594 to a new server (migration) or the client chooses to use an alternate 6595 server (e.g., in response to server unresponsiveness) in the context 6596 of file system replication, the appropriate handling of state shared 6597 between the client and server (i.e., locks, leases, stateids, and 6598 client IDs) is as described below. The handling differs between 6599 migration and replication. For related discussion of file server 6600 state and recover of such see the sections under Section 9.6. 6602 If a server replica or a server immigrating a filesystem agrees to, 6603 or is expected to, accept opaque values from the client that 6604 originated from another server, then it is a wise implementation 6605 practice for the servers to encode the "opaque" values in network 6606 byte order. This way, servers acting as replicas or immigrating 6607 filesystems will be able to parse values like stateids, directory 6608 cookies, filehandles, etc. even if their native byte order is 6609 different from other servers cooperating in the replication and 6610 migration of the filesystem. 6612 9.14.1. Migration and State 6614 In the case of migration, the servers involved in the migration of a 6615 filesystem SHOULD transfer all server state from the original to the 6616 new server. This must be done in a way that is transparent to the 6617 client. This state transfer will ease the client's transition when a 6618 filesystem migration occurs. If the servers are successful in 6619 transferring all state, the client will continue to use stateids 6620 assigned by the original server. Therefore the new server must 6621 recognize these stateids as valid. This holds true for the client ID 6622 as well. Since responsibility for an entire filesystem is 6623 transferred with a migration event, there is no possibility that 6624 conflicts will arise on the new server as a result of the transfer of 6625 locks. 6627 As part of the transfer of information between servers, leases would 6628 be transferred as well. The leases being transferred to the new 6629 server will typically have a different expiration time from those for 6630 the same client, previously on the old server. To maintain the 6631 property that all leases on a given server for a given client expire 6632 at the same time, the server should advance the expiration time to 6633 the later of the leases being transferred or the leases already 6634 present. This allows the client to maintain lease renewal of both 6635 classes without special effort. 6637 The servers may choose not to transfer the state information upon 6638 migration. However, this choice is discouraged. In this case, when 6639 the client presents state information from the original server (e.g., 6640 in a RENEW op or a READ op of zero length), the client must be 6641 prepared to receive either NFS4ERR_STALE_CLIENTID or 6642 NFS4ERR_STALE_STATEID from the new server. The client should then 6643 recover its state information as it normally would in response to a 6644 server failure. The new server must take care to allow for the 6645 recovery of state information as it would in the event of server 6646 restart. 6648 A client SHOULD re-establish new callback information with the new 6649 server as soon as possible, according to sequences described in 6650 Section 15.35 and Section 15.36. This ensures that server operations 6651 are not blocked by the inability to recall delegations. 6653 9.14.2. Replication and State 6655 Since client switch-over in the case of replication is not under 6656 server control, the handling of state is different. In this case, 6657 leases, stateids and client IDs do not have validity across a 6658 transition from one server to another. The client must re-establish 6659 its locks on the new server. This can be compared to the re- 6660 establishment of locks by means of reclaim-type requests after a 6661 server reboot. The difference is that the server has no provision to 6662 distinguish requests reclaiming locks from those obtaining new locks 6663 or to defer the latter. Thus, a client re-establishing a lock on the 6664 new server (by means of a LOCK or OPEN request), may have the 6665 requests denied due to a conflicting lock. Since replication is 6666 intended for read-only use of filesystems, such denial of locks 6667 should not pose large difficulties in practice. When an attempt to 6668 re-establish a lock on a new server is denied, the client should 6669 treat the situation as if his original lock had been revoked. 6671 9.14.3. Notification of Migrated Lease 6673 In the case of lease renewal, the client may not be submitting 6674 requests for a filesystem that has been migrated to another server. 6675 This can occur because of the implicit lease renewal mechanism. The 6676 client renews leases for all filesystems when submitting a request to 6677 any one filesystem at the server. 6679 In order for the client to schedule renewal of leases that may have 6680 been relocated to the new server, the client must find out about 6681 lease relocation before those leases expire. To accomplish this, all 6682 operations which implicitly renew leases for a client (such as OPEN, 6683 CLOSE, READ, WRITE, RENEW, LOCK, and others), will return the error 6684 NFS4ERR_LEASE_MOVED if responsibility for any of the leases to be 6685 renewed has been transferred to a new server. This condition will 6686 continue until the client receives an NFS4ERR_MOVED error and the 6687 server receives the subsequent GETATTR(fs_locations) for an access to 6688 each filesystem for which a lease has been moved to a new server. By 6689 convention, the compound including the GETATTR(fs_locations) SHOULD 6690 append a RENEW operation to permit the server to identify the client 6691 doing the access. 6693 Upon receiving the NFS4ERR_LEASE_MOVED error, a client that supports 6694 filesystem migration MUST probe all filesystems from that server on 6695 which it holds open state. Once the client has successfully probed 6696 all those filesystems which are migrated, the server MUST resume 6697 normal handling of stateful requests from that client. 6699 In order to support legacy clients that do not handle the 6700 NFS4ERR_LEASE_MOVED error correctly, the server SHOULD time out after 6701 a wait of at least two lease periods, at which time it will resume 6702 normal handling of stateful requests from all clients. If a client 6703 attempts to access the migrated files, the server MUST reply 6704 NFS4ERR_MOVED. 6706 When the client receives an NFS4ERR_MOVED error, the client can 6707 follow the normal process to obtain the new server information 6708 (through the fs_locations attribute) and perform renewal of those 6709 leases on the new server. If the server has not had state 6710 transferred to it transparently, the client will receive either 6711 NFS4ERR_STALE_CLIENTID or NFS4ERR_STALE_STATEID from the new server, 6712 as described above. The client can then recover state information as 6713 it does in the event of server failure. 6715 9.14.4. Migration and the Lease_time Attribute 6717 In order that the client may appropriately manage its leases in the 6718 case of migration, the destination server must establish proper 6719 values for the lease_time attribute. 6721 When state is transferred transparently, that state should include 6722 the correct value of the lease_time attribute. The lease_time 6723 attribute on the destination server must never be less than that on 6724 the source since this would result in premature expiration of leases 6725 granted by the source server. Upon migration in which state is 6726 transferred transparently, the client is under no obligation to re- 6727 fetch the lease_time attribute and may continue to use the value 6728 previously fetched (on the source server). 6730 If state has not been transferred transparently (i.e., the client 6731 sees a real or simulated server reboot), the client should fetch the 6732 value of lease_time on the new (i.e., destination) server, and use it 6733 for subsequent locking requests. However the server must respect a 6734 grace period at least as long as the lease_time on the source server, 6735 in order to ensure that clients have ample time to reclaim their 6736 locks before potentially conflicting non-reclaimed locks are granted. 6737 The means by which the new server obtains the value of lease_time on 6738 the old server is left to the server implementations. It is not 6739 specified by the NFS version 4 protocol. 6741 10. Client-Side Caching 6743 Client-side caching of data, of file attributes, and of file names is 6744 essential to providing good performance with the NFS protocol. 6745 Providing distributed cache coherence is a difficult problem and 6746 previous versions of the NFS protocol have not attempted it. 6747 Instead, several NFS client implementation techniques have been used 6748 to reduce the problems that a lack of coherence poses for users. 6749 These techniques have not been clearly defined by earlier protocol 6750 specifications and it is often unclear what is valid or invalid 6751 client behavior. 6753 The NFSv4 protocol uses many techniques similar to those that have 6754 been used in previous protocol versions. The NFSv4 protocol does not 6755 provide distributed cache coherence. However, it defines a more 6756 limited set of caching guarantees to allow locks and share 6757 reservations to be used without destructive interference from client 6758 side caching. 6760 In addition, the NFSv4 protocol introduces a delegation mechanism 6761 which allows many decisions normally made by the server to be made 6762 locally by clients. This mechanism provides efficient support of the 6763 common cases where sharing is infrequent or where sharing is read- 6764 only. 6766 10.1. Performance Challenges for Client-Side Caching 6768 Caching techniques used in previous versions of the NFS protocol have 6769 been successful in providing good performance. However, several 6770 scalability challenges can arise when those techniques are used with 6771 very large numbers of clients. This is particularly true when 6772 clients are geographically distributed which classically increases 6773 the latency for cache re-validation requests. 6775 The previous versions of the NFS protocol repeat their file data 6776 cache validation requests at the time the file is opened. This 6777 behavior can have serious performance drawbacks. A common case is 6778 one in which a file is only accessed by a single client. Therefore, 6779 sharing is infrequent. 6781 In this case, repeated reference to the server to find that no 6782 conflicts exist is expensive. A better option with regards to 6783 performance is to allow a client that repeatedly opens a file to do 6784 so without reference to the server. This is done until potentially 6785 conflicting operations from another client actually occur. 6787 A similar situation arises in connection with file locking. Sending 6788 file lock and unlock requests to the server as well as the read and 6789 write requests necessary to make data caching consistent with the 6790 locking semantics (see Section 10.3.2) can severely limit 6791 performance. When locking is used to provide protection against 6792 infrequent conflicts, a large penalty is incurred. This penalty may 6793 discourage the use of file locking by applications. 6795 The NFSv4 protocol provides more aggressive caching strategies with 6796 the following design goals: 6798 o Compatibility with a large range of server semantics. 6800 o Provide the same caching benefits as previous versions of the NFS 6801 protocol when unable to provide the more aggressive model. 6803 o Requirements for aggressive caching are organized so that a large 6804 portion of the benefit can be obtained even when not all of the 6805 requirements can be met. 6807 The appropriate requirements for the server are discussed in later 6808 sections in which specific forms of caching are covered (see 6809 Section 10.4). 6811 10.2. Delegation and Callbacks 6813 Recallable delegation of server responsibilities for a file to a 6814 client improves performance by avoiding repeated requests to the 6815 server in the absence of inter-client conflict. With the use of a 6816 "callback" RPC from server to client, a server recalls delegated 6817 responsibilities when another client engages in sharing of a 6818 delegated file. 6820 A delegation is passed from the server to the client, specifying the 6821 object of the delegation and the type of delegation. There are 6822 different types of delegations but each type contains a stateid to be 6823 used to represent the delegation when performing operations that 6824 depend on the delegation. This stateid is similar to those 6825 associated with locks and share reservations but differs in that the 6826 stateid for a delegation is associated with a client ID and may be 6827 used on behalf of all the open-owners for the given client. A 6828 delegation is made to the client as a whole and not to any specific 6829 process or thread of control within it. 6831 Because callback RPCs may not work in all environments (due to 6832 firewalls, for example), correct protocol operation does not depend 6833 on them. Preliminary testing of callback functionality by means of a 6834 CB_NULL procedure determines whether callbacks can be supported. The 6835 CB_NULL procedure checks the continuity of the callback path. A 6836 server makes a preliminary assessment of callback availability to a 6837 given client and avoids delegating responsibilities until it has 6838 determined that callbacks are supported. Because the granting of a 6839 delegation is always conditional upon the absence of conflicting 6840 access, clients must not assume that a delegation will be granted and 6841 they must always be prepared for OPENs to be processed without any 6842 delegations being granted. 6844 Once granted, a delegation behaves in most ways like a lock. There 6845 is an associated lease that is subject to renewal together with all 6846 of the other leases held by that client. 6848 Unlike locks, an operation by a second client to a delegated file 6849 will cause the server to recall a delegation through a callback. 6851 On recall, the client holding the delegation must flush modified 6852 state (such as modified data) to the server and return the 6853 delegation. The conflicting request will not be acted on until the 6854 recall is complete. The recall is considered complete when the 6855 client returns the delegation or the server times its wait for the 6856 delegation to be returned and revokes the delegation as a result of 6857 the timeout. In the interim, the server will either delay responding 6858 to conflicting requests or respond to them with NFS4ERR_DELAY. 6859 Following the resolution of the recall, the server has the 6860 information necessary to grant or deny the second client's request. 6862 At the time the client receives a delegation recall, it may have 6863 substantial state that needs to be flushed to the server. Therefore, 6864 the server should allow sufficient time for the delegation to be 6865 returned since it may involve numerous RPCs to the server. If the 6866 server is able to determine that the client is diligently flushing 6867 state to the server as a result of the recall, the server may extend 6868 the usual time allowed for a recall. However, the time allowed for 6869 recall completion should not be unbounded. 6871 An example of this is when responsibility to mediate opens on a given 6872 file is delegated to a client (see Section 10.4). The server will 6873 not know what opens are in effect on the client. Without this 6874 knowledge the server will be unable to determine if the access and 6875 deny state for the file allows any particular open until the 6876 delegation for the file has been returned. 6878 A client failure or a network partition can result in failure to 6879 respond to a recall callback. In this case, the server will revoke 6880 the delegation which in turn will render useless any modified state 6881 still on the client. 6883 Clients need to be aware that server implementors may enforce 6884 practical limitations on the number of delegations issued. Further, 6885 as there is no way to determine which delegations to revoke, the 6886 server is allowed to revoke any. If the server is implemented to 6887 revoke another delegation held by that client, then the client may be 6888 able to determine that a limit has been reached because each new 6889 delegation request results in a revoke. The client could then 6890 determine which delegations it may not need and preemptively release 6891 them. 6893 10.2.1. Delegation Recovery 6895 There are three situations that delegation recovery must deal with: 6897 o Client reboot or restart 6898 o Server reboot or restart 6900 o Network partition (full or callback-only) 6902 In the event the client reboots or restarts, the failure to renew 6903 leases will result in the revocation of byte-range locks and share 6904 reservations. Delegations, however, may be treated a bit 6905 differently. 6907 There will be situations in which delegations will need to be 6908 reestablished after a client reboots or restarts. The reason for 6909 this is the client may have file data stored locally and this data 6910 was associated with the previously held delegations. The client will 6911 need to reestablish the appropriate file state on the server. 6913 To allow for this type of client recovery, the server MAY extend the 6914 period for delegation recovery beyond the typical lease expiration 6915 period. This implies that requests from other clients that conflict 6916 with these delegations will need to wait. Because the normal recall 6917 process may require significant time for the client to flush changed 6918 state to the server, other clients need be prepared for delays that 6919 occur because of a conflicting delegation. This longer interval 6920 would increase the window for clients to reboot and consult stable 6921 storage so that the delegations can be reclaimed. For open 6922 delegations, such delegations are reclaimed using OPEN with a claim 6923 type of CLAIM_DELEGATE_PREV. (See Section 10.5 and Section 15.18 for 6924 discussion of open delegation and the details of OPEN respectively). 6926 A server MAY support a claim type of CLAIM_DELEGATE_PREV, but if it 6927 does, it MUST NOT remove delegations upon SETCLIENTID_CONFIRM, and 6928 instead MUST, for a period of time no less than that of the value of 6929 the lease_time attribute, maintain the client's delegations to allow 6930 time for the client to issue CLAIM_DELEGATE_PREV requests. The 6931 server that supports CLAIM_DELEGATE_PREV MUST support the DELEGPURGE 6932 operation. 6934 When the server reboots or restarts, delegations are reclaimed (using 6935 the OPEN operation with CLAIM_PREVIOUS) in a similar fashion to byte- 6936 range locks and share reservations. However, there is a slight 6937 semantic difference. In the normal case if the server decides that a 6938 delegation should not be granted, it performs the requested action 6939 (e.g., OPEN) without granting any delegation. For reclaim, the 6940 server grants the delegation but a special designation is applied so 6941 that the client treats the delegation as having been granted but 6942 recalled by the server. Because of this, the client has the duty to 6943 write all modified state to the server and then return the 6944 delegation. This process of handling delegation reclaim reconciles 6945 three principles of the NFSv4 protocol: 6947 o Upon reclaim, a client reporting resources assigned to it by an 6948 earlier server instance must be granted those resources. 6950 o The server has unquestionable authority to determine whether 6951 delegations are to be granted and, once granted, whether they are 6952 to be continued. 6954 o The use of callbacks is not to be depended upon until the client 6955 has proven its ability to receive them. 6957 When a client has more than a single open associated with a 6958 delegation, state for those additional opens can be established using 6959 OPEN operations of type CLAIM_DELEGATE_CUR. When these are used to 6960 establish opens associated with reclaimed delegations, the server 6961 MUST allow them when made within the grace period. 6963 When a network partition occurs, delegations are subject to freeing 6964 by the server when the lease renewal period expires. This is similar 6965 to the behavior for locks and share reservations. For delegations, 6966 however, the server may extend the period in which conflicting 6967 requests are held off. Eventually the occurrence of a conflicting 6968 request from another client will cause revocation of the delegation. 6969 A loss of the callback path (e.g., by later network configuration 6970 change) will have the same effect. A recall request will fail and 6971 revocation of the delegation will result. 6973 A client normally finds out about revocation of a delegation when it 6974 uses a stateid associated with a delegation and receives the error 6975 NFS4ERR_EXPIRED. It also may find out about delegation revocation 6976 after a client reboot when it attempts to reclaim a delegation and 6977 receives that same error. Note that in the case of a revoked 6978 OPEN_DELEGATE_WRITE delegation, there are issues because data may 6979 have been modified by the client whose delegation is revoked and 6980 separately by other clients. See Section 10.5.1 for a discussion of 6981 such issues. Note also that when delegations are revoked, 6982 information about the revoked delegation will be written by the 6983 server to stable storage (as described in Section 9.6). This is done 6984 to deal with the case in which a server reboots after revoking a 6985 delegation but before the client holding the revoked delegation is 6986 notified about the revocation. 6988 10.3. Data Caching 6990 When applications share access to a set of files, they need to be 6991 implemented so as to take account of the possibility of conflicting 6992 access by another application. This is true whether the applications 6993 in question execute on different clients or reside on the same 6994 client. 6996 Share reservations and byte-range locks are the facilities the NFS 6997 version 4 protocol provides to allow applications to coordinate 6998 access by providing mutual exclusion facilities. The NFSv4 6999 protocol's data caching must be implemented such that it does not 7000 invalidate the assumptions that those using these facilities depend 7001 upon. 7003 10.3.1. Data Caching and OPENs 7005 In order to avoid invalidating the sharing assumptions that 7006 applications rely on, NFSv4 clients should not provide cached data to 7007 applications or modify it on behalf of an application when it would 7008 not be valid to obtain or modify that same data via a READ or WRITE 7009 operation. 7011 Furthermore, in the absence of open delegation (see Section 10.4) two 7012 additional rules apply. Note that these rules are obeyed in practice 7013 by many NFSv2 and NFSv3 clients. 7015 o First, cached data present on a client must be revalidated after 7016 doing an OPEN. Revalidating means that the client fetches the 7017 change attribute from the server, compares it with the cached 7018 change attribute, and if different, declares the cached data (as 7019 well as the cached attributes) as invalid. This is to ensure that 7020 the data for the OPENed file is still correctly reflected in the 7021 client's cache. This validation must be done at least when the 7022 client's OPEN operation includes DENY=WRITE or BOTH thus 7023 terminating a period in which other clients may have had the 7024 opportunity to open the file with WRITE access. Clients may 7025 choose to do the revalidation more often (i.e., at OPENs 7026 specifying DENY=NONE) to parallel the NFSv3 protocol's practice 7027 for the benefit of users assuming this degree of cache 7028 revalidation. Since the change attribute is updated for data and 7029 metadata modifications, some client implementors may be tempted to 7030 use the time_modify attribute and not change to validate cached 7031 data, so that metadata changes do not spuriously invalidate clean 7032 data. The implementor is cautioned in this approach. The change 7033 attribute is guaranteed to change for each update to the file, 7034 whereas time_modify is guaranteed to change only at the 7035 granularity of the time_delta attribute. Use by the client's data 7036 cache validation logic of time_modify and not change runs the risk 7037 of the client incorrectly marking stale data as valid. 7039 o Second, modified data must be flushed to the server before closing 7040 a file OPENed for write. This is complementary to the first rule. 7041 If the data is not flushed at CLOSE, the revalidation done after 7042 client OPENs as file is unable to achieve its purpose. The other 7043 aspect to flushing the data before close is that the data must be 7044 committed to stable storage, at the server, before the CLOSE 7045 operation is requested by the client. In the case of a server 7046 reboot or restart and a CLOSEd file, it may not be possible to 7047 retransmit the data to be written to the file. Hence, this 7048 requirement. 7050 10.3.2. Data Caching and File Locking 7052 For those applications that choose to use file locking instead of 7053 share reservations to exclude inconsistent file access, there is an 7054 analogous set of constraints that apply to client side data caching. 7055 These rules are effective only if the file locking is used in a way 7056 that matches in an equivalent way the actual READ and WRITE 7057 operations executed. This is as opposed to file locking that is 7058 based on pure convention. For example, it is possible to manipulate 7059 a two-megabyte file by dividing the file into two one-megabyte 7060 regions and protecting access to the two regions by file locks on 7061 bytes zero and one. A lock for write on byte zero of the file would 7062 represent the right to do READ and WRITE operations on the first 7063 region. A lock for write on byte one of the file would represent the 7064 right to do READ and WRITE operations on the second region. As long 7065 as all applications manipulating the file obey this convention, they 7066 will work on a local filesystem. However, they may not work with the 7067 NFSv4 protocol unless clients refrain from data caching. 7069 The rules for data caching in the file locking environment are: 7071 o First, when a client obtains a file lock for a particular region, 7072 the data cache corresponding to that region (if any cached data 7073 exists) must be revalidated. If the change attribute indicates 7074 that the file may have been updated since the cached data was 7075 obtained, the client must flush or invalidate the cached data for 7076 the newly locked region. A client might choose to invalidate all 7077 of non-modified cached data that it has for the file but the only 7078 requirement for correct operation is to invalidate all of the data 7079 in the newly locked region. 7081 o Second, before releasing a write lock for a region, all modified 7082 data for that region must be flushed to the server. The modified 7083 data must also be written to stable storage. 7085 Note that flushing data to the server and the invalidation of cached 7086 data must reflect the actual byte ranges locked or unlocked. 7087 Rounding these up or down to reflect client cache block boundaries 7088 will cause problems if not carefully done. For example, writing a 7089 modified block when only half of that block is within an area being 7090 unlocked may cause invalid modification to the region outside the 7091 unlocked area. This, in turn, may be part of a region locked by 7092 another client. Clients can avoid this situation by synchronously 7093 performing portions of write operations that overlap that portion 7094 (initial or final) that is not a full block. Similarly, invalidating 7095 a locked area which is not an integral number of full buffer blocks 7096 would require the client to read one or two partial blocks from the 7097 server if the revalidation procedure shows that the data which the 7098 client possesses may not be valid. 7100 The data that is written to the server as a prerequisite to the 7101 unlocking of a region must be written, at the server, to stable 7102 storage. The client may accomplish this either with synchronous 7103 writes or by following asynchronous writes with a COMMIT operation. 7104 This is required because retransmission of the modified data after a 7105 server reboot might conflict with a lock held by another client. 7107 A client implementation may choose to accommodate applications which 7108 use byte-range locking in non-standard ways (e.g., using a byte-range 7109 lock as a global semaphore) by flushing to the server more data upon 7110 a LOCKU than is covered by the locked range. This may include 7111 modified data within files other than the one for which the unlocks 7112 are being done. In such cases, the client must not interfere with 7113 applications whose READs and WRITEs are being done only within the 7114 bounds of record locks which the application holds. For example, an 7115 application locks a single byte of a file and proceeds to write that 7116 single byte. A client that chose to handle a LOCKU by flushing all 7117 modified data to the server could validly write that single byte in 7118 response to an unrelated unlock. However, it would not be valid to 7119 write the entire block in which that single written byte was located 7120 since it includes an area that is not locked and might be locked by 7121 another client. Client implementations can avoid this problem by 7122 dividing files with modified data into those for which all 7123 modifications are done to areas covered by an appropriate byte-range 7124 lock and those for which there are modifications not covered by a 7125 byte-range lock. Any writes done for the former class of files must 7126 not include areas not locked and thus not modified on the client. 7128 10.3.3. Data Caching and Mandatory File Locking 7130 Client side data caching needs to respect mandatory file locking when 7131 it is in effect. The presence of mandatory file locking for a given 7132 file is indicated when the client gets back NFS4ERR_LOCKED from a 7133 READ or WRITE on a file it has an appropriate share reservation for. 7134 When mandatory locking is in effect for a file, the client must check 7135 for an appropriate file lock for data being read or written. If a 7136 lock exists for the range being read or written, the client may 7137 satisfy the request using the client's validated cache. If an 7138 appropriate file lock is not held for the range of the read or write, 7139 the read or write request must not be satisfied by the client's cache 7140 and the request must be sent to the server for processing. When a 7141 read or write request partially overlaps a locked region, the request 7142 should be subdivided into multiple pieces with each region (locked or 7143 not) treated appropriately. 7145 10.3.4. Data Caching and File Identity 7147 When clients cache data, the file data needs to be organized 7148 according to the filesystem object to which the data belongs. For 7149 NFSv3 clients, the typical practice has been to assume for the 7150 purpose of caching that distinct filehandles represent distinct 7151 filesystem objects. The client then has the choice to organize and 7152 maintain the data cache on this basis. 7154 In the NFSv4 protocol, there is now the possibility to have 7155 significant deviations from a "one filehandle per object" model 7156 because a filehandle may be constructed on the basis of the object's 7157 pathname. Therefore, clients need a reliable method to determine if 7158 two filehandles designate the same filesystem object. If clients 7159 were simply to assume that all distinct filehandles denote distinct 7160 objects and proceed to do data caching on this basis, caching 7161 inconsistencies would arise between the distinct client side objects 7162 which mapped to the same server side object. 7164 By providing a method to differentiate filehandles, the NFSv4 7165 protocol alleviates a potential functional regression in comparison 7166 with the NFSv3 protocol. Without this method, caching 7167 inconsistencies within the same client could occur and this has not 7168 been present in previous versions of the NFS protocol. Note that it 7169 is possible to have such inconsistencies with applications executing 7170 on multiple clients but that is not the issue being addressed here. 7172 For the purposes of data caching, the following steps allow an NFSv4 7173 client to determine whether two distinct filehandles denote the same 7174 server side object: 7176 o If GETATTR directed to two filehandles returns different values of 7177 the fsid attribute, then the filehandles represent distinct 7178 objects. 7180 o If GETATTR for any file with an fsid that matches the fsid of the 7181 two filehandles in question returns a unique_handles attribute 7182 with a value of TRUE, then the two objects are distinct. 7184 o If GETATTR directed to the two filehandles does not return the 7185 fileid attribute for both of the handles, then it cannot be 7186 determined whether the two objects are the same. Therefore, 7187 operations which depend on that knowledge (e.g., client side data 7188 caching) cannot be done reliably. Note that if GETATTR does not 7189 return the fileid attribute for both filehandles, it will return 7190 it for neither of the filehandles, since the fsid for both 7191 filehandles is the same. 7193 o If GETATTR directed to the two filehandles returns different 7194 values for the fileid attribute, then they are distinct objects. 7196 o Otherwise they are the same object. 7198 10.4. Open Delegation 7200 When a file is being OPENed, the server may delegate further handling 7201 of opens and closes for that file to the opening client. Any such 7202 delegation is recallable, since the circumstances that allowed for 7203 the delegation are subject to change. In particular, the server may 7204 receive a conflicting OPEN from another client, the server must 7205 recall the delegation before deciding whether the OPEN from the other 7206 client may be granted. Making a delegation is up to the server and 7207 clients should not assume that any particular OPEN either will or 7208 will not result in an open delegation. The following is a typical 7209 set of conditions that servers might use in deciding whether OPEN 7210 should be delegated: 7212 o The client must be able to respond to the server's callback 7213 requests. The server will use the CB_NULL procedure for a test of 7214 callback ability. 7216 o The client must have responded properly to previous recalls. 7218 o There must be no current open conflicting with the requested 7219 delegation. 7221 o There should be no current delegation that conflicts with the 7222 delegation being requested. 7224 o The probability of future conflicting open requests should be low 7225 based on the recent history of the file. 7227 o The existence of any server-specific semantics of OPEN/CLOSE that 7228 would make the required handling incompatible with the prescribed 7229 handling that the delegated client would apply (see below). 7231 There are two types of open delegations, OPEN_DELEGATE_READ and 7232 OPEN_DELEGATE_WRITE. A OPEN_DELEGATE_READ delegation allows a client 7233 to handle, on its own, requests to open a file for reading that do 7234 not deny read access to others. Multiple OPEN_DELEGATE_READ 7235 delegations may be outstanding simultaneously and do not conflict. A 7236 OPEN_DELEGATE_WRITE delegation allows the client to handle, on its 7237 own, all opens. Only one OPEN_DELEGATE_WRITE delegation may exist 7238 for a given file at a given time and it is inconsistent with any 7239 OPEN_DELEGATE_READ delegations. 7241 When a client has a OPEN_DELEGATE_READ delegation, it may not make 7242 any changes to the contents or attributes of the file but it is 7243 assured that no other client may do so. When a client has a 7244 OPEN_DELEGATE_WRITE delegation, it may modify the file data since no 7245 other client will be accessing the file's data. The client holding a 7246 OPEN_DELEGATE_WRITE delegation may only affect file attributes which 7247 are intimately connected with the file data: size, time_modify, 7248 change. 7250 When a client has an open delegation, it does not send OPENs or 7251 CLOSEs to the server but updates the appropriate status internally. 7252 For a OPEN_DELEGATE_READ delegation, opens that cannot be handled 7253 locally (opens for write or that deny read access) must be sent to 7254 the server. 7256 When an open delegation is made, the response to the OPEN contains an 7257 open delegation structure which specifies the following: 7259 o the type of delegation (read or write) 7261 o space limitation information to control flushing of data on close 7262 (OPEN_DELEGATE_WRITE delegation only, see Section 10.4.1) 7264 o an nfsace4 specifying read and write permissions 7266 o a stateid to represent the delegation for READ and WRITE 7268 The delegation stateid is separate and distinct from the stateid for 7269 the OPEN proper. The standard stateid, unlike the delegation 7270 stateid, is associated with a particular lock-owner and will continue 7271 to be valid after the delegation is recalled and the file remains 7272 open. 7274 When a request internal to the client is made to open a file and open 7275 delegation is in effect, it will be accepted or rejected solely on 7276 the basis of the following conditions. Any requirement for other 7277 checks to be made by the delegate should result in open delegation 7278 being denied so that the checks can be made by the server itself. 7280 o The access and deny bits for the request and the file as described 7281 in Section 9.9. 7283 o The read and write permissions as determined below. 7285 The nfsace4 passed with delegation can be used to avoid frequent 7286 ACCESS calls. The permission check should be as follows: 7288 o If the nfsace4 indicates that the open may be done, then it should 7289 be granted without reference to the server. 7291 o If the nfsace4 indicates that the open may not be done, then an 7292 ACCESS request must be sent to the server to obtain the definitive 7293 answer. 7295 The server may return an nfsace4 that is more restrictive than the 7296 actual ACL of the file. This includes an nfsace4 that specifies 7297 denial of all access. Note that some common practices such as 7298 mapping the traditional user "root" to the user "nobody" may make it 7299 incorrect to return the actual ACL of the file in the delegation 7300 response. 7302 The use of delegation together with various other forms of caching 7303 creates the possibility that no server authentication will ever be 7304 performed for a given user since all of the user's requests might be 7305 satisfied locally. Where the client is depending on the server for 7306 authentication, the client should be sure authentication occurs for 7307 each user by use of the ACCESS operation. This should be the case 7308 even if an ACCESS operation would not be required otherwise. As 7309 mentioned before, the server may enforce frequent authentication by 7310 returning an nfsace4 denying all access with every open delegation. 7312 10.4.1. Open Delegation and Data Caching 7314 OPEN delegation allows much of the message overhead associated with 7315 the opening and closing files to be eliminated. An open when an open 7316 delegation is in effect does not require that a validation message be 7317 sent to the server. The continued endurance of the 7318 "OPEN_DELEGATE_READ delegation" provides a guarantee that no OPEN for 7319 write and thus no write has occurred. Similarly, when closing a file 7320 opened for write and if OPEN_DELEGATE_WRITE delegation is in effect, 7321 the data written does not have to be flushed to the server until the 7322 open delegation is recalled. The continued endurance of the open 7323 delegation provides a guarantee that no open and thus no read or 7324 write has been done by another client. 7326 For the purposes of open delegation, READs and WRITEs done without an 7327 OPEN are treated as the functional equivalents of a corresponding 7328 type of OPEN. This refers to the READs and WRITEs that use the 7329 special stateids consisting of all zero bits or all one bits. 7330 Therefore, READs or WRITEs with a special stateid done by another 7331 client will force the server to recall a OPEN_DELEGATE_WRITE 7332 delegation. A WRITE with a special stateid done by another client 7333 will force a recall of OPEN_DELEGATE_READ delegations. 7335 With delegations, a client is able to avoid writing data to the 7336 server when the CLOSE of a file is serviced. The file close system 7337 call is the usual point at which the client is notified of a lack of 7338 stable storage for the modified file data generated by the 7339 application. At the close, file data is written to the server and 7340 through normal accounting the server is able to determine if the 7341 available filesystem space for the data has been exceeded (i.e., 7342 server returns NFS4ERR_NOSPC or NFS4ERR_DQUOT). This accounting 7343 includes quotas. The introduction of delegations requires that a 7344 alternative method be in place for the same type of communication to 7345 occur between client and server. 7347 In the delegation response, the server provides either the limit of 7348 the size of the file or the number of modified blocks and associated 7349 block size. The server must ensure that the client will be able to 7350 flush data to the server of a size equal to that provided in the 7351 original delegation. The server must make this assurance for all 7352 outstanding delegations. Therefore, the server must be careful in 7353 its management of available space for new or modified data taking 7354 into account available filesystem space and any applicable quotas. 7355 The server can recall delegations as a result of managing the 7356 available filesystem space. The client should abide by the server's 7357 state space limits for delegations. If the client exceeds the stated 7358 limits for the delegation, the server's behavior is undefined. 7360 Based on server conditions, quotas or available filesystem space, the 7361 server may grant OPEN_DELEGATE_WRITE delegations with very 7362 restrictive space limitations. The limitations may be defined in a 7363 way that will always force modified data to be flushed to the server 7364 on close. 7366 With respect to authentication, flushing modified data to the server 7367 after a CLOSE has occurred may be problematic. For example, the user 7368 of the application may have logged off the client and unexpired 7369 authentication credentials may not be present. In this case, the 7370 client may need to take special care to ensure that local unexpired 7371 credentials will in fact be available. This may be accomplished by 7372 tracking the expiration time of credentials and flushing data well in 7373 advance of their expiration or by making private copies of 7374 credentials to assure their availability when needed. 7376 10.4.2. Open Delegation and File Locks 7378 When a client holds a OPEN_DELEGATE_WRITE delegation, lock operations 7379 may be performed locally. This includes those required for mandatory 7380 file locking. This can be done since the delegation implies that 7381 there can be no conflicting locks. Similarly, all of the 7382 revalidations that would normally be associated with obtaining locks 7383 and the flushing of data associated with the releasing of locks need 7384 not be done. 7386 When a client holds a OPEN_DELEGATE_READ delegation, lock operations 7387 are not performed locally. All lock operations, including those 7388 requesting non-exclusive locks, are sent to the server for 7389 resolution. 7391 10.4.3. Handling of CB_GETATTR 7393 The server needs to employ special handling for a GETATTR where the 7394 target is a file that has a OPEN_DELEGATE_WRITE delegation in effect. 7395 The reason for this is that the client holding the 7396 OPEN_DELEGATE_WRITE delegation may have modified the data and the 7397 server needs to reflect this change to the second client that 7398 submitted the GETATTR. Therefore, the client holding the 7399 OPEN_DELEGATE_WRITE delegation needs to be interrogated. The server 7400 will use the CB_GETATTR operation. The only attributes that the 7401 server can reliably query via CB_GETATTR are size and change. 7403 Since CB_GETATTR is being used to satisfy another client's GETATTR 7404 request, the server only needs to know if the client holding the 7405 delegation has a modified version of the file. If the client's copy 7406 of the delegated file is not modified (data or size), the server can 7407 satisfy the second client's GETATTR request from the attributes 7408 stored locally at the server. If the file is modified, the server 7409 only needs to know about this modified state. If the server 7410 determines that the file is currently modified, it will respond to 7411 the second client's GETATTR as if the file had been modified locally 7412 at the server. 7414 Since the form of the change attribute is determined by the server 7415 and is opaque to the client, the client and server need to agree on a 7416 method of communicating the modified state of the file. For the size 7417 attribute, the client will report its current view of the file size. 7418 For the change attribute, the handling is more involved. 7420 For the client, the following steps will be taken when receiving a 7421 OPEN_DELEGATE_WRITE delegation: 7423 o The value of the change attribute will be obtained from the server 7424 and cached. Let this value be represented by c. 7426 o The client will create a value greater than c that will be used 7427 for communicating modified data is held at the client. Let this 7428 value be represented by d. 7430 o When the client is queried via CB_GETATTR for the change 7431 attribute, it checks to see if it holds modified data. If the 7432 file is modified, the value d is returned for the change attribute 7433 value. If this file is not currently modified, the client returns 7434 the value c for the change attribute. 7436 For simplicity of implementation, the client MAY for each CB_GETATTR 7437 return the same value d. This is true even if, between successive 7438 CB_GETATTR operations, the client again modifies in the file's data 7439 or metadata in its cache. The client can return the same value 7440 because the only requirement is that the client be able to indicate 7441 to the server that the client holds modified data. Therefore, the 7442 value of d may always be c + 1. 7444 While the change attribute is opaque to the client in the sense that 7445 it has no idea what units of time, if any, the server is counting 7446 change with, it is not opaque in that the client has to treat it as 7447 an unsigned integer, and the server has to be able to see the results 7448 of the client's changes to that integer. Therefore, the server MUST 7449 encode the change attribute in network order when sending it to the 7450 client. The client MUST decode it from network order to its native 7451 order when receiving it and the client MUST encode it network order 7452 when sending it to the server. For this reason, change is defined as 7453 an unsigned integer rather than an opaque array of bytes. 7455 For the server, the following steps will be taken when providing a 7456 OPEN_DELEGATE_WRITE delegation: 7458 o Upon providing a OPEN_DELEGATE_WRITE delegation, the server will 7459 cache a copy of the change attribute in the data structure it uses 7460 to record the delegation. Let this value be represented by sc. 7462 o When a second client sends a GETATTR operation on the same file to 7463 the server, the server obtains the change attribute from the first 7464 client. Let this value be cc. 7466 o If the value cc is equal to sc, the file is not modified and the 7467 server returns the current values for change, time_metadata, and 7468 time_modify (for example) to the second client. 7470 o If the value cc is NOT equal to sc, the file is currently modified 7471 at the first client and most likely will be modified at the server 7472 at a future time. The server then uses its current time to 7473 construct attribute values for time_metadata and time_modify. A 7474 new value of sc, which we will call nsc, is computed by the 7475 server, such that nsc >= sc + 1. The server then returns the 7476 constructed time_metadata, time_modify, and nsc values to the 7477 requester. The server replaces sc in the delegation record with 7478 nsc. To prevent the possibility of time_modify, time_metadata, 7479 and change from appearing to go backward (which would happen if 7480 the client holding the delegation fails to write its modified data 7481 to the server before the delegation is revoked or returned), the 7482 server SHOULD update the file's metadata record with the 7483 constructed attribute values. For reasons of reasonable 7484 performance, committing the constructed attribute values to stable 7485 storage is OPTIONAL. 7487 As discussed earlier in this section, the client MAY return the same 7488 cc value on subsequent CB_GETATTR calls, even if the file was 7489 modified in the client's cache yet again between successive 7490 CB_GETATTR calls. Therefore, the server must assume that the file 7491 has been modified yet again, and MUST take care to ensure that the 7492 new nsc it constructs and returns is greater than the previous nsc it 7493 returned. An example implementation's delegation record would 7494 satisfy this mandate by including a boolean field (let us call it 7495 "modified") that is set to FALSE when the delegation is granted, and 7496 an sc value set at the time of grant to the change attribute value. 7497 The modified field would be set to TRUE the first time cc != sc, and 7498 would stay TRUE until the delegation is returned or revoked. The 7499 processing for constructing nsc, time_modify, and time_metadata would 7500 use this pseudo code: 7502 if (!modified) { 7503 do CB_GETATTR for change and size; 7505 if (cc != sc) 7506 modified = TRUE; 7507 } else { 7508 do CB_GETATTR for size; 7509 } 7511 if (modified) { 7512 sc = sc + 1; 7513 time_modify = time_metadata = current_time; 7514 update sc, time_modify, time_metadata into file's metadata; 7515 } 7517 This would return to the client (that sent GETATTR) the attributes it 7518 requested, but make sure size comes from what CB_GETATTR returned. 7519 The server would not update the file's metadata with the client's 7520 modified size. 7522 In the case that the file attribute size is different than the 7523 server's current value, the server treats this as a modification 7524 regardless of the value of the change attribute retrieved via 7525 CB_GETATTR and responds to the second client as in the last step. 7527 This methodology resolves issues of clock differences between client 7528 and server and other scenarios where the use of CB_GETATTR break 7529 down. 7531 It should be noted that the server is under no obligation to use 7532 CB_GETATTR and therefore the server MAY simply recall the delegation 7533 to avoid its use. 7535 10.4.4. Recall of Open Delegation 7537 The following events necessitate recall of an open delegation: 7539 o Potentially conflicting OPEN request (or READ/WRITE done with 7540 "special" stateid) 7542 o SETATTR issued by another client 7544 o REMOVE request for the file 7546 o RENAME request for the file as either source or target of the 7547 RENAME 7549 Whether a RENAME of a directory in the path leading to the file 7550 results in recall of an open delegation depends on the semantics of 7551 the server filesystem. If that filesystem denies such RENAMEs when a 7552 file is open, the recall must be performed to determine whether the 7553 file in question is, in fact, open. 7555 In addition to the situations above, the server may choose to recall 7556 open delegations at any time if resource constraints make it 7557 advisable to do so. Clients should always be prepared for the 7558 possibility of recall. 7560 When a client receives a recall for an open delegation, it needs to 7561 update state on the server before returning the delegation. These 7562 same updates must be done whenever a client chooses to return a 7563 delegation voluntarily. The following items of state need to be 7564 dealt with: 7566 o If the file associated with the delegation is no longer open and 7567 no previous CLOSE operation has been sent to the server, a CLOSE 7568 operation must be sent to the server. 7570 o If a file has other open references at the client, then OPEN 7571 operations must be sent to the server. The appropriate stateids 7572 will be provided by the server for subsequent use by the client 7573 since the delegation stateid will not longer be valid. These OPEN 7574 requests are done with the claim type of CLAIM_DELEGATE_CUR. This 7575 will allow the presentation of the delegation stateid so that the 7576 client can establish the appropriate rights to perform the OPEN. 7577 (see Section 15.18 for details.) 7579 o If there are granted file locks, the corresponding LOCK operations 7580 need to be performed. This applies to the OPEN_DELEGATE_WRITE 7581 delegation case only. 7583 o For a OPEN_DELEGATE_WRITE delegation, if at the time of recall the 7584 file is not open for write, all modified data for the file must be 7585 flushed to the server. If the delegation had not existed, the 7586 client would have done this data flush before the CLOSE operation. 7588 o For a OPEN_DELEGATE_WRITE delegation when a file is still open at 7589 the time of recall, any modified data for the file needs to be 7590 flushed to the server. 7592 o With the OPEN_DELEGATE_WRITE delegation in place, it is possible 7593 that the file was truncated during the duration of the delegation. 7594 For example, the truncation could have occurred as a result of an 7595 OPEN UNCHECKED4 with a size attribute value of zero. Therefore, 7596 if a truncation of the file has occurred and this operation has 7597 not been propagated to the server, the truncation must occur 7598 before any modified data is written to the server. 7600 In the case of OPEN_DELEGATE_WRITE delegation, file locking imposes 7601 some additional requirements. To precisely maintain the associated 7602 invariant, it is required to flush any modified data in any region 7603 for which a write lock was released while the OPEN_DELEGATE_WRITE 7604 delegation was in effect. However, because the OPEN_DELEGATE_WRITE 7605 delegation implies no other locking by other clients, a simpler 7606 implementation is to flush all modified data for the file (as 7607 described just above) if any write lock has been released while the 7608 OPEN_DELEGATE_WRITE delegation was in effect. 7610 An implementation need not wait until delegation recall (or deciding 7611 to voluntarily return a delegation) to perform any of the above 7612 actions, if implementation considerations (e.g., resource 7613 availability constraints) make that desirable. Generally, however, 7614 the fact that the actual open state of the file may continue to 7615 change makes it not worthwhile to send information about opens and 7616 closes to the server, except as part of delegation return. Only in 7617 the case of closing the open that resulted in obtaining the 7618 delegation would clients be likely to do this early, since, in that 7619 case, the close once done will not be undone. Regardless of the 7620 client's choices on scheduling these actions, all must be performed 7621 before the delegation is returned, including (when applicable) the 7622 close that corresponds to the open that resulted in the delegation. 7623 These actions can be performed either in previous requests or in 7624 previous operations in the same COMPOUND request. 7626 10.4.5. OPEN Delegation Race with CB_RECALL 7628 The server informs the client of recall via a CB_RECALL. A race case 7629 which may develop is when the delegation is immediately recalled 7630 before the COMPOUND which established the delegation is returned to 7631 the client. As the CB_RECALL provides both a stateid and a 7632 filehandle for which the client has no mapping, it cannot honor the 7633 recall attempt. At this point, the client has two choices, either do 7634 not respond or respond with NFS4ERR_BADHANDLE. If it does not 7635 respond, then it runs the risk of the server deciding to not grant it 7636 further delegations. 7638 If instead it does reply with NFS4ERR_BADHANDLE, then both the client 7639 and the server might be able to detect that a race condition is 7640 occurring. The client can keep a list of pending delegations. When 7641 it receives a CB_RECALL for an unknown delegation, it can cache the 7642 stateid and filehandle on a list of pending recalls. When it is 7643 provided with a delegation, it would only use it if it was not on the 7644 pending recall list. Upon the next CB_RECALL, it could immediately 7645 return the delegation. 7647 In turn, the server can keep track of when it issues a delegation and 7648 assume that if a client responds to the CB_RECALL with a 7649 NFS4ERR_BADHANDLE, then the client has yet to receive the delegation. 7650 The server SHOULD give the client a reasonable time both to get this 7651 delegation and to return it before revoking the delegation. Unlike a 7652 failed callback path, the server should periodically probe the client 7653 with CB_RECALL to see if it has received the delegation and is ready 7654 to return it. 7656 When the server finally determines that enough time has lapsed, it 7657 SHOULD revoke the delegation and it SHOULD NOT revoke the lease. 7658 During this extended recall process, the server SHOULD be renewing 7659 the client lease. The intent here is that the client not pay too 7660 onerous a burden for a condition caused by the server. 7662 10.4.6. Clients that Fail to Honor Delegation Recalls 7664 A client may fail to respond to a recall for various reasons, such as 7665 a failure of the callback path from server to the client. The client 7666 may be unaware of a failure in the callback path. This lack of 7667 awareness could result in the client finding out long after the 7668 failure that its delegation has been revoked, and another client has 7669 modified the data for which the client had a delegation. This is 7670 especially a problem for the client that held a OPEN_DELEGATE_WRITE 7671 delegation. 7673 The server also has a dilemma in that the client that fails to 7674 respond to the recall might also be sending other NFS requests, 7675 including those that renew the lease before the lease expires. 7676 Without returning an error for those lease renewing operations, the 7677 server leads the client to believe that the delegation it has is in 7678 force. 7680 This difficulty is solved by the following rules: 7682 o When the callback path is down, the server MUST NOT revoke the 7683 delegation if one of the following occurs: 7685 * The client has issued a RENEW operation and the server has 7686 returned an NFS4ERR_CB_PATH_DOWN error. The server MUST renew 7687 the lease for any byte-range locks and share reservations the 7688 client has that the server has known about (as opposed to those 7689 locks and share reservations the client has established but not 7690 yet sent to the server, due to the delegation). The server 7691 SHOULD give the client a reasonable time to return its 7692 delegations to the server before revoking the client's 7693 delegations. 7695 * The client has not issued a RENEW operation for some period of 7696 time after the server attempted to recall the delegation. This 7697 period of time MUST NOT be less than the value of the 7698 lease_time attribute. 7700 o When the client holds a delegation, it cannot rely on operations, 7701 except for RENEW, that take a stateid, to renew delegation leases 7702 across callback path failures. The client that wants to keep 7703 delegations in force across callback path failures must use RENEW 7704 to do so. 7706 10.4.7. Delegation Revocation 7708 At the point a delegation is revoked, if there are associated opens 7709 on the client, the applications holding these opens need to be 7710 notified. This notification usually occurs by returning errors for 7711 READ/WRITE operations or when a close is attempted for the open file. 7713 If no opens exist for the file at the point the delegation is 7714 revoked, then notification of the revocation is unnecessary. 7715 However, if there is modified data present at the client for the 7716 file, the user of the application should be notified. Unfortunately, 7717 it may not be possible to notify the user since active applications 7718 may not be present at the client. See Section 10.5.1 for additional 7719 details. 7721 10.5. Data Caching and Revocation 7723 When locks and delegations are revoked, the assumptions upon which 7724 successful caching depend are no longer guaranteed. For any locks or 7725 share reservations that have been revoked, the corresponding owner 7726 needs to be notified. This notification includes applications with a 7727 file open that has a corresponding delegation which has been revoked. 7728 Cached data associated with the revocation must be removed from the 7729 client. In the case of modified data existing in the client's cache, 7730 that data must be removed from the client without it being written to 7731 the server. As mentioned, the assumptions made by the client are no 7732 longer valid at the point when a lock or delegation has been revoked. 7733 For example, another client may have been granted a conflicting lock 7734 after the revocation of the lock at the first client. Therefore, the 7735 data within the lock range may have been modified by the other 7736 client. Obviously, the first client is unable to guarantee to the 7737 application what has occurred to the file in the case of revocation. 7739 Notification to a lock owner will in many cases consist of simply 7740 returning an error on the next and all subsequent READs/WRITEs to the 7741 open file or on the close. Where the methods available to a client 7742 make such notification impossible because errors for certain 7743 operations may not be returned, more drastic action such as signals 7744 or process termination may be appropriate. The justification for 7745 this is that an invariant for which an application depends on may be 7746 violated. Depending on how errors are typically treated for the 7747 client operating environment, further levels of notification 7748 including logging, console messages, and GUI pop-ups may be 7749 appropriate. 7751 10.5.1. Revocation Recovery for Write Open Delegation 7753 Revocation recovery for a OPEN_DELEGATE_WRITE delegation poses the 7754 special issue of modified data in the client cache while the file is 7755 not open. In this situation, any client which does not flush 7756 modified data to the server on each close must ensure that the user 7757 receives appropriate notification of the failure as a result of the 7758 revocation. Since such situations may require human action to 7759 correct problems, notification schemes in which the appropriate user 7760 or administrator is notified may be necessary. Logging and console 7761 messages are typical examples. 7763 If there is modified data on the client, it must not be flushed 7764 normally to the server. A client may attempt to provide a copy of 7765 the file data as modified during the delegation under a different 7766 name in the filesystem name space to ease recovery. Note that when 7767 the client can determine that the file has not been modified by any 7768 other client, or when the client has a complete cached copy of file 7769 in question, such a saved copy of the client's view of the file may 7770 be of particular value for recovery. In other case, recovery using a 7771 copy of the file based partially on the client's cached data and 7772 partially on the server copy as modified by other clients, will be 7773 anything but straightforward, so clients may avoid saving file 7774 contents in these situations or mark the results specially to warn 7775 users of possible problems. 7777 Saving of such modified data in delegation revocation situations may 7778 be limited to files of a certain size or might be used only when 7779 sufficient disk space is available within the target filesystem. 7780 Such saving may also be restricted to situations when the client has 7781 sufficient buffering resources to keep the cached copy available 7782 until it is properly stored to the target filesystem. 7784 10.6. Attribute Caching 7786 The attributes discussed in this section do not include named 7787 attributes. Individual named attributes are analogous to files and 7788 caching of the data for these needs to be handled just as data 7789 caching is for ordinary files. Similarly, LOOKUP results from an 7790 OPENATTR directory are to be cached on the same basis as any other 7791 pathnames and similarly for directory contents. 7793 Clients may cache file attributes obtained from the server and use 7794 them to avoid subsequent GETATTR requests. Such caching is write 7795 through in that modification to file attributes is always done by 7796 means of requests to the server and should not be done locally and 7797 cached. The exception to this are modifications to attributes that 7798 are intimately connected with data caching. Therefore, extending a 7799 file by writing data to the local data cache is reflected immediately 7800 in the size as seen on the client without this change being 7801 immediately reflected on the server. Normally such changes are not 7802 propagated directly to the server but when the modified data is 7803 flushed to the server, analogous attribute changes are made on the 7804 server. When open delegation is in effect, the modified attributes 7805 may be returned to the server in the response to a CB_RECALL call. 7807 The result of local caching of attributes is that the attribute 7808 caches maintained on individual clients will not be coherent. 7809 Changes made in one order on the server may be seen in a different 7810 order on one client and in a third order on a different client. 7812 The typical filesystem application programming interfaces do not 7813 provide means to atomically modify or interrogate attributes for 7814 multiple files at the same time. The following rules provide an 7815 environment where the potential incoherency mentioned above can be 7816 reasonably managed. These rules are derived from the practice of 7817 previous NFS protocols. 7819 o All attributes for a given file (per-fsid attributes excepted) are 7820 cached as a unit at the client so that no non-serializability can 7821 arise within the context of a single file. 7823 o An upper time boundary is maintained on how long a client cache 7824 entry can be kept without being refreshed from the server. 7826 o When operations are performed that change attributes at the 7827 server, the updated attribute set is requested as part of the 7828 containing RPC. This includes directory operations that update 7829 attributes indirectly. This is accomplished by following the 7830 modifying operation with a GETATTR operation and then using the 7831 results of the GETATTR to update the client's cached attributes. 7833 Note that if the full set of attributes to be cached is requested by 7834 READDIR, the results can be cached by the client on the same basis as 7835 attributes obtained via GETATTR. 7837 A client may validate its cached version of attributes for a file by 7838 fetching just both the change and time_access attributes and assuming 7839 that if the change attribute has the same value as it did when the 7840 attributes were cached, then no attributes other than time_access 7841 have changed. The reason why time_access is also fetched is because 7842 many servers operate in environments where the operation that updates 7843 change does not update time_access. For example, POSIX file 7844 semantics do not update access time when a file is modified by the 7845 write system call. Therefore, the client that wants a current 7846 time_access value should fetch it with change during the attribute 7847 cache validation processing and update its cached time_access. 7849 The client may maintain a cache of modified attributes for those 7850 attributes intimately connected with data of modified regular files 7851 (size, time_modify, and change). Other than those three attributes, 7852 the client MUST NOT maintain a cache of modified attributes. 7853 Instead, attribute changes are immediately sent to the server. 7855 In some operating environments, the equivalent to time_access is 7856 expected to be implicitly updated by each read of the content of the 7857 file object. If an NFS client is caching the content of a file 7858 object, whether it is a regular file, directory, or symbolic link, 7859 the client SHOULD NOT update the time_access attribute (via SETATTR 7860 or a small READ or READDIR request) on the server with each read that 7861 is satisfied from cache. The reason is that this can defeat the 7862 performance benefits of caching content, especially since an explicit 7863 SETATTR of time_access may alter the change attribute on the server. 7864 If the change attribute changes, clients that are caching the content 7865 will think the content has changed, and will re-read unmodified data 7866 from the server. Nor is the client encouraged to maintain a modified 7867 version of time_access in its cache, since this would mean that the 7868 client will either eventually have to write the access time to the 7869 server with bad performance effects, or it would never update the 7870 server's time_access, thereby resulting in a situation where an 7871 application that caches access time between a close and open of the 7872 same file observes the access time oscillating between the past and 7873 present. The time_access attribute always means the time of last 7874 access to a file by a read that was satisfied by the server. This 7875 way clients will tend to see only time_access changes that go forward 7876 in time. 7878 10.7. Data and Metadata Caching and Memory Mapped Files 7880 Some operating environments include the capability for an application 7881 to map a file's content into the application's address space. Each 7882 time the application accesses a memory location that corresponds to a 7883 block that has not been loaded into the address space, a page fault 7884 occurs and the file is read (or if the block does not exist in the 7885 file, the block is allocated and then instantiated in the 7886 application's address space). 7888 As long as each memory mapped access to the file requires a page 7889 fault, the relevant attributes of the file that are used to detect 7890 access and modification (time_access, time_metadata, time_modify, and 7891 change) will be updated. However, in many operating environments, 7892 when page faults are not required these attributes will not be 7893 updated on reads or updates to the file via memory access (regardless 7894 whether the file is local file or is being access remotely). A 7895 client or server MAY fail to update attributes of a file that is 7896 being accessed via memory mapped I/O. This has several implications: 7898 o If there is an application on the server that has memory mapped a 7899 file that a client is also accessing, the client may not be able 7900 to get a consistent value of the change attribute to determine 7901 whether its cache is stale or not. A server that knows that the 7902 file is memory mapped could always pessimistically return updated 7903 values for change so as to force the application to always get the 7904 most up to date data and metadata for the file. However, due to 7905 the negative performance implications of this, such behavior is 7906 OPTIONAL. 7908 o If the memory mapped file is not being modified on the server, and 7909 instead is just being read by an application via the memory mapped 7910 interface, the client will not see an updated time_access 7911 attribute. However, in many operating environments, neither will 7912 any process running on the server. Thus NFS clients are at no 7913 disadvantage with respect to local processes. 7915 o If there is another client that is memory mapping the file, and if 7916 that client is holding a OPEN_DELEGATE_WRITE delegation, the same 7917 set of issues as discussed in the previous two bullet items apply. 7918 So, when a server does a CB_GETATTR to a file that the client has 7919 modified in its cache, the response from CB_GETATTR will not 7920 necessarily be accurate. As discussed earlier, the client's 7921 obligation is to report that the file has been modified since the 7922 delegation was granted, not whether it has been modified again 7923 between successive CB_GETATTR calls, and the server MUST assume 7924 that any file the client has modified in cache has been modified 7925 again between successive CB_GETATTR calls. Depending on the 7926 nature of the client's memory management system, this weak 7927 obligation may not be possible. A client MAY return stale 7928 information in CB_GETATTR whenever the file is memory mapped. 7930 o The mixture of memory mapping and file locking on the same file is 7931 problematic. Consider the following scenario, where the page size 7932 on each client is 8192 bytes. 7934 * Client A memory maps first page (8192 bytes) of file X 7936 * Client B memory maps first page (8192 bytes) of file X 7938 * Client A write locks first 4096 bytes 7940 * Client B write locks second 4096 bytes 7941 * Client A, via a STORE instruction modifies part of its locked 7942 region. 7944 * Simultaneous to client A, client B issues a STORE on part of 7945 its locked region. 7947 Here the challenge is for each client to resynchronize to get a 7948 correct view of the first page. In many operating environments, the 7949 virtual memory management systems on each client only know a page is 7950 modified, not that a subset of the page corresponding to the 7951 respective lock regions has been modified. So it is not possible for 7952 each client to do the right thing, which is to only write to the 7953 server that portion of the page that is locked. For example, if 7954 client A simply writes out the page, and then client B writes out the 7955 page, client A's data is lost. 7957 Moreover, if mandatory locking is enabled on the file, then we have a 7958 different problem. When clients A and B issue the STORE 7959 instructions, the resulting page faults require a byte-range lock on 7960 the entire page. Each client then tries to extend their locked range 7961 to the entire page, which results in a deadlock. 7963 Communicating the NFS4ERR_DEADLOCK error to a STORE instruction is 7964 difficult at best. 7966 If a client is locking the entire memory mapped file, there is no 7967 problem with advisory or mandatory byte-range locking, at least until 7968 the client unlocks a region in the middle of the file. 7970 Given the above issues the following are permitted: 7972 o Clients and servers MAY deny memory mapping a file they know there 7973 are byte-range locks for. 7975 o Clients and servers MAY deny a byte-range lock on a file they know 7976 is memory mapped. 7978 o A client MAY deny memory mapping a file that it knows requires 7979 mandatory locking for I/O. If mandatory locking is enabled after 7980 the file is opened and mapped, the client MAY deny the application 7981 further access to its mapped file. 7983 10.8. Name Caching 7985 The results of LOOKUP and READDIR operations may be cached to avoid 7986 the cost of subsequent LOOKUP operations. Just as in the case of 7987 attribute caching, inconsistencies may arise among the various client 7988 caches. To mitigate the effects of these inconsistencies and given 7989 the context of typical filesystem APIs, an upper time boundary is 7990 maintained on how long a client name cache entry can be kept without 7991 verifying that the entry has not been made invalid by a directory 7992 change operation performed by another client. 7994 When a client is not making changes to a directory for which there 7995 exist name cache entries, the client needs to periodically fetch 7996 attributes for that directory to ensure that it is not being 7997 modified. After determining that no modification has occurred, the 7998 expiration time for the associated name cache entries may be updated 7999 to be the current time plus the name cache staleness bound. 8001 When a client is making changes to a given directory, it needs to 8002 determine whether there have been changes made to the directory by 8003 other clients. It does this by using the change attribute as 8004 reported before and after the directory operation in the associated 8005 change_info4 value returned for the operation. The server is able to 8006 communicate to the client whether the change_info4 data is provided 8007 atomically with respect to the directory operation. If the change 8008 values are provided atomically, the client is then able to compare 8009 the pre-operation change value with the change value in the client's 8010 name cache. If the comparison indicates that the directory was 8011 updated by another client, the name cache associated with the 8012 modified directory is purged from the client. If the comparison 8013 indicates no modification, the name cache can be updated on the 8014 client to reflect the directory operation and the associated timeout 8015 extended. The post-operation change value needs to be saved as the 8016 basis for future change_info4 comparisons. 8018 As demonstrated by the scenario above, name caching requires that the 8019 client revalidate name cache data by inspecting the change attribute 8020 of a directory at the point when the name cache item was cached. 8021 This requires that the server update the change attribute for 8022 directories when the contents of the corresponding directory is 8023 modified. For a client to use the change_info4 information 8024 appropriately and correctly, the server must report the pre and post 8025 operation change attribute values atomically. When the server is 8026 unable to report the before and after values atomically with respect 8027 to the directory operation, the server must indicate that fact in the 8028 change_info4 return value. When the information is not atomically 8029 reported, the client should not assume that other clients have not 8030 changed the directory. 8032 10.9. Directory Caching 8034 The results of READDIR operations may be used to avoid subsequent 8035 READDIR operations. Just as in the cases of attribute and name 8036 caching, inconsistencies may arise among the various client caches. 8038 To mitigate the effects of these inconsistencies, and given the 8039 context of typical filesystem APIs, the following rules should be 8040 followed: 8042 o Cached READDIR information for a directory which is not obtained 8043 in a single READDIR operation must always be a consistent snapshot 8044 of directory contents. This is determined by using a GETATTR 8045 before the first READDIR and after the last of READDIR that 8046 contributes to the cache. 8048 o An upper time boundary is maintained to indicate the length of 8049 time a directory cache entry is considered valid before the client 8050 must revalidate the cached information. 8052 The revalidation technique parallels that discussed in the case of 8053 name caching. When the client is not changing the directory in 8054 question, checking the change attribute of the directory with GETATTR 8055 is adequate. The lifetime of the cache entry can be extended at 8056 these checkpoints. When a client is modifying the directory, the 8057 client needs to use the change_info4 data to determine whether there 8058 are other clients modifying the directory. If it is determined that 8059 no other client modifications are occurring, the client may update 8060 its directory cache to reflect its own changes. 8062 As demonstrated previously, directory caching requires that the 8063 client revalidate directory cache data by inspecting the change 8064 attribute of a directory at the point when the directory was cached. 8065 This requires that the server update the change attribute for 8066 directories when the contents of the corresponding directory is 8067 modified. For a client to use the change_info4 information 8068 appropriately and correctly, the server must report the pre and post 8069 operation change attribute values atomically. When the server is 8070 unable to report the before and after values atomically with respect 8071 to the directory operation, the server must indicate that fact in the 8072 change_info4 return value. When the information is not atomically 8073 reported, the client should not assume that other clients have not 8074 changed the directory. 8076 11. Minor Versioning 8078 To address the requirement of an NFS protocol that can evolve as the 8079 need arises, the NFSv4 protocol contains the rules and framework to 8080 allow for future minor changes or versioning. 8082 The base assumption with respect to minor versioning is that any 8083 future accepted minor version must follow the IETF process and be 8084 documented in a standards track RFC. Therefore, each minor version 8085 number will correspond to an RFC. Minor version 0 of the NFS version 8086 4 protocol is represented by this RFC. The COMPOUND and CB_COMPOUND 8087 procedures support the encoding of the minor version being requested 8088 by the client. 8090 The following items represent the basic rules for the development of 8091 minor versions. Note that a future minor version may decide to 8092 modify or add to the following rules as part of the minor version 8093 definition. 8095 1. Procedures are not added or deleted 8097 To maintain the general RPC model, NFSv4 minor versions will not 8098 add to or delete procedures from the NFS program. 8100 2. Minor versions may add operations to the COMPOUND and 8101 CB_COMPOUND procedures. 8103 The addition of operations to the COMPOUND and CB_COMPOUND 8104 procedures does not affect the RPC model. 8106 1. Minor versions may append attributes to the bitmap4 that 8107 represents sets of attributes and to the fattr4 that 8108 represents sets of attribute values. 8110 This allows for the expansion of the attribute model to 8111 allow for future growth or adaptation. 8113 2. Minor version X must append any new attributes after the 8114 last documented attribute. 8116 Since attribute results are specified as an opaque array of 8117 per-attribute XDR encoded results, the complexity of adding 8118 new attributes in the midst of the current definitions would 8119 be too burdensome. 8121 3. Minor versions must not modify the structure of an existing 8122 operation's arguments or results. 8124 Again, the complexity of handling multiple structure definitions 8125 for a single operation is too burdensome. New operations should 8126 be added instead of modifying existing structures for a minor 8127 version. 8129 This rule does not preclude the following adaptations in a minor 8130 version. 8132 * adding bits to flag fields, such as new attributes to 8133 GETATTR's bitmap4 data type, and providing corresponding 8134 variants of opaque arrays, such as a notify4 used together 8135 with such bitmaps 8137 * adding bits to existing attributes like ACLs that have flag 8138 words 8140 * extending enumerated types (including NFS4ERR_*) with new 8141 values 8143 4. Minor versions must not modify the structure of existing 8144 attributes. 8146 5. Minor versions must not delete operations. 8148 This prevents the potential reuse of a particular operation 8149 "slot" in a future minor version. 8151 6. Minor versions must not delete attributes. 8153 7. Minor versions must not delete flag bits or enumeration values. 8155 8. Minor versions may declare an operation MUST NOT be implement. 8157 Specifying that an operation MUST NOT be implemented is 8158 equivalent to obsoleting an operation. For the client, it means 8159 that the operation MUST NOT be sent to the server. For the 8160 server, an NFS error can be returned as opposed to "dropping" 8161 the request as an XDR decode error. This approach allows for 8162 the obsolescence of an operation while maintaining its structure 8163 so that a future minor version can reintroduce the operation. 8165 1. Minor versions may declare that an attribute MUST NOT be 8166 implemented. 8168 2. Minor versions may declare that a flag bit or enumeration 8169 value MUST NOT be implemented. 8171 9. Minor versions may downgrade features from REQUIRED to 8172 RECOMMENDED, or RECOMMENDED to OPTIONAL. 8174 10. Minor versions may upgrade features from OPTIONAL to RECOMMENDED 8175 or RECOMMENDED to REQUIRED. 8177 11. A client and server that support minor version X SHOULD support 8178 minor versions 0 through X-1 as well. 8180 12. Except for infrastructural changes, no new features may be 8181 introduced as REQUIRED in a minor version. 8183 This rule allows for the introduction of new functionality and 8184 forces the use of implementation experience before designating a 8185 feature as REQUIRED. On the other hand, some classes of 8186 features are infrastructural and have broad effects. Allowing 8187 infrastructural features to be RECOMMENDED or OPTIONAL 8188 complicates implementation of the minor version. 8190 13. A client MUST NOT attempt to use a stateid, filehandle, or 8191 similar returned object from the COMPOUND procedure with minor 8192 version X for another COMPOUND procedure with minor version Y, 8193 where X != Y. 8195 12. Internationalization 8197 This chapter describes the string-handling aspects of the NFSv4 8198 protocol, and how they address issues related to 8199 internationalization, including issues related to UTF-8, 8200 normalization, string preparation, case folding, and handling of 8201 internationalization issues related to domains. 8203 The NFSv4 protocol needs to deal with internationalization, or I18N, 8204 with respect to file names and other strings as used within the 8205 protocol. The choice of string representation must allow for 8206 reasonable name/string access to clients, applications, and users 8207 which use various languages. The UTF-8 encoding of the UCS as 8208 defined by [7] allows for this type of access and follows the policy 8209 described in "IETF Policy on Character Sets and Languages", [8]. 8211 In implementing such policies, it is important to understand and 8212 respect the nature of NFSv4 as a means by which client 8213 implementations may invoke operations on remote file systems. Server 8214 implementations act as a conduit to a range of file system 8215 implementations that the NFSv4 server typically invokes through a 8216 virtual-file-system interface. 8218 Keeping this context in mind, one needs to understand that the file 8219 systems with which clients will be interacting will generally not be 8220 devoted solely to access using NFS version 4. Local access and its 8221 requirements will generally be important and often access over other 8222 remote file access protocols will be as well. It is generally a 8223 functional requirement in practice for the users of the NFSv4 8224 protocol (although it may be formally out of scope for this document) 8225 for the implementation to allow files created by other protocols and 8226 by local operations on the file system to be accessed using NFS 8227 version 4 as well. 8229 It also needs to be understood that a considerable portion of file 8230 name processing will occur within the implementation of the file 8231 system rather than within the limits of the NFSv4 server 8232 implementation per se. As a result, cetain aspects of name 8233 processing may change as the locus of processing moves from file 8234 system to file system. As a result of these factors, the protocol 8235 cannot enforce uniformity of name-related processing upon NFSv4 8236 server requests on the server as a whole. Because the server 8237 interacts with existing file system implementations, the same server 8238 handling will produce different behavior when interacting with 8239 different file system implementations. To attempt to require uniform 8240 behavior, and treat the the protocol server and the file system as a 8241 unified application, would considerably limit the usefulness of the 8242 protocol. 8244 12.1. Use of UTF-8 8246 As mentioned above, UTF-8 is used as a convenient way to encode 8247 Unicode which allows clients that have no internationalization 8248 requirements to avoid these issues since the mapping of ASCII names 8249 to UTF-8 is the identity. 8251 12.1.1. Relation to Stringprep 8253 RFC 3454 [9], otherwise known as "stringprep", documents a framework 8254 for using Unicode/UTF-8 in networking protocols, intended "to 8255 increase the likelihood that string input and string comparison work 8256 in ways that make sense for typical users throughout the world." A 8257 protocol conforming to this framework must define a profile of 8258 stringprep "in order to fully specify the processing options." 8259 NFSv4, while it does make normative references to stringprep and uses 8260 elements of that framework, it does not, for reasons that are 8261 explained below, conform to that framework, for all of the strings 8262 that are used within it. 8264 In addition to some specific issues which have caused stringprep to 8265 add confusion in handling certain characters for certain languages, 8266 there are a number of general reasons why stringprep profiles are not 8267 suitable for describing NFSv4. 8269 o Restricting the character repertoire to Unicode 3.2, as required 8270 by stringprep is unduly constricting. 8272 o Many of the character tables in stringprep are inappropriate 8273 because of this limited character repertoire, so that normative 8274 reference to stringprep is not desirable in many case and instead, 8275 we allow more flexibility in the definition of case mapping 8276 tables. 8278 o Because of the presence of different file systems, the specifics 8279 of processing are not fully defined and some aspects that are are 8280 RECOMMENDED, rather than REQUIRED. 8282 Despite these issues, in many cases the general structure of 8283 stringprep profiles, consisting of sections which deal with the 8284 applicability of the description, the character repertoire, character 8285 mapping, normalization, prohibited characters, and issues of the 8286 handling (i.e., possible prohibition) of bidirectional strings, is a 8287 convenient way to describe the string handling which is needed and 8288 will be used where appropriate. 8290 12.1.2. Normalization, Equivalence, and Confusability 8292 Unicode has defined several equivalence relationships among the set 8293 of possible strings. Understanding the nature and purpose of these 8294 equivalence relations is important to understand the handling of 8295 Unicode strings within NFSv4. 8297 Some string pairs are thought as only differing in the way accents 8298 and other diacritics are encoded, as illustrated in the examples 8299 below. Such string pairs are called "canonically equivalent". 8301 Such equivalence can occur when there are precomposed characters, 8302 as an alternative to encoding a base character in addition to a 8303 combining accent. For example, the character LATIN SMALL LETTER E 8304 WITH ACUTE (U+00E9) is defined as canonically equivalent to the 8305 string consisting of LATIN SMALL LETTER E followed by COMBINING 8306 ACUTE ACCENT (U+0065, U+0301). 8308 When multiple combining diacritics are present, differences in the 8309 ordering are not reflected in resulting display and the strings 8310 are defined as canonically equivalent. For example, the string 8311 consisting of LATIN SMALL LETTER Q, COMBINING ACUTE ACCENT, 8312 COMBINING GRAVE ACCENT (U+0071, U+0301, U+0300) is canonically 8313 equivalent to the string consisting of LATIN SMALL LETTER Q, 8314 COMBINING GRAVE ACCENT, COMBINING ACUTE ACCENT (U+0071, U+0300, 8315 U+0301) 8317 When both situations are present, the number of canonically 8318 equivalent strings can be greater. Thus, the following strings 8319 are all canonically equivalent: 8321 LATIN SMALL LETTER E, COMBINING MACRON, ACCENT, COMBINING ACUTE 8322 ACCENT (U+0xxx, U+0304, U+0301) 8323 LATIN SMALL LETTER E, COMBINING ACUTE ACCENT, COMBINING MACRON 8324 (U+0xxx, U+0301, U+0304) 8326 LATIN SMALL LETTER E WITH MACRON, COMBINING ACUTE ACCENT 8327 (U+011E, U+0301) 8329 LATIN SMALL LETTER E WITH ACUTE, COMBINING MACRON (U+00E9, 8330 U+0304) 8332 LATIN SMALL LETTER E WITH MACRON AND ACUTE (U+1E16) 8334 Additionally there is an equivalence relation of "compatibility 8335 equivalence". Two canonically equivalent strings are necessarily 8336 compatibility equivalent, although not the converse. An example of 8337 compatibility equivalent strings which are not canonically equivalent 8338 are GREEK CAPITAL LETTER OMEGA (U+03A9) and OHM SIGN (U+2129). These 8339 are identical in appearance while other compatibility equivalent 8340 strings are not. Another example would be "x2" and the two character 8341 string denoting x-squared which are clearly different in appearance 8342 although compatibility equivalent and not canonically equivalent. 8343 These have Unicode encodings LATIN SMALL LETTER X, DIGIT TWO (U+0078, 8344 U+0032) and LATIN SMALL LETTER X, SUPERSCRIPT TWO (U+0078, U+00B2), 8346 One way to deal with these equivalence relations is via 8347 normalization. A normalization form maps all strings to a 8348 corresponding normalized string in such a fashion that all strings 8349 that are equivalent (canonically or compatibly, depending on the 8350 form) are mapped to the same value. Thus the image of the mapping is 8351 a subset of Unicode strings conceived as the representatives of the 8352 equivalence classes defined by the chosen equivalence relation. 8354 In the NFSv4 protocol, handling of issues related to 8355 internationalization with regard to normalization follows one of two 8356 basic patterns: 8358 o For strings whose function is related to other internet standards, 8359 such as server and domain naming, the normalization form defined 8360 by the appropriate internet standards is used. For server and 8361 domain naming, this involves normalization form NFKC as specified 8362 in [10] 8364 o For other strings, particular those passed by the server to file 8365 system implementations, normalization requirements are the 8366 province of the file system and the job of this specification is 8367 not to specify a particular form but to make sure that 8368 interoperability is maximized, even when clients and server-based 8369 file systems have different preferences. 8371 A related but distinct issue concerns string confusability. This can 8372 occur when two strings (including single-character strings) having a 8373 similar appearance. There have been attempts to define uniform 8374 processing in an attempt to avoid such confusion (see stringprep [9]) 8375 but the results have often added confusion. 8377 Some examples of possible confusions and proposed processing intended 8378 to reduce/avoid confusions: 8380 o Deletion of characters believed to be invisible and appropriately 8381 ignored, justifying their deletion, including, WORD JOINER 8382 (U+2060), and the ZERO WIDTH SPACE (U+200B). 8384 o Deletion of characters supposed to not bear semantics and only 8385 affect glyph choice, including the ZERO WIDTH NON-JOINER (U+200C) 8386 and the ZERO WIDTH JOINER (U+200D), where the deletion turns out 8387 to be a problem for Farsi speakers. 8389 o Prohibition of space characters such as the EM SPACE (U+2003), the 8390 EN SPACE (U+2002), and the THIN SPACE (U+2009). 8392 In addition, character pairs which appear very similar and could and 8393 often do result in confusion. In addition to what Unicode defines as 8394 "compatibility equivalence", there are a considerable number of 8395 additional character pairs that could cause confusion. This includes 8396 characters such as LATIN CAPITAL LETTER O (U+004F) and DIGIT ZERO 8397 (U+0030), and CYRILLIC SMALL LETTER ER (U+0440) LATIN SMALL LETTER P 8398 (U+0070) (also with MATHEMATICAL BOLD SMALL P (U+1D429) and GREEK 8399 SMALL LETTER RHO (U+1D56, for good measure). 8401 NFSv4, as it does with normalization, takes a two-part approach to 8402 this issue: 8404 o For strings whose function is related to other internet standards, 8405 such as server and domain naming, any string processing to address 8406 the confusability issue is defined by the appropriate internet 8407 standards is used. For server and domain naming, this is the 8408 responsibility of IDNA as described in [10]. 8410 o For other strings, particularly those passed by the server to file 8411 system implementations, any such preparation requirements 8412 including the choice of how, or whether to address the 8413 confusability issue, are the responsibility of the file system to 8414 define, and for this specification to try to add its own set would 8415 add unacceptably to complexity, and make many files accessible 8416 locally and by other remote file access protocols, inaccessible by 8417 NFSv4. This specification defines how the protocol maximizes 8418 interoperability in the face of different file system 8419 implementations. NFSv4 does allow file systems to map and to 8420 reject characters, including those likely to result in confusion, 8421 since file systems may choose to do such things. It defines what 8422 the client will see in such cases, in order to limit problems that 8423 can arise when a file name is created and it appears to have a 8424 different name from the one it is assigned when the name is 8425 created. 8427 12.2. String Type Overview 8429 12.2.1. Overall String Class Divisions 8431 NFSv4 has to deal with a large set of different types of strings and 8432 because of the different role of each, internationalization issues 8433 will be different for each: 8435 o For some types of strings, the fundamental internationalization- 8436 related decisions are the province of the file system or the 8437 security-handling functions of the server and the protocol's job 8438 is to establish the rules under which file systems and servers are 8439 allowed to exercise this freedom, to avoid adding to confusion. 8441 o In other cases, the fundamental internationalization issues are 8442 the responsibility of other IETF groups and our job is simply to 8443 reference those and perhaps make a few choices as to how they are 8444 to be used (e.g., U-labels vs. A-labels). 8446 o There are also cases in which a string has a small amount of NFSv4 8447 processing which results in one or more strings being referred to 8448 one of the other categories. 8450 We will divide strings to be dealt with into the following classes: 8452 MIX: indicating that there is small amount of preparatory processing 8453 that either picks an internationalization handling mode or divides 8454 the string into a set of (two) strings with a different mode 8455 internationalization handling for each. The details are discussed 8456 in the section "Types with Pre-processing to Resolve Mixture 8457 Issues". 8459 NIP: indicating that, for various reasons, there is no need for 8460 internationalization-specific processing to be performed. The 8461 specifics of the various string types handled in this way are 8462 described in the section "String Types without 8463 Internationalization Processing". 8465 INET: indicating that the string needs to be processed in a fashion 8466 governed by non-NFS-specific internet specifications. The details 8467 are discussed in the section "Types with Processing Defined by 8468 Other Internet Areas". 8470 NFS: indicating that the string needs to be processed in a fashion 8471 governed by NFSv4-specific considerations. The primary focus is 8472 on enabling flexibility for the various file systems to be 8473 accessed and is described in the section "String Types with NFS- 8474 specific Processing". 8476 12.2.2. Divisions by Typedef Parent types 8478 There are a number of different string types within NFSv4 and 8479 internationalization handling will be different for different types 8480 of strings. Each the types will be in one of four groups based on 8481 the parent type that specifies the nature of its relationship to utf8 8482 and ascii. 8484 utf8_should/USHOULD: indicating that strings of this type SHOULD be 8485 UTF-8 but clients and servers will not check for valid UTF-8 8486 encoding. 8488 utf8val_should/UVSHOULD: indicating that strings of this type SHOULD 8489 be and generally will be in the form of the UTF-8 encoding of 8490 Unicode. Strings in most cases will be checked by the server for 8491 valid UTF-8 but for certain file systems, such checking may be 8492 inhibited. 8494 utf8val_must/UVMUST: indicating that strings of this type MUST be in 8495 the form of the UTF-8 encoding of Unicode. Strings will be 8496 checked by the server for valid UTF-8 and the server SHOULD ensure 8497 that when sent to the client, they are valid UTF-8. 8499 ascii_must/ASCII: indicating that strings of this type MUST be pure 8500 ASCII, and thus automatically UTF-8. The processing of these 8501 string must ensure that they are only have ASCII characters but 8502 this need not be a separate step if any normally required check 8503 for validity inherently assures that only ASCII characters are 8504 present. 8506 In those cases where UTF-8 is not required, USHOULD and UVSHOULD, and 8507 strings that are not valid UTF-8 are received and accepted, the 8508 receiver MUST NOT modify the strings. For example, setting 8509 particular bits such as the high-order bit to zero MUST NOT be done. 8511 12.2.3. Individual Types and Their Handling 8513 The first table outlines the handling for the primary string types, 8514 i.e., those not derived as a prefix or a suffix from a mixture type. 8516 +-----------------+----------+-------+------------------------------+ 8517 | Type | Parent | Class | Explanation | 8518 +-----------------+----------+-------+------------------------------+ 8519 | comptag4 | USHOULD | NIP | Should be utf8 but no | 8520 | | | | validation by server or | 8521 | | | | client is to be done. | 8522 | component4 | UVSHOULD | NFS | Should be utf8 but clients | 8523 | | | | may need to access file | 8524 | | | | systems with a different | 8525 | | | | name structure, such as file | 8526 | | | | systems that have non-utf8 | 8527 | | | | names. | 8528 | linktext4 | UVSHOULD | NFS | Should be utf8 since text | 8529 | | | | may include name components. | 8530 | | | | Because of the need to | 8531 | | | | access existing file | 8532 | | | | systems, this check may be | 8533 | | | | inhibited. | 8534 | fattr4_mimetype | ASCII | NIP | All mime types are ascii so | 8535 | | | | no specific utf8 processing | 8536 | | | | is required, given that you | 8537 | | | | are comparing to that list. | 8538 +-----------------+----------+-------+------------------------------+ 8540 Table 5 8542 There are a number of string types that are subject to preliminary 8543 processing. This processing may take the form either of selecting 8544 one of two possible forms based on the string contents or it in may 8545 consist of dividing the string into multiple conjoined strings each 8546 with different utf8-related processing. 8548 +---------+--------+-------+----------------------------------------+ 8549 | Type | Parent | Class | Explanation | 8550 +---------+--------+-------+----------------------------------------+ 8551 | prin4 | UVMUST | MIX | Consists of two parts separated by an | 8552 | | | | at-sign, a prinpfx4 and a prinsfx4. | 8553 | | | | These are described in the next table. | 8554 | server4 | UVMUST | MIX | Is either an IP address (serveraddr4) | 8555 | | | | which has to be pure ascii or a server | 8556 | | | | name svrname4, which is described | 8557 | | | | immediately below. | 8558 +---------+--------+-------+----------------------------------------+ 8559 Table 6 8561 The last table describes the components of the compound types 8562 described above. 8564 +----------+--------+------+----------------------------------------+ 8565 | Type | Class | Def | Explanation | 8566 +----------+--------+------+----------------------------------------+ 8567 | svraddr4 | ASCII | NIP | Server as IP address, whether IPv4 or | 8568 | | | | IPv6. | 8569 | svrname4 | UVMUST | INET | Server name as returned by server. | 8570 | | | | Not sent by client, except in | 8571 | | | | VERIFY/NVERIFY. | 8572 | prinsfx4 | UVMUST | INET | Suffix part of principal, in the form | 8573 | | | | of a domain name. | 8574 | prinpfx4 | UVMUST | NFS | Must match one of a list of valid | 8575 | | | | users or groups for that particular | 8576 | | | | domain. | 8577 +----------+--------+------+----------------------------------------+ 8579 Table 7 8581 12.3. Errors Related to Strings 8583 When the client sends an invalid UTF-8 string in a context in which 8584 UTF-8 is REQUIRED, the server MUST return an NFS4ERR_INVAL error. 8585 Within the framework of the previous section, this applies to strings 8586 whose type is defined as utf8val_must or ascii_must. When the client 8587 sends an invalid UTF-8 string in a context in which UTF-8 is 8588 RECOMMENDED and the server should test for UTF-8, the server SHOULD 8589 return an NFS4ERR_INVAL error. Within the framework of the previous 8590 section, this applies to strings whose type is defined as 8591 utf8val_should. These situations apply to cases in which 8592 inappropriate prefixes are detected and where the count includes 8593 trailing bytes that do not constitute a full UCS character. 8595 Where the client-supplied string is valid UTF-8 but contains 8596 characters that are not supported by the server file system as a 8597 value for that string (e.g., names containing characters that have 8598 more than two octets on a file system that supports UCS-2 characters 8599 only, file name components containing slashes on file systems that do 8600 not allow them in file name components), the server MUST return an 8601 NFS4ERR_BADCHAR error. 8603 Where a UTF-8 string is used as a file name component, and the file 8604 system, while supporting all of the characters within the name, does 8605 not allow that particular name to be used, the server should return 8606 the error NFS4ERR_BADNAME. This includes file system prohibitions of 8607 "." and ".." as file names for certain operations, and other such 8608 similar constraints. It does not include use of strings with non- 8609 preferred normalization modes. 8611 Where a UTF-8 string is used as a file name component, the file 8612 system implementation MUST NOT return NFS4ERR_BADNAME, simply due to 8613 a normalization mismatch. In such cases the implementation SHOULD 8614 convert the string to its own preferred normalization mode before 8615 performing the operation. As a result, a client cannot assume that a 8616 file created with a name it specifies will have that name when the 8617 directory is read. It may have instead, the name converted to the 8618 file system's preferred normalization form. 8620 Where a UTF-8 string is used as other than as file name component (or 8621 as symbolic link text) and the string does not meet the normalization 8622 requirements specified for it, the error NFS4ERR_INVAL is returned. 8624 12.4. Types with Pre-processing to Resolve Mixture Issues 8626 12.4.1. Processing of Principal Strings 8628 Strings denoting principals (users or groups) MUST be UTF-8 but since 8629 they consist of a principal prefix, an at-sign, and a domain, all 8630 three of which either are checked for being UTF-8, or inherently are 8631 UTF-8, checking the string as a whole for being UTF-8 is not 8632 required. Although a server implementation may choose to make this 8633 check on the string as whole, for example in converting it to 8634 Unicode, the description within this document, will reflect a 8635 processing model in which such checking happens after the division 8636 into a principal prefix and suffix, the latter being in the form of a 8637 domain name. 8639 The string should be scanned for at-signs. If there is more that one 8640 at-sign, the string is considered invalid. For cases in which there 8641 are no at-signs or the at-sign appears at the start or end of the 8642 string see Interpreting owner and owner_group. Otherwise, the 8643 portion before the at-sign is dealt with as a prinpfx4 and the 8644 portion after is dealt with as a prinsfx4. 8646 12.4.2. Processing of Server Id Strings 8648 Server id strings typically appear in responses (as attribute values) 8649 and only appear in requests as an attribute value presented to VERIFY 8650 and NVERIFY. With that exception, they are not subject to server 8651 validation and possible rejection. It is not expected that clients 8652 will typically do such validation on receipt of responses but they 8653 may as a way to check for proper server behavior. The responsibility 8654 for sending correct UTF-8 strings is with the server. 8656 Servers are identified by either server names or IP addresses. Once 8657 an id has been identified as an IP address, then there is no 8658 processing specific to internationalization to be done, since such an 8659 address must be ASCII to be valid. 8661 12.5. String Types without Internationalization Processing 8663 There are a number of types of strings which, for a number of 8664 different reasons, do not require any internationalization-specific 8665 handling, such as validation of UTF-8, normalization, or character 8666 mapping or checking. This does not necessarily mean that the strings 8667 need not be UTF-8. In some case, other checking on the string 8668 ensures that they are valid UTF-8, without doing any checking 8669 specific to internationalization. 8671 The following are the specific types: 8673 comptag4: strings are an aid to debugging and the sender should 8674 avoid confusion by not using anything but valid UTF-8. But any 8675 work validating the string or modifying it would only add 8676 complication to a mechanism whose basic function is best supported 8677 by making it not subject to any checking and having data maximally 8678 available to be looked at in a network trace. 8680 fattr4_mimetype: strings need to be validated by matching against a 8681 list of valid mime types. Since these are all ASCII, no 8682 processing specific to internationalization is required since 8683 anything that does not match is invalid and anything which does 8684 not obey the rules of UTF-8 will not be ASCII and consequently 8685 will not match, and will be invalid. 8687 svraddr4: strings, in order to be valid, need to be ASCII, but if 8688 you check them for validity, you have inherently checked that that 8689 they are ASCII and thus UTF-8. 8691 12.6. Types with Processing Defined by Other Internet Areas 8693 There are two types of strings which NFSv4 deals with whose 8694 processing is defined by other Internet standards, and where issues 8695 related to different handling choices by server operating systems or 8696 server file systems do not apply. 8698 These are as follows: 8700 o Server names as they appear in the fs_locations attribute. Note 8701 that for most purposes, such server names will only be sent by the 8702 server to the client. The exception is use of the fs_locations 8703 attribute in a VERIFY or NVERIFY operation. 8705 o Principal suffixes which are used to denote sets of users and 8706 groups, and are in the form of domain names. 8708 The general rules for handling all of these domain-related strings 8709 are similar and independent of role the of the sender or receiver as 8710 client or server although the consequences of failure to obey these 8711 rules may be different for client or server. The server can report 8712 errors when it is sent invalid strings, whereas the client will 8713 simply ignore invalid string or use a default value in their place. 8715 The string sent SHOULD be in the form of a U-label although it MAY be 8716 in the form of an A-label or a UTF-8 string that would not map to 8717 itself when canonicalized by applying ToUnicode(ToASCII(...)). The 8718 receiver needs to be able to accept domain and server names in any of 8719 the formats allowed. The server MUST reject, using the the error 8720 NFS4ERR_INVAL, a string which is not valid UTF-8 or which begins with 8721 "xn--" and violates the rules for a valid A-label. 8723 When a domain string is part of id@domain or group@domain, the server 8724 SHOULD map domain strings which are A-labels or are UTF-8 domain 8725 names which are not U-labels, to the corresponding U-label, using 8726 ToUnicode(domain) or ToUnicode(ToASCII(domain)). As a result, the 8727 domain name returned within a userid on a GETATTR may not match that 8728 sent when the userid is set using SETATTR, although when this 8729 happens, the domain will be in the form of a U-label. When the 8730 server does not map domain strings which are not U-labels into a 8731 U-label, which it MAY do, it MUST NOT modify the domain and the 8732 domain returned on a GETATTR of the userid MUST be the same as that 8733 used when setting the userid by the SETATTTR. 8735 The server MAY implement VERIFY and NVERIFY without translating 8736 internal state to a string form, so that, for example, a user 8737 principal which represents a specific numeric user id, will match a 8738 different principal string which represents the same numeric user id. 8740 12.7. String Types with NFS-specific Processing 8742 For a number of data types within NFSv4, the primary responsibility 8743 for internationalization-related handling is that of some entity 8744 other than the server itself (see below for details). In these 8745 situations, the primary responsibility of NFSv4 is to provide a 8746 framework in which that other entity (file system and server 8747 operating system principal naming framework) implements its own 8748 decisions while establishing rules to limit interoperability issues. 8750 This pattern applies to the following data types: 8752 o In the case of name components (strings of type component4), the 8753 server-side file system implementation (of which there may be more 8754 than one for a particular server) deals with internationalization 8755 issues, in a fashion that is appropriate to NFSv4, other remote 8756 file access protocols, and local file access methods. See 8757 "Handling of File Name Components" for the detailed treatment. 8759 o In the case of link text strings (strings of type lintext4), the 8760 issues are similar, but file systems are restricted in the set of 8761 acceptable internationalization-related processing that they may 8762 do, principally because symbolic links may contain name components 8763 that, when used, are presented to other file systems and/or other 8764 servers. See "Processing of Link Text" for the detailed 8765 treatment. 8767 o In the case of principal prefix strings, any decisions regarding 8768 internationalization are the responsibility of the server 8769 operating systems which may make its own rules regarding user and 8770 group name encoding. See "Processing of Principal Prefixes" for 8771 the detailed treatment. 8773 12.7.1. Handling of File Name Components 8775 There are a number of places within client and server where file name 8776 components are processed: 8778 o On the client, file names may be processed as part of forming 8779 NFSv4 requests. Any such processing will reflect specific needs 8780 of the client's environment and will be treated as out-of-scope 8781 from the viewpoint of this specification. 8783 o On the server, file names are processed as part of processing 8784 NFSv4 requests. In practice, parts of the processing will be 8785 implemented within the NFS version 4 server while other parts will 8786 be implemented within the file system. This processing is 8787 described in the sections below. These sections are organized in 8788 a fashion parallel to a stringprep profile. The same sorts of 8789 topics are dealt with but they differ in that there is a wider 8790 range of possible processing choices. 8792 o On the server, file name components might potentially be subject 8793 to processing as part of generating NFS version 4 responses. This 8794 specification assumes that this processing will be empty and that 8795 file name components will be copied verbatim at this point. The 8796 file name components may be modified as they appear in responses, 8797 relative to the values used in the request but this is only 8798 treated as reflecting changes made as part of request processing. 8799 For example, a change to a file name component made in processing 8800 a CREATE operation will be reflected in the READDIR since the 8801 files created will have names that reflect CREATE-time processing. 8803 o On the client, responses will need to be properly dealt with and 8804 the relevant issues will be discussed in the sections below. 8805 Primarily, this will involve dealing with the fact that file name 8806 components received in responses may need to be processed to meet 8807 the requirements of the client's internal environment. This will 8808 mainly involve dealing with changes in name components possibly 8809 made by server processing. It also addresses other sorts of 8810 expected behavior that do not involve a returned component4, such 8811 as whether a LOOKUP finds a given component4 or whether a CREATE 8812 or OPEN finds that a specified name already exists. 8814 12.7.1.1. Nature of Server Processing of Name Components in Request 8816 The component4 type defines a potentially case sensitive string, 8817 typically of UTF-8 characters. Its use in NFS version 4 is for 8818 representing file name components. Since file systems can implement 8819 case insensitive file name handling, it can be used for both case 8820 sensitive and case insensitive file name handling, based on the 8821 attributes of the file system. 8823 It may be the case that two valid distinct UTF-8 strings will be the 8824 same after the processing described below. In such a case, a server 8825 may either, 8827 o disallow the creation of a second name if its post-processed form 8828 collides with that of an existing name, or 8830 o allow the creation of the second name, but arrange so that after 8831 post processing, the second name is different than the post- 8832 processed form of the first name. 8834 12.7.1.2. Character Repertoire for the Component4 Type 8836 The RECOMMENDED character repertoire for file name components is a 8837 recent/current version of Unicode, as encoded via UTF-8. There are a 8838 number of alternate character repertoires which may be chosen by the 8839 server based on implementation constraints including the requirements 8840 of the file system being accessed. 8842 Two important alternative repertoires are: 8844 o One alternate character repertoire is to represent file name 8845 components as strings of bytes with no protocol-defined encoding 8846 of multi-byte characters. Most typically, implementations that 8847 support this single-byte alternative will make it available as an 8848 option set by an administrator for all file systems within a 8849 server or for some particular file systems. If a server accepts 8850 non-UTF-8 strings anywhere within a specific file system, then it 8851 MUST do so throughout the entire file system. 8853 o Another alternate character repertoire is the set of codepoints, 8854 representable by the file system, most typically UCS-4. 8856 Individual file system implementations may have more restricted 8857 character repertoires, as for example file system that only are 8858 capable of storing names consisting of UCS-2 characters. When this 8859 is the case, and the character repertoire is not restricted to 8860 single-byte characters, characters not within that repertoire are 8861 treated as prohibited and the error NFS4ERR_BADCHAR is returned by 8862 the server when that character is encountered. 8864 Strings are intended to be in UTF-8 format and servers SHOULD return 8865 NFS4ERR_INVAL, as discussed above, when the characters sent are not 8866 valid UTF-8. When the character repertoire consists of single-byte 8867 characters, UTF-8 is not enforced. Such situations should be 8868 restricted to those where use is within a restricted environment 8869 where a single character mapping locale can be administratively 8870 enforced, allowing a file name to be treated as a string of bytes, 8871 rather than as a string of characters. Such an arrangement might be 8872 necessary when NFSv4 access to a file system containing names which 8873 are not valid UTF-8 needs to be provided. 8875 However, in any of the following situations, file names have to be 8876 treated as strings of Unicode characters and servers MUST return 8877 NFS4ERR_INVAL when file names that are not in UTF-8 format: 8879 o Case-insensitive comparisons are specified by the file system and 8880 any characters sent contain non-ASCII byte codes. 8882 o Any normalization constraints are enforced by the server or file 8883 system implementation. 8885 o The server accepts a given name when creating a file and reports a 8886 different one when the directory is being examined. 8888 Much of the discussion below regarding normalization and silent 8889 deletion of characters within component4 strings is not applicable 8890 when the server does not enforce UTF-8 component4 strings and treats 8891 them as strings of bytes. A client may determine that a given 8892 filesystem is operating in this mode by performing a LOOKUP using a 8893 non-UTF-8 string, if NFS4ERR_INVAL is not returned, then name 8894 components will be treated as opaque and those sorts of modifications 8895 will not be seen. 8897 12.7.1.3. Case-based Mapping Used for Component4 Strings 8899 Case-based mapping is not always a required part of server processing 8900 of name components. However, if the NFSv4 file server supports the 8901 case_insensitive file system attribute, and if the case_insensitive 8902 attribute is true for a given file system, the NFS version 4 server 8903 MUST use the Unicode case mapping tables for the version of Unicode 8904 corresponding to the character repertoire. In the case where the 8905 character repertoire is UCS-2 or UCS-4, the case mapping tables from 8906 the latest available version of Unicode SHOULD be used. 8908 If the case_preserving attribute is present and set to false, then 8909 the NFSv4 server MUST use the corresponding Unicode case mapping 8910 table to map case when processing component4 strings. Whether the 8911 server maps from lower to upper case or the upper to lower case is a 8912 matter for implementation choice. 8914 Stringprep Table B.2 should not be used for these purpose since it is 8915 limited to Unicode version 3.2 and also because it erroneously maps 8916 the German ligature eszett to the string "ss", whereas later versions 8917 of Unicode contain both lower-case and upper-case versions of Eszett 8918 (SMALL LETTER SHARP S and CAPITAL LETTER SHARP S). 8920 Clients should be aware that servers may have mapped SMALL LETTER 8921 SHARP S to the string "ss" when case-insensitive mapping is in 8922 effect, with result that file whose name contains SMALL LETTER SHARP 8923 S may have that character replaced by "ss" or "SS". 8925 12.7.1.4. Other Mapping Used for Component4 Strings 8927 Other than for issues of case mapping, an NFSv4 server SHOULD limit 8928 visible (i.e., those that change the name of file to reflect those 8929 mappings to those from from a subset of the stringprep table B.1. 8930 Note particularly, the mappings from U+200C and U+200D to the empty 8931 string should be avoided, due to their undesirable effect on some 8932 strings in Farsi. 8934 Table B.1 may be used but it should be used only if required by the 8935 local file system implementation. For example, if the file system in 8936 question accepts file names containing the MONGOLIAN TODO SOFT HYPHEN 8937 character (U+1806) and they are distinct from the corresponding file 8938 names with this character removed, then using Table B.1 will cause 8939 functional problems when clients attempt to interact with that file 8940 system. The NFSv4 server implementation including the filesystem 8941 MUST NOT silently remove characters not within Table B.1. 8943 If an implementation wishes to eliminate other characters because it 8944 is believed that allowing component name versions that both include 8945 the character and do not have while otherwise the same, will 8946 contribute to confusion, it has two options: 8948 o Treat the characters as prohibited and return NFS4ERR_BADCHAR. 8950 o Eliminate the character as part of the name matching processing, 8951 while retaining it when a file is created. This would be 8952 analogous to file systems that are both case-insensitive and case- 8953 preserving,as discussed above, or those which are both 8954 normalization-insensitive and normalization-preserving, as 8955 discussed below. The handling will be insensitive to the presence 8956 of the chosen characters while preserving the presence or absence 8957 of such characters within names. 8959 Note that the second of these choices is a desirable way to handle 8960 characters within table B.1, again with the exception of U+200C and 8961 U+200D, which can cause issues for Farsi. 8963 In addition to modification due to normalization, discussed below, 8964 clients have to be able to deal with name modifications and other 8965 consequences of character mapping on the server, as discussed above. 8967 12.7.1.5. Normalization Issues for Component Strings 8969 The issues are best discussed separately for the server and the 8970 client. It is important to note that the server and client may have 8971 different approaches to this area, and that the server choice may not 8972 match the client operating environment. The issue of mismatches and 8973 how they may be best dealt with by the client is discussed in a later 8974 section. 8976 12.7.1.5.1. Server Normalization Issues for Component Strings 8978 The NFSv4 does not specify required use of a particular normalization 8979 form for component4 strings. Therefore, the server may receive 8980 unnormalized strings or strings that reflect either normalization 8981 form within protocol requests and responses. If the file system 8982 requires normalization, then the server implementation must normalize 8983 component4 strings within the protocol server before presenting the 8984 information to the local file system. 8986 With regard to normalization, servers have the following choices, 8987 with the possibility that different choices may be selected for 8988 different file systems. 8990 o Implement a particular normalization form, either NFC, or NFD, in 8991 which case file names received from a client are converted to that 8992 normalization form and as a consequence, the client will always 8993 receive names in that normalization form. If this option is 8994 chosen, then it is impossible to create two files in the same 8995 directory that have different names which map to the same name 8996 when normalized. 8998 o Implement handling which is both normalization-insensitive and 8999 normalization-preserving. This makes it impossible to create two 9000 files in the same directory that have two different canonically 9001 equivalent names, i.e., names which map to the same name when 9002 normalized. However, unlike the previous option, clients will not 9003 have the names that they present modified to meet the server's 9004 normalization constraints. 9006 o Implement normalization-sensitive handling without enforcing a 9007 normalization form constraint on file names. This exposes the 9008 client to the possibility that two files can be created in the 9009 same directory which have different names which map to the same 9010 name when normalized. This may be a significant issue when 9011 clients which use different normalization forms are used on the 9012 same file system, but this issue needs to be set against the 9013 difficulty of providing other sorts of normalization handling for 9014 some existing file systems. 9016 12.7.1.5.2. Client Normalization Issues for Component Strings 9018 The client, in processing name components, needs to deal with the 9019 fact that the server may impose normalization on file name components 9020 presented to it. As a result, a file can be created within a 9021 directory and that name be different from that sent by the client due 9022 to normalization at the server. 9024 Client operating environments differ in their handling of canonically 9025 equivalent names. Some environments treat canonically equivalent 9026 strings as essentially equal and we will call these environments 9027 normalization-aware. Others, because of the pattern of their 9028 development with regard to these issues treat different strings as 9029 different, even if they are canonically equivalent. We call these 9030 normalization-unaware. 9032 We discuss below issues that may arise when each of these types of 9033 environments interact with the various types of file systems, with 9034 regard to normalization handling. Note that complexity for the 9035 client is increased given that there are no file system attributes to 9036 determine the normalization handling present for that file system. 9037 Where the client has the ability to create files (file system not 9038 read-only and security allows it), attempting to create multiple 9039 files with canonically equivalent names and looking at success 9040 patterns and the names assigned by the server to these files can 9041 serve as a way to determine the relevant information. 9043 Normalization-aware environments interoperate most normally with 9044 servers that either impose a given normalization form or those that 9045 implement name handling which is both normalization-insensitive and 9046 normalization-preserving name handling. However, clients need to be 9047 prepared to interoperate with servers that have normalization- 9048 sensitive file naming. In this situation, the client needs to be 9049 prepared for the fact that a directory may contain multiple names 9050 that it considers equivalent. 9052 The following suggestions may be helpful in handling interoperability 9053 issues for normalization-aware client environments, when they 9054 interact with normalization-sensitive file systems. 9056 When READDIR is done, the names returned may include names that do 9057 not match the client's normalization form, but instead are other 9058 names canonically equivalent to the normalized name. 9060 When it can be determined that a normalization-insensitive server 9061 file system is not involved, the client can simply normalize 9062 filename components strings to its preferred normalization form. 9064 When it cannot be determined that a normalization-insensitive 9065 server file system is not involved, the client is generally best 9066 advised to process incoming name components so as to allow all 9067 name components in a canonical equivalence class to be together. 9068 When only a single member of class exists, it should generally 9069 mapped directly to the preferred normalization form, whether the 9070 name was of that form or not. 9072 When the client sees multiple names that are canonically 9073 equivalent, it is clear you have a file system which is 9074 normalization sensitive. Clients should generally replace each 9075 canonically equivalent name with one that appends some 9076 distinguishing suffix, usually including a number. The numbers 9077 should be assigned so that each distinct possible name with the 9078 set of canonically equivalent names has an assigned numeric value. 9079 Note that for some cases in which there are multiple instances of 9080 strings that might be composed or decomposed and/or situations 9081 with multiple diacritics to be applied to the same character, the 9082 class might be large. 9084 When interacting with a normalization-sensitive filesystem, it may 9085 be that the environment contains clients or implementations local 9086 to the OS in which the file system is embedded, which use a 9087 different normalization form. In such situations, a LOOKUP may 9088 well fail, even though the directory contains a name canonically 9089 equivalent to the name sought. One solution to this problem is to 9090 re-do the LOOKUP in that situation with name converted to the 9091 alternate normalization form. 9093 In the case in which normalization-unaware clients are involved in 9094 the mix, LOOKUP can fail and then the second LOOKUP, described 9095 above can also fail, even though there may well be a canonically 9096 equivalent name in the directory. One possible approach in that 9097 case is to use a READDIR to find the equivalent name and lookup 9098 that, although this can greatly add to client implementation 9099 complexity. 9101 When interacting with a normalization-sensitive filesystem, the 9102 situation where the environment contains clients or 9103 implementations local to the OS in which the file system is 9104 embedded, which use a different normalization form can also cause 9105 issues when a file (or symlink or directory, etc.) is being 9106 created. In such cases, you may be able to create an object of 9107 the specified name even though, the directory contains a 9108 canonically equivalent name. Similar issues can occur with LINK 9109 and RENAME. The client can't really do much about such 9110 situations, except be aware that they may occur. That's one of 9111 the reasons normalization-sensitive server file system 9112 implementations can be problematic to use when 9113 internationalization issues are important. 9115 Normalization-unaware environments interoperate most normally with 9116 servers that implement normalization-sensitive file naming. However, 9117 clients need to be prepared to interoperate with servers that impose 9118 a given normalization form or that implement name handling which is 9119 both normalization-insensitive and normalization-preserving. In the 9120 former case, a file created with a given name may find it changed to 9121 a different (although related name). In both cases, the client will 9122 have to deal with the fact that it is unable to create two names 9123 within a directory that are canonically equivalent. 9125 Note that although the client implementation itself and the kernel 9126 implementation may be normalization-unaware, treating name components 9127 as strings not subject to normalization, the environment as a whole 9128 may be normalization-aware if commonly used libraries result in an 9129 application environment where a single normalization form is used 9130 throughout. Because of this, normalization-unaware environments may 9131 be relatively rare. 9133 The following suggestions may be helpful in handling interoperability 9134 issues for truly normalization-unaware client environments, when they 9135 interact with file systems other than those which are normalization- 9136 sensitive. The issues tend to be the inverse of those for 9137 normalization-aware environments. The implementer should be careful 9138 not to erroneously treat the environment as normalization-unaware, 9139 based solely on the details of the kernel implementation. 9141 Unless the file system is normalization-preserving, when files (or 9142 other objects) are created, the object name as reported by a 9143 READDIR of the associated directory may show a name different than 9144 the one used to create the object. This behavior is something 9145 that the client has to accept. Since it has no preferred 9146 normalization form, it has no way of converting the name to a 9147 preferred form. 9149 In situations where there is an attempt to create multiple objects 9150 in the same directory which have canonically-equivalent names. 9151 these file systems will either report that an object of name 9152 already exists or simply open a file of that other name. 9154 If it desired to have those two objects in the same directory, the 9155 names must be made not canonically equivalent. It is possible to 9156 append some distinguishing character to the name of the second 9157 object but in clients having a typical file API (such as POSIX), 9158 the fact that the name change occurred cannot be propagated back 9159 to the requester. 9161 In cases where a client is application-specific, it may be 9162 possible for it to deal with such a collision by modifying the 9163 name and taking note of the changed name. 9165 12.7.1.6. Prohibited Characters for Component Names 9167 The NFSv4 protocol does not specify particular characters that may 9168 not appear in component names. File systems may have their own set 9169 of prohibited characters for which the error NFS4ERR_BADCHAR should 9170 be returned by the server. Clients need to be prepared for this 9171 error to occur whenever file name components are presented to the 9172 server. 9174 Clients whose character repertoire for acceptable characters in file 9175 name components is smaller than the entire scope of UCS-4 may need to 9176 deal with names returned by the server that contain characters 9177 outside that repertoire. It is up to the client whether it simply 9178 ignores these files or modifies the name to meet its own rules for 9179 acceptable names. 9181 Clients may encounter names that do not consist of valid UTF-8, if 9182 they interact with servers configured to allow this option. They are 9183 not required to deal with this case and may treat the server as not 9184 functioning correctly, or they may handle this as normal. Clients 9185 will normally make this a configuration option. As discussed above, 9186 a client can determine whether a particular file system is being 9187 supported by the server in this mode by issuing a LOOKUP specifying a 9188 name which is not valid UTF-8 and seeing if NFS4ERR_INVAL is 9189 returned. 9191 12.7.1.7. Bidirectional String Checking for Component Names 9193 The NFSv4 protocol does not require processing of component names to 9194 check for and reject bidirectional strings. Such processing may be a 9195 part of the file system implementation but if so, its particular form 9196 will be defined by the file system implementation. When strings are 9197 rejected on this basis, the error NFS4ERR_BADNAME would be returned. 9199 Clients need to be prepared for the fact that the server may reject a 9200 file name component if it consists of a bidirectional string, 9201 returning NFS4ERR_BADNAME. 9203 Clients may encounter names with bidirectional strings returned in 9204 responses from the server. If clients treat such strings as not 9205 valid file name components, it is up to the client whether it simply 9206 ignores these files or modifies the name component to meet its own 9207 rules for acceptable name component strings. 9209 12.7.2. Processing of Link Text 9211 Symbolic link text is defined as utf8val_should and therefore the 9212 server SHOULD validate link text on a CREATE and return NFS4ERR_INVAL 9213 if it is is not valid UTF-8. Note that file systems which treat 9214 names as strings of byte are an exception for which such validation 9215 need not be done. One other situation in which an NFSv4 might choose 9216 (or be configured) not to make such a check is when links within file 9217 system reference names in another which is configured to treat names 9218 as strings of bytes. 9220 On the other hand, UTF-8 validation of symbolic link text need not be 9221 done on the data resulting from a READLINK. Such data might have 9222 been stored by an NFS Version 4 server configured to allow non-UTF-8 9223 link text or it might have resulted from symbolic link text stored 9224 via local file system access or access via another remote file access 9225 protocol. 9227 Note that because of the role of the symbolic link, as data stored 9228 and read by the user, other sorts of validations or modifications 9229 should not be done. Note that when component names with the symbolic 9230 link text are used, such checks and modifications will be done at 9231 that time. In particular, 9232 o Limitation of the character repertoire MUST NOT be done. This 9233 includes limitations to reflect a particular version of Unicode, 9234 or the inability of any particularly file system to store 9235 characters beyond UCS-2. 9237 o Name mapping, whether for case folding or otherwise MUST NOT be 9238 done. 9240 o Checks for a type of normalization or normalization to a 9241 particular form MUST NOT be done. 9243 o Checks for specific characters excluded by the server or file 9244 system MUST NOT be done. 9246 o Checks for bidirectional strings MUST NOT be done. 9248 12.7.3. Processing of Principal Prefixes 9250 As mentioned above, users and groups are designated as a particular 9251 string at a specified domain. Servers will recognize a set of valid 9252 principals for one or more domains. With regard to the handling of 9253 these strings, the following rules MUST be followed 9255 o The string MUST be checked by the server for valid UTF-8 and the 9256 error NFS4ERR_INVAL returned if it is not valid. 9258 o The character repertoire for the principal prefix string should be 9259 limited to a current version of Unicode when the server is 9260 implemented. However, the client cannot be assured that all 9261 characters it receives as part of a user or group attribute are 9262 those that are defined in the Unicode version it expects to work 9263 with. 9265 o No character mapping is to be done, as for example table B.1 in 9266 stringprep, and no case mapping is to be done. The user and group 9267 names are to be treated as case-sensitive. 9269 o Strings must not be rejected based on their normalization. 9270 Servers should do normalization insensitive matching in converting 9271 a user to group to an internal id. The client cannot assume that 9272 the server preserves normalization so a user set to one string 9273 value may be returned as a string which differs in normalization 9274 and the client must be prepared to deal with that, by, for 9275 example, normalizing the string to the client's preferred form. 9277 o There are no checks for specific invalid characters but servers 9278 may limit the characters, with the result that any principal 9279 presented by the client which has such a characters is treated as 9280 invalid. 9282 o Specific checks for bidirectional strings are not done but servers 9283 may limit the principal prefix strings to those which are 9284 unidirectional or are of a certain direction, with the result that 9285 any principal presented by the client which done not meet that 9286 criterion will be treated as invalid. 9288 13. Error Values 9290 NFS error numbers are assigned to failed operations within a Compound 9291 (COMPOUND or CB_COMPOUND) request. A Compound request contains a 9292 number of NFS operations that have their results encoded in sequence 9293 in a Compound reply. The results of successful operations will 9294 consist of an NFS4_OK status followed by the encoded results of the 9295 operation. If an NFS operation fails, an error status will be 9296 entered in the reply and the Compound request will be terminated. 9298 13.1. Error Definitions 9300 Protocol Error Definitions 9302 +-----------------------------+--------+-------------------+ 9303 | Error | Number | Description | 9304 +-----------------------------+--------+-------------------+ 9305 | NFS4_OK | 0 | Section 13.1.3.1 | 9306 | NFS4ERR_ACCESS | 13 | Section 13.1.6.1 | 9307 | NFS4ERR_ATTRNOTSUPP | 10032 | Section 13.1.11.1 | 9308 | NFS4ERR_ADMIN_REVOKED | 10047 | Section 13.1.5.1 | 9309 | NFS4ERR_BADCHAR | 10040 | Section 13.1.7.1 | 9310 | NFS4ERR_BADHANDLE | 10001 | Section 13.1.2.1 | 9311 | NFS4ERR_BADNAME | 10041 | Section 13.1.7.2 | 9312 | NFS4ERR_BADOWNER | 10039 | Section 13.1.11.2 | 9313 | NFS4ERR_BADTYPE | 10007 | Section 13.1.4.1 | 9314 | NFS4ERR_BADXDR | 10036 | Section 13.1.1.1 | 9315 | NFS4ERR_BAD_COOKIE | 10003 | Section 13.1.1.2 | 9316 | NFS4ERR_BAD_RANGE | 10042 | Section 13.1.8.1 | 9317 | NFS4ERR_BAD_SEQID | 10026 | Section 13.1.8.2 | 9318 | NFS4ERR_BAD_STATEID | 10025 | Section 13.1.5.2 | 9319 | NFS4ERR_CLID_INUSE | 10017 | Section 13.1.10.1 | 9320 | NFS4ERR_DEADLOCK | 10045 | Section 13.1.8.3 | 9321 | NFS4ERR_DELAY | 10008 | Section 13.1.1.3 | 9322 | NFS4ERR_DENIED | 10010 | Section 13.1.8.4 | 9323 | NFS4ERR_DQUOT | 69 | Section 13.1.4.2 | 9324 | NFS4ERR_EXIST | 17 | Section 13.1.4.3 | 9325 | NFS4ERR_EXPIRED | 10011 | Section 13.1.5.3 | 9326 | NFS4ERR_FBIG | 27 | Section 13.1.4.4 | 9327 | NFS4ERR_FHEXPIRED | 10014 | Section 13.1.2.2 | 9328 | NFS4ERR_FILE_OPEN | 10046 | Section 13.1.4.5 | 9329 | NFS4ERR_GRACE | 10013 | Section 13.1.9.1 | 9330 | NFS4ERR_INVAL | 22 | Section 13.1.1.4 | 9331 | NFS4ERR_IO | 5 | Section 13.1.4.6 | 9332 | NFS4ERR_ISDIR | 21 | Section 13.1.2.3 | 9333 | NFS4ERR_LEASE_MOVED | 10031 | Section 13.1.5.4 | 9334 | NFS4ERR_LOCKED | 10012 | Section 13.1.8.5 | 9335 | NFS4ERR_LOCKS_HELD | 10037 | Section 13.1.8.6 | 9336 | NFS4ERR_LOCK_NOTSUPP | 10043 | Section 13.1.8.7 | 9337 | NFS4ERR_LOCK_RANGE | 10028 | Section 13.1.8.8 | 9338 | NFS4ERR_MINOR_VERS_MISMATCH | 10021 | Section 13.1.3.2 | 9339 | NFS4ERR_MLINK | 31 | Section 13.1.4.7 | 9340 | NFS4ERR_MOVED | 10019 | Section 13.1.2.4 | 9341 | NFS4ERR_NAMETOOLONG | 63 | Section 13.1.7.3 | 9342 | NFS4ERR_NOENT | 2 | Section 13.1.4.8 | 9343 | NFS4ERR_NOFILEHANDLE | 10020 | Section 13.1.2.5 | 9344 | NFS4ERR_NOSPC | 28 | Section 13.1.4.9 | 9345 | NFS4ERR_NOTDIR | 20 | Section 13.1.2.6 | 9346 | NFS4ERR_NOTEMPTY | 66 | Section 13.1.4.10 | 9347 | NFS4ERR_NOTSUPP | 10004 | Section 13.1.1.5 | 9348 | NFS4ERR_NOT_SAME | 10027 | Section 13.1.11.3 | 9349 | NFS4ERR_NO_GRACE | 10033 | Section 13.1.9.2 | 9350 | NFS4ERR_NXIO | 6 | Section 13.1.4.11 | 9351 | NFS4ERR_OLD_STATEID | 10024 | Section 13.1.5.5 | 9352 | NFS4ERR_OPENMODE | 10038 | Section 13.1.8.9 | 9353 | NFS4ERR_OP_ILLEGAL | 10044 | Section 13.1.3.3 | 9354 | NFS4ERR_PERM | 1 | Section 13.1.6.2 | 9355 | NFS4ERR_RECLAIM_BAD | 10034 | Section 13.1.9.3 | 9356 | NFS4ERR_RECLAIM_CONFLICT | 10035 | Section 13.1.9.4 | 9357 | NFS4ERR_RESOURCE | 10018 | Section 13.1.3.4 | 9358 | NFS4ERR_RESTOREFH | 10030 | Section 13.1.4.12 | 9359 | NFS4ERR_ROFS | 30 | Section 13.1.4.13 | 9360 | NFS4ERR_SAME | 10009 | Section 13.1.11.4 | 9361 | NFS4ERR_SERVERFAULT | 10006 | Section 13.1.1.6 | 9362 | NFS4ERR_STALE | 70 | Section 13.1.2.7 | 9363 | NFS4ERR_STALE_CLIENTID | 10022 | Section 13.1.10.2 | 9364 | NFS4ERR_STALE_STATEID | 10023 | Section 13.1.5.6 | 9365 | NFS4ERR_SYMLINK | 10029 | Section 13.1.2.8 | 9366 | NFS4ERR_TOOSMALL | 10005 | Section 13.1.1.7 | 9367 | NFS4ERR_WRONGSEC | 10016 | Section 13.1.6.3 | 9368 | NFS4ERR_XDEV | 18 | Section 13.1.4.14 | 9369 +-----------------------------+--------+-------------------+ 9371 Table 8 9373 13.1.1. General Errors 9375 This section deals with errors that are applicable to a broad set of 9376 different purposes. 9378 13.1.1.1. NFS4ERR_BADXDR (Error Code 10036) 9380 The arguments for this operation do not match those specified in the 9381 XDR definition. This includes situations in which the request ends 9382 before all the arguments have been seen. Note that this error 9383 applies when fixed enumerations (these include booleans) have a value 9384 within the input stream which is not valid for the enum. A replier 9385 may pre-parse all operations for a Compound procedure before doing 9386 any operation execution and return RPC-level XDR errors in that case. 9388 13.1.1.2. NFS4ERR_BAD_COOKIE (Error Code 10003) 9390 Used for operations that provide a set of information indexed by some 9391 quantity provided by the client or cookie sent by the server for an 9392 earlier invocation. Where the value cannot be used for its intended 9393 purpose, this error results. 9395 13.1.1.3. NFS4ERR_DELAY (Error Code 10008) 9397 For any of a number of reasons, the replier could not process this 9398 operation in what was deemed a reasonable time. The client should 9399 wait and then try the request with a new RPC transaction ID. 9401 Some example of situations that might lead to this situation: 9403 o A server that supports hierarchical storage receives a request to 9404 process a file that had been migrated. 9406 o An operation requires a delegation recall to proceed and waiting 9407 for this delegation recall makes processing this request in a 9408 timely fashion impossible. 9410 13.1.1.4. NFS4ERR_INVAL (Error Code 22) 9412 The arguments for this operation are not valid for some reason, even 9413 though they do match those specified in the XDR definition for the 9414 request. 9416 13.1.1.5. NFS4ERR_NOTSUPP (Error Code 10004) 9418 Operation not supported, either because the operation is an OPTIONAL 9419 one and is not supported by this server or because the operation MUST 9420 NOT be implemented in the current minor version. 9422 13.1.1.6. NFS4ERR_SERVERFAULT (Error Code 10006) 9424 An error occurred on the server which does not map to any of the 9425 specific legal NFSv4 protocol error values. The client should 9426 translate this into an appropriate error. UNIX clients may choose to 9427 translate this to EIO. 9429 13.1.1.7. NFS4ERR_TOOSMALL (Error Code 10005) 9431 Used where an operation returns a variable amount of data, with a 9432 limit specified by the client. Where the data returned cannot be fit 9433 within the limit specified by the client, this error results. 9435 13.1.2. Filehandle Errors 9437 These errors deal with the situation in which the current or saved 9438 filehandle, or the filehandle passed to PUTFH intended to become the 9439 current filehandle, is invalid in some way. This includes situations 9440 in which the filehandle is a valid filehandle in general but is not 9441 of the appropriate object type for the current operation. 9443 Where the error description indicates a problem with the current or 9444 saved filehandle, it is to be understood that filehandles are only 9445 checked for the condition if they are implicit arguments of the 9446 operation in question. 9448 13.1.2.1. NFS4ERR_BADHANDLE (Error Code 10001) 9450 Illegal NFS filehandle for the current server. The current file 9451 handle failed internal consistency checks. Once accepted as valid 9452 (by PUTFH), no subsequent status change can cause the filehandle to 9453 generate this error. 9455 13.1.2.2. NFS4ERR_FHEXPIRED (Error Code 10014) 9457 A current or saved filehandle which is an argument to the current 9458 operation is volatile and has expired at the server. 9460 13.1.2.3. NFS4ERR_ISDIR (Error Code 21) 9462 The current or saved filehandle designates a directory when the 9463 current operation does not allow a directory to be accepted as the 9464 target of this operation. 9466 13.1.2.4. NFS4ERR_MOVED (Error Code 10019) 9468 The file system which contains the current filehandle object is not 9469 present at the server. It may have been relocated, migrated to 9470 another server or may have never been present. The client may obtain 9471 the new file system location by obtaining the "fs_locations" or 9472 attribute for the current filehandle. For further discussion, refer 9473 to Section 7 9475 13.1.2.5. NFS4ERR_NOFILEHANDLE (Error Code 10020) 9477 The logical current or saved filehandle value is required by the 9478 current operation and is not set. This may be a result of a 9479 malformed COMPOUND operation (i.e., no PUTFH or PUTROOTFH before an 9480 operation that requires the current filehandle be set). 9482 13.1.2.6. NFS4ERR_NOTDIR (Error Code 20) 9484 The current (or saved) filehandle designates an object which is not a 9485 directory for an operation in which a directory is required. 9487 13.1.2.7. NFS4ERR_STALE (Error Code 70) 9489 The current or saved filehandle value designating an argument to the 9490 current operation is invalid The file referred to by that filehandle 9491 no longer exists or access to it has been revoked. 9493 13.1.2.8. NFS4ERR_SYMLINK (Error Code 10029) 9495 The current filehandle designates a symbolic link when the current 9496 operation does not allow a symbolic link as the target. 9498 13.1.3. Compound Structure Errors 9500 This section deals with errors that relate to overall structure of a 9501 Compound request (by which we mean to include both COMPOUND and 9502 CB_COMPOUND), rather than to particular operations. 9504 There are a number of basic constraints on the operations that may 9505 appear in a Compound request. 9507 13.1.3.1. NFS_OK (Error code 0) 9509 Indicates the operation completed successfully, in that all of the 9510 constituent operations completed without error. 9512 13.1.3.2. NFS4ERR_MINOR_VERS_MISMATCH (Error code 10021) 9514 The minor version specified is not one that the current listener 9515 supports. This value is returned in the overall status for the 9516 Compound but is not associated with a specific operation since the 9517 results must specify a result count of zero. 9519 13.1.3.3. NFS4ERR_OP_ILLEGAL (Error Code 10044) 9521 The operation code is not a valid one for the current Compound 9522 procedure. The opcode in the result stream matched with this error 9523 is the ILLEGAL value, although the value that appears in the request 9524 stream may be different. Where an illegal value appears and the 9525 replier pre-parses all operations for a Compound procedure before 9526 doing any operation execution, an RPC-level XDR error may be returned 9527 in this case. 9529 13.1.3.4. NFS4ERR_RESOURCE (Error Code 10018) 9531 For the processing of the Compound procedure, the server may exhaust 9532 available resources and cannot continue processing operations within 9533 the Compound procedure. This error will be returned from the server 9534 in those instances of resource exhaustion related to the processing 9535 of the Compound procedure. 9537 13.1.4. File System Errors 9539 These errors describe situations which occurred in the underlying 9540 file system implementation rather than in the protocol or any NFSv4.x 9541 feature. 9543 13.1.4.1. NFS4ERR_BADTYPE (Error Code 10007) 9545 An attempt was made to create an object with an inappropriate type 9546 specified to CREATE. This may be because the type is undefined, 9547 because it is a type not supported by the server, or because it is a 9548 type for which create is not intended such as a regular file or named 9549 attribute, for which OPEN is used to do the file creation. 9551 13.1.4.2. NFS4ERR_DQUOT (Error Code 19) 9553 Resource (quota) hard limit exceeded. The user's resource limit on 9554 the server has been exceeded. 9556 13.1.4.3. NFS4ERR_EXIST (Error Code 17) 9558 A file of the specified target name (when creating, renaming or 9559 linking) already exists. 9561 13.1.4.4. NFS4ERR_FBIG (Error Code 27) 9563 File too large. The operation would have caused a file to grow 9564 beyond the server's limit. 9566 13.1.4.5. NFS4ERR_FILE_OPEN (Error Code 10046) 9568 The operation is not allowed because a file involved in the operation 9569 is currently open. Servers may, but are not required to disallow 9570 linking-to, removing, or renaming open files. 9572 13.1.4.6. NFS4ERR_IO (Error Code 5) 9574 Indicates that an I/O error occurred for which the file system was 9575 unable to provide recovery. 9577 13.1.4.7. NFS4ERR_MLINK (Error Code 31) 9579 The request would have caused the server's limit for the number of 9580 hard links a file may have to be exceeded. 9582 13.1.4.8. NFS4ERR_NOENT (Error Code 2) 9584 Indicates no such file or directory. The file or directory name 9585 specified does not exist. 9587 13.1.4.9. NFS4ERR_NOSPC (Error Code 28) 9589 Indicates no space left on device. The operation would have caused 9590 the server's file system to exceed its limit. 9592 13.1.4.10. NFS4ERR_NOTEMPTY (Error Code 66) 9594 An attempt was made to remove a directory that was not empty. 9596 13.1.4.11. NFS4ERR_NXIO (Error Code 5) 9598 I/O error. No such device or address. 9600 13.1.4.12. NFS4ERR_RESTOREFH (Error Code 10030) 9602 The RESTOREFH operation does not have a saved filehandle (identified 9603 by SAVEFH) to operate upon. 9605 13.1.4.13. NFS4ERR_ROFS (Error Code 30) 9607 Indicates a read-only file system. A modifying operation was 9608 attempted on a read-only file system. 9610 13.1.4.14. NFS4ERR_XDEV (Error Code 18) 9612 Indicates an attempt to do an operation, such as linking, that 9613 inappropriately crosses a boundary. This may be due to such 9614 boundaries as: 9616 o That between file systems (where the fsids are different). 9618 o That between different named attribute directories or between a 9619 named attribute directory and an ordinary directory. 9621 o That between regions of a file system that the file system 9622 implementation treats as separate (for example for space 9623 accounting purposes), and where cross-connection between the 9624 regions are not allowed. 9626 13.1.5. State Management Errors 9628 These errors indicate problems with the stateid (or one of the 9629 stateids) passed to a given operation. This includes situations in 9630 which the stateid is invalid as well as situations in which the 9631 stateid is valid but designates revoked locking state. Depending on 9632 the operation, the stateid when valid may designate opens, byte-range 9633 locks, file or directory delegations, layouts, or device maps. 9635 13.1.5.1. NFS4ERR_ADMIN_REVOKED (Error Code 10047) 9637 A stateid designates locking state of any type that has been revoked 9638 due to administrative interaction, possibly while the lease is valid. 9640 13.1.5.2. NFS4ERR_BAD_STATEID (Error Code 10026) 9642 A stateid generated by the current server instance, but which does 9643 not designate any locking state (either current or superseded) for a 9644 current lockowner-file pair, was used. 9646 13.1.5.3. NFS4ERR_EXPIRED (Error Code 10011) 9648 A stateid designates locking state of any type that has been revoked 9649 due to expiration of the client's lease, either immediately upon 9650 lease expiration, or following a later request for a conflicting 9651 lock. 9653 13.1.5.4. NFS4ERR_LEASE_MOVED (Error Code 10031) 9655 A lease being renewed is associated with a file system that has been 9656 migrated to a new server. 9658 13.1.5.5. NFS4ERR_OLD_STATEID (Error Code 10024) 9660 A stateid with a non-zero seqid value does match the current seqid 9661 for the state designated by the user. 9663 13.1.5.6. NFS4ERR_STALE_STATEID (Error Code 10023) 9665 A stateid generated by an earlier server instance was used. 9667 13.1.6. Security Errors 9669 These are the various permission-related errors in NFSv4. 9671 13.1.6.1. NFS4ERR_ACCESS (Error Code 13) 9673 Indicates permission denied. The caller does not have the correct 9674 permission to perform the requested operation. Contrast this with 9675 NFS4ERR_PERM (Section 13.1.6.2), which restricts itself to owner or 9676 privileged user permission failures. 9678 13.1.6.2. NFS4ERR_PERM (Error Code 1) 9680 Indicates requester is not the owner. The operation was not allowed 9681 because the caller is neither a privileged user (root) nor the owner 9682 of the target of the operation. 9684 13.1.6.3. NFS4ERR_WRONGSEC (Error Code 10016) 9686 Indicates that the security mechanism being used by the client for 9687 the operation does not match the server's security policy. The 9688 client should change the security mechanism being used and re-send 9689 the operation. SECINFO can be used to determine the appropriate 9690 mechanism. 9692 13.1.7. Name Errors 9694 Names in NFSv4 are UTF-8 strings. When the strings are not are of 9695 length zero, the error NFS4ERR_INVAL results. When they are not 9696 valid UTF-8 the error NFS4ERR_INVAL also results, but servers may 9697 accommodate file systems with different character formats and not 9698 return this error. Besides this, there are a number of other errors 9699 to indicate specific problems with names. 9701 13.1.7.1. NFS4ERR_BADCHAR (Error Code 10040) 9703 A UTF-8 string contains a character which is not supported by the 9704 server in the context in which it being used. 9706 13.1.7.2. NFS4ERR_BADNAME (Error Code 10041) 9708 A name string in a request consisted of valid UTF-8 characters 9709 supported by the server but the name is not supported by the server 9710 as a valid name for current operation. An example might be creating 9711 a file or directory named ".." on a server whose file system uses 9712 that name for links to parent directories. 9714 This error should not be returned due a normalization issue in a 9715 string. When a file system keeps names in a particular normalization 9716 form, it is the server's responsibility to do the appropriate 9717 normalization, rather than rejecting the name. 9719 13.1.7.3. NFS4ERR_NAMETOOLONG (Error Code 63) 9721 Returned when the filename in an operation exceeds the server's 9722 implementation limit. 9724 13.1.8. Locking Errors 9726 This section deal with errors related to locking, both as to share 9727 reservations and byte-range locking. It does not deal with errors 9728 specific to the process of reclaiming locks. Those are dealt with in 9729 the next section. 9731 13.1.8.1. NFS4ERR_BAD_RANGE (Error Code 10042) 9733 The range for a LOCK, LOCKT, or LOCKU operation is not appropriate to 9734 the allowable range of offsets for the server. E.g., this error 9735 results when a server which only supports 32-bit ranges receives a 9736 range that cannot be handled by that server. (See Section 15.12.4). 9738 13.1.8.2. NFS4ERR_BAD_SEQID (Error Code 10026) 9740 The sequence number (seqid) in a locking request is neither the next 9741 expected number or the last number processed. 9743 13.1.8.3. NFS4ERR_DEADLOCK (Error Code 10045) 9745 The server has been able to determine a file locking deadlock 9746 condition for a blocking lock request. 9748 13.1.8.4. NFS4ERR_DENIED (Error Code 10010) 9750 An attempt to lock a file is denied. Since this may be a temporary 9751 condition, the client is encouraged to re-send the lock request until 9752 the lock is accepted. See Section 9.4 for a discussion of the re- 9753 send. 9755 13.1.8.5. NFS4ERR_LOCKED (Error Code 10012) 9757 A read or write operation was attempted on a file where there was a 9758 conflict between the I/O and an existing lock: 9760 o There is a share reservation inconsistent with the I/O being done. 9762 o The range to be read or written intersects an existing mandatory 9763 byte range lock. 9765 13.1.8.6. NFS4ERR_LOCKS_HELD (Error Code 10037) 9767 An operation was prevented by the unexpected presence of locks. 9769 13.1.8.7. NFS4ERR_LOCK_NOTSUPP (Error Code 10043) 9771 A locking request was attempted which would require the upgrade or 9772 downgrade of a lock range already held by the owner when the server 9773 does not support atomic upgrade or downgrade of locks. 9775 13.1.8.8. NFS4ERR_LOCK_RANGE (Error Code 10028) 9777 A lock request is operating on a range that overlaps in part a 9778 currently held lock for the current lock owner and does not precisely 9779 match a single such lock where the server does not support this type 9780 of request, and thus does not implement POSIX locking semantics [35]. 9781 See Section 15.12.5, Section 15.13.5, and Section 15.14.5 for a 9782 discussion of how this applies to LOCK, LOCKT, and LOCKU 9783 respectively. 9785 13.1.8.9. NFS4ERR_OPENMODE (Error Code 10038) 9787 The client attempted a READ, WRITE, LOCK or other operation not 9788 sanctioned by the stateid passed (e.g., writing to a file opened only 9789 for read). 9791 13.1.9. Reclaim Errors 9793 These errors relate to the process of reclaiming locks after a server 9794 restart. 9796 13.1.9.1. NFS4ERR_GRACE (Error Code 10013) 9798 The server is in its recovery or grace period which should at least 9799 match the lease period of the server. A locking request other than a 9800 reclaim could not be granted during that period. 9802 13.1.9.2. NFS4ERR_NO_GRACE (Error Code 10033) 9804 A reclaim of client state was attempted in circumstances in which the 9805 server cannot guarantee that conflicting state has not been provided 9806 to another client. As a result, the server cannot guarantee that 9807 conflicting state has not been provided to another client. 9809 13.1.9.3. NFS4ERR_RECLAIM_BAD (Error Code 10034) 9811 A reclaim attempted by the client does not match the server's state 9812 consistency checks and has been rejected therefore as invalid. 9814 13.1.9.4. NFS4ERR_RECLAIM_CONFLICT (Error Code 10035) 9816 The reclaim attempted by the client has encountered a conflict and 9817 cannot be satisfied. Potentially indicates a misbehaving client, 9818 although not necessarily the one receiving the error. The 9819 misbehavior might be on the part of the client that established the 9820 lock with which this client conflicted. 9822 13.1.10. Client Management Errors 9824 This sections deals with errors associated with requests used to 9825 create and manage client IDs. 9827 13.1.10.1. NFS4ERR_CLID_INUSE (Error Code 10017) 9829 The SETCLIENTID operation has found that a client id is already in 9830 use by another client. 9832 13.1.10.2. NFS4ERR_STALE_CLIENTID (Error Code 10022) 9834 A client ID not recognized by the server was used in a locking or 9835 SETCLIENTID_CONFIRM request. 9837 13.1.11. Attribute Handling Errors 9839 This section deals with errors specific to attribute handling within 9840 NFSv4. 9842 13.1.11.1. NFS4ERR_ATTRNOTSUPP (Error Code 10032) 9844 An attribute specified is not supported by the server. This error 9845 MUST NOT be returned by the GETATTR operation. 9847 13.1.11.2. NFS4ERR_BADOWNER (Error Code 10039) 9849 Returned when an owner or owner_group attribute value or the who 9850 field of an ace within an ACL attribute value cannot be translated to 9851 a local representation. 9853 13.1.11.3. NFS4ERR_NOT_SAME (Error Code 10027) 9855 This error is returned by the VERIFY operation to signify that the 9856 attributes compared were not the same as those provided in the 9857 client's request. 9859 13.1.11.4. NFS4ERR_SAME (Error Code 10009) 9861 This error is returned by the NVERIFY operation to signify that the 9862 attributes compared were the same as those provided in the client's 9863 request. 9865 13.2. Operations and their valid errors 9867 This section contains a table which gives the valid error returns for 9868 each protocol operation. The error code NFS4_OK (indicating no 9869 error) is not listed but should be understood to be returnable by all 9870 operations except ILLEGAL. 9872 Valid error returns for each protocol operation 9874 +---------------------+---------------------------------------------+ 9875 | Operation | Errors | 9876 +---------------------+---------------------------------------------+ 9877 | ACCESS | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 9878 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 9879 | | NFS4ERR_FHEXPIRED, NFS4ERR_INVAL, | 9880 | | NFS4ERR_IO, NFS4ERR_MOVED, | 9881 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_RESOURCE, | 9882 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE | 9883 | CLOSE | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADHANDLE, | 9884 | | NFS4ERR_BAD_SEQID, NFS4ERR_BAD_STATEID, | 9885 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 9886 | | NFS4ERR_EXPIRED, NFS4ERR_FHEXPIRED, | 9887 | | NFS4ERR_INVAL, NFS4ERR_ISDIR, | 9888 | | NFS4ERR_LEASE_MOVED, NFS4ERR_LOCKS_HELD, | 9889 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9890 | | NFS4ERR_OLD_STATEID, NFS4ERR_RESOURCE, | 9891 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 9892 | | NFS4ERR_STALE_STATEID | 9893 | COMMIT | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 9894 | | NFS4ERR_BADXDR, NFS4ERR_FHEXPIRED, | 9895 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_ISDIR, | 9896 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9897 | | NFS4ERR_RESOURCE, NFS4ERR_ROFS, | 9898 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 9899 | | NFS4ERR_SYMLINK | 9900 | CREATE | NFS4ERR_ACCESS, NFS4ERR_ATTRNOTSUPP, | 9901 | | NFS4ERR_BADCHAR, NFS4ERR_BADHANDLE, | 9902 | | NFS4ERR_BADNAME, NFS4ERR_BADOWNER, | 9903 | | NFS4ERR_BADTYPE, NFS4ERR_BADXDR, | 9904 | | NFS4ERR_DELAY, NFS4ERR_DQUOT, | 9905 | | NFS4ERR_EXIST, NFS4ERR_FHEXPIRED, | 9906 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_MOVED, | 9907 | | NFS4ERR_NAMETOOLONG, NFS4ERR_NOFILEHANDLE, | 9908 | | NFS4ERR_NOSPC, NFS4ERR_NOTDIR, | 9909 | | NFS4ERR_PERM, NFS4ERR_RESOURCE, | 9910 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 9911 | | NFS4ERR_STALE | 9912 | DELEGPURGE | NFS4ERR_BADXDR, NFS4ERR_NOTSUPP, | 9913 | | NFS4ERR_LEASE_MOVED, NFS4ERR_RESOURCE, | 9914 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE_CLIENTID | 9915 | DELEGRETURN | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BAD_STATEID, | 9916 | | NFS4ERR_BADXDR, NFS4ERR_EXPIRED, | 9917 | | NFS4ERR_INVAL, NFS4ERR_LEASE_MOVED, | 9918 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9919 | | NFS4ERR_NOTSUPP, NFS4ERR_OLD_STATEID, | 9920 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 9921 | | NFS4ERR_STALE, NFS4ERR_STALE_STATEID | 9922 | GETATTR | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 9923 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 9924 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 9925 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_MOVED, | 9926 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_RESOURCE, | 9927 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE | 9928 | GETFH | NFS4ERR_BADHANDLE, NFS4ERR_FHEXPIRED, | 9929 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9930 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 9931 | | NFS4ERR_STALE | 9932 | ILLEGAL | NFS4ERR_BADXDR, NFS4ERR_OP_ILLEGAL | 9933 | LINK | NFS4ERR_ACCESS, NFS4ERR_BADCHAR, | 9934 | | NFS4ERR_BADHANDLE, NFS4ERR_BADNAME, | 9935 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 9936 | | NFS4ERR_DQUOT, NFS4ERR_EXIST, | 9937 | | NFS4ERR_FHEXPIRED, NFS4ERR_FILE_OPEN, | 9938 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_ISDIR, | 9939 | | NFS4ERR_MLINK, NFS4ERR_MOVED, | 9940 | | NFS4ERR_NAMETOOLONG, NFS4ERR_NOENT, | 9941 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOSPC, | 9942 | | NFS4ERR_NOTDIR, NFS4ERR_NOTSUPP, | 9943 | | NFS4ERR_RESOURCE, NFS4ERR_ROFS, | 9944 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 9945 | | NFS4ERR_WRONGSEC, NFS4ERR_XDEV | 9946 | LOCK | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 9947 | | NFS4ERR_BADHANDLE, NFS4ERR_BAD_RANGE, | 9948 | | NFS4ERR_BAD_SEQID, NFS4ERR_BAD_STATEID, | 9949 | | NFS4ERR_BADXDR, NFS4ERR_DEADLOCK, | 9950 | | NFS4ERR_DELAY, NFS4ERR_DENIED, | 9951 | | NFS4ERR_EXPIRED, NFS4ERR_FHEXPIRED, | 9952 | | NFS4ERR_GRACE, NFS4ERR_INVAL, | 9953 | | NFS4ERR_ISDIR, NFS4ERR_LEASE_MOVED, | 9954 | | NFS4ERR_LOCK_NOTSUPP, NFS4ERR_LOCK_RANGE, | 9955 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9956 | | NFS4ERR_NO_GRACE, NFS4ERR_OLD_STATEID, | 9957 | | NFS4ERR_OPENMODE, NFS4ERR_RECLAIM_BAD, | 9958 | | NFS4ERR_RECLAIM_CONFLICT, NFS4ERR_RESOURCE, | 9959 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 9960 | | NFS4ERR_STALE_CLIENTID, | 9961 | | NFS4ERR_STALE_STATEID | 9962 | LOCKT | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 9963 | | NFS4ERR_BAD_RANGE, NFS4ERR_BADXDR, | 9964 | | NFS4ERR_DELAY, NFS4ERR_DENIED, | 9965 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 9966 | | NFS4ERR_INVAL, NFS4ERR_ISDIR, | 9967 | | NFS4ERR_LEASE_MOVED, NFS4ERR_LOCK_RANGE, | 9968 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9969 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 9970 | | NFS4ERR_STALE, NFS4ERR_STALE_CLIENTID | 9971 | LOCKU | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 9972 | | NFS4ERR_BADHANDLE, NFS4ERR_BAD_RANGE, | 9973 | | NFS4ERR_BAD_SEQID, NFS4ERR_BAD_STATEID, | 9974 | | NFS4ERR_BADXDR, NFS4ERR_EXPIRED, | 9975 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 9976 | | NFS4ERR_INVAL, NFS4ERR_ISDIR, | 9977 | | NFS4ERR_LEASE_MOVED, NFS4ERR_LOCK_RANGE, | 9978 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 9979 | | NFS4ERR_OLD_STATEID, NFS4ERR_RESOURCE, | 9980 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 9981 | | NFS4ERR_STALE_STATEID | 9982 | LOOKUP | NFS4ERR_ACCESS, NFS4ERR_BADCHAR, | 9983 | | NFS4ERR_BADHANDLE, NFS4ERR_BADNAME, | 9984 | | NFS4ERR_BADXDR, NFS4ERR_FHEXPIRED, | 9985 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_MOVED, | 9986 | | NFS4ERR_NAMETOOLONG, NFS4ERR_NOENT, | 9987 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOTDIR, | 9988 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 9989 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 9990 | | NFS4ERR_WRONGSEC | 9991 | LOOKUPP | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 9992 | | NFS4ERR_DELAY, NFS4ERR_FHEXPIRED, | 9993 | | NFS4ERR_IO, NFS4ERR_MOVED, NFS4ERR_NOENT, | 9994 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOTDIR, | 9995 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 9996 | | NFS4ERR_STALE, NFS4ERR_SYMLINK, | 9997 | | NFS4ERR_WRONGSEC | 9998 | NVERIFY | NFS4ERR_ACCESS, NFS4ERR_ATTRNOTSUPP, | 9999 | | NFS4ERR_BADCHAR, NFS4ERR_BADHANDLE, | 10000 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10001 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 10002 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_MOVED, | 10003 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_SAME, | 10004 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE | 10005 | OPEN | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 10006 | | NFS4ERR_ATTRNOTSUPP, NFS4ERR_BADCHAR, | 10007 | | NFS4ERR_BADHANDLE, NFS4ERR_BADNAME, | 10008 | | NFS4ERR_BADOWNER, NFS4ERR_BADXDR, | 10009 | | NFS4ERR_BAD_SEQID, NFS4ERR_BAD_STATEID, | 10010 | | NFS4ERR_DELAY, NFS4ERR_DQUOT, | 10011 | | NFS4ERR_EXIST, NFS4ERR_EXPIRED, | 10012 | | NFS4ERR_FBIG, NFS4ERR_FHEXPIRED, | 10013 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_IO, | 10014 | | NFS4ERR_ISDIR, NFS4ERR_MOVED, | 10015 | | NFS4ERR_NAMETOOLONG, NFS4ERR_NOENT, | 10016 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOSPC, | 10017 | | NFS4ERR_NOTDIR, NFS4ERR_NOTSUP, | 10018 | | NFS4ERR_NO_GRACE, NFS4ERR_OLD_STATEID, | 10019 | | NFS4ERR_PERM, NFS4ERR_RECLAIM_BAD, | 10020 | | NFS4ERR_RECLAIM_CONFLICT, NFS4ERR_RESOURCE, | 10021 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 10022 | | NFS4ERR_SHARE_DENIED, NFS4ERR_STALE, | 10023 | | NFS4ERR_STALE_CLIENTID, NFS4ERR_SYMLINK, | 10024 | | NFS4ERR_WRONGSEC | 10025 | OPENATTR | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 10026 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10027 | | NFS4ERR_DQUOT, NFS4ERR_FHEXPIRED, | 10028 | | NFS4ERR_IO, NFS4ERR_MOVED, NFS4ERR_NOENT, | 10029 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOSPC, | 10030 | | NFS4ERR_NOTSUPP, NFS4ERR_RESOURCE, | 10031 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 10032 | | NFS4ERR_STALE | 10033 | OPEN_CONFIRM | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADHANDLE, | 10034 | | NFS4ERR_BAD_SEQID, NFS4ERR_BAD_STATEID, | 10035 | | NFS4ERR_BADXDR, NFS4ERR_EXPIRED, | 10036 | | NFS4ERR_FHEXPIRED, NFS4ERR_INVAL, | 10037 | | NFS4ERR_ISDIR, NFS4ERR_LEASE_MOVED, | 10038 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 10039 | | NFS4ERR_OLD_STATEID, NFS4ERR_RESOURCE, | 10040 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 10041 | | NFS4ERR_STALE_STATEID | 10042 | OPEN_DOWNGRADE | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADHANDLE, | 10043 | | NFS4ERR_BADXDR, NFS4ERR_BAD_SEQID, | 10044 | | NFS4ERR_BAD_STATEID, NFS4ERR_DELAY, | 10045 | | NFS4ERR_EXPIRED, NFS4ERR_FHEXPIRED, | 10046 | | NFS4ERR_INVAL, NFS4ERR_LEASE_MOVED, | 10047 | | NFS4ERR_LOCKS_HELD, NFS4ERR_MOVED, | 10048 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_OLD_STATEID, | 10049 | | NFS4ERR_RESOURCE, NFS4ERR_ROFS, | 10050 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 10051 | | NFS4ERR_STALE_STATEID | 10052 | PUTFH | NFS4ERR_BADHANDLE, NFS4ERR_BADXDR, | 10053 | | NFS4ERR_DELAY, NFS4ERR_FHEXPIRED, | 10054 | | NFS4ERR_MOVED, NFS4ERR_SERVERFAULT, | 10055 | | NFS4ERR_STALE, NFS4ERR_WRONGSEC | 10056 | PUTPUBFH | NFS4ERR_DELAY, NFS4ERR_SERVERFAULT, | 10057 | | NFS4ERR_WRONGSEC | 10058 | PUTROOTFH | NFS4ERR_DELAY, NFS4ERR_SERVERFAULT, | 10059 | | NFS4ERR_WRONGSEC | 10060 | READ | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 10061 | | NFS4ERR_BADHANDLE, NFS4ERR_BADXDR, | 10062 | | NFS4ERR_BAD_STATEID, NFS4ERR_DELAY, | 10063 | | NFS4ERR_EXPIRED, NFS4ERR_FHEXPIRED, | 10064 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_IO, | 10065 | | NFS4ERR_ISDIR, NFS4ERR_LEASE_MOVED, | 10066 | | NFS4ERR_LOCKED, NFS4ERR_MOVED, | 10067 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_OLD_STATEID, | 10068 | | NFS4ERR_OPENMODE, NFS4ERR_RESOURCE, | 10069 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 10070 | | NFS4ERR_STALE_STATEID, NFS4ERR_SYMLINK | 10071 | READDIR | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 10072 | | NFS4ERR_BADXDR, NFS4ERR_BAD_COOKIE, | 10073 | | NFS4ERR_DELAY, NFS4ERR_FHEXPIRED, | 10074 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_MOVED, | 10075 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOTDIR, | 10076 | | NFS4ERR_NOT_SAME, NFS4ERR_RESOURCE, | 10077 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 10078 | | NFS4ERR_TOOSMALL | 10079 | READLINK | NFS4ERR_ACCESS, NFS4ERR_BADHANDLE, | 10080 | | NFS4ERR_DELAY, NFS4ERR_FHEXPIRED, | 10081 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_ISDIR, | 10082 | | NFS4ERR_MOVED, NFS4ERR_NOTSUP, | 10083 | | NFS4ERR_RESOURCE, NFS4ERR_NOFILEHANDLE, | 10084 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE | 10085 | RELEASE_LOCKOWNER | NFS4ERR_ADMIN_REVOKED, NFS4ERR_BADXDR, | 10086 | | NFS4ERR_EXPIRED, NFS4ERR_LEASE_MOVED, | 10087 | | NFS4ERR_LOCKS_HELD, NFS4ERR_RESOURCE, | 10088 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE_CLIENTID | 10089 | REMOVE | NFS4ERR_ACCESS, NFS4ERR_BADCHAR, | 10090 | | NFS4ERR_BADHANDLE, NFS4ERR_BADNAME, | 10091 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10092 | | NFS4ERR_FHEXPIRED, NFS4ERR_FILE_OPEN, | 10093 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_IO, | 10094 | | NFS4ERR_MOVED, NFS4ERR_NAMETOOLONG, | 10095 | | NFS4ERR_NOENT, NFS4ERR_NOFILEHANDLE, | 10096 | | NFS4ERR_NOTDIR, NFS4ERR_NOTEMPTY, | 10097 | | NFS4ERR_RESOURCE, NFS4ERR_ROFS, | 10098 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE | 10099 | RENAME | NFS4ERR_ACCESS, NFS4ERR_BADCHAR, | 10100 | | NFS4ERR_BADHANDLE, NFS4ERR_BADNAME, | 10101 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10102 | | NFS4ERR_DQUOT, NFS4ERR_EXIST, | 10103 | | NFS4ERR_FHEXPIRED, NFS4ERR_FILE_OPEN, | 10104 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_IO, | 10105 | | NFS4ERR_MOVED, NFS4ERR_NAMETOOLONG, | 10106 | | NFS4ERR_NOENT, NFS4ERR_NOFILEHANDLE, | 10107 | | NFS4ERR_NOSPC, NFS4ERR_NOTDIR, | 10108 | | NFS4ERR_NOTEMPTY, NFS4ERR_RESOURCE, | 10109 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 10110 | | NFS4ERR_STALE, NFS4ERR_WRONGSEC, | 10111 | | NFS4ERR_XDEV | 10112 | RENEW | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 10113 | | NFS4ERR_BADXDR, NFS4ERR_CB_PATH_DOWN, | 10114 | | NFS4ERR_EXPIRED, NFS4ERR_LEASE_MOVED, | 10115 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 10116 | | NFS4ERR_STALE_CLIENTID | 10117 | RESTOREFH | NFS4ERR_BADHANDLE, NFS4ERR_FHEXPIRED, | 10118 | | NFS4ERR_MOVED, NFS4ERR_RESOURCE, | 10119 | | NFS4ERR_RESTOREFH, NFS4ERR_SERVERFAULT, | 10120 | | NFS4ERR_STALE, NFS4ERR_WRONGSEC | 10121 | SAVEFH | NFS4ERR_BADHANDLE, NFS4ERR_FHEXPIRED, | 10122 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 10123 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 10124 | | NFS4ERR_STALE | 10125 | SECINFO | NFS4ERR_ACCESS, NFS4ERR_BADCHAR, | 10126 | | NFS4ERR_BADHANDLE, NFS4ERR_BADNAME, | 10127 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10128 | | NFS4ERR_FHEXPIRED, NFS4ERR_INVAL, | 10129 | | NFS4ERR_MOVED, NFS4ERR_NAMETOOLONG, | 10130 | | NFS4ERR_NOENT, NFS4ERR_NOFILEHANDLE, | 10131 | | NFS4ERR_NOTDIR, NFS4ERR_RESOURCE, | 10132 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE | 10133 | SETATTR | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 10134 | | NFS4ERR_ATTRNOTSUPP, NFS4ERR_BADCHAR, | 10135 | | NFS4ERR_BADHANDLE, NFS4ERR_BADOWNER, | 10136 | | NFS4ERR_BADXDR, NFS4ERR_BAD_STATEID, | 10137 | | NFS4ERR_DELAY, NFS4ERR_DQUOT, | 10138 | | NFS4ERR_EXPIRED, NFS4ERR_FBIG, | 10139 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 10140 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_ISDIR, | 10141 | | NFS4ERR_LEASE_MOVED, NFS4ERR_LOCKED, | 10142 | | NFS4ERR_MOVED, NFS4ERR_NOFILEHANDLE, | 10143 | | NFS4ERR_NOSPC, NFS4ERR_OLD_STATEID, | 10144 | | NFS4ERR_OPENMODE, NFS4ERR_PERM, | 10145 | | NFS4ERR_RESOURCE, NFS4ERR_ROFS, | 10146 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE, | 10147 | | NFS4ERR_STALE_STATEID | 10148 | SETCLIENTID | NFS4ERR_BADXDR, NFS4ERR_CLID_INUSE, | 10149 | | NFS4ERR_DELAY, NFS4ERR_INVAL, | 10150 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT | 10151 | SETCLIENTID_CONFIRM | NFS4ERR_BADXDR, NFS4ERR_CLID_INUSE, | 10152 | | NFS4ERR_DELAY, NFS4ERR_RESOURCE, | 10153 | | NFS4ERR_SERVERFAULT, NFS4ERR_STALE_CLIENTID | 10154 | VERIFY | NFS4ERR_ACCESS, NFS4ERR_ATTRNOTSUPP, | 10155 | | NFS4ERR_BADCHAR, NFS4ERR_BADHANDLE, | 10156 | | NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10157 | | NFS4ERR_FHEXPIRED, NFS4ERR_GRACE, | 10158 | | NFS4ERR_INVAL, NFS4ERR_IO, NFS4ERR_MOVED, | 10159 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOT_SAME, | 10160 | | NFS4ERR_RESOURCE, NFS4ERR_SERVERFAULT, | 10161 | | NFS4ERR_STALE | 10162 | WRITE | NFS4ERR_ACCESS, NFS4ERR_ADMIN_REVOKED, | 10163 | | NFS4ERR_BADXDR, NFS4ERR_BADHANDLE, | 10164 | | NFS4ERR_BAD_STATEID, NFS4ERR_DELAY, | 10165 | | NFS4ERR_DQUOT, NFS4ERR_EXPIRED, | 10166 | | NFS4ERR_FBIG, NFS4ERR_FHEXPIRED, | 10167 | | NFS4ERR_GRACE, NFS4ERR_INVAL, NFS4ERR_IO, | 10168 | | NFS4ERR_ISDIR, NFS4ERR_LEASE_MOVED, | 10169 | | NFS4ERR_LOCKED, NFS4ERR_MOVED, | 10170 | | NFS4ERR_NOFILEHANDLE, NFS4ERR_NOSPC, | 10171 | | NFS4ERR_NXIO, NFS4ERR_OLD_STATEID, | 10172 | | NFS4ERR_OPENMODE, NFS4ERR_RESOURCE, | 10173 | | NFS4ERR_ROFS, NFS4ERR_SERVERFAULT, | 10174 | | NFS4ERR_STALE, NFS4ERR_STALE_STATEID, | 10175 | | NFS4ERR_SYMLINK | 10176 +---------------------+---------------------------------------------+ 10178 Table 9 10180 13.3. Callback operations and their valid errors 10182 This section contains a table which gives the valid error returns for 10183 each callback operation. The error code NFS4_OK (indicating no 10184 error) is not listed but should be understood to be returnable by all 10185 callback operations with the exception of CB_ILLEGAL. 10187 Valid error returns for each protocol callback operation 10189 +-------------+-----------------------------------------------------+ 10190 | Callback | Errors | 10191 | Operation | | 10192 +-------------+-----------------------------------------------------+ 10193 | CB_GETATTR | NFS4ERR_BADHANDLE, NFS4ERR_BADXDR, NFS4ERR_DELAY, | 10194 | | NFS4ERR_INVAL, NFS4ERR_SERVERFAULT | 10195 | CB_ILLEGAL | NFS4ERR_BADXDR, NFS4ERR_OP_ILLEGAL | 10196 | CB_RECALL | NFS4ERR_BADHANDLE, NFS4ERR_BADXDR, | 10197 | | NFS4ERR_BAD_STATEID, NFS4ERR_DELAY, | 10198 | | NFS4ERR_SERVERFAULT | 10199 +-------------+-----------------------------------------------------+ 10201 Table 10 10203 13.4. Errors and the operations that use them 10204 +--------------------------+----------------------------------------+ 10205 | Error | Operations | 10206 +--------------------------+----------------------------------------+ 10207 | NFS4ERR_ACCESS | ACCESS, COMMIT, CREATE, GETATTR, LINK, | 10208 | | LOCK, LOCKT, LOCKU, LOOKUP, LOOKUPP, | 10209 | | NVERIFY, OPEN, OPENATTR, READ, | 10210 | | READDIR, READLINK, REMOVE, RENAME, | 10211 | | RENEW, SECINFO, SETATTR, VERIFY, WRITE | 10212 | NFS4ERR_ADMIN_REVOKED | CLOSE, DELEGRETURN, LOCK, LOCKU, OPEN, | 10213 | | OPEN_CONFIRM, OPEN_DOWNGRADE, READ, | 10214 | | RELEASE_LOCKOWNER, RENEW, SETATTR, | 10215 | | WRITE | 10216 | NFS4ERR_ATTRNOTSUPP | CREATE, NVERIFY, OPEN, SETATTR, VERIFY | 10217 | NFS4ERR_BADCHAR | CREATE, LINK, LOOKUP, NVERIFY, OPEN, | 10218 | | REMOVE, RENAME, SECINFO, SETATTR, | 10219 | | VERIFY | 10220 | NFS4ERR_BADHANDLE | ACCESS, CB_GETATTR, CB_RECALL, CLOSE, | 10221 | | COMMIT, CREATE, GETATTR, GETFH, LINK, | 10222 | | LOCK, LOCKT, LOCKU, LOOKUP, LOOKUPP, | 10223 | | NVERIFY, OPEN, OPENATTR, OPEN_CONFIRM, | 10224 | | OPEN_DOWNGRADE, PUTFH, READ, READDIR, | 10225 | | READLINK, REMOVE, RENAME, RESTOREFH, | 10226 | | SAVEFH, SECINFO, SETATTR, VERIFY, | 10227 | | WRITE | 10228 | NFS4ERR_BADNAME | CREATE, LINK, LOOKUP, OPEN, REMOVE, | 10229 | | RENAME, SECINFO | 10230 | NFS4ERR_BADOWNER | CREATE, OPEN, SETATTR | 10231 | NFS4ERR_BADTYPE | CREATE | 10232 | NFS4ERR_BADXDR | ACCESS, CB_GETATTR, CB_ILLEGAL, | 10233 | | CB_RECALL, CLOSE, COMMIT, CREATE, | 10234 | | DELEGPURGE, DELEGRETURN, GETATTR, | 10235 | | ILLEGAL, LINK, LOCK, LOCKT, LOCKU, | 10236 | | LOOKUP, NVERIFY, OPEN, OPENATTR, | 10237 | | OPEN_CONFIRM, OPEN_DOWNGRADE, PUTFH, | 10238 | | READ, READDIR, RELEASE_LOCKOWNER, | 10239 | | REMOVE, RENAME, RENEW, SECINFO, | 10240 | | SETATTR, SETCLIENTID, | 10241 | | SETCLIENTID_CONFIRM, VERIFY, WRITE | 10242 | NFS4ERR_BAD_COOKIE | READDIR | 10243 | NFS4ERR_BAD_RANGE | LOCK, LOCKT, LOCKU | 10244 | NFS4ERR_BAD_SEQID | CLOSE, LOCK, LOCKU, OPEN, | 10245 | | OPEN_CONFIRM, OPEN_DOWNGRADE | 10246 | NFS4ERR_BAD_STATEID | CB_RECALL, CLOSE, DELEGRETURN, LOCK, | 10247 | | LOCKU, OPEN, OPEN_CONFIRM, | 10248 | | OPEN_DOWNGRADE, READ, SETATTR, WRITE | 10249 | NFS4ERR_CB_PATH_DOWN | RENEW | 10250 | NFS4ERR_CLID_INUSE | SETCLIENTID, SETCLIENTID_CONFIRM | 10251 | NFS4ERR_DEADLOCK | LOCK | 10252 | NFS4ERR_DELAY | ACCESS, CB_GETATTR, CB_RECALL, CLOSE, | 10253 | | CREATE, GETATTR, LINK, LOCK, LOCKT, | 10254 | | LOOKUPP, NVERIFY, OPEN, OPENATTR, | 10255 | | OPEN_DOWNGRADE, PUTFH, PUTPUBFH, | 10256 | | PUTROOTFH, READ, READDIR, READLINK, | 10257 | | REMOVE, RENAME, SECINFO, SETATTR, | 10258 | | SETCLIENTID, SETCLIENTID_CONFIRM, | 10259 | | VERIFY, WRITE | 10260 | NFS4ERR_DENIED | LOCK, LOCKT | 10261 | NFS4ERR_DQUOT | CREATE, LINK, OPEN, OPENATTR, RENAME, | 10262 | | SETATTR, WRITE | 10263 | NFS4ERR_EXIST | CREATE, LINK, OPEN, RENAME | 10264 | NFS4ERR_EXPIRED | CLOSE, DELEGRETURN, LOCK, LOCKU, OPEN, | 10265 | | OPEN_CONFIRM, OPEN_DOWNGRADE, READ, | 10266 | | RELEASE_LOCKOWNER, RENEW, SETATTR, | 10267 | | WRITE | 10268 | NFS4ERR_FBIG | OPEN, SETATTR, WRITE | 10269 | NFS4ERR_FHEXPIRED | ACCESS, CLOSE, COMMIT, CREATE, | 10270 | | GETATTR, GETFH, LINK, LOCK, LOCKT, | 10271 | | LOCKU, LOOKUP, LOOKUPP, NVERIFY, OPEN, | 10272 | | OPENATTR, OPEN_CONFIRM, | 10273 | | OPEN_DOWNGRADE, PUTFH, READ, READDIR, | 10274 | | READLINK, REMOVE, RENAME, RESTOREFH, | 10275 | | SAVEFH, SECINFO, SETATTR, VERIFY, | 10276 | | WRITE | 10277 | NFS4ERR_FILE_OPEN | LINK, REMOVE, RENAME | 10278 | NFS4ERR_GRACE | GETATTR, LOCK, LOCKT, LOCKU, NVERIFY, | 10279 | | OPEN, READ, REMOVE, RENAME, SETATTR, | 10280 | | VERIFY, WRITE | 10281 | NFS4ERR_INVAL | ACCESS, CB_GETATTR, CLOSE, COMMIT, | 10282 | | CREATE, DELEGRETURN, GETATTR, LINK, | 10283 | | LOCK, LOCKT, LOCKU, LOOKUP, NVERIFY, | 10284 | | OPEN, OPEN_CONFIRM, OPEN_DOWNGRADE, | 10285 | | READ, READDIR, READLINK, REMOVE, | 10286 | | RENAME, SECINFO, SETATTR, SETCLIENTID, | 10287 | | VERIFY, WRITE | 10288 | NFS4ERR_IO | ACCESS, COMMIT, CREATE, GETATTR, LINK, | 10289 | | LOOKUP, LOOKUPP, NVERIFY, OPEN, | 10290 | | OPENATTR, READ, READDIR, READLINK, | 10291 | | REMOVE, RENAME, SETATTR, VERIFY, WRITE | 10292 | NFS4ERR_ISDIR | CLOSE, COMMIT, LINK, LOCK, LOCKT, | 10293 | | LOCKU, OPEN, OPEN_CONFIRM, READ, | 10294 | | READLINK, SETATTR, WRITE | 10295 | NFS4ERR_LEASE_MOVED | CLOSE, DELEGPURGE, DELEGRETURN, LOCK, | 10296 | | LOCKT, LOCKU, OPEN_CONFIRM, | 10297 | | OPEN_DOWNGRADE, READ, | 10298 | | RELEASE_LOCKOWNER, RENEW, SETATTR, | 10299 | | WRITE | 10300 | NFS4ERR_LOCKED | READ, SETATTR, WRITE | 10301 | NFS4ERR_LOCKS_HELD | CLOSE, OPEN_DOWNGRADE, | 10302 | | RELEASE_LOCKOWNER | 10303 | NFS4ERR_LOCK_NOTSUPP | LOCK | 10304 | NFS4ERR_LOCK_RANGE | LOCK, LOCKT, LOCKU | 10305 | NFS4ERR_MLINK | LINK | 10306 | NFS4ERR_MOVED | ACCESS, CLOSE, COMMIT, CREATE, | 10307 | | DELEGRETURN, GETATTR, GETFH, LINK, | 10308 | | LOCK, LOCKT, LOCKU, LOOKUP, LOOKUPP, | 10309 | | NVERIFY, OPEN, OPENATTR, OPEN_CONFIRM, | 10310 | | OPEN_DOWNGRADE, PUTFH, READ, READDIR, | 10311 | | READLINK, REMOVE, RENAME, RESTOREFH, | 10312 | | SAVEFH, SECINFO, SETATTR, VERIFY, | 10313 | | WRITE | 10314 | NFS4ERR_NAMETOOLONG | CREATE, LINK, LOOKUP, OPEN, REMOVE, | 10315 | | RENAME, SECINFO | 10316 | NFS4ERR_NOENT | LINK, LOOKUP, LOOKUPP, OPEN, OPENATTR, | 10317 | | REMOVE, RENAME, SECINFO | 10318 | NFS4ERR_NOFILEHANDLE | ACCESS, CLOSE, COMMIT, CREATE, | 10319 | | DELEGRETURN, GETATTR, GETFH, LINK, | 10320 | | LOCK, LOCKT, LOCKU, LOOKUP, LOOKUPP, | 10321 | | NVERIFY, OPEN, OPENATTR, OPEN_CONFIRM, | 10322 | | OPEN_DOWNGRADE, READ, READDIR, | 10323 | | READLINK, REMOVE, RENAME, SAVEFH, | 10324 | | SECINFO, SETATTR, VERIFY, WRITE | 10325 | NFS4ERR_NOSPC | CREATE, LINK, OPEN, OPENATTR, RENAME, | 10326 | | SETATTR, WRITE | 10327 | NFS4ERR_NOTDIR | CREATE, LINK, LOOKUP, LOOKUPP, OPEN, | 10328 | | READDIR, REMOVE, RENAME, SECINFO | 10329 | NFS4ERR_NOTEMPTY | REMOVE, RENAME | 10330 | NFS4ERR_NOTSUP | OPEN, READLINK | 10331 | NFS4ERR_NOTSUPP | DELEGPURGE, DELEGRETURN, LINK, | 10332 | | OPENATTR | 10333 | NFS4ERR_NOT_SAME | READDIR, VERIFY | 10334 | NFS4ERR_NO_GRACE | LOCK, OPEN | 10335 | NFS4ERR_NXIO | WRITE | 10336 | NFS4ERR_OLD_STATEID | CLOSE, DELEGRETURN, LOCK, LOCKU, OPEN, | 10337 | | OPEN_CONFIRM, OPEN_DOWNGRADE, READ, | 10338 | | SETATTR, WRITE | 10339 | NFS4ERR_OPENMODE | LOCK, READ, SETATTR, WRITE | 10340 | NFS4ERR_OP_ILLEGAL | CB_ILLEGAL, ILLEGAL | 10341 | NFS4ERR_PERM | CREATE, OPEN, SETATTR | 10342 | NFS4ERR_RECLAIM_BAD | LOCK, OPEN | 10343 | NFS4ERR_RECLAIM_CONFLICT | LOCK, OPEN | 10344 | NFS4ERR_RESOURCE | ACCESS, CLOSE, COMMIT, CREATE, | 10345 | | DELEGPURGE, DELEGRETURN, GETATTR, | 10346 | | GETFH, LINK, LOCK, LOCKT, LOCKU, | 10347 | | LOOKUP, LOOKUPP, OPEN, OPENATTR, | 10348 | | OPEN_CONFIRM, OPEN_DOWNGRADE, READ, | 10349 | | READDIR, READLINK, RELEASE_LOCKOWNER, | 10350 | | REMOVE, RENAME, RENEW, RESTOREFH, | 10351 | | SAVEFH, SECINFO, SETATTR, SETCLIENTID, | 10352 | | SETCLIENTID_CONFIRM, VERIFY, WRITE | 10353 | NFS4ERR_RESTOREFH | RESTOREFH | 10354 | NFS4ERR_ROFS | COMMIT, CREATE, LINK, OPEN, OPENATTR, | 10355 | | OPEN_DOWNGRADE, REMOVE, RENAME, | 10356 | | SETATTR, WRITE | 10357 | NFS4ERR_SAME | NVERIFY | 10358 | NFS4ERR_SERVERFAULT | ACCESS, CB_GETATTR, CB_RECALL, CLOSE, | 10359 | | COMMIT, CREATE, DELEGPURGE, | 10360 | | DELEGRETURN, GETATTR, GETFH, LINK, | 10361 | | LOCK, LOCKT, LOCKU, LOOKUP, LOOKUPP, | 10362 | | NVERIFY, OPEN, OPENATTR, OPEN_CONFIRM, | 10363 | | OPEN_DOWNGRADE, PUTFH, PUTPUBFH, | 10364 | | PUTROOTFH, READ, READDIR, READLINK, | 10365 | | RELEASE_LOCKOWNER, REMOVE, RENAME, | 10366 | | RENEW, RESTOREFH, SAVEFH, SECINFO, | 10367 | | SETATTR, SETCLIENTID, | 10368 | | SETCLIENTID_CONFIRM, VERIFY, WRITE | 10369 | NFS4ERR_SHARE_DENIED | OPEN | 10370 | NFS4ERR_STALE | ACCESS, CLOSE, COMMIT, CREATE, | 10371 | | DELEGRETURN, GETATTR, GETFH, LINK, | 10372 | | LOCK, LOCKT, LOCKU, LOOKUP, LOOKUPP, | 10373 | | NVERIFY, OPEN, OPENATTR, OPEN_CONFIRM, | 10374 | | OPEN_DOWNGRADE, PUTFH, READ, READDIR, | 10375 | | READLINK, REMOVE, RENAME, RESTOREFH, | 10376 | | SAVEFH, SECINFO, SETATTR, VERIFY, | 10377 | | WRITE | 10378 | NFS4ERR_STALE_CLIENTID | DELEGPURGE, LOCK, LOCKT, OPEN, | 10379 | | RELEASE_LOCKOWNER, RENEW, | 10380 | | SETCLIENTID_CONFIRM | 10381 | NFS4ERR_STALE_STATEID | CLOSE, DELEGRETURN, LOCK, LOCKU, | 10382 | | OPEN_CONFIRM, OPEN_DOWNGRADE, READ, | 10383 | | SETATTR, WRITE | 10384 | NFS4ERR_SYMLINK | COMMIT, LOOKUP, LOOKUPP, OPEN, READ, | 10385 | | WRITE | 10386 | NFS4ERR_TOOSMALL | READDIR | 10387 | NFS4ERR_WRONGSEC | LINK, LOOKUP, LOOKUPP, OPEN, PUTFH, | 10388 | | PUTPUBFH, PUTROOTFH, RENAME, RESTOREFH | 10389 | NFS4ERR_XDEV | LINK, RENAME | 10390 +--------------------------+----------------------------------------+ 10391 Table 11 10393 14. NFSv4 Requests 10395 For the NFSv4 RPC program, there are two traditional RPC procedures: 10396 NULL and COMPOUND. All other functionality is defined as a set of 10397 operations and these operations are defined in normal XDR/RPC syntax 10398 and semantics. However, these operations are encapsulated within the 10399 COMPOUND procedure. This requires that the client combine one or 10400 more of the NFSv4 operations into a single request. 10402 The NFS4_CALLBACK program is used to provide server to client 10403 signaling and is constructed in a similar fashion as the NFSv4 10404 program. The procedures CB_NULL and CB_COMPOUND are defined in the 10405 same way as NULL and COMPOUND are within the NFS program. The 10406 CB_COMPOUND request also encapsulates the remaining operations of the 10407 NFS4_CALLBACK program. There is no predefined RPC program number for 10408 the NFS4_CALLBACK program. It is up to the client to specify a 10409 program number in the "transient" program range. The program and 10410 port number of the NFS4_CALLBACK program are provided by the client 10411 as part of the SETCLIENTID/SETCLIENTID_CONFIRM sequence. The program 10412 and port can be changed by another SETCLIENTID/SETCLIENTID_CONFIRM 10413 sequence, and it is possible to use the sequence to change them 10414 within a client incarnation without removing relevant leased client 10415 state. 10417 14.1. Compound Procedure 10419 The COMPOUND procedure provides the opportunity for better 10420 performance within high latency networks. The client can avoid 10421 cumulative latency of multiple RPCs by combining multiple dependent 10422 operations into a single COMPOUND procedure. A compound operation 10423 may provide for protocol simplification by allowing the client to 10424 combine basic procedures into a single request that is customized for 10425 the client's environment. 10427 The CB_COMPOUND procedure precisely parallels the features of 10428 COMPOUND as described above. 10430 The basic structure of the COMPOUND procedure is: 10432 +-----+--------------+--------+-----------+-----------+-----------+-- 10433 | tag | minorversion | numops | op + args | op + args | op + args | 10434 +-----+--------------+--------+-----------+-----------+-----------+-- 10436 and the reply's structure is: 10438 +------------+-----+--------+-----------------------+-- 10439 |last status | tag | numres | status + op + results | 10440 +------------+-----+--------+-----------------------+-- 10442 The numops and numres fields, used in the depiction above, represent 10443 the count for the counted array encoding use to signify the number of 10444 arguments or results encoded in the request and response. As per the 10445 XDR encoding, these counts must match exactly the number of operation 10446 arguments or results encoded. 10448 14.2. Evaluation of a Compound Request 10450 The server will process the COMPOUND procedure by evaluating each of 10451 the operations within the COMPOUND procedure in order. Each 10452 component operation consists of a 32 bit operation code, followed by 10453 the argument of length determined by the type of operation. The 10454 results of each operation are encoded in sequence into a reply 10455 buffer. The results of each operation are preceded by the opcode and 10456 a status code (normally zero). If an operation results in a non-zero 10457 status code, the status will be encoded and evaluation of the 10458 compound sequence will halt and the reply will be returned. Note 10459 that evaluation stops even in the event of "non error" conditions 10460 such as NFS4ERR_SAME. 10462 There are no atomicity requirements for the operations contained 10463 within the COMPOUND procedure. The operations being evaluated as 10464 part of a COMPOUND request may be evaluated simultaneously with other 10465 COMPOUND requests that the server receives. 10467 It is the client's responsibility for recovering from any partially 10468 completed COMPOUND procedure. Partially completed COMPOUND 10469 procedures may occur at any point due to errors such as 10470 NFS4ERR_RESOURCE and NFS4ERR_DELAY. This may occur even given an 10471 otherwise valid operation string. Further, a server reboot which 10472 occurs in the middle of processing a COMPOUND procedure may leave the 10473 client with the difficult task of determining how far COMPOUND 10474 processing has proceeded. Therefore, the client should avoid overly 10475 complex COMPOUND procedures in the event of the failure of an 10476 operation within the procedure. 10478 Each operation assumes a "current" and "saved" filehandle that is 10479 available as part of the execution context of the compound request. 10480 Operations may set, change, or return the current filehandle. The 10481 "saved" filehandle is used for temporary storage of a filehandle 10482 value and as operands for the RENAME and LINK operations. 10484 14.3. Synchronous Modifying Operations 10486 NFSv4 operations that modify the filesystem are synchronous. When an 10487 operation is successfully completed at the server, the client can 10488 depend that any data associated with the request is now on stable 10489 storage (the one exception is in the case of the file data in a WRITE 10490 operation with the UNSTABLE option specified). 10492 This implies that any previous operations within the same compound 10493 request are also reflected in stable storage. This behavior enables 10494 the client's ability to recover from a partially executed compound 10495 request which may resulted from the failure of the server. For 10496 example, if a compound request contains operations A and B and the 10497 server is unable to send a response to the client, depending on the 10498 progress the server made in servicing the request the result of both 10499 operations may be reflected in stable storage or just operation A may 10500 be reflected. The server must not have just the results of operation 10501 B in stable storage. 10503 14.4. Operation Values 10505 The operations encoded in the COMPOUND procedure are identified by 10506 operation values. To avoid overlap with the RPC procedure numbers, 10507 operations 0 (zero) and 1 are not defined. Operation 2 is not 10508 defined but reserved for future use with minor versioning. 10510 15. NFSv4 Procedures 10512 15.1. Procedure 0: NULL - No Operation 10514 15.1.1. SYNOPSIS 10516 10518 15.1.2. ARGUMENT 10520 void; 10522 15.1.3. RESULT 10524 void; 10526 15.1.4. DESCRIPTION 10528 Standard NULL procedure. Void argument, void response. This 10529 procedure has no functionality associated with it. Because of this 10530 it is sometimes used to measure the overhead of processing a service 10531 request. Therefore, the server should ensure that no unnecessary 10532 work is done in servicing this procedure. 10534 15.2. Procedure 1: COMPOUND - Compound Operations 10536 15.2.1. SYNOPSIS 10538 compoundargs -> compoundres 10540 15.2.2. ARGUMENT 10542 union nfs_argop4 switch (nfs_opnum4 argop) { 10543 case : ; 10544 ... 10545 }; 10547 struct COMPOUND4args { 10548 comptag4 tag; 10549 uint32_t minorversion; 10550 nfs_argop4 argarray<>; 10551 }; 10553 15.2.3. RESULT 10555 union nfs_resop4 switch (nfs_opnum4 resop) { 10556 case : ; 10557 ... 10558 }; 10560 struct COMPOUND4res { 10561 nfsstat4 status; 10562 comptag4 tag; 10563 nfs_resop4 resarray<>; 10564 }; 10566 15.2.4. DESCRIPTION 10568 The COMPOUND procedure is used to combine one or more of the NFS 10569 operations into a single RPC request. The main NFS RPC program has 10570 two main procedures: NULL and COMPOUND. All other operations use the 10571 COMPOUND procedure as a wrapper. 10573 The COMPOUND procedure is used to combine individual operations into 10574 a single RPC request. The server interprets each of the operations 10575 in turn. If an operation is executed by the server and the status of 10576 that operation is NFS4_OK, then the next operation in the COMPOUND 10577 procedure is executed. The server continues this process until there 10578 are no more operations to be executed or one of the operations has a 10579 status value other than NFS4_OK. 10581 In the processing of the COMPOUND procedure, the server may find that 10582 it does not have the available resources to execute any or all of the 10583 operations within the COMPOUND sequence. In this case, the error 10584 NFS4ERR_RESOURCE will be returned for the particular operation within 10585 the COMPOUND procedure where the resource exhaustion occurred. This 10586 assumes that all previous operations within the COMPOUND sequence 10587 have been evaluated successfully. The results for all of the 10588 evaluated operations must be returned to the client. 10590 The server will generally choose between two methods of decoding the 10591 client's request. The first would be the traditional one-pass XDR 10592 decode, in which decoding of the entire COMPOUND precedes execution 10593 of any operation within it. If there is an XDR decoding error in 10594 this case, an RPC XDR decode error would be returned. The second 10595 method would be to make an initial pass to decode the basic COMPOUND 10596 request and then to XDR decode each of the individual operations, as 10597 the server is ready to execute it. In this case, the server may 10598 encounter an XDR decode error during such an operation decode, after 10599 previous operations within the COMPOUND have been executed. In this 10600 case, the server would return the error NFS4ERR_BADXDR to signify the 10601 decode error. 10603 The COMPOUND arguments contain a "minorversion" field. The initial 10604 and default value for this field is 0 (zero). This field will be 10605 used by future minor versions such that the client can communicate to 10606 the server what minor version is being requested. If the server 10607 receives a COMPOUND procedure with a minorversion field value that it 10608 does not support, the server MUST return an error of 10609 NFS4ERR_MINOR_VERS_MISMATCH and a zero length resultdata array. 10611 Contained within the COMPOUND results is a "status" field. If the 10612 results array length is non-zero, this status must be equivalent to 10613 the status of the last operation that was executed within the 10614 COMPOUND procedure. Therefore, if an operation incurred an error 10615 then the "status" value will be the same error value as is being 10616 returned for the operation that failed. 10618 Note that operations, 0 (zero) and 1 (one) are not defined for the 10619 COMPOUND procedure. Operation 2 is not defined but reserved for 10620 future definition and use with minor versioning. If the server 10621 receives a operation array that contains operation 2 and the 10622 minorversion field has a value of 0 (zero), an error of 10623 NFS4ERR_OP_ILLEGAL, as described in the next paragraph, is returned 10624 to the client. If an operation array contains an operation 2 and the 10625 minorversion field is non-zero and the server does not support the 10626 minor version, the server returns an error of 10627 NFS4ERR_MINOR_VERS_MISMATCH. Therefore, the 10628 NFS4ERR_MINOR_VERS_MISMATCH error takes precedence over all other 10629 errors. 10631 It is possible that the server receives a request that contains an 10632 operation that is less than the first legal operation (OP_ACCESS) or 10633 greater than the last legal operation (OP_RELEASE_LOCKOWNER). In 10634 this case, the server's response will encode the opcode OP_ILLEGAL 10635 rather than the illegal opcode of the request. The status field in 10636 the ILLEGAL return results will set to NFS4ERR_OP_ILLEGAL. The 10637 COMPOUND procedure's return results will also be NFS4ERR_OP_ILLEGAL. 10639 The definition of the "tag" in the request is left to the 10640 implementor. It may be used to summarize the content of the compound 10641 request for the benefit of packet sniffers and engineers debugging 10642 implementations. However, the value of "tag" in the response SHOULD 10643 be the same value as provided in the request. This applies to the 10644 tag field of the CB_COMPOUND procedure as well. 10646 15.2.4.1. Current Filehandle 10648 The current and saved filehandle are used throughout the protocol. 10649 Most operations implicitly use the current filehandle as a argument 10650 and many set the current filehandle as part of the results. The 10651 combination of client specified sequences of operations and current 10652 and saved filehandle arguments and results allows for greater 10653 protocol flexibility. The best or easiest example of current 10654 filehandle usage is a sequence like the following: 10656 PUTFH fh1 {fh1} 10657 LOOKUP "compA" {fh2} 10658 GETATTR {fh2} 10659 LOOKUP "compB" {fh3} 10660 GETATTR {fh3} 10661 LOOKUP "compC" {fh4} 10662 GETATTR {fh4} 10663 GETFH 10665 Figure 1 10667 In this example, the PUTFH (Section 15.22) operation explicitly sets 10668 the current filehandle value while the result of each LOOKUP 10669 operation sets the current filehandle value to the resultant file 10670 system object. Also, the client is able to insert GETATTR operations 10671 using the current filehandle as an argument. 10673 The PUTROOTFH (Section 15.24) and PUTPUBFH (Section 15.24) operations 10674 also set the current filehandle. The above example would replace 10675 "PUTFH fh1" with PUTROOTFH or PUTPUBFH with no filehandle argument in 10676 order to achieve the same effect (on the assumption that "compA" is 10677 directly below the root of the namespace). 10679 Along with the current filehandle, there is a saved filehandle. 10680 While the current filehandle is set as the result of operations like 10681 LOOKUP, the saved filehandle must be set directly with the use of the 10682 SAVEFH operation. The SAVEFH operations copies the current 10683 filehandle value to the saved value. The saved filehandle value is 10684 used in combination with the current filehandle value for the LINK 10685 and RENAME operations. The RESTOREFH operation will copy the saved 10686 filehandle value to the current filehandle value; as a result, the 10687 saved filehandle value may be used a sort of "scratch" area for the 10688 client's series of operations. 10690 15.2.4.2. Current Stateid 10692 The COMPOUND processing environment also have a current stateid and a 10693 saved stateid, which allows for the passing of stateids between 10694 operations. 10696 A "current stateid" is the stateid that is associated with the 10697 current filehandle. The current stateid may only be changed by an 10698 operation that modifies the current filehandle or returns a stateid. 10699 If an operation returns a stateid it MUST set the current stateid to 10700 the returned value. If an operation sets the current filehandle but 10701 does not return a stateid, the current stateid MUST be set to the 10702 all-zeros special stateid, i.e. (seqid, other) = (0, 0). If an 10703 operation uses a stateid as an argument but does not return a 10704 stateid, the current stateid MUST NOT be changed. E.g., PUTFH, 10705 PUTROOTFH, and PUTPUBFH will change the current server state from 10706 {ocfh, (osid)} to {cfh, (0, 0)} while LOCK will change the current 10707 state from {cfh, (osid} to {cfh, (nsid)}. Operations like LOOKUP 10708 that transform a current filehandle and component name into a new 10709 current filehandle will also change the current stateid to {0, 0}. 10710 The SAVEFH and RESTOREFH operations will save and restore both the 10711 current filehandle and the current stateid as a set. 10713 The following example is the common case of a simple READ operation 10714 with a supplied stateid showing that the PUTFH initializes the 10715 current stateid to (0, 0). The subsequent READ with stateid (sid1) 10716 leaves the current stateid unchanged, but does evaluate the the 10717 operation. 10719 PUTFH fh1 - -> {fh1, (0, 0)} 10720 READ (sid1), 0, 1024 {fh1, (0, 0)} -> {fh1, (0, 0)} 10722 Figure 2 10724 This next example performs an OPEN with the root filehandle and as a 10725 result generates stateid (sid1). The next operation specifies the 10726 READ with the argument stateid set such that (seqid, other) are equal 10727 to (1, 0), but the current stateid set by the previous operation is 10728 actually used when the operation is evaluated. This allows correct 10729 interaction with any existing, potentially conflicting, locks. 10731 PUTROOTFH - -> {fh1, (0, 0)} 10732 OPEN "compA" {fh1, (0, 0)} -> {fh2, (sid1)} 10733 READ (1, 0), 0, 1024 {fh2, (sid1)} -> {fh2, (sid1)} 10734 CLOSE (1, 0) {fh2, (sid1)} -> {fh2, (sid2)} 10736 Figure 3 10738 This next example is similar to the second in how it passes the 10739 stateid sid2 generated by the LOCK operation to the next READ 10740 operation. This allows the client to explicitly surround a single 10741 I/O operation with a lock and its appropriate stateid to guarantee 10742 correctness with other client locks. The example also shows how 10743 SAVEFH and RESTOREFH can save and later re-use a filehandle and 10744 stateid, passing them as the current filehandle and stateid to a READ 10745 operation. 10747 PUTFH fh1 - -> {fh1, (0, 0)} 10748 LOCK 0, 1024, (sid1) {fh1, (sid1)} -> {fh1, (sid2)} 10749 READ (1, 0), 0, 1024 {fh1, (sid2)} -> {fh1, (sid2)} 10750 LOCKU 0, 1024, (1, 0) {fh1, (sid2)} -> {fh1, (sid3)} 10751 SAVEFH {fh1, (sid3)} -> {fh1, (sid3)} 10753 PUTFH fh2 {fh1, (sid3)} -> {fh2, (0, 0)} 10754 WRITE (1, 0), 0, 1024 {fh2, (0, 0)} -> {fh2, (0, 0)} 10756 RESTOREFH {fh2, (0, 0)} -> {fh1, (sid3)} 10757 READ (1, 0), 1024, 1024 {fh1, (sid3)} -> {fh1, (sid3)} 10759 Figure 4 10761 The final example shows a disallowed use of the current stateid. The 10762 client is attempting to implicitly pass anonymous special stateid, 10763 (0,0) to the READ operation. The server MUST return 10764 NFS4ERR_BAD_STATEID in the reply to the READ operation. 10766 PUTFH fh1 - -> {fh1, (0, 0)} 10767 READ (1, 0), 0, 1024 {fh1, (0, 0)} -> NFS4ERR_BAD_STATEID 10769 Figure 5 10771 15.2.5. IMPLEMENTATION 10773 Since an error of any type may occur after only a portion of the 10774 operations have been evaluated, the client must be prepared to 10775 recover from any failure. If the source of an NFS4ERR_RESOURCE error 10776 was a complex or lengthy set of operations, it is likely that if the 10777 number of operations were reduced the server would be able to 10778 evaluate them successfully. Therefore, the client is responsible for 10779 dealing with this type of complexity in recovery. 10781 The client SHOULD NOT construct a COMPOUND which mixes operations for 10782 different client IDs. 10784 15.3. Operation 3: ACCESS - Check Access Rights 10786 15.3.1. SYNOPSIS 10788 (cfh), accessreq -> supported, accessrights 10790 15.3.2. ARGUMENT 10792 const ACCESS4_READ = 0x00000001; 10793 const ACCESS4_LOOKUP = 0x00000002; 10794 const ACCESS4_MODIFY = 0x00000004; 10795 const ACCESS4_EXTEND = 0x00000008; 10796 const ACCESS4_DELETE = 0x00000010; 10797 const ACCESS4_EXECUTE = 0x00000020; 10799 struct ACCESS4args { 10800 /* CURRENT_FH: object */ 10801 uint32_t access; 10802 }; 10804 15.3.3. RESULT 10806 struct ACCESS4resok { 10807 uint32_t supported; 10808 uint32_t access; 10809 }; 10811 union ACCESS4res switch (nfsstat4 status) { 10812 case NFS4_OK: 10813 ACCESS4resok resok4; 10814 default: 10815 void; 10816 }; 10818 15.3.4. DESCRIPTION 10820 ACCESS determines the access rights that a user, as identified by the 10821 credentials in the RPC request, has with respect to the file system 10822 object specified by the current filehandle. The client encodes the 10823 set of access rights that are to be checked in the bit mask "access". 10824 The server checks the permissions encoded in the bit mask. If a 10825 status of NFS4_OK is returned, two bit masks are included in the 10826 response. The first, "supported", represents the access rights for 10827 which the server can verify reliably. The second, "access", 10828 represents the access rights available to the user for the filehandle 10829 provided. On success, the current filehandle retains its value. 10831 Note that the supported field will contain only as many values as 10832 were originally sent in the arguments. For example, if the client 10833 sends an ACCESS operation with only the ACCESS4_READ value set and 10834 the server supports this value, the server will return only 10835 ACCESS4_READ even if it could have reliably checked other values. 10837 The results of this operation are necessarily advisory in nature. A 10838 return status of NFS4_OK and the appropriate bit set in the bit mask 10839 does not imply that such access will be allowed to the file system 10840 object in the future. This is because access rights can be revoked 10841 by the server at any time. 10843 The following access permissions may be requested: 10845 ACCESS4_READ: Read data from file or read a directory. 10847 ACCESS4_LOOKUP: Look up a name in a directory (no meaning for non- 10848 directory objects). 10850 ACCESS4_MODIFY: Rewrite existing file data or modify existing 10851 directory entries. 10853 ACCESS4_EXTEND: Write new data or add directory entries. 10855 ACCESS4_DELETE: Delete an existing directory entry. 10857 ACCESS4_EXECUTE: Execute file (no meaning for a directory). 10859 On success, the current filehandle retains its value. 10861 15.3.5. IMPLEMENTATION 10863 In general, it is not sufficient for the client to attempt to deduce 10864 access permissions by inspecting the uid, gid, and mode fields in the 10865 file attributes or by attempting to interpret the contents of the ACL 10866 attribute. This is because the server may perform uid or gid mapping 10867 or enforce additional access control restrictions. It is also 10868 possible that the server may not be in the same ID space as the 10869 client. In these cases (and perhaps others), the client cannot 10870 reliably perform an access check with only current file attributes. 10872 In the NFSv2 protocol, the only reliable way to determine whether an 10873 operation was allowed was to try it and see if it succeeded or 10874 failed. Using the ACCESS operation in the NFSv4 protocol, the client 10875 can ask the server to indicate whether or not one or more classes of 10876 operations are permitted. The ACCESS operation is provided to allow 10877 clients to check before doing a series of operations which will 10878 result in an access failure. The OPEN operation provides a point 10879 where the server can verify access to the file object and method to 10880 return that information to the client. The ACCESS operation is still 10881 useful for directory operations or for use in the case the UNIX API 10882 "access" is used on the client. 10884 The information returned by the server in response to an ACCESS call 10885 is not permanent. It was correct at the exact time that the server 10886 performed the checks, but not necessarily afterward. The server can 10887 revoke access permission at any time. 10889 The client should use the effective credentials of the user to build 10890 the authentication information in the ACCESS request used to 10891 determine access rights. It is the effective user and group 10892 credentials that are used in subsequent read and write operations. 10894 Many implementations do not directly support the ACCESS4_DELETE 10895 permission. Operating systems like UNIX will ignore the 10896 ACCESS4_DELETE bit if set on an access request on a non-directory 10897 object. In these systems, delete permission on a file is determined 10898 by the access permissions on the directory in which the file resides, 10899 instead of being determined by the permissions of the file itself. 10900 Therefore, the mask returned enumerating which access rights can be 10901 determined will have the ACCESS4_DELETE value set to 0. This 10902 indicates to the client that the server was unable to check that 10903 particular access right. The ACCESS4_DELETE bit in the access mask 10904 returned will then be ignored by the client. 10906 15.4. Operation 4: CLOSE - Close File 10908 15.4.1. SYNOPSIS 10910 (cfh), seqid, open_stateid -> open_stateid 10912 15.4.2. ARGUMENT 10914 struct CLOSE4args { 10915 /* CURRENT_FH: object */ 10916 seqid4 seqid; 10917 stateid4 open_stateid; 10918 }; 10920 15.4.3. RESULT 10922 union CLOSE4res switch (nfsstat4 status) { 10923 case NFS4_OK: 10924 stateid4 open_stateid; 10925 default: 10926 void; 10927 }; 10929 15.4.4. DESCRIPTION 10931 The CLOSE operation releases share reservations for the regular or 10932 named attribute file as specified by the current filehandle. The 10933 share reservations and other state information released at the server 10934 as a result of this CLOSE is only associated with the supplied 10935 stateid. The sequence id provides for the correct ordering. State 10936 associated with other OPENs is not affected. 10938 If byte-range locks are held, the client SHOULD release all locks 10939 before issuing a CLOSE. The server MAY free all outstanding locks on 10940 CLOSE but some servers may not support the CLOSE of a file that still 10941 has byte-range locks held. The server MUST return failure if any 10942 locks would exist after the CLOSE. 10944 On success, the current filehandle retains its value. 10946 15.4.5. IMPLEMENTATION 10948 Even though CLOSE returns a stateid, this stateid is not useful to 10949 the client and should be treated as deprecated. CLOSE "shuts down" 10950 the state associated with all OPENs for the file by a single open- 10951 owner. As noted above, CLOSE will either release all file locking 10952 state or return an error. Therefore, the stateid returned by CLOSE 10953 is not useful for operations that follow. 10955 15.5. Operation 5: COMMIT - Commit Cached Data 10957 15.5.1. SYNOPSIS 10959 (cfh), offset, count -> verifier 10961 15.5.2. ARGUMENT 10963 struct COMMIT4args { 10964 /* CURRENT_FH: file */ 10965 offset4 offset; 10966 count4 count; 10967 }; 10969 15.5.3. RESULT 10971 struct COMMIT4resok { 10972 verifier4 writeverf; 10973 }; 10975 union COMMIT4res switch (nfsstat4 status) { 10976 case NFS4_OK: 10977 COMMIT4resok resok4; 10978 default: 10979 void; 10980 }; 10982 15.5.4. DESCRIPTION 10984 The COMMIT operation forces or flushes data to stable storage for the 10985 file specified by the current filehandle. The flushed data is that 10986 which was previously written with a WRITE operation which had the 10987 stable field set to UNSTABLE4. 10989 The offset specifies the position within the file where the flush is 10990 to begin. An offset value of 0 (zero) means to flush data starting 10991 at the beginning of the file. The count specifies the number of 10992 bytes of data to flush. If count is 0 (zero), a flush from offset to 10993 the end of the file is done. 10995 The server returns a write verifier upon successful completion of the 10996 COMMIT. The write verifier is used by the client to determine if the 10997 server has restarted or rebooted between the initial WRITE(s) and the 10998 COMMIT. The client does this by comparing the write verifier 10999 returned from the initial writes and the verifier returned by the 11000 COMMIT operation. The server must vary the value of the write 11001 verifier at each server event or instantiation that may lead to a 11002 loss of uncommitted data. Most commonly this occurs when the server 11003 is rebooted; however, other events at the server may result in 11004 uncommitted data loss as well. 11006 On success, the current filehandle retains its value. 11008 15.5.5. IMPLEMENTATION 11010 The COMMIT operation is similar in operation and semantics to the 11011 POSIX fsync() [36] system call that synchronizes a file's state with 11012 the disk (file data and metadata is flushed to disk or stable 11013 storage). COMMIT performs the same operation for a client, flushing 11014 any unsynchronized data and metadata on the server to the server's 11015 disk or stable storage for the specified file. Like fsync(), it may 11016 be that there is some modified data or no modified data to 11017 synchronize. The data may have been synchronized by the server's 11018 normal periodic buffer synchronization activity. COMMIT should 11019 return NFS4_OK, unless there has been an unexpected error. 11021 COMMIT differs from fsync() in that it is possible for the client to 11022 flush a range of the file (most likely triggered by a buffer- 11023 reclamation scheme on the client before file has been completely 11024 written). 11026 The server implementation of COMMIT is reasonably simple. If the 11027 server receives a full file COMMIT request, that is starting at 11028 offset 0 and count 0, it should do the equivalent of fsync()'ing the 11029 file. Otherwise, it should arrange to have the cached data in the 11030 range specified by offset and count to be flushed to stable storage. 11031 In both cases, any metadata associated with the file must be flushed 11032 to stable storage before returning. It is not an error for there to 11033 be nothing to flush on the server. This means that the data and 11034 metadata that needed to be flushed have already been flushed or lost 11035 during the last server failure. 11037 The client implementation of COMMIT is a little more complex. There 11038 are two reasons for wanting to commit a client buffer to stable 11039 storage. The first is that the client wants to reuse a buffer. In 11040 this case, the offset and count of the buffer are sent to the server 11041 in the COMMIT request. The server then flushes any cached data based 11042 on the offset and count, and flushes any metadata associated with the 11043 file. It then returns the status of the flush and the write 11044 verifier. The other reason for the client to generate a COMMIT is 11045 for a full file flush, such as may be done at close. In this case, 11046 the client would gather all of the buffers for this file that contain 11047 uncommitted data, do the COMMIT operation with an offset of 0 and 11048 count of 0, and then free all of those buffers. Any other dirty 11049 buffers would be sent to the server in the normal fashion. 11051 After a buffer is written by the client with the stable parameter set 11052 to UNSTABLE4, the buffer must be considered as modified by the client 11053 until the buffer has either been flushed via a COMMIT operation or 11054 written via a WRITE operation with stable parameter set to FILE_SYNC4 11055 or DATA_SYNC4. This is done to prevent the buffer from being freed 11056 and reused before the data can be flushed to stable storage on the 11057 server. 11059 When a response is returned from either a WRITE or a COMMIT operation 11060 and it contains a write verifier that is different than previously 11061 returned by the server, the client will need to retransmit all of the 11062 buffers containing uncommitted cached data to the server. How this 11063 is to be done is up to the implementor. If there is only one buffer 11064 of interest, then it should probably be sent back over in a WRITE 11065 request with the appropriate stable parameter. If there is more than 11066 one buffer, it might be worthwhile retransmitting all of the buffers 11067 in WRITE requests with the stable parameter set to UNSTABLE4 and then 11068 retransmitting the COMMIT operation to flush all of the data on the 11069 server to stable storage. The timing of these retransmissions is 11070 left to the implementor. 11072 The above description applies to page-cache-based systems as well as 11073 buffer-cache-based systems. In those systems, the virtual memory 11074 system will need to be modified instead of the buffer cache. 11076 15.6. Operation 6: CREATE - Create a Non-Regular File Object 11078 15.6.1. SYNOPSIS 11080 (cfh), name, type, attrs -> (cfh), change_info, attrs_set 11082 15.6.2. ARGUMENT 11084 union createtype4 switch (nfs_ftype4 type) { 11085 case NF4LNK: 11086 linktext4 linkdata; 11087 case NF4BLK: 11088 case NF4CHR: 11089 specdata4 devdata; 11090 case NF4SOCK: 11091 case NF4FIFO: 11092 case NF4DIR: 11093 void; 11094 default: 11095 void; /* server should return NFS4ERR_BADTYPE */ 11096 }; 11098 struct CREATE4args { 11099 /* CURRENT_FH: directory for creation */ 11100 createtype4 objtype; 11101 component4 objname; 11102 fattr4 createattrs; 11103 }; 11105 15.6.3. RESULT 11107 struct CREATE4resok { 11108 change_info4 cinfo; 11109 bitmap4 attrset; /* attributes set */ 11110 }; 11112 union CREATE4res switch (nfsstat4 status) { 11113 case NFS4_OK: 11114 CREATE4resok resok4; 11115 default: 11116 void; 11117 }; 11119 15.6.4. DESCRIPTION 11121 The CREATE operation creates a non-regular file object in a directory 11122 with a given name. The OPEN operation MUST be used to create a 11123 regular file. 11125 The objname specifies the name for the new object. The objtype 11126 determines the type of object to be created: directory, symlink, etc. 11128 If an object of the same name already exists in the directory, the 11129 server will return the error NFS4ERR_EXIST. 11131 For the directory where the new file object was created, the server 11132 returns change_info4 information in cinfo. With the atomic field of 11133 the change_info4 struct, the server will indicate if the before and 11134 after change attributes were obtained atomically with respect to the 11135 file object creation. 11137 If the objname is of zero length, NFS4ERR_INVAL will be returned. 11138 The objname is also subject to the normal UTF-8, character support, 11139 and name checks. See Section 12.3 for further discussion. 11141 If the objname has a length of 0 (zero), or if objname does not obey 11142 the UTF-8 definition, the error NFS4ERR_INVAL will be returned. 11144 The current filehandle is replaced by that of the new object. 11146 The createattrs specifies the initial set of attributes for the 11147 object. The set of attributes may include any writable attribute 11148 valid for the object type. When the operation is successful, the 11149 server will return to the client an attribute mask signifying which 11150 attributes were successfully set for the object. 11152 If createattrs includes neither the owner attribute nor an ACL with 11153 an ACE for the owner, and if the server's filesystem both supports 11154 and requires an owner attribute (or an owner ACE) then the server 11155 MUST derive the owner (or the owner ACE). This would typically be 11156 from the principal indicated in the RPC credentials of the call, but 11157 the server's operating environment or filesystem semantics may 11158 dictate other methods of derivation. Similarly, if createattrs 11159 includes neither the group attribute nor a group ACE, and if the 11160 server's filesystem both supports and requires the notion of a group 11161 attribute (or group ACE), the server MUST derive the group attribute 11162 (or the corresponding owner ACE) for the file. This could be from 11163 the RPC call's credentials, such as the group principal if the 11164 credentials include it (such as with AUTH_SYS), from the group 11165 identifier associated with the principal in the credentials (e.g., 11166 POSIX systems have a user database [37] that has the group identifier 11167 for every user identifier), inherited from directory the object is 11168 created in, or whatever else the server's operating environment or 11169 filesystem semantics dictate. This applies to the OPEN operation 11170 too. 11172 Conversely, it is possible the client will specify in createattrs an 11173 owner attribute or group attribute or ACL that the principal 11174 indicated the RPC call's credentials does not have permissions to 11175 create files for. The error to be returned in this instance is 11176 NFS4ERR_PERM. This applies to the OPEN operation too. 11178 15.6.5. IMPLEMENTATION 11180 If the client desires to set attribute values after the create, a 11181 SETATTR operation can be added to the COMPOUND request so that the 11182 appropriate attributes will be set. 11184 15.7. Operation 7: DELEGPURGE - Purge Delegations Awaiting Recovery 11186 15.7.1. SYNOPSIS 11188 clientid -> 11190 15.7.2. ARGUMENT 11192 struct DELEGPURGE4args { 11193 clientid4 clientid; 11194 }; 11196 15.7.3. RESULT 11198 struct DELEGPURGE4res { 11199 nfsstat4 status; 11200 }; 11202 15.7.4. DESCRIPTION 11204 Purges all of the delegations awaiting recovery for a given client. 11205 This is useful for clients which do not commit delegation information 11206 to stable storage to indicate that conflicting requests need not be 11207 delayed by the server awaiting recovery of delegation information. 11209 This operation should be used by clients that record delegation 11210 information on stable storage on the client. In this case, 11211 DELEGPURGE should be issued immediately after doing delegation 11212 recovery on all delegations known to the client. Doing so will 11213 notify the server that no additional delegations for the client will 11214 be recovered allowing it to free resources, and avoid delaying other 11215 clients who make requests that conflict with the unrecovered 11216 delegations. The set of delegations known to the server and the 11217 client may be different. The reason for this is that a client may 11218 fail after making a request which resulted in delegation but before 11219 it received the results and committed them to the client's stable 11220 storage. 11222 The server MAY support DELEGPURGE, but if it does not, it MUST NOT 11223 support CLAIM_DELEGATE_PREV. 11225 15.8. Operation 8: DELEGRETURN - Return Delegation 11227 15.8.1. SYNOPSIS 11229 (cfh), stateid -> 11231 15.8.2. ARGUMENT 11233 struct DELEGRETURN4args { 11234 /* CURRENT_FH: delegated file */ 11235 stateid4 deleg_stateid; 11236 }; 11238 15.8.3. RESULT 11240 struct DELEGRETURN4res { 11241 nfsstat4 status; 11242 }; 11244 15.8.4. DESCRIPTION 11246 Returns the delegation represented by the current filehandle and 11247 stateid. 11249 Delegations may be returned when recalled or voluntarily (i.e., 11250 before the server has recalled them). In either case the client must 11251 properly propagate state changed under the context of the delegation 11252 to the server before returning the delegation. 11254 15.9. Operation 9: GETATTR - Get Attributes 11256 15.9.1. SYNOPSIS 11258 (cfh), attrbits -> attrbits, attrvals 11260 15.9.2. ARGUMENT 11262 struct GETATTR4args { 11263 /* CURRENT_FH: directory or file */ 11264 bitmap4 attr_request; 11265 }; 11267 15.9.3. RESULT 11269 struct GETATTR4resok { 11270 fattr4 obj_attributes; 11271 }; 11273 union GETATTR4res switch (nfsstat4 status) { 11274 case NFS4_OK: 11275 GETATTR4resok resok4; 11276 default: 11277 void; 11278 }; 11280 15.9.4. DESCRIPTION 11282 The GETATTR operation will obtain attributes for the filesystem 11283 object specified by the current filehandle. The client sets a bit in 11284 the bitmap argument for each attribute value that it would like the 11285 server to return. The server returns an attribute bitmap that 11286 indicates the attribute values for which it was able to return, 11287 followed by the attribute values ordered lowest attribute number 11288 first. 11290 The server MUST return a value for each attribute that the client 11291 requests if the attribute is supported by the server. If the server 11292 does not support an attribute or cannot approximate a useful value 11293 then it MUST NOT return the attribute value and MUST NOT set the 11294 attribute bit in the result bitmap. The server MUST return an error 11295 if it supports an attribute on the target but cannot obtain its 11296 value. In that case no attribute values will be returned. 11298 File systems which are absent should be treated as having support for 11299 a very small set of attributes as described in GETATTR Within an 11300 Absent File System (Section 7.3.1), even if previously, when the file 11301 system was present, more attributes were supported. 11303 All servers MUST support the REQUIRED attributes as specified in the 11304 section File Attributes (Section 5), for all file systems, with the 11305 exception of absent file systems. 11307 On success, the current filehandle retains its value. 11309 15.9.5. IMPLEMENTATION 11311 Suppose there is a OPEN_DELEGATE_WRITE delegation held by another 11312 client for file in question and size and/or change are among the set 11313 of attributes being interrogated. The server has two choices. 11315 First, the server can obtain the actual current value of these 11316 attributes from the client holding the delegation by using the 11317 CB_GETATTR callback. Second, the server, particularly when the 11318 delegated client is unresponsive, can recall the delegation in 11319 question. The GETATTR MUST NOT proceed until one of the following 11320 occurs: 11322 o The requested attribute values are returned in the response to 11323 CB_GETATTR. 11325 o The OPEN_DELEGATE_WRITE delegation is returned. 11327 o The OPEN_DELEGATE_WRITE delegation is revoked. 11329 Unless one of the above happens very quickly, one or more 11330 NFS4ERR_DELAY errors will be returned if while a delegation is 11331 outstanding. 11333 15.10. Operation 10: GETFH - Get Current Filehandle 11335 15.10.1. SYNOPSIS 11337 (cfh) -> filehandle 11339 15.10.2. ARGUMENT 11341 /* CURRENT_FH: */ 11342 void; 11344 15.10.3. RESULT 11346 struct GETFH4resok { 11347 nfs_fh4 object; 11348 }; 11350 union GETFH4res switch (nfsstat4 status) { 11351 case NFS4_OK: 11352 GETFH4resok resok4; 11353 default: 11354 void; 11355 }; 11357 15.10.4. DESCRIPTION 11359 This operation returns the current filehandle value. 11361 On success, the current filehandle retains its value. 11363 15.10.5. IMPLEMENTATION 11365 Operations that change the current filehandle like LOOKUP or CREATE 11366 do not automatically return the new filehandle as a result. For 11367 instance, if a client needs to lookup a directory entry and obtain 11368 its filehandle then the following request is needed. 11370 PUTFH (directory filehandle) 11371 LOOKUP (entry name) 11372 GETFH 11374 15.11. Operation 11: LINK - Create Link to a File 11376 15.11.1. SYNOPSIS 11378 (sfh), (cfh), newname -> (cfh), change_info 11380 15.11.2. ARGUMENT 11382 struct LINK4args { 11383 /* SAVED_FH: source object */ 11384 /* CURRENT_FH: target directory */ 11385 component4 newname; 11386 }; 11388 15.11.3. RESULT 11390 struct LINK4resok { 11391 change_info4 cinfo; 11392 }; 11394 union LINK4res switch (nfsstat4 status) { 11395 case NFS4_OK: 11396 LINK4resok resok4; 11397 default: 11398 void; 11399 }; 11401 15.11.4. DESCRIPTION 11403 The LINK operation creates an additional newname for the file 11404 represented by the saved filehandle, as set by the SAVEFH operation, 11405 in the directory represented by the current filehandle. The existing 11406 file and the target directory must reside within the same filesystem 11407 on the server. On success, the current filehandle will continue to 11408 be the target directory. If an object exists in the target directory 11409 with the same name as newname, the server must return NFS4ERR_EXIST. 11411 For the target directory, the server returns change_info4 information 11412 in cinfo. With the atomic field of the change_info4 struct, the 11413 server will indicate if the before and after change attributes were 11414 obtained atomically with respect to the link creation. 11416 If the newname has a length of 0 (zero), or if newname does not obey 11417 the UTF-8 definition, the error NFS4ERR_INVAL will be returned. 11419 15.11.5. IMPLEMENTATION 11421 Changes to any property of the "hard" linked files are reflected in 11422 all of the linked files. When a link is made to a file, the 11423 attributes for the file should have a value for numlinks that is one 11424 greater than the value before the LINK operation. 11426 The statement "file and the target directory must reside within the 11427 same filesystem on the server" means that the fsid fields in the 11428 attributes for the objects are the same. If they reside on different 11429 filesystems, the error, NFS4ERR_XDEV, is returned. On some servers, 11430 the filenames, "." and "..", are illegal as newname. 11432 In the case that newname is already linked to the file represented by 11433 the saved filehandle, the server will return NFS4ERR_EXIST. 11435 Note that symbolic links are created with the CREATE operation. 11437 15.12. Operation 12: LOCK - Create Lock 11439 15.12.1. SYNOPSIS 11441 (cfh) locktype, reclaim, offset, length, locker -> stateid 11443 15.12.2. ARGUMENT 11445 enum nfs_lock_type4 { 11446 READ_LT = 1, 11447 WRITE_LT = 2, 11448 READW_LT = 3, /* blocking read */ 11449 WRITEW_LT = 4 /* blocking write */ 11450 }; 11451 /* 11452 * For LOCK, transition from open_owner to new lock_owner 11453 */ 11454 struct open_to_lock_owner4 { 11455 seqid4 open_seqid; 11456 stateid4 open_stateid; 11457 seqid4 lock_seqid; 11458 lock_owner4 lock_owner; 11459 }; 11461 /* 11462 * For LOCK, existing lock_owner continues to request file locks 11463 */ 11464 struct exist_lock_owner4 { 11465 stateid4 lock_stateid; 11466 seqid4 lock_seqid; 11467 }; 11469 union locker4 switch (bool new_lock_owner) { 11470 case TRUE: 11471 open_to_lock_owner4 open_owner; 11472 case FALSE: 11473 exist_lock_owner4 lock_owner; 11474 }; 11476 /* 11477 * LOCK/LOCKT/LOCKU: Record lock management 11478 */ 11479 struct LOCK4args { 11480 /* CURRENT_FH: file */ 11481 nfs_lock_type4 locktype; 11482 bool reclaim; 11483 offset4 offset; 11484 length4 length; 11485 locker4 locker; 11486 }; 11488 15.12.3. RESULT 11490 struct LOCK4denied { 11491 offset4 offset; 11492 length4 length; 11493 nfs_lock_type4 locktype; 11494 lock_owner4 owner; 11495 }; 11497 struct LOCK4resok { 11498 stateid4 lock_stateid; 11499 }; 11501 union LOCK4res switch (nfsstat4 status) { 11502 case NFS4_OK: 11503 LOCK4resok resok4; 11504 case NFS4ERR_DENIED: 11505 LOCK4denied denied; 11506 default: 11507 void; 11508 }; 11510 15.12.4. DESCRIPTION 11512 The LOCK operation requests a byte-range lock for the byte range 11513 specified by the offset and length parameters. The lock type is also 11514 specified to be one of the nfs_lock_type4s. If this is a reclaim 11515 request, the reclaim parameter will be TRUE; 11517 Bytes in a file may be locked even if those bytes are not currently 11518 allocated to the file. To lock the file from a specific offset 11519 through the end-of-file (no matter how long the file actually is) use 11520 a length field with all bits set to 1 (one). If the length is zero, 11521 or if a length which is not all bits set to one is specified, and 11522 length when added to the offset exceeds the maximum 64-bit unsigned 11523 integer value, the error NFS4ERR_INVAL will result. 11525 Some servers may only support locking for byte offsets that fit 11526 within 32 bits. If the client specifies a range that includes a byte 11527 beyond the last byte offset of the 32-bit range, but does not include 11528 the last byte offset of the 32-bit and all of the byte offsets beyond 11529 it, up to the end of the valid 64-bit range, such a 32-bit server 11530 MUST return the error NFS4ERR_BAD_RANGE. 11532 In the case that the lock is denied, the owner, offset, and length of 11533 a conflicting lock are returned. 11535 On success, the current filehandle retains its value. 11537 15.12.5. IMPLEMENTATION 11539 If the server is unable to determine the exact offset and length of 11540 the conflicting lock, the same offset and length that were provided 11541 in the arguments should be returned in the denied results. Section 9 11542 contains a full description of this and the other file locking 11543 operations. 11545 LOCK operations are subject to permission checks and to checks 11546 against the access type of the associated file. However, the 11547 specific right and modes required for various type of locks, reflect 11548 the semantics of the server-exported filesystem, and are not 11549 specified by the protocol. For example, Windows 2000 allows a write 11550 lock of a file open for READ, while a POSIX-compliant system does 11551 not. 11553 When the client makes a lock request that corresponds to a range that 11554 the lockowner has locked already (with the same or different lock 11555 type), or to a sub-region of such a range, or to a region which 11556 includes multiple locks already granted to that lockowner, in whole 11557 or in part, and the server does not support such locking operations 11558 (i.e., does not support POSIX locking semantics), the server will 11559 return the error NFS4ERR_LOCK_RANGE. In that case, the client may 11560 return an error, or it may emulate the required operations, using 11561 only LOCK for ranges that do not include any bytes already locked by 11562 that lock-owner and LOCKU of locks held by that lock-owner 11563 (specifying an exactly-matching range and type). Similarly, when the 11564 client makes a lock request that amounts to upgrading (changing from 11565 a read lock to a write lock) or downgrading (changing from write lock 11566 to a read lock) an existing record lock, and the server does not 11567 support such a lock, the server will return NFS4ERR_LOCK_NOTSUPP. 11568 Such operations may not perfectly reflect the required semantics in 11569 the face of conflicting lock requests from other clients. 11571 When a client holds an OPEN_DELEGATE_WRITE delegation, the client 11572 holding that delegation is assured that there are no opens by other 11573 clients. Thus, there can be no conflicting LOCK operations from such 11574 clients. Therefore, the client may be handling locking requests 11575 locally, without doing LOCK operations on the server. If it does 11576 that, it must be prepared to update the lock status on the server, by 11577 sending appropriate LOCK and LOCKU operations before returning the 11578 delegation. 11580 When one or more clients hold OPEN_DELEGATE_READ delegations, any 11581 LOCK operation where the server is implementing mandatory locking 11582 semantics MUST result in the recall of all such delegations. The 11583 LOCK operation may not be granted until all such delegations are 11584 returned or revoked. Except where this happens very quickly, one or 11585 more NFS4ERR_DELAY errors will be returned to requests made while the 11586 delegation remains outstanding. 11588 The locker argument specifies the lock-owner that is associated with 11589 the LOCK request. The locker4 structure is a switched union that 11590 indicates whether the client has already created byte-range locking 11591 state associated with the current open file and lock-owner. In the 11592 case in which it has, the argument is just a stateid representing the 11593 set of locks associated with that open file and lock-owner, together 11594 with a lock_seqid value that MAY be any value and MUST be ignored by 11595 the server. In the case where no byte-range locking state has been 11596 established, or the client does not have the stateid available, the 11597 argument contains the stateid of the open file with which this lock 11598 is to be associated, together with the lock-owner with which the lock 11599 is to be associated. The open_to_lock_owner case covers the very 11600 first lock done by a lock-owner for a given open file and offers a 11601 method to use the established state of the open_stateid to transition 11602 to the use of a lock stateid. 11604 15.13. Operation 13: LOCKT - Test For Lock 11606 15.13.1. SYNOPSIS 11608 (cfh) locktype, offset, length, owner -> {void, NFS4ERR_DENIED -> 11609 owner} 11611 15.13.2. ARGUMENT 11613 struct LOCKT4args { 11614 /* CURRENT_FH: file */ 11615 nfs_lock_type4 locktype; 11616 offset4 offset; 11617 length4 length; 11618 lock_owner4 owner; 11619 }; 11621 15.13.3. RESULT 11623 union LOCKT4res switch (nfsstat4 status) { 11624 case NFS4ERR_DENIED: 11625 LOCK4denied denied; 11626 case NFS4_OK: 11627 void; 11628 default: 11629 void; 11630 }; 11632 15.13.4. DESCRIPTION 11634 The LOCKT operation tests the lock as specified in the arguments. If 11635 a conflicting lock exists, the owner, offset, length, and type of the 11636 conflicting lock are returned; if no lock is held, nothing other than 11637 NFS4_OK is returned. Lock types READ_LT and READW_LT are processed 11638 in the same way in that a conflicting lock test is done without 11639 regard to blocking or non-blocking. The same is true for WRITE_LT 11640 and WRITEW_LT. 11642 The ranges are specified as for LOCK. The NFS4ERR_INVAL and 11643 NFS4ERR_BAD_RANGE errors are returned under the same circumstances as 11644 for LOCK. 11646 On success, the current filehandle retains its value. 11648 15.13.5. IMPLEMENTATION 11650 If the server is unable to determine the exact offset and length of 11651 the conflicting lock, the same offset and length that were provided 11652 in the arguments should be returned in the denied results. Section 9 11653 contains further discussion of the file locking mechanisms. 11655 LOCKT uses a lock_owner4 rather a stateid4, as is used in LOCK to 11656 identify the owner. This is because the client does not have to open 11657 the file to test for the existence of a lock, so a stateid may not be 11658 available. 11660 The test for conflicting locks SHOULD exclude locks for the current 11661 lockowner. Note that since such locks are not examined the possible 11662 existence of overlapping ranges may not affect the results of LOCKT. 11663 If the server does examine locks that match the lockowner for the 11664 purpose of range checking, NFS4ERR_LOCK_RANGE may be returned.. In 11665 the event that it returns NFS4_OK, clients may do a LOCK and receive 11666 NFS4ERR_LOCK_RANGE on the LOCK request because of the flexibility 11667 provided to the server. 11669 When a client holds an OPEN_DELEGATE_WRITE delegation, it may choose 11670 (see Section 15.12.5)) to handle LOCK requests locally. In such a 11671 case, LOCKT requests will similarly be handled locally. 11673 15.14. Operation 14: LOCKU - Unlock File 11675 15.14.1. SYNOPSIS 11677 (cfh) type, seqid, stateid, offset, length -> stateid 11679 15.14.2. ARGUMENT 11681 struct LOCKU4args { 11682 /* CURRENT_FH: file */ 11683 nfs_lock_type4 locktype; 11684 seqid4 seqid; 11685 stateid4 lock_stateid; 11686 offset4 offset; 11687 length4 length; 11688 }; 11690 15.14.3. RESULT 11692 union LOCKU4res switch (nfsstat4 status) { 11693 case NFS4_OK: 11694 stateid4 lock_stateid; 11695 default: 11696 void; 11697 }; 11699 15.14.4. DESCRIPTION 11701 The LOCKU operation unlocks the byte-range lock specified by the 11702 parameters. The client may set the locktype field to any value that 11703 is legal for the nfs_lock_type4 enumerated type, and the server MUST 11704 accept any legal value for locktype. Any legal value for locktype 11705 has no effect on the success or failure of the LOCKU operation. 11707 The ranges are specified as for LOCK. The NFS4ERR_INVAL and 11708 NFS4ERR_BAD_RANGE errors are returned under the same circumstances as 11709 for LOCK. 11711 On success, the current filehandle retains its value. 11713 15.14.5. IMPLEMENTATION 11715 If the area to be unlocked does not correspond exactly to a lock 11716 actually held by the lockowner the server may return the error 11717 NFS4ERR_LOCK_RANGE. This includes the case in which the area is not 11718 locked, where the area is a sub-range of the area locked, where it 11719 overlaps the area locked without matching exactly or the area 11720 specified includes multiple locks held by the lockowner. In all of 11721 these cases, allowed by POSIX locking [35] semantics, a client 11722 receiving this error, should if it desires support for such 11723 operations, simulate the operation using LOCKU on ranges 11724 corresponding to locks it actually holds, possibly followed by LOCK 11725 requests for the sub-ranges not being unlocked. 11727 When a client holds an OPEN_DELEGATE_WRITE delegation, it may choose 11728 (see Section 15.12.5)) to handle LOCK requests locally. In such a 11729 case, LOCKU requests will similarly be handled locally. 11731 15.15. Operation 15: LOOKUP - Lookup Filename 11733 15.15.1. SYNOPSIS 11735 (cfh), component -> (cfh) 11737 15.15.2. ARGUMENT 11739 struct LOOKUP4args { 11740 /* CURRENT_FH: directory */ 11741 component4 objname; 11742 }; 11744 15.15.3. RESULT 11746 struct LOOKUP4res { 11747 /* CURRENT_FH: object */ 11748 nfsstat4 status; 11749 }; 11751 15.15.4. DESCRIPTION 11753 This operation LOOKUPs or finds a filesystem object using the 11754 directory specified by the current filehandle. LOOKUP evaluates the 11755 component and if the object exists the current filehandle is replaced 11756 with the component's filehandle. 11758 If the component cannot be evaluated either because it does not exist 11759 or because the client does not have permission to evaluate the 11760 component, then an error will be returned and the current filehandle 11761 will be unchanged. 11763 If the component is of zero length, NFS4ERR_INVAL will be returned. 11764 The component is also subject to the normal UTF-8, character support, 11765 and name checks. See Section 12.3 for further discussion. 11767 15.15.5. IMPLEMENTATION 11769 If the client wants to achieve the effect of a multi-component 11770 lookup, it may construct a COMPOUND request such as (and obtain each 11771 filehandle): 11773 PUTFH (directory filehandle) 11774 LOOKUP "pub" 11775 GETFH 11776 LOOKUP "foo" 11777 GETFH 11778 LOOKUP "bar" 11779 GETFH 11781 NFSv4 servers depart from the semantics of previous NFS versions in 11782 allowing LOOKUP requests to cross mountpoints on the server. The 11783 client can detect a mountpoint crossing by comparing the fsid 11784 attribute of the directory with the fsid attribute of the directory 11785 looked up. If the fsids are different then the new directory is a 11786 server mountpoint. UNIX clients that detect a mountpoint crossing 11787 will need to mount the server's filesystem. This needs to be done to 11788 maintain the file object identity checking mechanisms common to UNIX 11789 clients. 11791 Servers that limit NFS access to "shares" or "exported" filesystems 11792 should provide a pseudo-filesystem into which the exported 11793 filesystems can be integrated, so that clients can browse the 11794 server's name space. The clients' view of a pseudo filesystem will 11795 be limited to paths that lead to exported filesystems. 11797 Note: previous versions of the protocol assigned special semantics to 11798 the names "." and "..". NFSv4 assigns no special semantics to these 11799 names. The LOOKUPP operator must be used to lookup a parent 11800 directory. 11802 Note that this operation does not follow symbolic links. The client 11803 is responsible for all parsing of filenames including filenames that 11804 are modified by symbolic links encountered during the lookup process. 11806 If the current filehandle supplied is not a directory but a symbolic 11807 link, the error NFS4ERR_SYMLINK is returned as the error. For all 11808 other non-directory file types, the error NFS4ERR_NOTDIR is returned. 11810 15.16. Operation 16: LOOKUPP - Lookup Parent Directory 11812 15.16.1. SYNOPSIS 11814 (cfh) -> (cfh) 11816 15.16.2. ARGUMENT 11818 /* CURRENT_FH: object */ 11819 void; 11821 15.16.3. RESULT 11823 struct LOOKUPP4res { 11824 /* CURRENT_FH: directory */ 11825 nfsstat4 status; 11826 }; 11828 15.16.4. DESCRIPTION 11830 The current filehandle is assumed to refer to a regular directory or 11831 a named attribute directory. LOOKUPP assigns the filehandle for its 11832 parent directory to be the current filehandle. If there is no parent 11833 directory an NFS4ERR_NOENT error must be returned. Therefore, 11834 NFS4ERR_NOENT will be returned by the server when the current 11835 filehandle is at the root or top of the server's file tree. 11837 15.16.5. IMPLEMENTATION 11839 As for LOOKUP, LOOKUPP will also cross mountpoints. 11841 If the current filehandle is not a directory or named attribute 11842 directory, the error NFS4ERR_NOTDIR is returned. 11844 15.17. Operation 17: NVERIFY - Verify Difference in Attributes 11846 15.17.1. SYNOPSIS 11848 (cfh), fattr -> - 11850 15.17.2. ARGUMENT 11852 struct NVERIFY4args { 11853 /* CURRENT_FH: object */ 11854 fattr4 obj_attributes; 11855 }; 11857 15.17.3. RESULT 11859 struct NVERIFY4res { 11860 nfsstat4 status; 11861 }; 11863 15.17.4. DESCRIPTION 11865 This operation is used to prefix a sequence of operations to be 11866 performed if one or more attributes have changed on some filesystem 11867 object. If all the attributes match then the error NFS4ERR_SAME must 11868 be returned. 11870 On success, the current filehandle retains its value. 11872 15.17.5. IMPLEMENTATION 11874 This operation is useful as a cache validation operator. If the 11875 object to which the attributes belong has changed then the following 11876 operations may obtain new data associated with that object. For 11877 instance, to check if a file has been changed and obtain new data if 11878 it has: 11880 PUTFH (public) 11881 LOOKUP "foobar" 11882 NVERIFY attrbits attrs 11883 READ 0 32767 11885 In the case that a recommended attribute is specified in the NVERIFY 11886 operation and the server does not support that attribute for the 11887 filesystem object, the error NFS4ERR_ATTRNOTSUPP is returned to the 11888 client. 11890 When the attribute rdattr_error or any write-only attribute (e.g., 11891 time_modify_set) is specified, the error NFS4ERR_INVAL is returned to 11892 the client. 11894 15.18. Operation 18: OPEN - Open a Regular File 11896 15.18.1. SYNOPSIS 11898 (cfh), seqid, share_access, share_deny, owner, openhow, claim -> 11899 (cfh), stateid, cinfo, rflags, attrset, delegation 11901 15.18.2. ARGUMENT 11903 /* 11904 * Various definitions for OPEN 11905 */ 11906 enum createmode4 { 11907 UNCHECKED4 = 0, 11908 GUARDED4 = 1, 11909 EXCLUSIVE4 = 2 11910 }; 11912 union createhow4 switch (createmode4 mode) { 11913 case UNCHECKED4: 11914 case GUARDED4: 11915 fattr4 createattrs; 11916 case EXCLUSIVE4: 11917 verifier4 createverf; 11918 }; 11920 enum opentype4 { 11921 OPEN4_NOCREATE = 0, 11922 OPEN4_CREATE = 1 11923 }; 11925 union openflag4 switch (opentype4 opentype) { 11926 case OPEN4_CREATE: 11927 createhow4 how; 11928 default: 11929 void; 11930 }; 11932 /* Next definitions used for OPEN delegation */ 11933 enum limit_by4 { 11934 NFS_LIMIT_SIZE = 1, 11935 NFS_LIMIT_BLOCKS = 2 11936 /* others as needed */ 11937 }; 11939 struct nfs_modified_limit4 { 11940 uint32_t num_blocks; 11941 uint32_t bytes_per_block; 11943 }; 11945 union nfs_space_limit4 switch (limit_by4 limitby) { 11946 /* limit specified as file size */ 11947 case NFS_LIMIT_SIZE: 11948 uint64_t filesize; 11949 /* limit specified by number of blocks */ 11950 case NFS_LIMIT_BLOCKS: 11951 nfs_modified_limit4 mod_blocks; 11952 } ; 11954 enum open_delegation_type4 { 11955 OPEN_DELEGATE_NONE = 0, 11956 OPEN_DELEGATE_READ = 1, 11957 OPEN_DELEGATE_WRITE = 2 11958 }; 11960 enum open_claim_type4 { 11961 CLAIM_NULL = 0, 11962 CLAIM_PREVIOUS = 1, 11963 CLAIM_DELEGATE_CUR = 2, 11964 CLAIM_DELEGATE_PREV = 3 11965 }; 11967 struct open_claim_delegate_cur4 { 11968 stateid4 delegate_stateid; 11969 component4 file; 11970 }; 11972 union open_claim4 switch (open_claim_type4 claim) { 11973 /* 11974 * No special rights to file. 11975 * Ordinary OPEN of the specified file. 11976 */ 11977 case CLAIM_NULL: 11978 /* CURRENT_FH: directory */ 11979 component4 file; 11980 /* 11981 * Right to the file established by an 11982 * open previous to server reboot. File 11983 * identified by filehandle obtained at 11984 * that time rather than by name. 11985 */ 11986 case CLAIM_PREVIOUS: 11987 /* CURRENT_FH: file being reclaimed */ 11988 open_delegation_type4 delegate_type; 11990 /* 11991 * Right to file based on a delegation 11992 * granted by the server. File is 11993 * specified by name. 11994 */ 11995 case CLAIM_DELEGATE_CUR: 11996 /* CURRENT_FH: directory */ 11997 open_claim_delegate_cur4 delegate_cur_info; 11999 /* 12000 * Right to file based on a delegation 12001 * granted to a previous boot instance 12002 * of the client. File is specified by name. 12003 */ 12004 case CLAIM_DELEGATE_PREV: 12005 /* CURRENT_FH: directory */ 12006 component4 file_delegate_prev; 12007 }; 12009 /* 12010 * OPEN: Open a file, potentially receiving an open delegation 12011 */ 12012 struct OPEN4args { 12013 seqid4 seqid; 12014 uint32_t share_access; 12015 uint32_t share_deny; 12016 open_owner4 owner; 12017 openflag4 openhow; 12018 open_claim4 claim; 12019 }; 12021 15.18.3. RESULT 12023 struct open_read_delegation4 { 12024 stateid4 stateid; /* Stateid for delegation*/ 12025 bool recall; /* Pre-recalled flag for 12026 delegations obtained 12027 by reclaim (CLAIM_PREVIOUS) */ 12029 nfsace4 permissions; /* Defines users who don't 12030 need an ACCESS call to 12031 open for read */ 12032 }; 12034 struct open_write_delegation4 { 12035 stateid4 stateid; /* Stateid for delegation */ 12036 bool recall; /* Pre-recalled flag for 12037 delegations obtained 12038 by reclaim 12039 (CLAIM_PREVIOUS) */ 12041 nfs_space_limit4 12042 space_limit; /* Defines condition that 12043 the client must check to 12044 determine whether the 12045 file needs to be flushed 12046 to the server on close. */ 12048 nfsace4 permissions; /* Defines users who don't 12049 need an ACCESS call as 12050 part of a delegated 12051 open. */ 12052 }; 12054 union open_delegation4 12055 switch (open_delegation_type4 delegation_type) { 12056 case OPEN_DELEGATE_NONE: 12057 void; 12058 case OPEN_DELEGATE_READ: 12059 open_read_delegation4 read; 12060 case OPEN_DELEGATE_WRITE: 12061 open_write_delegation4 write; 12062 }; 12064 /* 12065 * Result flags 12066 */ 12068 /* Client must confirm open */ 12069 const OPEN4_RESULT_CONFIRM = 0x00000002; 12070 /* Type of file locking behavior at the server */ 12071 const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004; 12073 struct OPEN4resok { 12074 stateid4 stateid; /* Stateid for open */ 12075 change_info4 cinfo; /* Directory Change Info */ 12076 uint32_t rflags; /* Result flags */ 12077 bitmap4 attrset; /* attribute set for create*/ 12078 open_delegation4 delegation; /* Info on any open 12079 delegation */ 12080 }; 12082 union OPEN4res switch (nfsstat4 status) { 12083 case NFS4_OK: 12084 /* CURRENT_FH: opened file */ 12085 OPEN4resok resok4; 12087 default: 12088 void; 12089 }; 12091 15.18.4. WARNING TO CLIENT IMPLEMENTORS 12093 OPEN resembles LOOKUP in that it generates a filehandle for the 12094 client to use. Unlike LOOKUP though, OPEN creates server state on 12095 the filehandle. In normal circumstances, the client can only release 12096 this state with a CLOSE operation. CLOSE uses the current filehandle 12097 to determine which file to close. Therefore the client MUST follow 12098 every OPEN operation with a GETFH operation in the same COMPOUND 12099 procedure. This will supply the client with the filehandle such that 12100 CLOSE can be used appropriately. 12102 Simply waiting for the lease on the file to expire is insufficient 12103 because the server may maintain the state indefinitely as long as 12104 another client does not attempt to make a conflicting access to the 12105 same file. 12107 15.18.5. DESCRIPTION 12109 The OPEN operation creates and/or opens a regular file in a directory 12110 with the provided name. If the file does not exist at the server and 12111 creation is desired, specification of the method of creation is 12112 provided by the openhow parameter. The client has the choice of 12113 three creation methods: UNCHECKED4, GUARDED4, or EXCLUSIVE4. 12115 If the current filehandle is a named attribute directory, OPEN will 12116 then create or open a named attribute file. Note that exclusive 12117 create of a named attribute is not supported. If the createmode is 12118 EXCLUSIVE4 and the current filehandle is a named attribute directory, 12119 the server will return EINVAL. 12121 UNCHECKED4 means that the file should be created if a file of that 12122 name does not exist and encountering an existing regular file of that 12123 name is not an error. For this type of create, createattrs specifies 12124 the initial set of attributes for the file. The set of attributes 12125 may include any writable attribute valid for regular files. When an 12126 UNCHECKED4 create encounters an existing file, the attributes 12127 specified by createattrs are not used, except that when an size of 12128 zero is specified, the existing file is truncated. If GUARDED4 is 12129 specified, the server checks for the presence of a duplicate object 12130 by name before performing the create. If a duplicate exists, an 12131 error of NFS4ERR_EXIST is returned as the status. If the object does 12132 not exist, the request is performed as described for UNCHECKED4. For 12133 each of these cases (UNCHECKED4 and GUARDED4) where the operation is 12134 successful, the server will return to the client an attribute mask 12135 signifying which attributes were successfully set for the object. 12137 EXCLUSIVE4 specifies that the server is to follow exclusive creation 12138 semantics, using the verifier to ensure exclusive creation of the 12139 target. The server should check for the presence of a duplicate 12140 object by name. If the object does not exist, the server creates the 12141 object and stores the verifier with the object. If the object does 12142 exist and the stored verifier matches the client provided verifier, 12143 the server uses the existing object as the newly created object. If 12144 the stored verifier does not match, then an error of NFS4ERR_EXIST is 12145 returned. No attributes may be provided in this case, since the 12146 server may use an attribute of the target object to store the 12147 verifier. If the server uses an attribute to store the exclusive 12148 create verifier, it will signify which attribute by setting the 12149 appropriate bit in the attribute mask that is returned in the 12150 results. 12152 For the target directory, the server returns change_info4 information 12153 in cinfo. With the atomic field of the change_info4 struct, the 12154 server will indicate if the before and after change attributes were 12155 obtained atomically with respect to the link creation. 12157 Upon successful creation, the current filehandle is replaced by that 12158 of the new object. 12160 The OPEN operation provides for Windows share reservation capability 12161 with the use of the share_access and share_deny fields of the OPEN 12162 arguments. The client specifies at OPEN the required share_access 12163 and share_deny modes. For clients that do not directly support 12164 SHAREs (i.e., UNIX), the expected deny value is DENY_NONE. In the 12165 case that there is a existing SHARE reservation that conflicts with 12166 the OPEN request, the server returns the error NFS4ERR_SHARE_DENIED. 12167 For a complete SHARE request, the client must provide values for the 12168 owner and seqid fields for the OPEN argument. For additional 12169 discussion of SHARE semantics see Section 9.9. 12171 In the case that the client is recovering state from a server 12172 failure, the claim field of the OPEN argument is used to signify that 12173 the request is meant to reclaim state previously held. 12175 The "claim" field of the OPEN argument is used to specify the file to 12176 be opened and the state information which the client claims to 12177 possess. There are four basic claim types which cover the various 12178 situations for an OPEN. They are as follows: 12180 CLAIM_NULL: For the client, this is a new OPEN request and there is 12181 no previous state associate with the file for the client. 12183 CLAIM_PREVIOUS: The client is claiming basic OPEN state for a file 12184 that was held previous to a server reboot. Generally used when a 12185 server is returning persistent filehandles; the client may not 12186 have the file name to reclaim the OPEN. 12188 CLAIM_DELEGATE_CUR: The client is claiming a delegation for OPEN as 12189 granted by the server. Generally this is done as part of 12190 recalling a delegation. 12192 CLAIM_DELEGATE_PREV: The client is claiming a delegation granted to 12193 a previous client instance; used after the client reboots. The 12194 server MAY support CLAIM_DELEGATE_PREV. If it does support 12195 CLAIM_DELEGATE_PREV, SETCLIENTID_CONFIRM MUST NOT remove the 12196 client's delegation state, and the server MUST support the 12197 DELEGPURGE operation. 12199 For OPEN requests whose claim type is other than CLAIM_PREVIOUS 12200 (i.e., requests other than those devoted to reclaiming opens after a 12201 server reboot) that reach the server during its grace or lease 12202 expiration period, the server returns an error of NFS4ERR_GRACE. 12204 For any OPEN request, the server may return an open delegation, which 12205 allows further opens and closes to be handled locally on the client 12206 as described in Section 10.4. Note that delegation is up to the 12207 server to decide. The client should never assume that delegation 12208 will or will not be granted in a particular instance. It should 12209 always be prepared for either case. A partial exception is the 12210 reclaim (CLAIM_PREVIOUS) case, in which a delegation type is claimed. 12211 In this case, delegation will always be granted, although the server 12212 may specify an immediate recall in the delegation structure. 12214 The rflags returned by a successful OPEN allow the server to return 12215 information governing how the open file is to be handled. 12217 OPEN4_RESULT_CONFIRM indicates that the client MUST execute an 12218 OPEN_CONFIRM operation before using the open file. 12219 OPEN4_RESULT_LOCKTYPE_POSIX indicates the server's file locking 12220 behavior supports the complete set of Posix locking techniques [35]. 12221 From this the client can choose to manage file locking state in a way 12222 to handle a mis-match of file locking management. 12224 If the component is of zero length, NFS4ERR_INVAL will be returned. 12225 The component is also subject to the normal UTF-8, character support, 12226 and name checks. See Section 12.3 for further discussion. 12228 When an OPEN is done and the specified open-owner already has the 12229 resulting filehandle open, the result is to "OR" together the new 12230 share and deny status together with the existing status. In this 12231 case, only a single CLOSE need be done, even though multiple OPENs 12232 were completed. When such an OPEN is done, checking of share 12233 reservations for the new OPEN proceeds normally, with no exception 12234 for the existing OPEN held by the same owner. In this case, the 12235 stateid returned as an "other" field that matches that of the 12236 previous open while the "seqid" field is incremented to reflect the 12237 change status due to the new open. 12239 If the underlying filesystem at the server is only accessible in a 12240 read-only mode and the OPEN request has specified ACCESS_WRITE or 12241 ACCESS_BOTH, the server will return NFS4ERR_ROFS to indicate a read- 12242 only filesystem. 12244 As with the CREATE operation, the server MUST derive the owner, owner 12245 ACE, group, or group ACE if any of the four attributes are required 12246 and supported by the server's filesystem. For an OPEN with the 12247 EXCLUSIVE4 createmode, the server has no choice, since such OPEN 12248 calls do not include the createattrs field. Conversely, if 12249 createattrs is specified, and includes owner or group (or 12250 corresponding ACEs) that the principal in the RPC call's credentials 12251 does not have authorization to create files for, then the server may 12252 return NFS4ERR_PERM. 12254 In the case of a OPEN which specifies a size of zero (e.g., 12255 truncation) and the file has named attributes, the named attributes 12256 are left as is. They are not removed. 12258 15.18.6. IMPLEMENTATION 12260 The OPEN operation contains support for EXCLUSIVE4 create. The 12261 mechanism is similar to the support in NFSv3 [14]. As in NFSv3, this 12262 mechanism provides reliable exclusive creation. Exclusive create is 12263 invoked when the how parameter is EXCLUSIVE4. In this case, the 12264 client provides a verifier that can reasonably be expected to be 12265 unique. A combination of a client identifier, perhaps the client 12266 network address, and a unique number generated by the client, perhaps 12267 the RPC transaction identifier, may be appropriate. 12269 If the object does not exist, the server creates the object and 12270 stores the verifier in stable storage. For filesystems that do not 12271 provide a mechanism for the storage of arbitrary file attributes, the 12272 server may use one or more elements of the object meta-data to store 12273 the verifier. The verifier must be stored in stable storage to 12274 prevent erroneous failure on retransmission of the request. It is 12275 assumed that an exclusive create is being performed because exclusive 12276 semantics are critical to the application. Because of the expected 12277 usage, exclusive CREATE does not rely solely on the normally volatile 12278 duplicate request cache for storage of the verifier. The duplicate 12279 request cache in volatile storage does not survive a crash and may 12280 actually flush on a long network partition, opening failure windows. 12281 In the UNIX local filesystem environment, the expected storage 12282 location for the verifier on creation is the meta-data (time stamps) 12283 of the object. For this reason, an exclusive object create may not 12284 include initial attributes because the server would have nowhere to 12285 store the verifier. 12287 If the server cannot support these exclusive create semantics, 12288 possibly because of the requirement to commit the verifier to stable 12289 storage, it should fail the OPEN request with the error, 12290 NFS4ERR_NOTSUPP. 12292 During an exclusive CREATE request, if the object already exists, the 12293 server reconstructs the object's verifier and compares it with the 12294 verifier in the request. If they match, the server treats the 12295 request as a success. The request is presumed to be a duplicate of 12296 an earlier, successful request for which the reply was lost and that 12297 the server duplicate request cache mechanism did not detect. If the 12298 verifiers do not match, the request is rejected with the status, 12299 NFS4ERR_EXIST. 12301 Once the client has performed a successful exclusive create, it must 12302 issue a SETATTR to set the correct object attributes. Until it does 12303 so, it should not rely upon any of the object attributes, since the 12304 server implementation may need to overload object meta-data to store 12305 the verifier. The subsequent SETATTR must not occur in the same 12306 COMPOUND request as the OPEN. This separation will guarantee that 12307 the exclusive create mechanism will continue to function properly in 12308 the face of retransmission of the request. 12310 Use of the GUARDED4 attribute does not provide exactly-once 12311 semantics. In particular, if a reply is lost and the server does not 12312 detect the retransmission of the request, the operation can fail with 12313 NFS4ERR_EXIST, even though the create was performed successfully. 12314 The client would use this behavior in the case that the application 12315 has not requested an exclusive create but has asked to have the file 12316 truncated when the file is opened. In the case of the client timing 12317 out and retransmitting the create request, the client can use 12318 GUARDED4 to prevent against a sequence like: create, write, create 12319 (retransmitted) from occurring. 12321 For SHARE reservations, the client must specify a value for 12322 share_access that is one of READ, WRITE, or BOTH. For share_deny, 12323 the client must specify one of NONE, READ, WRITE, or BOTH. If the 12324 client fails to do this, the server must return NFS4ERR_INVAL. 12326 Based on the share_access value (READ, WRITE, or BOTH) the client 12327 should check that the requester has the proper access rights to 12328 perform the specified operation. This would generally be the results 12329 of applying the ACL access rules to the file for the current 12330 requester. However, just as with the ACCESS operation, the client 12331 should not attempt to second-guess the server's decisions, as access 12332 rights may change and may be subject to server administrative 12333 controls outside the ACL framework. If the requester is not 12334 authorized to READ or WRITE (depending on the share_access value), 12335 the server must return NFS4ERR_ACCESS. Note that since the NFS 12336 version 4 protocol does not impose any requirement that READs and 12337 WRITEs issued for an open file have the same credentials as the OPEN 12338 itself, the server still must do appropriate access checking on the 12339 READs and WRITEs themselves. 12341 If the component provided to OPEN is a symbolic link, the error 12342 NFS4ERR_SYMLINK will be returned to the client. If the current 12343 filehandle is not a directory, the error NFS4ERR_NOTDIR will be 12344 returned. 12346 If a COMPOUND contains an OPEN which establishes a 12347 OPEN_DELEGATE_WRITE delegation, then a subsequent GETATTR inside that 12348 COMPOUND SHOULD not result in a CB_GETATTR to the client. The server 12349 SHOULD understand the GETATTR to be for the same client ID and avoid 12350 querying the client, which will not be able to respond. This 12351 sequence of OPEN, GETATTR SHOULD be understood as an atomic retrieval 12352 of the initial size and change attribute. Further, the client SHOULD 12353 NOT construct a COMPOUND which mixes operations for different client 12354 IDs. 12356 15.18.7. Warning to Client Implementors 12358 OPEN resembles LOOKUP in that it generates a filehandle for the 12359 client to use. Unlike LOOKUP though, OPEN creates server state on 12360 the filehandle. In normal circumstances, the client can only release 12361 this state with a CLOSE operation. CLOSE uses the current filehandle 12362 to determine which file to close. Therefore, the client MUST follow 12363 every OPEN operation with a GETFH operation in the same COMPOUND 12364 procedure. This will supply the client with the filehandle such that 12365 CLOSE can be used appropriately. 12367 Simply waiting for the lease on the file to expire is insufficient 12368 because the server may maintain the state indefinitely as long as 12369 another client does not attempt to make a conflicting access to the 12370 same file. 12372 15.19. Operation 19: OPENATTR - Open Named Attribute Directory 12374 15.19.1. SYNOPSIS 12376 (cfh) createdir -> (cfh) 12378 15.19.2. ARGUMENT 12380 struct OPENATTR4args { 12381 /* CURRENT_FH: object */ 12382 bool createdir; 12383 }; 12385 15.19.3. RESULT 12387 struct OPENATTR4res { 12388 /* CURRENT_FH: named attr directory */ 12389 nfsstat4 status; 12390 }; 12392 15.19.4. DESCRIPTION 12394 The OPENATTR operation is used to obtain the filehandle of the named 12395 attribute directory associated with the current filehandle. The 12396 result of the OPENATTR will be a filehandle to an object of type 12397 NF4ATTRDIR. From this filehandle, READDIR and LOOKUP operations can 12398 be used to obtain filehandles for the various named attributes 12399 associated with the original filesystem object. Filehandles returned 12400 within the named attribute directory will have a type of 12401 NF4NAMEDATTR. 12403 The createdir argument allows the client to signify if a named 12404 attribute directory should be created as a result of the OPENATTR 12405 operation. Some clients may use the OPENATTR operation with a value 12406 of FALSE for createdir to determine if any named attributes exist for 12407 the object. If none exist, then NFS4ERR_NOENT will be returned. If 12408 createdir has a value of TRUE and no named attribute directory 12409 exists, one is created. The creation of a named attribute directory 12410 assumes that the server has implemented named attribute support in 12411 this fashion and is not required to do so by this definition. 12413 15.19.5. IMPLEMENTATION 12415 If the server does not support named attributes for the current 12416 filehandle, an error of NFS4ERR_NOTSUPP will be returned to the 12417 client. 12419 15.20. Operation 20: OPEN_CONFIRM - Confirm Open 12421 15.20.1. SYNOPSIS 12423 (cfh), seqid, stateid-> stateid 12425 15.20.2. ARGUMENT 12427 struct OPEN_CONFIRM4args { 12428 /* CURRENT_FH: opened file */ 12429 stateid4 open_stateid; 12430 seqid4 seqid; 12431 }; 12433 15.20.3. RESULT 12435 struct OPEN_CONFIRM4resok { 12436 stateid4 open_stateid; 12437 }; 12439 union OPEN_CONFIRM4res switch (nfsstat4 status) { 12440 case NFS4_OK: 12441 OPEN_CONFIRM4resok resok4; 12442 default: 12443 void; 12444 }; 12446 15.20.4. DESCRIPTION 12448 This operation is used to confirm the sequence id usage for the first 12449 time that a open-owner is used by a client. The stateid returned 12450 from the OPEN operation is used as the argument for this operation 12451 along with the next sequence id for the open-owner. The sequence id 12452 passed to the OPEN_CONFIRM must be 1 (one) greater than the seqid 12453 passed to the OPEN operation. If the server receives an unexpected 12454 sequence id with respect to the original open, then the server 12455 assumes that the client will not confirm the original OPEN and all 12456 state associated with the original OPEN is released by the server. 12458 On success, the current filehandle retains its value. 12460 15.20.5. IMPLEMENTATION 12462 A given client might generate many open_owner4 data structures for a 12463 given client ID. The client will periodically either dispose of its 12464 open_owner4s or stop using them for indefinite periods of time. The 12465 latter situation is why the NFSv4 protocol does not have an explicit 12466 operation to exit an open_owner4: such an operation is of no use in 12467 that situation. Instead, to avoid unbounded memory use, the server 12468 needs to implement a strategy for disposing of open_owner4s that have 12469 no current open state for any files and have not been used recently. 12470 The time period used to determine when to dispose of open_owner4s is 12471 an implementation choice. The time period should certainly be no 12472 less than the lease time plus any grace period the server wishes to 12473 implement beyond a lease time. The OPEN_CONFIRM operation allows the 12474 server to safely dispose of unused open_owner4 data structures. 12476 In the case that a client issues an OPEN operation and the server no 12477 longer has a record of the open_owner4, the server needs to ensure 12478 that this is a new OPEN and not a replay or retransmission. 12480 Servers must not require confirmation on OPENs that grant delegations 12481 or are doing reclaim operations. See Section 9.1.9 for details. The 12482 server can easily avoid this by noting whether it has disposed of one 12483 open_owner4 for the given client ID. If the server does not support 12484 delegation, it might simply maintain a single bit that notes whether 12485 any open_owner4 (for any client) has been disposed of. 12487 The server must hold unconfirmed OPEN state until one of three events 12488 occur. First, the client sends an OPEN_CONFIRM request with the 12489 appropriate sequence id and stateid within the lease period. In this 12490 case, the OPEN state on the server goes to confirmed, and the 12491 open_owner4 on the server is fully established. 12493 Second, the client sends another OPEN request with a sequence id that 12494 is incorrect for the open_owner4 (out of sequence). In this case, 12495 the server assumes the second OPEN request is valid and the first one 12496 is a replay. The server cancels the OPEN state of the first OPEN 12497 request, establishes an unconfirmed OPEN state for the second OPEN 12498 request, and responds to the second OPEN request with an indication 12499 that an OPEN_CONFIRM is needed. The process then repeats itself. 12500 While there is a potential for a denial of service attack on the 12501 client, it is mitigated if the client and server require the use of a 12502 security flavor based on Kerberos V5, LIPKEY, or some other flavor 12503 that uses cryptography. 12505 What if the server is in the unconfirmed OPEN state for a given 12506 open_owner4, and it receives an operation on the open_owner4 that has 12507 a stateid but the operation is not OPEN, or it is OPEN_CONFIRM but 12508 with the wrong stateid? Then, even if the seqid is correct, the 12509 server returns NFS4ERR_BAD_STATEID, because the server assumes the 12510 operation is a replay: if the server has no established OPEN state, 12511 then there is no way, for example, a LOCK operation could be valid. 12513 Third, neither of the two aforementioned events occur for the 12514 open_owner4 within the lease period. In this case, the OPEN state is 12515 canceled and disposal of the open_owner4 can occur. 12517 15.21. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access 12519 15.21.1. SYNOPSIS 12521 (cfh), stateid, seqid, access, deny -> stateid 12523 15.21.2. ARGUMENT 12525 struct OPEN_DOWNGRADE4args { 12526 /* CURRENT_FH: opened file */ 12527 stateid4 open_stateid; 12528 seqid4 seqid; 12529 uint32_t share_access; 12530 uint32_t share_deny; 12531 }; 12533 15.21.3. RESULT 12535 struct OPEN_DOWNGRADE4resok { 12536 stateid4 open_stateid; 12537 }; 12539 union OPEN_DOWNGRADE4res switch(nfsstat4 status) { 12540 case NFS4_OK: 12541 OPEN_DOWNGRADE4resok resok4; 12542 default: 12543 void; 12544 }; 12546 15.21.4. DESCRIPTION 12548 This operation is used to adjust the share_access and share_deny bits 12549 for a given open. This is necessary when a given openowner opens the 12550 same file multiple times with different share_access and share_deny 12551 flags. In this situation, a close of one of the opens may change the 12552 appropriate share_access and share_deny flags to remove bits 12553 associated with opens no longer in effect. 12555 The share_access and share_deny bits specified in this operation 12556 replace the current ones for the specified open file. The 12557 share_access and share_deny bits specified must be exactly equal to 12558 the union of the share_access and share_deny bits specified for some 12559 subset of the OPENs in effect for current openowner on the current 12560 file. If that constraint is not respected, the error NFS4ERR_INVAL 12561 should be returned. Since share_access and share_deny bits are 12562 subsets of those already granted, it is not possible for this request 12563 to be denied because of conflicting share reservations. 12565 As the OPEN_DOWNGRADE may change a file to be not-open-for-write and 12566 a write byte-range lock might be held, the server may have to reject 12567 the OPEN_DOWNGRADE with a NFS4ERR_LOCKS_HELD. 12569 On success, the current filehandle retains its value. 12571 15.22. Operation 22: PUTFH - Set Current Filehandle 12573 15.22.1. SYNOPSIS 12575 filehandle -> (cfh) 12577 15.22.2. ARGUMENT 12579 struct PUTFH4args { 12580 nfs_fh4 object; 12581 }; 12583 15.22.3. RESULT 12585 struct PUTFH4res { 12586 /* CURRENT_FH: */ 12587 nfsstat4 status; 12588 }; 12590 15.22.4. DESCRIPTION 12592 Replaces the current filehandle with the filehandle provided as an 12593 argument. Clears the current stateid. 12595 If the security mechanism used by the requester does not meet the 12596 requirements of the filehandle provided to this operation, the server 12597 MUST return NFS4ERR_WRONGSEC. 12599 See Section 15.2.4.1 for more details on the current filehandle. 12601 See Section 15.2.4.2 for more details on the current stateid. 12603 15.22.5. IMPLEMENTATION 12605 Commonly used as the first operator in an NFS request to set the 12606 context for following operations. 12608 15.23. Operation 23: PUTPUBFH - Set Public Filehandle 12610 15.23.1. SYNOPSIS 12612 - -> (cfh) 12614 15.23.2. ARGUMENT 12616 void; 12618 15.23.3. RESULT 12620 struct PUTPUBFH4res { 12621 /* CURRENT_FH: public fh */ 12622 nfsstat4 status; 12623 }; 12625 15.23.4. DESCRIPTION 12627 Replaces the current filehandle with the filehandle that represents 12628 the public filehandle of the server's name space. This filehandle 12629 may be different from the "root" filehandle which may be associated 12630 with some other directory on the server. 12632 The public filehandle represents the concepts embodied in [23], [24], 12633 [38]. The intent for NFSv4 is that the public filehandle 12634 (represented by the PUTPUBFH operation) be used as a method of 12635 providing WebNFS server compatibility with NFSv2 and NFSv3. 12637 The public filehandle and the root filehandle (represented by the 12638 PUTROOTFH operation) should be equivalent. If the public and root 12639 filehandles are not equivalent, then the public filehandle MUST be a 12640 descendant of the root filehandle. 12642 15.23.5. IMPLEMENTATION 12644 Used as the first operator in an NFS request to set the context for 12645 following operations. 12647 With the NFSv2 and 3 public filehandle, the client is able to specify 12648 whether the path name provided in the LOOKUP should be evaluated as 12649 either an absolute path relative to the server's root or relative to 12650 the public filehandle. [38] contains further discussion of the 12651 functionality. With NFSv4, that type of specification is not 12652 directly available in the LOOKUP operation. The reason for this is 12653 because the component separators needed to specify absolute vs. 12654 relative are not allowed in NFSv4. Therefore, the client is 12655 responsible for constructing its request such that the use of either 12656 PUTROOTFH or PUTPUBFH are used to signify absolute or relative 12657 evaluation of an NFS URL respectively. 12659 Note that there are warnings mentioned in [38] with respect to the 12660 use of absolute evaluation and the restrictions the server may place 12661 on that evaluation with respect to how much of its namespace has been 12662 made available. These same warnings apply to NFSv4. It is likely, 12663 therefore that because of server implementation details, an NFSv3 12664 absolute public filehandle lookup may behave differently than an 12665 NFSv4 absolute resolution. 12667 There is a form of security negotiation as described in [39] that 12668 uses the public filehandle a method of employing SNEGO. This method 12669 is not available with NFSv4 as filehandles are not overloaded with 12670 special meaning and therefore do not provide the same framework as 12671 NFSv2 and NFSv3. Clients should therefore use the security 12672 negotiation mechanisms described in this RFC. 12674 15.24. Operation 24: PUTROOTFH - Set Root Filehandle 12676 15.24.1. SYNOPSIS 12678 - -> (cfh) 12680 15.24.2. ARGUMENT 12682 void; 12684 15.24.3. RESULT 12686 struct PUTROOTFH4res { 12687 /* CURRENT_FH: root fh */ 12688 nfsstat4 status; 12689 }; 12691 15.24.4. DESCRIPTION 12693 Replaces the current filehandle with the filehandle that represents 12694 the root of the server's name space. From this filehandle a LOOKUP 12695 operation can locate any other filehandle on the server. This 12696 filehandle may be different from the "public" filehandle which may be 12697 associated with some other directory on the server. 12699 PUTROOTFH also clears the current stateid. 12701 See Section 15.2.4.1 for more details on the current filehandle. 12703 See Section 15.2.4.2 for more details on the current stateid. 12705 15.24.5. IMPLEMENTATION 12707 Commonly used as the first operator in an NFS request to set the 12708 context for following operations. 12710 15.25. Operation 25: READ - Read from File 12712 15.25.1. SYNOPSIS 12714 (cfh), stateid, offset, count -> eof, data 12716 15.25.2. ARGUMENT 12718 struct READ4args { 12719 /* CURRENT_FH: file */ 12720 stateid4 stateid; 12721 offset4 offset; 12722 count4 count; 12723 }; 12725 15.25.3. RESULT 12727 struct READ4resok { 12728 bool eof; 12729 opaque data<>; 12730 }; 12732 union READ4res switch (nfsstat4 status) { 12733 case NFS4_OK: 12734 READ4resok resok4; 12735 default: 12736 void; 12737 }; 12739 15.25.4. DESCRIPTION 12741 The READ operation reads data from the regular file identified by the 12742 current filehandle. 12744 The client provides an offset of where the READ is to start and a 12745 count of how many bytes are to be read. An offset of 0 (zero) means 12746 to read data starting at the beginning of the file. If offset is 12747 greater than or equal to the size of the file, the status, NFS4_OK, 12748 is returned with a data length set to 0 (zero) and eof is set to 12749 TRUE. The READ is subject to access permissions checking. 12751 If the client specifies a count value of 0 (zero), the READ succeeds 12752 and returns 0 (zero) bytes of data again subject to access 12753 permissions checking. The server may choose to return fewer bytes 12754 than specified by the client. The client needs to check for this 12755 condition and handle the condition appropriately. 12757 The stateid value for a READ request represents a value returned from 12758 a previous byte-range lock or share reservation request or the 12759 stateid associated with a delegation. The stateid is used by the 12760 server to verify that the associated share reservation and any byte- 12761 range locks are still valid and to update lease timeouts for the 12762 client. 12764 If the read ended at the end-of-file (formally, in a correctly formed 12765 READ request, if offset + count is equal to the size of the file), or 12766 the read request extends beyond the size of the file (if offset + 12767 count is greater than the size of the file), eof is returned as TRUE; 12768 otherwise it is FALSE. A successful READ of an empty file will 12769 always return eof as TRUE. 12771 If the current filehandle is not a regular file, an error will be 12772 returned to the client. In the case the current filehandle 12773 represents a directory, NFS4ERR_ISDIR is return; otherwise, 12774 NFS4ERR_INVAL is returned. 12776 For a READ with a stateid value of all bits 0, the server MAY allow 12777 the READ to be serviced subject to mandatory file locks or the 12778 current share deny modes for the file. For a READ with a stateid 12779 value of all bits 1, the server MAY allow READ operations to bypass 12780 locking checks at the server. 12782 On success, the current filehandle retains its value. 12784 15.25.5. IMPLEMENTATION 12786 If the server returns a "short read" (i.e., fewer data than requested 12787 and eof is set to FALSE), the client should send another READ to get 12788 the remaining data. A server may return less data than requested 12789 under several circumstances. The file may have been truncated by 12790 another client or perhaps on the server itself, changing the file 12791 size from what the requesting client believes to be the case. This 12792 would reduce the actual amount of data available to the client. It 12793 is possible that the server reduce the transfer size and so return a 12794 short read result. Server resource exhaustion may also occur in a 12795 short read. 12797 If mandatory byte-range locking is in effect for the file, and if the 12798 byte-range corresponding to the data to be read from the file is 12799 WRITE_LT locked by an owner not associated with the stateid, the 12800 server will return the NFS4ERR_LOCKED error. The client should try 12801 to get the appropriate READ_LT via the LOCK operation before 12802 reattempting the READ. When the READ completes, the client should 12803 release the byte-range lock via LOCKU. 12805 If another client has an OPEN_DELEGATE_WRITE delegation for the file 12806 being read, the delegation must be recalled, and the operation cannot 12807 proceed until that delegation is returned or revoked. Except where 12808 this happens very quickly, one or more NFS4ERR_DELAY errors will be 12809 returned to requests made while the delegation remains outstanding. 12810 Normally, delegations will not be recalled as a result of a READ 12811 operation since the recall will occur as a result of an earlier OPEN. 12812 However, since it is possible for a READ to be done with a special 12813 stateid, the server needs to check for this case even though the 12814 client should have done an OPEN previously. 12816 15.26. Operation 26: READDIR - Read Directory 12818 15.26.1. SYNOPSIS 12820 (cfh), cookie, cookieverf, dircount, maxcount, attr_request -> 12821 cookieverf { cookie, name, attrs } 12823 15.26.2. ARGUMENT 12825 struct READDIR4args { 12826 /* CURRENT_FH: directory */ 12827 nfs_cookie4 cookie; 12828 verifier4 cookieverf; 12829 count4 dircount; 12830 count4 maxcount; 12831 bitmap4 attr_request; 12832 }; 12834 15.26.3. RESULT 12836 struct entry4 { 12837 nfs_cookie4 cookie; 12838 component4 name; 12839 fattr4 attrs; 12840 entry4 *nextentry; 12841 }; 12843 struct dirlist4 { 12844 entry4 *entries; 12845 bool eof; 12846 }; 12848 struct READDIR4resok { 12849 verifier4 cookieverf; 12850 dirlist4 reply; 12851 }; 12853 union READDIR4res switch (nfsstat4 status) { 12854 case NFS4_OK: 12855 READDIR4resok resok4; 12856 default: 12857 void; 12858 }; 12860 15.26.4. DESCRIPTION 12862 The READDIR operation retrieves a variable number of entries from a 12863 filesystem directory and returns client requested attributes for each 12864 entry along with information to allow the client to request 12865 additional directory entries in a subsequent READDIR. 12867 The arguments contain a cookie value that represents where the 12868 READDIR should start within the directory. A value of 0 (zero) for 12869 the cookie is used to start reading at the beginning of the 12870 directory. For subsequent READDIR requests, the client specifies a 12871 cookie value that is provided by the server on a previous READDIR 12872 request. 12874 The cookieverf value should be set to 0 (zero) when the cookie value 12875 is 0 (zero) (first directory read). On subsequent requests, it 12876 should be a cookieverf as returned by the server. The cookieverf 12877 must match that returned by the READDIR in which the cookie was 12878 acquired. If the server determines that the cookieverf is no longer 12879 valid for the directory, the error NFS4ERR_NOT_SAME must be returned. 12881 The dircount portion of the argument is a hint of the maximum number 12882 of bytes of directory information that should be returned. This 12883 value represents the length of the names of the directory entries and 12884 the cookie value for these entries. This length represents the XDR 12885 encoding of the data (names and cookies) and not the length in the 12886 native format of the server. 12888 The maxcount value of the argument is the maximum number of bytes for 12889 the result. This maximum size represents all of the data being 12890 returned within the READDIR4resok structure and includes the XDR 12891 overhead. The server may return less data. If the server is unable 12892 to return a single directory entry within the maxcount limit, the 12893 error NFS4ERR_TOOSMALL will be returned to the client. 12895 Finally, attr_request represents the list of attributes to be 12896 returned for each directory entry supplied by the server. 12898 On successful return, the server's response will provide a list of 12899 directory entries. Each of these entries contains the name of the 12900 directory entry, a cookie value for that entry, and the associated 12901 attributes as requested. The "eof" flag has a value of TRUE if there 12902 are no more entries in the directory. 12904 The cookie value is only meaningful to the server and is used as a 12905 "bookmark" for the directory entry. As mentioned, this cookie is 12906 used by the client for subsequent READDIR operations so that it may 12907 continue reading a directory. The cookie is similar in concept to a 12908 READ offset but should not be interpreted as such by the client. 12909 Ideally, the cookie value should not change if the directory is 12910 modified since the client may be caching these values. 12912 In some cases, the server may encounter an error while obtaining the 12913 attributes for a directory entry. Instead of returning an error for 12914 the entire READDIR operation, the server can instead return the 12915 attribute 'fattr4_rdattr_error'. With this, the server is able to 12916 communicate the failure to the client and not fail the entire 12917 operation in the instance of what might be a transient failure. 12918 Obviously, the client must request the fattr4_rdattr_error attribute 12919 for this method to work properly. If the client does not request the 12920 attribute, the server has no choice but to return failure for the 12921 entire READDIR operation. 12923 For some filesystem environments, the directory entries "." and ".." 12924 have special meaning and in other environments, they may not. If the 12925 server supports these special entries within a directory, they should 12926 not be returned to the client as part of the READDIR response. To 12927 enable some client environments, the cookie values of 0, 1, and 2 are 12928 to be considered reserved. Note that the UNIX client will use these 12929 values when combining the server's response and local representations 12930 to enable a fully formed UNIX directory presentation to the 12931 application. 12933 For READDIR arguments, cookie values of 1 and 2 SHOULD NOT be used 12934 and for READDIR results cookie values of 0, 1, and 2 MUST NOT be 12935 returned. 12937 On success, the current filehandle retains its value. 12939 15.26.5. IMPLEMENTATION 12941 The server's filesystem directory representations can differ greatly. 12942 A client's programming interfaces may also be bound to the local 12943 operating environment in a way that does not translate well into the 12944 NFS protocol. Therefore the use of the dircount and maxcount fields 12945 are provided to allow the client the ability to provide guidelines to 12946 the server. If the client is aggressive about attribute collection 12947 during a READDIR, the server has an idea of how to limit the encoded 12948 response. The dircount field provides a hint on the number of 12949 entries based solely on the names of the directory entries. Since it 12950 is a hint, it may be possible that a dircount value is zero. In this 12951 case, the server is free to ignore the dircount value and return 12952 directory information based on the specified maxcount value. 12954 The cookieverf may be used by the server to help manage cookie values 12955 that may become stale. It should be a rare occurrence that a server 12956 is unable to continue properly reading a directory with the provided 12957 cookie/cookieverf pair. The server should make every effort to avoid 12958 this condition since the application at the client may not be able to 12959 properly handle this type of failure. 12961 The use of the cookieverf will also protect the client from using 12962 READDIR cookie values that may be stale. For example, if the file 12963 system has been migrated, the server may or may not be able to use 12964 the same cookie values to service READDIR as the previous server 12965 used. With the client providing the cookieverf, the server is able 12966 to provide the appropriate response to the client. This prevents the 12967 case where the server may accept a cookie value but the underlying 12968 directory has changed and the response is invalid from the client's 12969 context of its previous READDIR. 12971 Since some servers will not be returning "." and ".." entries as has 12972 been done with previous versions of the NFS protocol, the client that 12973 requires these entries be present in READDIR responses must fabricate 12974 them. 12976 15.27. Operation 27: READLINK - Read Symbolic Link 12978 15.27.1. SYNOPSIS 12980 (cfh) -> linktext 12982 15.27.2. ARGUMENT 12984 /* CURRENT_FH: symlink */ 12985 void; 12987 15.27.3. RESULT 12989 struct READLINK4resok { 12990 linktext4 link; 12991 }; 12993 union READLINK4res switch (nfsstat4 status) { 12994 case NFS4_OK: 12995 READLINK4resok resok4; 12996 default: 12997 void; 12998 }; 13000 15.27.4. DESCRIPTION 13002 READLINK reads the data associated with a symbolic link. The data is 13003 a UTF-8 string that is opaque to the server. That is, whether 13004 created by an NFS client or created locally on the server, the data 13005 in a symbolic link is not interpreted when created, but is simply 13006 stored. 13008 On success, the current filehandle retains its value. 13010 15.27.5. IMPLEMENTATION 13012 A symbolic link is nominally a pointer to another file. The data is 13013 not necessarily interpreted by the server, just stored in the file. 13014 It is possible for a client implementation to store a path name that 13015 is not meaningful to the server operating system in a symbolic link. 13016 A READLINK operation returns the data to the client for 13017 interpretation. If different implementations want to share access to 13018 symbolic links, then they must agree on the interpretation of the 13019 data in the symbolic link. 13021 The READLINK operation is only allowed on objects of type NF4LNK. 13022 The server should return the error, NFS4ERR_INVAL, if the object is 13023 not of type, NF4LNK. 13025 15.28. Operation 28: REMOVE - Remove Filesystem Object 13027 15.28.1. SYNOPSIS 13029 (cfh), filename -> change_info 13031 15.28.2. ARGUMENT 13033 struct REMOVE4args { 13034 /* CURRENT_FH: directory */ 13035 component4 target; 13036 }; 13038 15.28.3. RESULT 13040 struct REMOVE4resok { 13041 change_info4 cinfo; 13042 }; 13044 union REMOVE4res switch (nfsstat4 status) { 13045 case NFS4_OK: 13046 REMOVE4resok resok4; 13047 default: 13048 void; 13049 }; 13051 15.28.4. DESCRIPTION 13053 The REMOVE operation removes (deletes) a directory entry M named by 13054 filename from the directory corresponding to the current filehandle. 13055 If the entry in the directory was the last reference to the 13056 corresponding filesystem object, the object may be destroyed. 13058 For the directory where the filename was removed, the server returns 13059 change_info4 information in cinfo. With the atomic field of the 13060 change_info4 struct, the server will indicate if the before and after 13061 change attributes were obtained atomically with respect to the 13062 removal. 13064 If the target is of zero length, NFS4ERR_INVAL will be returned. The 13065 target is also subject to the normal UTF-8, character support, and 13066 name checks. See Section 12.3 for further discussion. 13068 On success, the current filehandle retains its value. 13070 15.28.5. IMPLEMENTATION 13072 NFSv3 required a different operator RMDIR for directory removal and 13073 REMOVE for non-directory removal. This allowed clients to skip 13074 checking the file type when being passed a non-directory delete 13075 system call (e.g., unlink() [40] in POSIX) to remove a directory, as 13076 well as the converse (e.g., a rmdir() on a non-directory) because 13077 they knew the server would check the file type. NFSv4 REMOVE can be 13078 used to delete any directory entry independent of its file type. The 13079 implementor of an NFSv4 client's entry points from the unlink() and 13080 rmdir() system calls should first check the file type against the 13081 types the system call is allowed to remove before issuing a REMOVE. 13082 Alternatively, the implementor can produce a COMPOUND call that 13083 includes a LOOKUP/VERIFY sequence to verify the file type before a 13084 REMOVE operation in the same COMPOUND call. 13086 The concept of last reference is server specific. However, if the 13087 numlinks field in the previous attributes of the object had the value 13088 1, the client should not rely on referring to the object via a 13089 filehandle. Likewise, the client should not rely on the resources 13090 (disk space, directory entry, and so on) formerly associated with the 13091 object becoming immediately available. Thus, if a client needs to be 13092 able to continue to access a file after using REMOVE to remove it, 13093 the client should take steps to make sure that the file will still be 13094 accessible. The usual mechanism used is to RENAME the file from its 13095 old name to a new hidden name. 13097 If the server finds that the file is still open when the REMOVE 13098 arrives: 13100 o The server SHOULD NOT delete the file's directory entry if the 13101 file was opened with OPEN4_SHARE_DENY_WRITE or 13102 OPEN4_SHARE_DENY_BOTH. 13104 o If the file was not opened with OPEN4_SHARE_DENY_WRITE or 13105 OPEN4_SHARE_DENY_BOTH, the server SHOULD delete the file's 13106 directory entry. However, until last CLOSE of the file, the 13107 server MAY continue to allow access to the file via its 13108 filehandle. 13110 15.29. Operation 29: RENAME - Rename Directory Entry 13112 15.29.1. SYNOPSIS 13114 (sfh), oldname, (cfh), newname -> source_change_info, 13115 target_change_info 13117 15.29.2. ARGUMENT 13119 struct RENAME4args { 13120 /* SAVED_FH: source directory */ 13121 component4 oldname; 13122 /* CURRENT_FH: target directory */ 13123 component4 newname; 13124 }; 13126 15.29.3. RESULT 13128 struct RENAME4resok { 13129 change_info4 source_cinfo; 13130 change_info4 target_cinfo; 13131 }; 13133 union RENAME4res switch (nfsstat4 status) { 13134 case NFS4_OK: 13135 RENAME4resok resok4; 13136 default: 13137 void; 13138 }; 13140 15.29.4. DESCRIPTION 13142 The RENAME operation renames the object identified by oldname in the 13143 source directory corresponding to the saved filehandle, as set by the 13144 SAVEFH operation, to newname in the target directory corresponding to 13145 the current filehandle. The operation is required to be atomic to 13146 the client. Source and target directories must reside on the same 13147 filesystem on the server. On success, the current filehandle will 13148 continue to be the target directory. 13150 If the target directory already contains an entry with the name, 13151 newname, the source object must be compatible with the target: either 13152 both are non-directories or both are directories and the target must 13153 be empty. If compatible, the existing target is removed before the 13154 rename occurs (See Section 15.28 for client and server actions 13155 whenever a target is removed). If they are not compatible or if the 13156 target is a directory but not empty, the server will return the 13157 error, NFS4ERR_EXIST. 13159 If oldname and newname both refer to the same file (they might be 13160 hard links of each other), then RENAME should perform no action and 13161 return success. 13163 For both directories involved in the RENAME, the server returns 13164 change_info4 information. With the atomic field of the change_info4 13165 struct, the server will indicate if the before and after change 13166 attributes were obtained atomically with respect to the rename. 13168 If the oldname refers to a named attribute and the saved and current 13169 filehandles refer to different filesystem objects, the server will 13170 return NFS4ERR_XDEV just as if the saved and current filehandles 13171 represented directories on different filesystems. 13173 If the oldname or newname is of zero length, NFS4ERR_INVAL will be 13174 returned. The oldname and newname are also subject to the normal 13175 UTF-8, character support, and name checks. See Section 12.3 for 13176 further discussion. 13178 15.29.5. IMPLEMENTATION 13180 The RENAME operation must be atomic to the client. The statement 13181 "source and target directories must reside on the same filesystem on 13182 the server" means that the fsid fields in the attributes for the 13183 directories are the same. If they reside on different filesystems, 13184 the error, NFS4ERR_XDEV, is returned. 13186 Based on the value of the fh_expire_type attribute for the object, 13187 the filehandle may or may not expire on a RENAME. However, server 13188 implementors are strongly encouraged to attempt to keep filehandles 13189 from expiring in this fashion. 13191 On some servers, the file names "." and ".." are illegal as either 13192 oldname or newname, and will result in the error NFS4ERR_BADNAME. In 13193 addition, on many servers the case of oldname or newname being an 13194 alias for the source directory will be checked for. Such servers 13195 will return the error NFS4ERR_INVAL in these cases. 13197 If either of the source or target filehandles are not directories, 13198 the server will return NFS4ERR_NOTDIR. 13200 15.30. Operation 30: RENEW - Renew a Lease 13202 15.30.1. SYNOPSIS 13204 clientid -> () 13206 15.30.2. ARGUMENT 13208 struct RENEW4args { 13209 clientid4 clientid; 13210 }; 13212 15.30.3. RESULT 13214 struct RENEW4res { 13215 nfsstat4 status; 13216 }; 13218 15.30.4. DESCRIPTION 13220 The RENEW operation is used by the client to renew leases which it 13221 currently holds at a server. In processing the RENEW request, the 13222 server renews all leases associated with the client. The associated 13223 leases are determined by the clientid provided via the SETCLIENTID 13224 operation. 13226 15.30.5. IMPLEMENTATION 13228 When the client holds delegations, it needs to use RENEW to detect 13229 when the server has determined that the callback path is down. When 13230 the server has made such a determination, only the RENEW operation 13231 will renew the lease on delegations. If the server determines the 13232 callback path is down, it returns NFS4ERR_CB_PATH_DOWN. Even though 13233 it returns NFS4ERR_CB_PATH_DOWN, the server MUST renew the lease on 13234 the byte-range locks and share reservations that the client has 13235 established on the server. If for some reason the lock and share 13236 reservation lease cannot be renewed, then the server MUST return an 13237 error other than NFS4ERR_CB_PATH_DOWN, even if the callback path is 13238 also down. In the event that the server has conditions such that is 13239 could return either NFS4ERR_CB_PATH_DOWN or NFS4ERR_LEASE_MOVED, 13240 NFS4ERR_LEASE_MOVED MUST be handled first. 13242 The client that issues RENEW MUST choose the principal, RPC security 13243 flavor, and if applicable, GSS-API mechanism and service via one of 13244 the following algorithms: 13246 o The client uses the same principal, RPC security flavor -- and if 13247 the flavor was RPCSEC_GSS -- the same mechanism and service that 13248 was used when the client id was established via 13249 SETCLIENTID_CONFIRM. 13251 o The client uses any principal, RPC security flavor mechanism and 13252 service combination that currently has an OPEN file on the server. 13253 I.e., the same principal had a successful OPEN operation, the file 13254 is still open by that principal, and the flavor, mechanism, and 13255 service of RENEW match that of the previous OPEN. 13257 The server MUST reject a RENEW that does not use one the 13258 aforementioned algorithms, with the error NFS4ERR_ACCESS. 13260 15.31. Operation 31: RESTOREFH - Restore Saved Filehandle 13262 15.31.1. SYNOPSIS 13264 (sfh) -> (cfh) 13266 15.31.2. ARGUMENT 13268 /* SAVED_FH: */ 13269 void; 13271 15.31.3. RESULT 13273 struct RESTOREFH4res { 13274 /* CURRENT_FH: value of saved fh */ 13275 nfsstat4 status; 13276 }; 13278 15.31.4. DESCRIPTION 13280 Set the current filehandle to the value in the saved filehandle. If 13281 there is no saved filehandle then return the error NFS4ERR_RESTOREFH. 13283 15.31.5. IMPLEMENTATION 13285 Operations like OPEN and LOOKUP use the current filehandle to 13286 represent a directory and replace it with a new filehandle. Assuming 13287 the previous filehandle was saved with a SAVEFH operator, the 13288 previous filehandle can be restored as the current filehandle. This 13289 is commonly used to obtain post-operation attributes for the 13290 directory, e.g., 13291 PUTFH (directory filehandle) 13292 SAVEFH 13293 GETATTR attrbits (pre-op dir attrs) 13294 CREATE optbits "foo" attrs 13295 GETATTR attrbits (file attributes) 13296 RESTOREFH 13297 GETATTR attrbits (post-op dir attrs) 13299 15.32. Operation 32: SAVEFH - Save Current Filehandle 13301 15.32.1. SYNOPSIS 13303 (cfh) -> (sfh) 13305 15.32.2. ARGUMENT 13307 /* CURRENT_FH: */ 13308 void; 13310 15.32.3. RESULT 13312 struct SAVEFH4res { 13313 /* SAVED_FH: value of current fh */ 13314 nfsstat4 status; 13315 }; 13317 15.32.4. DESCRIPTION 13319 Save the current filehandle. If a previous filehandle was saved then 13320 it is no longer accessible. The saved filehandle can be restored as 13321 the current filehandle with the RESTOREFH operator. 13323 On success, the current filehandle retains its value. 13325 15.32.5. IMPLEMENTATION 13327 15.33. Operation 33: SECINFO - Obtain Available Security 13329 15.33.1. SYNOPSIS 13331 (cfh), name -> { secinfo } 13333 15.33.2. ARGUMENT 13335 struct SECINFO4args { 13336 /* CURRENT_FH: directory */ 13337 component4 name; 13338 }; 13340 15.33.3. RESULT 13342 /* 13343 * From RFC 2203 13344 */ 13345 enum rpc_gss_svc_t { 13346 RPC_GSS_SVC_NONE = 1, 13347 RPC_GSS_SVC_INTEGRITY = 2, 13348 RPC_GSS_SVC_PRIVACY = 3 13349 }; 13351 struct rpcsec_gss_info { 13352 sec_oid4 oid; 13353 qop4 qop; 13354 rpc_gss_svc_t service; 13355 }; 13357 /* RPCSEC_GSS has a value of '6' - See RFC 2203 */ 13358 union secinfo4 switch (uint32_t flavor) { 13359 case RPCSEC_GSS: 13360 rpcsec_gss_info flavor_info; 13361 default: 13362 void; 13363 }; 13365 typedef secinfo4 SECINFO4resok<>; 13367 union SECINFO4res switch (nfsstat4 status) { 13368 case NFS4_OK: 13369 SECINFO4resok resok4; 13370 default: 13371 void; 13372 }; 13374 15.33.4. DESCRIPTION 13376 The SECINFO operation is used by the client to obtain a list of valid 13377 RPC authentication flavors for a specific directory filehandle, file 13378 name pair. SECINFO should apply the same access methodology used for 13379 LOOKUP when evaluating the name. Therefore, if the requester does 13380 not have the appropriate access to LOOKUP the name then SECINFO must 13381 behave the same way and return NFS4ERR_ACCESS. 13383 The result will contain an array which represents the security 13384 mechanisms available, with an order corresponding to server's 13385 preferences, the most preferred being first in the array. The client 13386 is free to pick whatever security mechanism it both desires and 13387 supports, or to pick in the server's preference order the first one 13388 it supports. The array entries are represented by the secinfo4 13389 structure. The field 'flavor' will contain a value of AUTH_NONE, 13390 AUTH_SYS (as defined in [3]), or RPCSEC_GSS (as defined in [4]). 13392 For the flavors AUTH_NONE and AUTH_SYS, no additional security 13393 information is returned. For a return value of RPCSEC_GSS, a 13394 security triple is returned that contains the mechanism object id (as 13395 defined in [6]), the quality of protection (as defined in [6]) and 13396 the service type (as defined in [4]). It is possible for SECINFO to 13397 return multiple entries with flavor equal to RPCSEC_GSS with 13398 different security triple values. 13400 On success, the current filehandle retains its value. 13402 If the name has a length of 0 (zero), or if name does not obey the 13403 UTF-8 definition, the error NFS4ERR_INVAL will be returned. 13405 15.33.5. IMPLEMENTATION 13407 The SECINFO operation is expected to be used by the NFS client when 13408 the error value of NFS4ERR_WRONGSEC is returned from another NFS 13409 operation. This signifies to the client that the server's security 13410 policy is different from what the client is currently using. At this 13411 point, the client is expected to obtain a list of possible security 13412 flavors and choose what best suits its policies. 13414 As mentioned, the server's security policies will determine when a 13415 client request receives NFS4ERR_WRONGSEC. The operations which may 13416 receive this error are: LINK, LOOKUP, LOOKUPP, OPEN, PUTFH, PUTPUBFH, 13417 PUTROOTFH, RENAME, RESTOREFH, and indirectly READDIR. LINK and 13418 RENAME will only receive this error if the security used for the 13419 operation is inappropriate for saved filehandle. With the exception 13420 of READDIR, these operations represent the point at which the client 13421 can instantiate a filehandle into the "current filehandle" at the 13422 server. The filehandle is either provided by the client (PUTFH, 13423 PUTPUBFH, PUTROOTFH) or generated as a result of a name to filehandle 13424 translation (LOOKUP and OPEN). RESTOREFH is different because the 13425 filehandle is a result of a previous SAVEFH. Even though the 13426 filehandle, for RESTOREFH, might have previously passed the server's 13427 inspection for a security match, the server will check it again on 13428 RESTOREFH to ensure that the security policy has not changed. 13430 If the client wants to resolve an error return of NFS4ERR_WRONGSEC, 13431 the following will occur: 13433 o For LOOKUP and OPEN, the client will use SECINFO with the same 13434 current filehandle and name as provided in the original LOOKUP or 13435 OPEN to enumerate the available security triples. 13437 o For LINK, PUTFH, RENAME, and RESTOREFH, the client will use 13438 SECINFO and provide the parent directory filehandle and object 13439 name which corresponds to the filehandle originally provided by 13440 the PUTFH RESTOREFH, or for LINK and RENAME, the SAVEFH. 13442 o For LOOKUPP, PUTROOTFH and PUTPUBFH, the client will be unable to 13443 use the SECINFO operation since SECINFO requires a current 13444 filehandle and none exist for these two operations. Therefore, 13445 the client must iterate through the security triples available at 13446 the client and reattempt the PUTROOTFH or PUTPUBFH operation. In 13447 the unfortunate event none of the MANDATORY security triples are 13448 supported by the client and server, the client SHOULD try using 13449 others that support integrity. Failing that, the client can try 13450 using AUTH_NONE, but because such forms lack integrity checks, 13451 this puts the client at risk. Nonetheless, the server SHOULD 13452 allow the client to use whatever security form the client requests 13453 and the server supports, since the risks of doing so are on the 13454 client. 13456 The READDIR operation will not directly return the NFS4ERR_WRONGSEC 13457 error. However, if the READDIR request included a request for 13458 attributes, it is possible that the READDIR request's security triple 13459 does not match that of a directory entry. If this is the case and 13460 the client has requested the rdattr_error attribute, the server will 13461 return the NFS4ERR_WRONGSEC error in rdattr_error for the entry. 13463 See Section 17 for a discussion on the recommendations for security 13464 flavor used by SECINFO. 13466 15.34. Operation 34: SETATTR - Set Attributes 13468 15.34.1. SYNOPSIS 13470 (cfh), stateid, attrmask, attr_vals -> attrsset 13472 15.34.2. ARGUMENT 13474 struct SETATTR4args { 13475 /* CURRENT_FH: target object */ 13476 stateid4 stateid; 13477 fattr4 obj_attributes; 13478 }; 13480 15.34.3. RESULT 13482 struct SETATTR4res { 13483 nfsstat4 status; 13484 bitmap4 attrsset; 13485 }; 13487 15.34.4. DESCRIPTION 13489 The SETATTR operation changes one or more of the attributes of a 13490 filesystem object. The new attributes are specified with a bitmap 13491 and the attributes that follow the bitmap in bit order. 13493 The stateid argument for SETATTR is used to provide byte-range 13494 locking context that is necessary for SETATTR requests that set the 13495 size attribute. Since setting the size attribute modifies the file's 13496 data, it has the same locking requirements as a corresponding WRITE. 13497 Any SETATTR that sets the size attribute is incompatible with a share 13498 reservation that specifies OPEN4_SHARE_DENY_WRITE. The area between 13499 the old end-of-file and the new end-of-file is considered to be 13500 modified just as would have been the case had the area in question 13501 been specified as the target of WRITE, for the purpose of checking 13502 conflicts with byte-range locks, for those cases in which a server is 13503 implementing mandatory byte-range locking behavior. A valid stateid 13504 SHOULD always be specified. When the file size attribute is not set, 13505 the special stateid consisting of all bits zero MAY be passed. 13507 On either success or failure of the operation, the server will return 13508 the attrsset bitmask to represent what (if any) attributes were 13509 successfully set. The attrsset in the response is a subset of the 13510 bitmap4 that is part of the obj_attributes in the argument. 13512 On success, the current filehandle retains its value. 13514 15.34.5. IMPLEMENTATION 13516 If the request specifies the owner attribute to be set, the server 13517 SHOULD allow the operation to succeed if the current owner of the 13518 object matches the value specified in the request. Some servers may 13519 be implemented in a way as to prohibit the setting of the owner 13520 attribute unless the requester has privilege to do so. If the server 13521 is lenient in this one case of matching owner values, the client 13522 implementation may be simplified in cases of creation of an object 13523 (e.g., an exclusive create via OPEN) followed by a SETATTR. 13525 The file size attribute is used to request changes to the size of a 13526 file. A value of zero causes the file to be truncated, a value less 13527 than the current size of the file causes data from new size to the 13528 end of the file to be discarded, and a size greater than the current 13529 size of the file causes logically zeroed data bytes to be added to 13530 the end of the file. Servers are free to implement this using holes 13531 or actual zero data bytes. Clients should not make any assumptions 13532 regarding a server's implementation of this feature, beyond that the 13533 bytes returned will be zeroed. Servers MUST support extending the 13534 file size via SETATTR. 13536 SETATTR is not guaranteed atomic. A failed SETATTR may partially 13537 change a file's attributes, hence the reason why the reply always 13538 includes the status and the list of attributes that were set. 13540 If the object whose attributes are being changed has a file 13541 delegation that is held by a client other than the one doing the 13542 SETATTR, the delegation(s) must be recalled, and the operation cannot 13543 proceed to actually change an attribute until each such delegation is 13544 returned or revoked. In all cases in which delegations are recalled, 13545 the server is likely to return one or more NFS4ERR_DELAY errors while 13546 the delegation(s) remains outstanding, although it might not do that 13547 if the delegations are returned quickly. 13549 Changing the size of a file with SETATTR indirectly changes the 13550 time_modify and change attributes. A client must account for this as 13551 size changes can result in data deletion. 13553 The attributes time_access_set and time_modify_set are write-only 13554 attributes constructed as a switched union so the client can direct 13555 the server in setting the time values. If the switched union 13556 specifies SET_TO_CLIENT_TIME4, the client has provided an nfstime4 to 13557 be used for the operation. If the switch union does not specify 13558 SET_TO_CLIENT_TIME4, the server is to use its current time for the 13559 SETATTR operation. 13561 If server and client times differ, programs that compare client time 13562 to file times can break. A time maintenance protocol should be used 13563 to limit client/server time skew. 13565 Use of a COMPOUND containing a VERIFY operation specifying only the 13566 change attribute, immediately followed by a SETATTR, provides a means 13567 whereby a client may specify a request that emulates the 13568 functionality of the SETATTR guard mechanism of NFSv3. Since the 13569 function of the guard mechanism is to avoid changes to the file 13570 attributes based on stale information, delays between checking of the 13571 guard condition and the setting of the attributes have the potential 13572 to compromise this function, as would the corresponding delay in the 13573 NFSv4 emulation. Therefore, NFSv4 servers should take care to avoid 13574 such delays, to the degree possible, when executing such a request. 13576 If the server does not support an attribute as requested by the 13577 client, the server should return NFS4ERR_ATTRNOTSUPP. 13579 A mask of the attributes actually set is returned by SETATTR in all 13580 cases. That mask MUST NOT include attribute bits not requested to be 13581 set by the client. If the attribute masks in the request and reply 13582 are equal, the status field in the reply MUST be NFS4_OK. 13584 15.35. Operation 35: SETCLIENTID - Negotiate Client ID 13586 15.35.1. SYNOPSIS 13588 client, callback, callback_ident -> clientid, setclientid_confirm 13590 15.35.2. ARGUMENT 13592 struct SETCLIENTID4args { 13593 nfs_client_id4 client; 13594 cb_client4 callback; 13595 uint32_t callback_ident; 13596 }; 13598 15.35.3. RESULT 13600 struct SETCLIENTID4resok { 13601 clientid4 clientid; 13602 verifier4 setclientid_confirm; 13603 }; 13605 union SETCLIENTID4res switch (nfsstat4 status) { 13606 case NFS4_OK: 13607 SETCLIENTID4resok resok4; 13608 case NFS4ERR_CLID_INUSE: 13609 clientaddr4 client_using; 13610 default: 13611 void; 13612 }; 13614 15.35.4. DESCRIPTION 13616 The client uses the SETCLIENTID operation to notify the server of its 13617 intention to use a particular client identifier, callback, and 13618 callback_ident for subsequent requests that entail creating lock, 13619 share reservation, and delegation state on the server. Upon 13620 successful completion the server will return a shorthand client ID 13621 which, if confirmed via a separate step, will be used in subsequent 13622 file locking and file open requests. Confirmation of the client ID 13623 must be done via the SETCLIENTID_CONFIRM operation to return the 13624 client ID and setclientid_confirm values, as verifiers, to the 13625 server. The reason why two verifiers are necessary is that it is 13626 possible to use SETCLIENTID and SETCLIENTID_CONFIRM to modify the 13627 callback and callback_ident information but not the shorthand client 13628 ID. In that event, the setclientid_confirm value is effectively the 13629 only verifier. 13631 The callback information provided in this operation will be used if 13632 the client is provided an open delegation at a future point. 13633 Therefore, the client must correctly reflect the program and port 13634 numbers for the callback program at the time SETCLIENTID is used. 13636 The callback_ident value is used by the server on the callback. The 13637 client can leverage the callback_ident to eliminate the need for more 13638 than one callback RPC program number, while still being able to 13639 determine which server is initiating the callback. 13641 15.35.5. IMPLEMENTATION 13643 To understand how to implement SETCLIENTID, make the following 13644 notations. Let: 13646 x be the value of the client.id subfield of the SETCLIENTID4args 13647 structure. 13649 v be the value of the client.verifier subfield of the 13650 SETCLIENTID4args structure. 13652 c be the value of the client ID field returned in the 13653 SETCLIENTID4resok structure. 13655 k represent the value combination of the fields callback and 13656 callback_ident fields of the SETCLIENTID4args structure. 13658 s be the setclientid_confirm value returned in the SETCLIENTID4resok 13659 structure. 13661 { v, x, c, k, s } be a quintuple for a client record. A client 13662 record is confirmed if there has been a SETCLIENTID_CONFIRM 13663 operation to confirm it. Otherwise it is unconfirmed. An 13664 unconfirmed record is established by a SETCLIENTID call. 13666 Since SETCLIENTID is a non-idempotent operation, let us assume that 13667 the server is implementing the duplicate request cache (DRC). 13669 When the server gets a SETCLIENTID { v, x, k } request, it processes 13670 it in the following manner. 13672 o It first looks up the request in the DRC. If there is a hit, it 13673 returns the result cached in the DRC. The server does NOT remove 13674 client state (locks, shares, delegations) nor does it modify any 13675 recorded callback and callback_ident information for client { x }. 13677 For any DRC miss, the server takes the client id string x, and 13678 searches for client records for x that the server may have 13679 recorded from previous SETCLIENTID calls. For any confirmed 13680 record with the same id string x, if the recorded principal does 13681 not match that of SETCLIENTID call, then the server returns a 13682 NFS4ERR_CLID_INUSE error. 13684 For brevity of discussion, the remaining description of the 13685 processing assumes that there was a DRC miss, and that where the 13686 server has previously recorded a confirmed record for client x, 13687 the aforementioned principal check has successfully passed. 13689 o The server checks if it has recorded a confirmed record for { v, 13690 x, c, l, s }, where l may or may not equal k. If so, and since 13691 the id verifier v of the request matches that which is confirmed 13692 and recorded, the server treats this as a probable callback 13693 information update and records an unconfirmed { v, x, c, k, t } 13694 and leaves the confirmed { v, x, c, l, s } in place, such that t 13695 != s. It does not matter if k equals l or not. Any pre-existing 13696 unconfirmed { v, x, c, *, * } is removed. 13698 The server returns { c, t }. It is indeed returning the old 13699 clientid4 value c, because the client apparently only wants to 13700 update callback value k to value l. It's possible this request is 13701 one from the Byzantine router that has stale callback information, 13702 but this is not a problem. The callback information update is 13703 only confirmed if followed up by a SETCLIENTID_CONFIRM { c, t }. 13705 The server awaits confirmation of k via SETCLIENTID_CONFIRM { c, t 13706 }. 13708 The server does NOT remove client (lock/share/delegation) state 13709 for x. 13711 o The server has previously recorded a confirmed { u, x, c, l, s } 13712 record such that v != u, l may or may not equal k, and has not 13713 recorded any unconfirmed { *, x, *, *, * } record for x. The 13714 server records an unconfirmed { v, x, d, k, t } (d != c, t != s). 13716 The server returns { d, t }. 13718 The server awaits confirmation of { d, k } via SETCLIENTID_CONFIRM 13719 { d, t }. 13721 The server does NOT remove client (lock/share/delegation) state 13722 for x. 13724 o The server has previously recorded a confirmed { u, x, c, l, s } 13725 record such that v != u, l may or may not equal k, and recorded an 13726 unconfirmed { w, x, d, m, t } record such that c != d, t != s, m 13727 may or may not equal k, m may or may not equal l, and k may or may 13728 not equal l. Whether w == v or w != v makes no difference. The 13729 server simply removes the unconfirmed { w, x, d, m, t } record and 13730 replaces it with an unconfirmed { v, x, e, k, r } record, such 13731 that e != d, e != c, r != t, r != s. 13733 The server returns { e, r }. 13735 The server awaits confirmation of { e, k } via SETCLIENTID_CONFIRM 13736 { e, r }. 13738 The server does NOT remove client (lock/share/delegation) state 13739 for x. 13741 o The server has no confirmed { *, x, *, *, * } for x. It may or 13742 may not have recorded an unconfirmed { u, x, c, l, s }, where l 13743 may or may not equal k, and u may or may not equal v. Any 13744 unconfirmed record { u, x, c, l, * }, regardless whether u == v or 13745 l == k, is replaced with an unconfirmed record { v, x, d, k, t } 13746 where d != c, t != s. 13748 The server returns { d, t }. 13750 The server awaits confirmation of { d, k } via SETCLIENTID_CONFIRM 13751 { d, t }. The server does NOT remove client (lock/share/ 13752 delegation) state for x. 13754 The server generates the clientid and setclientid_confirm values and 13755 must take care to ensure that these values are extremely unlikely to 13756 ever be regenerated. 13758 15.36. Operation 36: SETCLIENTID_CONFIRM - Confirm Client ID 13760 15.36.1. SYNOPSIS 13762 clientid, verifier -> - 13764 15.36.2. ARGUMENT 13766 struct SETCLIENTID_CONFIRM4args { 13767 clientid4 clientid; 13768 verifier4 setclientid_confirm; 13769 }; 13771 15.36.3. RESULT 13773 struct SETCLIENTID_CONFIRM4res { 13774 nfsstat4 status; 13775 }; 13777 15.36.4. DESCRIPTION 13779 This operation is used by the client to confirm the results from a 13780 previous call to SETCLIENTID. The client provides the server 13781 supplied (from a SETCLIENTID response) client ID. The server 13782 responds with a simple status of success or failure. 13784 15.36.5. IMPLEMENTATION 13786 The client must use the SETCLIENTID_CONFIRM operation to confirm the 13787 following two distinct cases: 13789 o The client's use of a new shorthand client identifier (as returned 13790 from the server in the response to SETCLIENTID), a new callback 13791 value (as specified in the arguments to SETCLIENTID) and a new 13792 callback_ident (as specified in the arguments to SETCLIENTID) 13793 value. The client's use of SETCLIENTID_CONFIRM in this case also 13794 confirms the removal of any of the client's previous relevant 13795 leased state. Relevant leased client state includes byte-range 13796 locks, share reservations, and where the server does not support 13797 the CLAIM_DELEGATE_PREV claim type, delegations. If the server 13798 supports CLAIM_DELEGATE_PREV, then SETCLIENTID_CONFIRM MUST NOT 13799 remove delegations for this client; relevant leased client state 13800 would then just include byte-range locks and share reservations. 13802 o The client's re-use of an old, previously confirmed, shorthand 13803 client identifier, a new callback value, and a new callback_ident 13804 value. The client's use of SETCLIENTID_CONFIRM in this case MUST 13805 NOT result in the removal of any previous leased state (locks, 13806 share reservations, and delegations) 13808 We use the same notation and definitions for v, x, c, k, s, and 13809 unconfirmed and confirmed client records as introduced in the 13810 description of the SETCLIENTID operation. The arguments to 13811 SETCLIENTID_CONFIRM are indicated by the notation { c, s }, where c 13812 is a value of type clientid4, and s is a value of type verifier4 13813 corresponding to the setclientid_confirm field. 13815 As with SETCLIENTID, SETCLIENTID_CONFIRM is a non-idempotent 13816 operation, and we assume that the server is implementing the 13817 duplicate request cache (DRC). 13819 When the server gets a SETCLIENTID_CONFIRM { c, s } request, it 13820 processes it in the following manner. 13822 o It first looks up the request in the DRC. If there is a hit, it 13823 returns the result cached in the DRC. The server does not remove 13824 any relevant leased client state nor does it modify any recorded 13825 callback and callback_ident information for client { x } as 13826 represented by the shorthand value c. 13828 For a DRC miss, the server checks for client records that match the 13829 shorthand value c. The processing cases are as follows: 13831 o The server has recorded an unconfirmed { v, x, c, k, s } record 13832 and a confirmed { v, x, c, l, t } record, such that s != t. If 13833 the principals of the records do not match that of the 13834 SETCLIENTID_CONFIRM, the server returns NFS4ERR_CLID_INUSE, and no 13835 relevant leased client state is removed and no recorded callback 13836 and callback_ident information for client { x } is changed. 13837 Otherwise, the confirmed { v, x, c, l, t } record is removed and 13838 the unconfirmed { v, x, c, k, s } is marked as confirmed, thereby 13839 modifying recorded and confirmed callback and callback_ident 13840 information for client { x }. 13842 The server does not remove any relevant leased client state. 13844 The server returns NFS4_OK. 13846 o The server has not recorded an unconfirmed { v, x, c, *, * } and 13847 has recorded a confirmed { v, x, c, *, s }. If the principals of 13848 the record and of SETCLIENTID_CONFIRM do not match, the server 13849 returns NFS4ERR_CLID_INUSE without removing any relevant leased 13850 client state and without changing recorded callback and 13851 callback_ident values for client { x }. 13853 If the principals match, then what has likely happened is that the 13854 client never got the response from the SETCLIENTID_CONFIRM, and 13855 the DRC entry has been purged. Whatever the scenario, since the 13856 principals match, as well as { c, s } matching a confirmed record, 13857 the server leaves client x's relevant leased client state intact, 13858 leaves its callback and callback_ident values unmodified, and 13859 returns NFS4_OK. 13861 o The server has not recorded a confirmed { *, *, c, *, * }, and has 13862 recorded an unconfirmed { *, x, c, k, s }. Even if this is a 13863 retry from client, nonetheless the client's first 13864 SETCLIENTID_CONFIRM attempt was not received by the server. Retry 13865 or not, the server doesn't know, but it processes it as if were a 13866 first try. If the principal of the unconfirmed { *, x, c, k, s } 13867 record mismatches that of the SETCLIENTID_CONFIRM request the 13868 server returns NFS4ERR_CLID_INUSE without removing any relevant 13869 leased client state. 13871 Otherwise, the server records a confirmed { *, x, c, k, s }. If 13872 there is also a confirmed { *, x, d, *, t }, the server MUST 13873 remove the client x's relevant leased client state, and overwrite 13874 the callback state with k. The confirmed record { *, x, d, *, t } 13875 is removed. 13877 Server returns NFS4_OK. 13879 o The server has no record of a confirmed or unconfirmed { *, *, c, 13880 *, s }. The server returns NFS4ERR_STALE_CLIENTID. The server 13881 does not remove any relevant leased client state, nor does it 13882 modify any recorded callback and callback_ident information for 13883 any client. 13885 The server needs to cache unconfirmed { v, x, c, k, s } client 13886 records and await for some time their confirmation. As should be 13887 clear from the record processing discussions for SETCLIENTID and 13888 SETCLIENTID_CONFIRM, there are cases where the server does not 13889 deterministically remove unconfirmed client records. To avoid 13890 running out of resources, the server is not required to hold 13891 unconfirmed records indefinitely. One strategy the server might use 13892 is to set a limit on how many unconfirmed client records it will 13893 maintain, and then when the limit would be exceeded, remove the 13894 oldest record. Another strategy might be to remove an unconfirmed 13895 record when some amount of time has elapsed. The choice of the 13896 amount of time is fairly arbitrary but it is surely no higher than 13897 the server's lease time period. Consider that leases need to be 13898 renewed before the lease time expires via an operation from the 13899 client. If the client cannot issue a SETCLIENTID_CONFIRM after a 13900 SETCLIENTID before a period of time equal to that of a lease expires, 13901 then the client is unlikely to be able maintain state on the server 13902 during steady state operation. 13904 If the client does send a SETCLIENTID_CONFIRM for an unconfirmed 13905 record that the server has already deleted, the client will get 13906 NFS4ERR_STALE_CLIENTID back. If so, the client should then start 13907 over, and send SETCLIENTID to reestablish an unconfirmed client 13908 record and get back an unconfirmed client ID and setclientid_confirm 13909 verifier. The client should then send the SETCLIENTID_CONFIRM to 13910 confirm the client ID. 13912 SETCLIENTID_CONFIRM does not establish or renew a lease. However, if 13913 SETCLIENTID_CONFIRM removes relevant leased client state, and that 13914 state does not include existing delegations, the server MUST allow 13915 the client a period of time no less than the value of lease_time 13916 attribute, to reclaim, (via the CLAIM_DELEGATE_PREV claim type of the 13917 OPEN operation) its delegations before removing unreclaimed 13918 delegations. 13920 15.37. Operation 37: VERIFY - Verify Same Attributes 13922 15.37.1. SYNOPSIS 13924 (cfh), fattr -> - 13926 15.37.2. ARGUMENT 13928 struct VERIFY4args { 13929 /* CURRENT_FH: object */ 13930 fattr4 obj_attributes; 13931 }; 13933 15.37.3. RESULT 13935 struct VERIFY4res { 13936 nfsstat4 status; 13937 }; 13939 15.37.4. DESCRIPTION 13941 The VERIFY operation is used to verify that attributes have a value 13942 assumed by the client before proceeding with following operations in 13943 the compound request. If any of the attributes do not match then the 13944 error NFS4ERR_NOT_SAME must be returned. The current filehandle 13945 retains its value after successful completion of the operation. 13947 15.37.5. IMPLEMENTATION 13949 One possible use of the VERIFY operation is the following compound 13950 sequence. With this the client is attempting to verify that the file 13951 being removed will match what the client expects to be removed. This 13952 sequence can help prevent the unintended deletion of a file. 13954 PUTFH (directory filehandle) 13955 LOOKUP (file name) 13956 VERIFY (filehandle == fh) 13957 PUTFH (directory filehandle) 13958 REMOVE (file name) 13960 This sequence does not prevent a second client from removing and 13961 creating a new file in the middle of this sequence but it does help 13962 avoid the unintended result. 13964 In the case that a recommended attribute is specified in the VERIFY 13965 operation and the server does not support that attribute for the 13966 filesystem object, the error NFS4ERR_ATTRNOTSUPP is returned to the 13967 client. 13969 When the attribute rdattr_error or any write-only attribute (e.g., 13970 time_modify_set) is specified, the error NFS4ERR_INVAL is returned to 13971 the client. 13973 15.38. Operation 38: WRITE - Write to File 13975 15.38.1. SYNOPSIS 13977 (cfh), stateid, offset, stable, data -> count, committed, writeverf 13979 15.38.2. ARGUMENT 13981 enum stable_how4 { 13982 UNSTABLE4 = 0, 13983 DATA_SYNC4 = 1, 13984 FILE_SYNC4 = 2 13985 }; 13987 struct WRITE4args { 13988 /* CURRENT_FH: file */ 13989 stateid4 stateid; 13990 offset4 offset; 13991 stable_how4 stable; 13992 opaque data<>; 13993 }; 13995 15.38.3. RESULT 13997 struct WRITE4resok { 13998 count4 count; 13999 stable_how4 committed; 14000 verifier4 writeverf; 14001 }; 14003 union WRITE4res switch (nfsstat4 status) { 14004 case NFS4_OK: 14005 WRITE4resok resok4; 14006 default: 14007 void; 14008 }; 14010 15.38.4. DESCRIPTION 14012 The WRITE operation is used to write data to a regular file. The 14013 target file is specified by the current filehandle. The offset 14014 specifies the offset where the data should be written. An offset of 14015 0 (zero) specifies that the write should start at the beginning of 14016 the file. The count, as encoded as part of the opaque data 14017 parameter, represents the number of bytes of data that are to be 14018 written. If the count is 0 (zero), the WRITE will succeed and return 14019 a count of 0 (zero) subject to permissions checking. The server may 14020 choose to write fewer bytes than requested by the client. 14022 Part of the write request is a specification of how the write is to 14023 be performed. The client specifies with the stable parameter the 14024 method of how the data is to be processed by the server. If stable 14025 is FILE_SYNC4, the server must commit the data written plus all 14026 filesystem metadata to stable storage before returning results. This 14027 corresponds to the NFS version 2 protocol semantics. Any other 14028 behavior constitutes a protocol violation. If stable is DATA_SYNC4, 14029 then the server must commit all of the data to stable storage and 14030 enough of the metadata to retrieve the data before returning. The 14031 server implementor is free to implement DATA_SYNC4 in the same 14032 fashion as FILE_SYNC4, but with a possible performance drop. If 14033 stable is UNSTABLE4, the server is free to commit any part of the 14034 data and the metadata to stable storage, including all or none, 14035 before returning a reply to the client. There is no guarantee 14036 whether or when any uncommitted data will subsequently be committed 14037 to stable storage. The only guarantees made by the server are that 14038 it will not destroy any data without changing the value of verf and 14039 that it will not commit the data and metadata at a level less than 14040 that requested by the client. 14042 The stateid value for a WRITE request represents a value returned 14043 from a previous byte-range lock or share reservation request or the 14044 stateid associated with a delegation. The stateid is used by the 14045 server to verify that the associated share reservation and any byte- 14046 range locks are still valid and to update lease timeouts for the 14047 client. 14049 Upon successful completion, the following results are returned. The 14050 count result is the number of bytes of data written to the file. The 14051 server may write fewer bytes than requested. If so, the actual 14052 number of bytes written starting at location, offset, is returned. 14054 The server also returns an indication of the level of commitment of 14055 the data and metadata via committed. If the server committed all 14056 data and metadata to stable storage, committed should be set to 14057 FILE_SYNC4. If the level of commitment was at least as strong as 14058 DATA_SYNC4, then committed should be set to DATA_SYNC4. Otherwise, 14059 committed must be returned as UNSTABLE4. If stable was FILE4_SYNC, 14060 then committed must also be FILE_SYNC4: anything else constitutes a 14061 protocol violation. If stable was DATA_SYNC4, then committed may be 14062 FILE_SYNC4 or DATA_SYNC4: anything else constitutes a protocol 14063 violation. If stable was UNSTABLE4, then committed may be either 14064 FILE_SYNC4, DATA_SYNC4, or UNSTABLE4. 14066 The final portion of the result is the write verifier. The write 14067 verifier is a cookie that the client can use to determine whether the 14068 server has changed instance (boot) state between a call to WRITE and 14069 a subsequent call to either WRITE or COMMIT. This cookie must be 14070 consistent during a single instance of the NFSv4 protocol service and 14071 must be unique between instances of the NFSv4 protocol server, where 14072 uncommitted data may be lost. 14074 If a client writes data to the server with the stable argument set to 14075 UNSTABLE4 and the reply yields a committed response of DATA_SYNC4 or 14076 UNSTABLE4, the client will follow up some time in the future with a 14077 COMMIT operation to synchronize outstanding asynchronous data and 14078 metadata with the server's stable storage, barring client error. It 14079 is possible that due to client crash or other error that a subsequent 14080 COMMIT will not be received by the server. 14082 For a WRITE with a stateid value of all bits 0, the server MAY allow 14083 the WRITE to be serviced subject to mandatory file locks or the 14084 current share deny modes for the file. For a WRITE with a stateid 14085 value of all bits 1, the server MUST NOT allow the WRITE operation to 14086 bypass locking checks at the server and are treated exactly the same 14087 as if a stateid of all bits 0 were used. 14089 On success, the current filehandle retains its value. 14091 15.38.5. IMPLEMENTATION 14093 It is possible for the server to write fewer bytes of data than 14094 requested by the client. In this case, the server should not return 14095 an error unless no data was written at all. If the server writes 14096 less than the number of bytes specified, the client should issue 14097 another WRITE to write the remaining data. 14099 It is assumed that the act of writing data to a file will cause the 14100 time_modified of the file to be updated. However, the time_modified 14101 of the file should not be changed unless the contents of the file are 14102 changed. Thus, a WRITE request with count set to 0 should not cause 14103 the time_modified of the file to be updated. 14105 The definition of stable storage has been historically a point of 14106 contention. The following expected properties of stable storage may 14107 help in resolving design issues in the implementation. Stable 14108 storage is persistent storage that survives: 14110 1. Repeated power failures. 14112 2. Hardware failures (of any board, power supply, etc.). 14114 3. Repeated software crashes, including reboot cycle. 14116 This definition does not address failure of the stable storage module 14117 itself. 14119 The verifier is defined to allow a client to detect different 14120 instances of an NFSv4 protocol server over which cached, uncommitted 14121 data may be lost. In the most likely case, the verifier allows the 14122 client to detect server reboots. This information is required so 14123 that the client can safely determine whether the server could have 14124 lost cached data. If the server fails unexpectedly and the client 14125 has uncommitted data from previous WRITE requests (done with the 14126 stable argument set to UNSTABLE4 and in which the result committed 14127 was returned as UNSTABLE4 as well) it may not have flushed cached 14128 data to stable storage. The burden of recovery is on the client and 14129 the client will need to retransmit the data to the server. 14131 A suggested verifier would be to use the time that the server was 14132 booted or the time the server was last started (if restarting the 14133 server without a reboot results in lost buffers). 14135 The committed field in the results allows the client to do more 14136 effective caching. If the server is committing all WRITE requests to 14137 stable storage, then it should return with committed set to 14138 FILE_SYNC4, regardless of the value of the stable field in the 14139 arguments. A server that uses an NVRAM accelerator may choose to 14140 implement this policy. The client can use this to increase the 14141 effectiveness of the cache by discarding cached data that has already 14142 been committed on the server. 14144 Some implementations may return NFS4ERR_NOSPC instead of 14145 NFS4ERR_DQUOT when a user's quota is exceeded. In the case that the 14146 current filehandle is a directory, the server will return 14147 NFS4ERR_ISDIR. If the current filehandle is not a regular file or a 14148 directory, the server will return NFS4ERR_INVAL. 14150 If mandatory file locking is on for the file, and corresponding 14151 record of the data to be written file is read or write locked by an 14152 owner that is not associated with the stateid, the server will return 14153 NFS4ERR_LOCKED. If so, the client must check if the owner 14154 corresponding to the stateid used with the WRITE operation has a 14155 conflicting read lock that overlaps with the region that was to be 14156 written. If the stateid's owner has no conflicting read lock, then 14157 the client should try to get the appropriate write byte-range lock 14158 via the LOCK operation before re-attempting the WRITE. When the 14159 WRITE completes, the client should release the byte-range lock via 14160 LOCKU. 14162 If the stateid's owner had a conflicting read lock, then the client 14163 has no choice but to return an error to the application that 14164 attempted the WRITE. The reason is that since the stateid's owner 14165 had a read lock, the server either attempted to temporarily 14166 effectively upgrade this read lock to a write lock, or the server has 14167 no upgrade capability. If the server attempted to upgrade the read 14168 lock and failed, it is pointless for the client to re-attempt the 14169 upgrade via the LOCK operation, because there might be another client 14170 also trying to upgrade. If two clients are blocked trying upgrade 14171 the same lock, the clients deadlock. If the server has no upgrade 14172 capability, then it is pointless to try a LOCK operation to upgrade. 14174 15.39. Operation 39: RELEASE_LOCKOWNER - Release Lockowner State 14176 15.39.1. SYNOPSIS 14178 lockowner -> () 14180 15.39.2. ARGUMENT 14182 struct RELEASE_LOCKOWNER4args { 14183 lock_owner4 lock_owner; 14184 }; 14186 15.39.3. RESULT 14188 struct RELEASE_LOCKOWNER4res { 14189 nfsstat4 status; 14190 }; 14192 15.39.4. DESCRIPTION 14194 This operation is used to notify the server that the lock-owner is no 14195 longer in use by the client. This allows the server to release 14196 cached state related to the specified lock-owner. If file locks, 14197 associated with the lock-owner, are held at the server, the error 14198 NFS4ERR_LOCKS_HELD will be returned and no further action will be 14199 taken. 14201 15.39.5. IMPLEMENTATION 14203 The client may choose to use this operation to ease the amount of 14204 server state that is held. Depending on behavior of applications at 14205 the client, it may be important for the client to use this operation 14206 since the server has certain obligations with respect to holding a 14207 reference to a lock-owner as long as the associated file is open. 14209 Therefore, if the client knows for certain that the lock-owner will 14210 no longer be used under the context of the associated open_owner4, it 14211 should use RELEASE_LOCKOWNER. 14213 15.40. Operation 10044: ILLEGAL - Illegal operation 14215 15.40.1. SYNOPSIS 14217 -> () 14219 15.40.2. ARGUMENT 14221 void; 14223 15.40.3. RESULT 14225 struct ILLEGAL4res { 14226 nfsstat4 status; 14227 }; 14229 15.40.4. DESCRIPTION 14231 This operation is a placeholder for encoding a result to handle the 14232 case of the client sending an operation code within COMPOUND that is 14233 not supported. See Section 15.2.4 for more details. 14235 The status field of ILLEGAL4res MUST be set to NFS4ERR_OP_ILLEGAL. 14237 15.40.5. IMPLEMENTATION 14239 A client will probably not send an operation with code OP_ILLEGAL but 14240 if it does, the response will be ILLEGAL4res just as it would be with 14241 any other invalid operation code. Note that if the server gets an 14242 illegal operation code that is not OP_ILLEGAL, and if the server 14243 checks for legal operation codes during the XDR decode phase, then 14244 the ILLEGAL4res would not be returned. 14246 16. NFSv4 Callback Procedures 14248 The procedures used for callbacks are defined in the following 14249 sections. In the interest of clarity, the terms "client" and 14250 "server" refer to NFS clients and servers, despite the fact that for 14251 an individual callback RPC, the sense of these terms would be 14252 precisely the opposite. 14254 16.1. Procedure 0: CB_NULL - No Operation 14256 16.1.1. SYNOPSIS 14258 14260 16.1.2. ARGUMENT 14262 void; 14264 16.1.3. RESULT 14266 void; 14268 16.1.4. DESCRIPTION 14270 Standard NULL procedure. Void argument, void response. Even though 14271 there is no direct functionality associated with this procedure, the 14272 server will use CB_NULL to confirm the existence of a path for RPCs 14273 from server to client. 14275 16.2. Procedure 1: CB_COMPOUND - Compound Operations 14277 16.2.1. SYNOPSIS 14279 compoundargs -> compoundres 14281 16.2.2. ARGUMENT 14283 enum nfs_cb_opnum4 { 14284 OP_CB_GETATTR = 3, 14285 OP_CB_RECALL = 4, 14286 OP_CB_ILLEGAL = 10044 14287 }; 14289 union nfs_cb_argop4 switch (unsigned argop) { 14290 case OP_CB_GETATTR: 14291 CB_GETATTR4args opcbgetattr; 14292 case OP_CB_RECALL: 14293 CB_RECALL4args opcbrecall; 14294 case OP_CB_ILLEGAL: void; 14295 }; 14296 struct CB_COMPOUND4args { 14297 comptag4 tag; 14298 uint32_t minorversion; 14299 uint32_t callback_ident; 14300 nfs_cb_argop4 argarray<>; 14301 }; 14303 16.2.3. RESULT 14305 union nfs_cb_resop4 switch (unsigned resop) { 14306 case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; 14307 case OP_CB_RECALL: CB_RECALL4res opcbrecall; 14308 case OP_CB_ILLEGAL: CB_ILLEGAL4res opcbillegal; 14309 }; 14311 struct CB_COMPOUND4res { 14312 nfsstat4 status; 14313 comptag4 tag; 14314 nfs_cb_resop4 resarray<>; 14315 }; 14317 16.2.4. DESCRIPTION 14319 The CB_COMPOUND procedure is used to combine one or more of the 14320 callback procedures into a single RPC request. The main callback RPC 14321 program has two main procedures: CB_NULL and CB_COMPOUND. All other 14322 operations use the CB_COMPOUND procedure as a wrapper. 14324 In the processing of the CB_COMPOUND procedure, the client may find 14325 that it does not have the available resources to execute any or all 14326 of the operations within the CB_COMPOUND sequence. In this case, the 14327 error NFS4ERR_RESOURCE will be returned for the particular operation 14328 within the CB_COMPOUND procedure where the resource exhaustion 14329 occurred. This assumes that all previous operations within the 14330 CB_COMPOUND sequence have been evaluated successfully. 14332 Contained within the CB_COMPOUND results is a 'status' field. This 14333 status must be equivalent to the status of the last operation that 14334 was executed within the CB_COMPOUND procedure. Therefore, if an 14335 operation incurred an error then the 'status' value will be the same 14336 error value as is being returned for the operation that failed. 14338 For the definition of the "tag" field, see Section 15.2. 14340 The value of callback_ident is supplied by the client during 14341 SETCLIENTID. The server must use the client supplied callback_ident 14342 during the CB_COMPOUND to allow the client to properly identify the 14343 server. 14345 Illegal operation codes are handled in the same way as they are 14346 handled for the COMPOUND procedure. 14348 16.2.5. IMPLEMENTATION 14350 The CB_COMPOUND procedure is used to combine individual operations 14351 into a single RPC request. The client interprets each of the 14352 operations in turn. If an operation is executed by the client and 14353 the status of that operation is NFS4_OK, then the next operation in 14354 the CB_COMPOUND procedure is executed. The client continues this 14355 process until there are no more operations to be executed or one of 14356 the operations has a status value other than NFS4_OK. 14358 16.2.6. Operation 3: CB_GETATTR - Get Attributes 14360 16.2.6.1. SYNOPSIS 14362 fh, attr_request -> attrmask, attr_vals 14364 16.2.6.2. ARGUMENT 14366 struct CB_GETATTR4args { 14367 nfs_fh4 fh; 14368 bitmap4 attr_request; 14369 }; 14371 16.2.6.3. RESULT 14373 struct CB_GETATTR4resok { 14374 fattr4 obj_attributes; 14375 }; 14377 union CB_GETATTR4res switch (nfsstat4 status) { 14378 case NFS4_OK: 14379 CB_GETATTR4resok resok4; 14380 default: 14381 void; 14382 }; 14384 16.2.6.4. DESCRIPTION 14386 The CB_GETATTR operation is used by the server to obtain the current 14387 modified state of a file that has been OPEN_DELEGATE_WRITE delegated. 14388 The attributes size and change are the only ones guaranteed to be 14389 serviced by the client. See Section 10.4.3 for a full description of 14390 how the client and server are to interact with the use of CB_GETATTR. 14392 If the filehandle specified is not one for which the client holds a 14393 OPEN_DELEGATE_WRITE delegation, an NFS4ERR_BADHANDLE error is 14394 returned. 14396 16.2.6.5. IMPLEMENTATION 14398 The client returns attrmask bits and the associated attribute values 14399 only for the change attribute, and attributes that it may change 14400 (time_modify, and size). 14402 16.2.7. Operation 4: CB_RECALL - Recall an Open Delegation 14404 16.2.7.1. SYNOPSIS 14406 stateid, truncate, fh -> () 14408 16.2.7.2. ARGUMENT 14410 struct CB_RECALL4args { 14411 stateid4 stateid; 14412 bool truncate; 14413 nfs_fh4 fh; 14414 }; 14416 16.2.7.3. RESULT 14418 struct CB_RECALL4res { 14419 nfsstat4 status; 14420 }; 14422 16.2.7.4. DESCRIPTION 14424 The CB_RECALL operation is used to begin the process of recalling an 14425 open delegation and returning it to the server. 14427 The truncate flag is used to optimize recall for a file which is 14428 about to be truncated to zero. When it is set, the client is freed 14429 of obligation to propagate modified data for the file to the server, 14430 since this data is irrelevant. 14432 If the handle specified is not one for which the client holds an open 14433 delegation, an NFS4ERR_BADHANDLE error is returned. 14435 If the stateid specified is not one corresponding to an open 14436 delegation for the file specified by the filehandle, an 14437 NFS4ERR_BAD_STATEID is returned. 14439 16.2.7.5. IMPLEMENTATION 14441 The client should reply to the callback immediately. Replying does 14442 not complete the recall except when an error was returned. The 14443 recall is not complete until the delegation is returned using a 14444 DELEGRETURN. 14446 16.2.8. Operation 10044: CB_ILLEGAL - Illegal Callback Operation 14448 16.2.8.1. SYNOPSIS 14450 -> () 14452 16.2.8.2. ARGUMENT 14454 void; 14456 16.2.8.3. RESULT 14458 /* 14459 * CB_ILLEGAL: Response for illegal operation numbers 14460 */ 14461 struct CB_ILLEGAL4res { 14462 nfsstat4 status; 14463 }; 14465 16.2.8.4. DESCRIPTION 14467 This operation is a placeholder for encoding a result to handle the 14468 case of the client sending an operation code within COMPOUND that is 14469 not supported. See Section 15.2.4 for more details. 14471 The status field of CB_ILLEGAL4res MUST be set to NFS4ERR_OP_ILLEGAL. 14473 16.2.8.5. IMPLEMENTATION 14475 A server will probably not send an operation with code OP_CB_ILLEGAL 14476 but if it does, the response will be CB_ILLEGAL4res just as it would 14477 be with any other invalid operation code. Note that if the client 14478 gets an illegal operation code that is not OP_ILLEGAL, and if the 14479 client checks for legal operation codes during the XDR decode phase, 14480 then the CB_ILLEGAL4res would not be returned. 14482 17. Security Considerations 14484 NFS has historically used a model where, from an authentication 14485 perspective, the client was the entire machine, or at least the 14486 source IP address of the machine. The NFS server relied on the NFS 14487 client to make the proper authentication of the end-user. The NFS 14488 server in turn shared its files only to specific clients, as 14489 identified by the client's source IP address. Given this model, the 14490 AUTH_SYS RPC security flavor simply identified the end-user using the 14491 client to the NFS server. When processing NFS responses, the client 14492 ensured that the responses came from the same IP address and port 14493 number that the request was sent to. While such a model is easy to 14494 implement and simple to deploy and use, it is certainly not a safe 14495 model. Thus, NFSv4 mandates that implementations support a security 14496 model that uses end to end authentication, where an end-user on a 14497 client mutually authenticates (via cryptographic schemes that do not 14498 expose passwords or keys in the clear on the network) to a principal 14499 on an NFS server. Consideration should also be given to the 14500 integrity and privacy of NFS requests and responses. The issues of 14501 end to end mutual authentication, integrity, and privacy are 14502 discussed as part of Section 3. 14504 Note that while NFSv4 mandates an end to end mutual authentication 14505 model, the "classic" model of machine authentication via IP address 14506 checking and AUTH_SYS identification can still be supported with the 14507 caveat that the AUTH_SYS flavor is neither MANDATORY nor RECOMMENDED 14508 by this specification, and so interoperability via AUTH_SYS is not 14509 assured. 14511 For reasons of reduced administration overhead, better performance 14512 and/or reduction of CPU utilization, users of NFSv4 implementations 14513 may choose to not use security mechanisms that enable integrity 14514 protection on each remote procedure call and response. The use of 14515 mechanisms without integrity leaves the customer vulnerable to an 14516 attacker in between the NFS client and server that modifies the RPC 14517 request and/or the response. While implementations are free to 14518 provide the option to use weaker security mechanisms, there are two 14519 operations in particular that warrant the implementation overriding 14520 user choices. 14522 The first such operation is SECINFO. It is recommended that the 14523 client issue the SECINFO call such that it is protected with a 14524 security flavor that has integrity protection, such as RPCSEC_GSS 14525 with a security triple that uses either rpc_gss_svc_integrity or 14526 rpc_gss_svc_privacy (rpc_gss_svc_privacy includes integrity 14527 protection) service. Without integrity protection encapsulating 14528 SECINFO and therefore its results, an attacker in the middle could 14529 modify results such that the client might select a weaker algorithm 14530 in the set allowed by server, making the client and/or server 14531 vulnerable to further attacks. 14533 The second operation that should definitely use integrity protection 14534 is any GETATTR for the fs_locations attribute. The attack has two 14535 steps. First the attacker modifies the unprotected results of some 14536 operation to return NFS4ERR_MOVED. Second, when the client follows 14537 up with a GETATTR for the fs_locations attribute, the attacker 14538 modifies the results to cause the client migrate its traffic to a 14539 server controlled by the attacker. 14541 Because the operations SETCLIENTID/SETCLIENTID_CONFIRM are 14542 responsible for the release of client state, it is imperative that 14543 the principal used for these operations is checked against and match 14544 the previous use of these operations. See Section 9.1.1 for further 14545 discussion. 14547 18. IANA Considerations 14549 This section uses terms that are defined in [41]. 14551 18.1. Named Attribute Definitions 14553 IANA will create a registry called the "NFSv4 Named Attribute 14554 Definitions Registry". 14556 The NFSv4 protocol supports the association of a file with zero or 14557 more named attributes. The name space identifiers for these 14558 attributes are defined as string names. The protocol does not define 14559 the specific assignment of the name space for these file attributes. 14560 An IANA registry will promote interoperability where common interests 14561 exist. While application developers are allowed to define and use 14562 attributes as needed, they are encouraged to register the attributes 14563 with IANA. 14565 Such registered named attributes are presumed to apply to all minor 14566 versions of NFSv4, including those defined subsequently to the 14567 registration. Where the named attribute is intended to be limited 14568 with regard to the minor versions for which they are not be used, the 14569 assignment in registry will clearly state the applicable limits. 14571 All assignments to the registry are made on a First Come First Served 14572 basis, per section 4.1 of [41]. The policy for each assignment is 14573 Specification Required, per section 4.1 of [41]. 14575 Under the NFSv4 specification, the name of a named attribute can in 14576 theory be up to 2^32 - 1 bytes in length, but in practice NFSv4 14577 clients and servers will be unable to a handle string that long. 14578 IANA should reject any assignment request with a named attribute that 14579 exceeds 128 UTF-8 characters. To give IESG the flexibility to set up 14580 bases of assignment of Experimental Use and Standards Action, the 14581 prefixes of "EXPE" and "STDS" are Reserved. The zero length named 14582 attribute name is Reserved. 14584 The prefix "PRIV" is allocated for Private Use. A site that wants to 14585 make use of unregistered named attributes without risk of conflicting 14586 with an assignment in IANA's registry should use the prefix "PRIV" in 14587 all of its named attributes. 14589 Because some NFSv4 clients and servers have case insensitive 14590 semantics, the fifteen additional lower case and mixed case 14591 permutations of each of "EXPE", "PRIV", and "STDS", are Reserved 14592 (e.g. "expe", "expE", "exPe", etc. are Reserved). Similarly, IANA 14593 must not allow two assignments that would conflict if both named 14594 attributes were converted to a common case. 14596 The registry of named attributes is a list of assignments, each 14597 containing three fields for each assignment. 14599 1. A US-ASCII string name that is the actual name of the attribute. 14600 This name must be unique. This string name can be 1 to 128 UTF-8 14601 characters long. 14603 2. A reference to the specification of the named attribute. The 14604 reference can consume up to 256 bytes (or more if IANA permits). 14606 3. The point of contact of the registrant. The point of contact can 14607 consume up to 256 bytes (or more if IANA permits). 14609 18.1.1. Initial Registry 14611 There is no initial registry. 14613 18.1.2. Updating Registrations 14615 The registrant is always permitted to update the point of contact 14616 field. To make any other change will require Expert Review or IESG 14617 Approval. 14619 18.2. ONC RPC Network Identifiers (netids) 14621 Section 2.2 discussed the r_netid field and the corresponding r_addr 14622 field of a clientaddr4 structure. The NFSv4 protocol depends on the 14623 syntax and semantics of these fields to effectively communicate 14624 callback information between client and server. Therefore, an IANA 14625 registry has been created to include the values defined in this 14626 document and to allow for future expansion based on transport usage/ 14627 availability. Additions to this ONC RPC Network Identifier registry 14628 must be done with the publication of an RFC. 14630 The initial values for this registry are as follows (some of this 14631 text is replicated from section 2.2 for clarity): 14633 The Network Identifier (or r_netid for short) is used to specify a 14634 transport protocol and associated universal address (or r_addr for 14635 short). The syntax of the Network Identifier is a US-ASCII string. 14636 The initial definitions for r_netid are: 14638 "tcp": TCP over IP version 4 14640 "udp": UDP over IP version 4 14642 "tcp6": TCP over IP version 6 14644 "udp6": UDP over IP version 6 14646 Note: the '"' marks are used for delimiting the strings for this 14647 document and are not part of the Network Identifier string. 14649 For the "tcp" and "udp" Network Identifiers the Universal Address or 14650 r_addr (for IPv4) is a US-ASCII string and is of the form: 14652 h1.h2.h3.h4.p1.p2 14654 The prefix, "h1.h2.h3.h4", is the standard textual form for 14655 representing an IPv4 address, which is always four octets long. 14656 Assuming big-endian ordering, h1, h2, h3, and h4, are respectively, 14657 the first through fourth octets each converted to ASCII-decimal. 14658 Assuming big-endian ordering, p1 and p2 are, respectively, the first 14659 and second octets each converted to ASCII-decimal. For example, if a 14660 host, in big-endian order, has an address of 0x0A010307 and there is 14661 a service listening on, in big endian order, port 0x020F (decimal 14662 527), then complete universal address is "10.1.3.7.2.15". 14664 For the "tcp6" and "udp6" Network Identifiers the Universal Address 14665 or r_addr (for IPv6) is a US-ASCII string and is of the form: 14667 x1:x2:x3:x4:x5:x6:x7:x8.p1.p2 14669 The suffix "p1.p2" is the service port, and is computed the same way 14670 as with universal addresses for "tcp" and "udp". The prefix, "x1:x2: 14671 x3:x4:x5:x6:x7:x8", is the standard textual form for representing an 14672 IPv6 address as defined in Section 2.2 of [18]. Additionally, the 14673 two alternative forms specified in Section 2.2 of [18] are also 14674 acceptable. 14676 18.2.1. Initial Registry 14678 There is no initial registry. 14680 18.2.2. Updating Registrations 14682 The registrant is always permitted to update the point of contact 14683 field. To make any other change will require Expert Review or IESG 14684 Approval. 14686 19. References 14688 19.1. Normative References 14690 [1] Bradner, S., "Key words for use in RFCs to Indicate Requirement 14691 Levels", March 1997. 14693 [2] Haynes, T. and D. Noveck, "NFSv4 Version 0 XDR Description", 14694 draft-ietf-nfsv4-rfc3530bis-dot-x-02 (work in progress), 14695 Feb 2011. 14697 [3] Thurlow, R., "RPC: Remote Procedure Call Protocol Specification 14698 Version 2", RFC 5531, May 2009. 14700 [4] Eisler, M., Chiu, A., and L. Ling, "RPCSEC_GSS Protocol 14701 Specification", RFC 2203, September 1997. 14703 [5] Eisler, M., "LIPKEY - A Low Infrastructure Public Key Mechanism 14704 Using SPKM", RFC 2847, June 2000. 14706 [6] Linn, J., "Generic Security Service Application Program 14707 Interface Version 2, Update 1", RFC 2743, January 2000. 14709 [7] International Organization for Standardization, "Information 14710 Technology - Universal Multiple-octet coded Character Set (UCS) 14711 - Part 1: Architecture and Basic Multilingual Plane", 14712 ISO Standard 10646-1, May 1993. 14714 [8] Alvestrand, H., "IETF Policy on Character Sets and Languages", 14715 BCP 18, RFC 2277, January 1998. 14717 [9] Hoffman, P. and M. Blanchet, "Preparation of Internationalized 14718 Strings ("stringprep")", RFC 3454, December 2002. 14720 [10] Klensin, J., "Internationalized Domain Names in Applications 14721 (IDNA): Protocol", draft-ietf-idnabis-protocol-18 (work in 14722 progress), January 2010. 14724 19.2. Informative References 14726 [11] Shepler, S., Callaghan, B., Robinson, D., Thurlow, R., Beame, 14727 C., Eisler, M., and D. Noveck, "Network File System (NFS) 14728 version 4 Protocol", RFC 3530, April 2003. 14730 [12] Shepler, S., Callaghan, B., Robinson, D., Thurlow, R., Beame, 14731 C., Eisler, M., and D. Noveck, "Network File System (NFS) 14732 version 4 Protocol", RFC 3010, December 2000. 14734 [13] Nowicki, B., "NFS: Network File System Protocol specification", 14735 RFC 1094, March 1989. 14737 [14] Callaghan, B., Pawlowski, B., and P. Staubach, "NFS Version 3 14738 Protocol Specification", RFC 1813, June 1995. 14740 [15] Eisler, M., "XDR: External Data Representation Standard", 14741 RFC 4506, May 2006. 14743 [16] Linn, J., "The Kerberos Version 5 GSS-API Mechanism", RFC 1964, 14744 June 1996. 14746 [17] Srinivasan, R., "Binding Protocols for ONC RPC Version 2", 14747 RFC 1833, August 1995. 14749 [18] Hinden, R. and S. Deering, "IP Version 6 Addressing 14750 Architecture", RFC 2373, July 1998. 14752 [19] Reynolds, J., "Assigned Numbers: RFC 1700 is Replaced by an On- 14753 line Database", RFC 3232, January 2002. 14755 [20] Floyd, S. and V. Jacobson, "The Synchronization of Periodic 14756 Routing Messages", IEEE/ACM Transactions on Networking 2(2), 14757 pp. 122-136, April 1994. 14759 [21] Eisler, M., "NFS Version 2 and Version 3 Security Issues and 14760 the NFS Protocol's Use of RPCSEC_GSS and Kerberos V5", 14761 RFC 2623, June 1999. 14763 [22] Adams, C., "The Simple Public-Key GSS-API Mechanism (SPKM)", 14764 RFC 2025, October 1996. 14766 [23] Callaghan, B., "WebNFS Client Specification", RFC 2054, 14767 October 1996. 14769 [24] Callaghan, B., "WebNFS Server Specification", RFC 2055, 14770 October 1996. 14772 [25] IESG, "IESG Processing of RFC Errata for the IETF Stream", 14773 July 2008. 14775 [26] The Open Group, "Section 'read()' of System Interfaces of The 14776 Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 14777 Edition", 2004. 14779 [27] The Open Group, "Section 'readdir()' of System Interfaces of 14780 The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 14781 2004 Edition", 2004. 14783 [28] The Open Group, "Section 'write()' of System Interfaces of The 14784 Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 14785 Edition", 2004. 14787 [29] Shepler, S., "NFS Version 4 Design Considerations", RFC 2624, 14788 June 1999. 14790 [30] Simonsen, K., "Character Mnemonics and Character Sets", 14791 RFC 1345, June 1992. 14793 [31] Shepler, S., Eisler, M., and D. Noveck, "Network File System 14794 (NFS) Version 4 Minor Version 1 Protocol", RFC 5661, 14795 January 2010. 14797 [32] The Open Group, "Protocols for Interworking: XNFS, Version 3W, 14798 ISBN 1-85912-184-5", February 1998. 14800 [33] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, 14801 September 1981. 14803 [34] Juszczak, C., "Improving the Performance and Correctness of an 14804 NFS Server", USENIX Conference Proceedings , June 1990. 14806 [35] The Open Group, "Section 'fcntl()' of System Interfaces of The 14807 Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 14808 Edition, HTML Version (www.opengroup.org), ISBN 1931624232", 14809 2004. 14811 [36] The Open Group, "Section 'fsync()' of System Interfaces of The 14812 Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 14813 Edition, HTML Version (www.opengroup.org), ISBN 1931624232", 14814 2004. 14816 [37] The Open Group, "Section 'getpwnam()' of System Interfaces of 14817 The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 14818 2004 Edition, HTML Version (www.opengroup.org), ISBN 14819 1931624232", 2004. 14821 [38] Callaghan, B., "NFS URL Scheme", RFC 2224, October 1997. 14823 [39] Chiu, A., Eisler, M., and B. Callaghan, "Security Negotiation 14824 for WebNFS", RFC 2755, January 2000. 14826 [40] The Open Group, "Section 'unlink()' of System Interfaces of The 14827 Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 14828 Edition, HTML Version (www.opengroup.org), ISBN 1931624232", 14829 2004. 14831 [41] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA 14832 Considerations Section in RFCs", BCP 26, RFC 5226, May 2008. 14834 Appendix A. Acknowledgments 14836 A bis is certainly built on the shoulders of the first attempt. 14837 Spencer Shepler, Brent Callaghan, David Robinson, Robert Thurlow, 14838 Carl Beame, Mike Eisler, and David Noveck are responsible for a great 14839 deal of the effort in this work. 14841 Rob Thurlow clarified how a client should contact a new server if a 14842 migration has occurred. 14844 David Black, Nico Williams, Mike Eisler, Trond Myklebust, and James 14845 Lentini read many drafts of Section 12 and contributed numerous 14846 useful suggestions, without which the necessary revision of that 14847 section for this document would not have been possible. 14849 Peter Staubach read almost all of the drafts of Section 12 leading to 14850 the published result and his numerous comments were always useful and 14851 contributed substantially to improving the quality of the final 14852 result. 14854 James Lentini graciously read the rewrite of Section 7 and his 14855 comments were vital in improving the quality of that effort. 14857 Rob Thurlow, Sorin Faibish, James Lentini, Bruce Fields, and Trond 14858 Myklebust were faithful attendants of the biweekly triage meeting and 14859 accepted many an action item. 14861 Bruce Fields was a good sounding board for both the Third Edge 14862 Condition and Courtsey Locks in general. 14864 Appendix B. RFC Editor Notes 14866 [RFC Editor: please remove this section prior to publishing this 14867 document as an RFC] 14869 [RFC Editor: prior to publishing this document as an RFC, please 14870 replace all occurrences of RFCTBD10 with RFCxxxx where xxxx is the 14871 RFC number of this document] 14873 Authors' Addresses 14875 Thomas Haynes (editor) 14876 NetApp 14877 9110 E 66th St 14878 Tulsa, OK 74133 14879 USA 14881 Phone: +1 918 307 1415 14882 Email: thomas@netapp.com 14883 URI: http://www.tulsalabs.com 14885 David Noveck (editor) 14886 EMC Corporation 14887 32 Coslin Drive 14888 Southborough, MA 01772 14889 US 14891 Phone: +1 508 305 8404 14892 Email: novecd@emc.com