--- 1/draft-ietf-nfsv4-rfc3010bis-00.txt 2006-02-05 00:48:38.000000000 +0100 +++ 2/draft-ietf-nfsv4-rfc3010bis-01.txt 2006-02-05 00:48:38.000000000 +0100 @@ -1,26 +1,26 @@ NFS Version 4 Working Group S. Shepler INTERNET-DRAFT Sun Microsystems, Inc. -Document: draft-ietf-nfsv4-rfc3010bis-00.txt C. Beame +Document: draft-ietf-nfsv4-rfc3010bis-01.txt C. Beame Hummingbird Ltd. B. Callaghan Sun Microsystems, Inc. M. Eisler Zambeel, Inc. D. Noveck Network Appliance, Inc. D. Robinson Sun Microsystems, Inc. R. Thurlow Sun Microsystems, Inc. - November 2001 + July 2002 NFS version 4 Protocol Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that @@ -36,41 +36,41 @@ http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. Abstract NFS version 4 is a distributed file system protocol which owes heritage to NFS protocol versions 2 [RFC1094] and 3 [RFC1813]. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 Unlike earlier versions, the NFS version 4 protocol supports traditional file access while integrating support for file locking and the mount protocol. In addition, support for strong security (and its negotiation), compound operations, client caching, and internationalization have been added. Of course, attention has been applied to making NFS version 4 operate well in an Internet environment. Copyright - Copyright (C) The Internet Society (2001). All Rights Reserved. + Copyright (C) The Internet Society (2000-2002). All Rights Reserved. Key Words The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1. Overview of NFS Version 4 Features . . . . . . . . . . . . 7 1.1.1. RPC and Security . . . . . . . . . . . . . . . . . . . . 8 1.1.2. Procedure and Operation Structure . . . . . . . . . . . 8 1.1.3. File System Model . . . . . . . . . . . . . . . . . . . 9 1.1.3.1. Filehandle Types . . . . . . . . . . . . . . . . . . . 9 1.1.3.2. Attribute Types . . . . . . . . . . . . . . . . . . . 9 @@ -103,168 +103,170 @@ 4.2.3. Volatile Filehandle . . . . . . . . . . . . . . . . . 28 4.2.4. One Method of Constructing a Volatile Filehandle . . . 30 4.3. Client Recovery from Filehandle Expiration . . . . . . . 30 5. File Attributes . . . . . . . . . . . . . . . . . . . . . 32 5.1. Mandatory Attributes . . . . . . . . . . . . . . . . . . 33 5.2. Recommended Attributes . . . . . . . . . . . . . . . . . 33 5.3. Named Attributes . . . . . . . . . . . . . . . . . . . . 33 5.4. Mandatory Attributes - Definitions . . . . . . . . . . . 35 5.5. Recommended Attributes - Definitions . . . . . . . . . . 37 5.6. Interpreting owner and owner_group . . . . . . . . . . . 41 - 5.7. Character Case Attributes . . . . . . . . . . . . . . . 42 - 5.8. Quota Attributes . . . . . . . . . . . . . . . . . . . . 42 - 5.9. Access Control Lists . . . . . . . . . . . . . . . . . . 43 - 5.9.1. ACE type . . . . . . . . . . . . . . . . . . . . . . . 44 - 5.9.2. ACE flag . . . . . . . . . . . . . . . . . . . . . . . 44 - 5.9.3. ACE Access Mask . . . . . . . . . . . . . . . . . . . 46 - 5.9.4. ACE who . . . . . . . . . . . . . . . . . . . . . . . 47 + 5.7. Character Case Attributes . . . . . . . . . . . . . . . 43 + 5.8. Quota Attributes . . . . . . . . . . . . . . . . . . . . 43 + 5.9. Access Control Lists . . . . . . . . . . . . . . . . . . 44 + 5.9.1. ACE type . . . . . . . . . . . . . . . . . . . . . . . 45 + 5.9.2. ACE flag . . . . . . . . . . . . . . . . . . . . . . . 45 + 5.9.3. ACE Access Mask . . . . . . . . . . . . . . . . . . . 47 + 5.9.4. ACE who . . . . . . . . . . . . . . . . . . . . . . . 48 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - 6. File System Migration and Replication . . . . . . . . . . 48 - 6.1. Replication . . . . . . . . . . . . . . . . . . . . . . 48 - 6.2. Migration . . . . . . . . . . . . . . . . . . . . . . . 48 - 6.3. Interpretation of the fs_locations Attribute . . . . . . 49 - 6.4. Filehandle Recovery for Migration or Replication . . . . 50 - 7. NFS Server Name Space . . . . . . . . . . . . . . . . . . 51 - 7.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 51 - 7.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 51 - 7.3. Server Pseudo File System . . . . . . . . . . . . . . . 51 - 7.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 52 - 7.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 52 - 7.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 52 - 7.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 53 - 7.8. Security Policy and Name Space Presentation . . . . . . 53 - 8. File Locking and Share Reservations . . . . . . . . . . . 54 - 8.1. Locking . . . . . . . . . . . . . . . . . . . . . . . . 54 - 8.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . . 54 - 8.1.2. Server Release of Clientid . . . . . . . . . . . . . . 56 - 8.1.3. nfs_lockowner and stateid Definition . . . . . . . . . 57 - 8.1.4. Use of the stateid . . . . . . . . . . . . . . . . . . 58 - 8.1.5. Sequencing of Lock Requests . . . . . . . . . . . . . 58 - 8.1.6. Recovery from Replayed Requests . . . . . . . . . . . 59 - 8.1.7. Releasing nfs_lockowner State . . . . . . . . . . . . 59 - 8.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 60 - 8.3. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 61 - 8.4. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 61 - 8.5. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 62 - 8.5.1. Client Failure and Recovery . . . . . . . . . . . . . 62 - 8.5.2. Server Failure and Recovery . . . . . . . . . . . . . 63 - 8.5.3. Network Partitions and Recovery . . . . . . . . . . . 64 - 8.6. Recovery from a Lock Request Timeout or Abort . . . . . 65 - 8.7. Server Revocation of Locks . . . . . . . . . . . . . . . 66 - 8.8. Share Reservations . . . . . . . . . . . . . . . . . . . 67 - 8.9. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 68 - 8.10. Open Upgrade and Downgrade . . . . . . . . . . . . . . 68 - 8.11. Short and Long Leases . . . . . . . . . . . . . . . . . 69 - 8.12. Clocks and Calculating Lease Expiration . . . . . . . . 69 - 8.13. Migration, Replication and State . . . . . . . . . . . 70 - 8.13.1. Migration and State . . . . . . . . . . . . . . . . . 70 - 8.13.2. Replication and State . . . . . . . . . . . . . . . . 70 - 8.13.3. Notification of Migrated Lease . . . . . . . . . . . 71 - 9. Client-Side Caching . . . . . . . . . . . . . . . . . . . 72 - 9.1. Performance Challenges for Client-Side Caching . . . . . 72 - 9.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 73 - 9.2.1. Delegation Recovery . . . . . . . . . . . . . . . . . 74 - 9.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 76 - 9.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . . 76 - 9.3.2. Data Caching and File Locking . . . . . . . . . . . . 77 - 9.3.3. Data Caching and Mandatory File Locking . . . . . . . 78 - 9.3.4. Data Caching and File Identity . . . . . . . . . . . . 79 - 9.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 80 - 9.4.1. Open Delegation and Data Caching . . . . . . . . . . . 82 + 6. File System Migration and Replication . . . . . . . . . . 49 + 6.1. Replication . . . . . . . . . . . . . . . . . . . . . . 49 + 6.2. Migration . . . . . . . . . . . . . . . . . . . . . . . 49 + 6.3. Interpretation of the fs_locations Attribute . . . . . . 50 + 6.4. Filehandle Recovery for Migration or Replication . . . . 51 + 7. NFS Server Name Space . . . . . . . . . . . . . . . . . . 52 + 7.1. Server Exports . . . . . . . . . . . . . . . . . . . . . 52 + 7.2. Browsing Exports . . . . . . . . . . . . . . . . . . . . 52 + 7.3. Server Pseudo File System . . . . . . . . . . . . . . . 52 + 7.4. Multiple Roots . . . . . . . . . . . . . . . . . . . . . 53 + 7.5. Filehandle Volatility . . . . . . . . . . . . . . . . . 53 + 7.6. Exported Root . . . . . . . . . . . . . . . . . . . . . 53 + 7.7. Mount Point Crossing . . . . . . . . . . . . . . . . . . 54 + 7.8. Security Policy and Name Space Presentation . . . . . . 54 + 8. File Locking and Share Reservations . . . . . . . . . . . 55 + 8.1. Locking . . . . . . . . . . . . . . . . . . . . . . . . 55 + 8.1.1. Client ID . . . . . . . . . . . . . . . . . . . . . . 55 + 8.1.2. Server Release of Clientid . . . . . . . . . . . . . . 57 + 8.1.3. nfs_lockowner and stateid Definition . . . . . . . . . 58 + 8.1.4. Use of the stateid . . . . . . . . . . . . . . . . . . 59 + 8.1.5. Sequencing of Lock Requests . . . . . . . . . . . . . 60 + 8.1.6. Recovery from Replayed Requests . . . . . . . . . . . 61 + 8.1.7. Releasing nfs_lockowner State . . . . . . . . . . . . 61 + 8.2. Lock Ranges . . . . . . . . . . . . . . . . . . . . . . 62 + 8.3. Blocking Locks . . . . . . . . . . . . . . . . . . . . . 62 + 8.4. Lease Renewal . . . . . . . . . . . . . . . . . . . . . 63 + 8.5. Crash Recovery . . . . . . . . . . . . . . . . . . . . . 64 + 8.5.1. Client Failure and Recovery . . . . . . . . . . . . . 64 + 8.5.2. Server Failure and Recovery . . . . . . . . . . . . . 65 + 8.5.3. Network Partitions and Recovery . . . . . . . . . . . 66 + 8.6. Recovery from a Lock Request Timeout or Abort . . . . . 67 + 8.7. Server Revocation of Locks . . . . . . . . . . . . . . . 68 + 8.8. Share Reservations . . . . . . . . . . . . . . . . . . . 69 + 8.9. OPEN/CLOSE Operations . . . . . . . . . . . . . . . . . 69 + 8.10. Open Upgrade and Downgrade . . . . . . . . . . . . . . 70 + 8.11. Short and Long Leases . . . . . . . . . . . . . . . . . 71 + 8.12. Clocks and Calculating Lease Expiration . . . . . . . . 71 + 8.13. Migration, Replication and State . . . . . . . . . . . 71 + 8.13.1. Migration and State . . . . . . . . . . . . . . . . . 72 + 8.13.2. Replication and State . . . . . . . . . . . . . . . . 72 + 8.13.3. Notification of Migrated Lease . . . . . . . . . . . 73 + 9. Client-Side Caching . . . . . . . . . . . . . . . . . . . 74 + 9.1. Performance Challenges for Client-Side Caching . . . . . 74 + 9.2. Delegation and Callbacks . . . . . . . . . . . . . . . . 75 + 9.2.1. Delegation Recovery . . . . . . . . . . . . . . . . . 76 + 9.3. Data Caching . . . . . . . . . . . . . . . . . . . . . . 78 + 9.3.1. Data Caching and OPENs . . . . . . . . . . . . . . . . 78 + 9.3.2. Data Caching and File Locking . . . . . . . . . . . . 79 + 9.3.3. Data Caching and Mandatory File Locking . . . . . . . 80 + 9.3.4. Data Caching and File Identity . . . . . . . . . . . . 81 + 9.4. Open Delegation . . . . . . . . . . . . . . . . . . . . 82 + 9.4.1. Open Delegation and Data Caching . . . . . . . . . . . 84 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - 9.4.2. Open Delegation and File Locks . . . . . . . . . . . . 83 - 9.4.3. Recall of Open Delegation . . . . . . . . . . . . . . 83 - 9.4.4. Delegation Revocation . . . . . . . . . . . . . . . . 85 - 9.5. Data Caching and Revocation . . . . . . . . . . . . . . 85 - 9.5.1. Revocation Recovery for Write Open Delegation . . . . 86 - 9.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 87 - 9.7. Name Caching . . . . . . . . . . . . . . . . . . . . . . 88 - 9.8. Directory Caching . . . . . . . . . . . . . . . . . . . 89 - 10. Minor Versioning . . . . . . . . . . . . . . . . . . . . 91 - 11. Internationalization . . . . . . . . . . . . . . . . . . 94 - 11.1. Universal Versus Local Character Sets . . . . . . . . . 94 - 11.2. Overview of Universal Character Set Standards . . . . . 95 - 11.3. Difficulties with UCS-4, UCS-2, Unicode . . . . . . . . 96 - 11.4. UTF-8 and its solutions . . . . . . . . . . . . . . . . 96 - 11.5. Normalization . . . . . . . . . . . . . . . . . . . . . 97 - 12. Error Definitions . . . . . . . . . . . . . . . . . . . . 98 - 13. NFS Version 4 Requests . . . . . . . . . . . . . . . . . 103 - 13.1. Compound Procedure . . . . . . . . . . . . . . . . . . 103 - 13.2. Evaluation of a Compound Request . . . . . . . . . . . 103 - 13.3. Synchronous Modifying Operations . . . . . . . . . . . 104 - 13.4. Operation Values . . . . . . . . . . . . . . . . . . . 105 - 14. NFS Version 4 Procedures . . . . . . . . . . . . . . . . 106 - 14.1. Procedure 0: NULL - No Operation . . . . . . . . . . . 106 - 14.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 107 - 14.2.1. Operation 3: ACCESS - Check Access Rights . . . . . . 110 - 14.2.2. Operation 4: CLOSE - Close File . . . . . . . . . . . 113 - 14.2.3. Operation 5: COMMIT - Commit Cached Data . . . . . . 115 - 14.2.4. Operation 6: CREATE - Create a Non-Regular File Object 118 + 9.4.2. Open Delegation and File Locks . . . . . . . . . . . . 85 + 9.4.3. Recall of Open Delegation . . . . . . . . . . . . . . 85 + 9.4.4. Delegation Revocation . . . . . . . . . . . . . . . . 87 + 9.5. Data Caching and Revocation . . . . . . . . . . . . . . 87 + 9.5.1. Revocation Recovery for Write Open Delegation . . . . 88 + 9.6. Attribute Caching . . . . . . . . . . . . . . . . . . . 89 + 9.7. Name Caching . . . . . . . . . . . . . . . . . . . . . . 90 + 9.8. Directory Caching . . . . . . . . . . . . . . . . . . . 91 + 10. Minor Versioning . . . . . . . . . . . . . . . . . . . . 93 + 11. Internationalization . . . . . . . . . . . . . . . . . . 96 + 11.1. Universal Versus Local Character Sets . . . . . . . . . 96 + 11.2. Overview of Universal Character Set Standards . . . . . 97 + 11.3. Difficulties with UCS-4, UCS-2, Unicode . . . . . . . . 98 + 11.4. UTF-8 and its solutions . . . . . . . . . . . . . . . . 98 + 11.5. Normalization . . . . . . . . . . . . . . . . . . . . . 99 + 12. Error Definitions . . . . . . . . . . . . . . . . . . . . 100 + 13. NFS Version 4 Requests . . . . . . . . . . . . . . . . . 105 + 13.1. Compound Procedure . . . . . . . . . . . . . . . . . . 105 + 13.2. Evaluation of a Compound Request . . . . . . . . . . . 106 + 13.3. Synchronous Modifying Operations . . . . . . . . . . . 106 + 13.4. Operation Values . . . . . . . . . . . . . . . . . . . 107 + 14. NFS Version 4 Procedures . . . . . . . . . . . . . . . . 108 + 14.1. Procedure 0: NULL - No Operation . . . . . . . . . . . 108 + 14.2. Procedure 1: COMPOUND - Compound Operations . . . . . . 109 + 14.2.1. Operation 3: ACCESS - Check Access Rights . . . . . . 112 + 14.2.2. Operation 4: CLOSE - Close File . . . . . . . . . . . 115 + 14.2.3. Operation 5: COMMIT - Commit Cached Data . . . . . . 117 + 14.2.4. Operation 6: CREATE - Create a Non-Regular File Object 120 14.2.5. Operation 7: DELEGPURGE - Purge Delegations Awaiting - Recovery . . . . . . . . . . . . . . . . . . . . . . 120 - 14.2.6. Operation 8: DELEGRETURN - Return Delegation . . . . 121 - 14.2.7. Operation 9: GETATTR - Get Attributes . . . . . . . . 122 - 14.2.8. Operation 10: GETFH - Get Current Filehandle . . . . 124 - 14.2.9. Operation 11: LINK - Create Link to a File . . . . . 126 - 14.2.10. Operation 12: LOCK - Create Lock . . . . . . . . . . 128 - 14.2.11. Operation 13: LOCKT - Test For Lock . . . . . . . . 130 - 14.2.12. Operation 14: LOCKU - Unlock File . . . . . . . . . 132 - 14.2.13. Operation 15: LOOKUP - Lookup Filename . . . . . . . 134 - 14.2.14. Operation 16: LOOKUPP - Lookup Parent Directory . . 137 + Recovery . . . . . . . . . . . . . . . . . . . . . . 123 + 14.2.6. Operation 8: DELEGRETURN - Return Delegation . . . . 124 + 14.2.7. Operation 9: GETATTR - Get Attributes . . . . . . . . 125 + 14.2.8. Operation 10: GETFH - Get Current Filehandle . . . . 127 + 14.2.9. Operation 11: LINK - Create Link to a File . . . . . 129 + 14.2.10. Operation 12: LOCK - Create Lock . . . . . . . . . . 131 + 14.2.11. Operation 13: LOCKT - Test For Lock . . . . . . . . 134 + 14.2.12. Operation 14: LOCKU - Unlock File . . . . . . . . . 136 + 14.2.13. Operation 15: LOOKUP - Lookup Filename . . . . . . . 138 + 14.2.14. Operation 16: LOOKUPP - Lookup Parent Directory . . 141 14.2.15. Operation 17: NVERIFY - Verify Difference in - Attributes . . . . . . . . . . . . . . . . . . . . . 139 - 14.2.16. Operation 18: OPEN - Open a Regular File . . . . . . 141 + Attributes . . . . . . . . . . . . . . . . . . . . . 143 + 14.2.16. Operation 18: OPEN - Open a Regular File . . . . . . 145 14.2.17. Operation 19: OPENATTR - Open Named Attribute - Directory . . . . . . . . . . . . . . . . . . . . . 150 - 14.2.18. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . 152 - 14.2.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access155 - 14.2.20. Operation 22: PUTFH - Set Current Filehandle . . . . 157 - 14.2.21. Operation 23: PUTPUBFH - Set Public Filehandle . . . 158 - 14.2.22. Operation 24: PUTROOTFH - Set Root Filehandle . . . 159 - 14.2.23. Operation 25: READ - Read from File . . . . . . . . 160 - 14.2.24. Operation 26: READDIR - Read Directory . . . . . . . 163 - 14.2.25. Operation 27: READLINK - Read Symbolic Link . . . . 167 + Directory . . . . . . . . . . . . . . . . . . . . . 154 + 14.2.18. Operation 20: OPEN_CONFIRM - Confirm Open . . . . . 156 + 14.2.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access159 + 14.2.20. Operation 22: PUTFH - Set Current Filehandle . . . . 161 + 14.2.21. Operation 23: PUTPUBFH - Set Public Filehandle . . . 162 + 14.2.22. Operation 24: PUTROOTFH - Set Root Filehandle . . . 164 + 14.2.23. Operation 25: READ - Read from File . . . . . . . . 165 + 14.2.24. Operation 26: READDIR - Read Directory . . . . . . . 168 + 14.2.25. Operation 27: READLINK - Read Symbolic Link . . . . 172 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - 14.2.26. Operation 28: REMOVE - Remove Filesystem Object . . 169 - 14.2.27. Operation 29: RENAME - Rename Directory Entry . . . 171 - 14.2.28. Operation 30: RENEW - Renew a Lease . . . . . . . . 174 - 14.2.29. Operation 31: RESTOREFH - Restore Saved Filehandle . 175 - 14.2.30. Operation 32: SAVEFH - Save Current Filehandle . . . 177 - 14.2.31. Operation 33: SECINFO - Obtain Available Security . 178 - 14.2.32. Operation 34: SETATTR - Set Attributes . . . . . . . 180 - 14.2.33. Operation 35: SETCLIENTID - Negotiate Clientid . . . 182 - 14.2.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Clientid 184 - 14.2.35. Operation 37: VERIFY - Verify Same Attributes . . . 185 - 14.2.36. Operation 38: WRITE - Write to File . . . . . . . . 187 - 15. NFS Version 4 Callback Procedures . . . . . . . . . . . . 191 - 15.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 191 - 15.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . 192 - 15.2.1. Operation 3: CB_GETATTR - Get Attributes . . . . . . 194 - 15.2.2. Operation 4: CB_RECALL - Recall an Open Delegation . 195 - 16. Security Considerations . . . . . . . . . . . . . . . . . 197 - 17. IANA Considerations . . . . . . . . . . . . . . . . . . . 198 - 17.1. Named Attribute Definition . . . . . . . . . . . . . . 198 - 18. RPC definition file . . . . . . . . . . . . . . . . . . . 199 - 19. Bibliography . . . . . . . . . . . . . . . . . . . . . . 229 - 20. Authors . . . . . . . . . . . . . . . . . . . . . . . . . 234 - 20.1. Editor's Address . . . . . . . . . . . . . . . . . . . 234 - 20.2. Authors' Addresses . . . . . . . . . . . . . . . . . . 234 - 20.3. Acknowledgements . . . . . . . . . . . . . . . . . . . 235 - 21. Full Copyright Statement . . . . . . . . . . . . . . . . 236 + 14.2.26. Operation 28: REMOVE - Remove Filesystem Object . . 174 + 14.2.27. Operation 29: RENAME - Rename Directory Entry . . . 176 + 14.2.28. Operation 30: RENEW - Renew a Lease . . . . . . . . 179 + 14.2.29. Operation 31: RESTOREFH - Restore Saved Filehandle . 180 + 14.2.30. Operation 32: SAVEFH - Save Current Filehandle . . . 182 + 14.2.31. Operation 33: SECINFO - Obtain Available Security . 183 + 14.2.32. Operation 34: SETATTR - Set Attributes . . . . . . . 186 + 14.2.33. Operation 35: SETCLIENTID - Negotiate Clientid . . . 189 + 14.2.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Clientid 191 + 14.2.35. Operation 37: VERIFY - Verify Same Attributes . . . 192 + 14.2.36. Operation 38: WRITE - Write to File . . . . . . . . 194 + 14.2.37. Operation 39: RELEASE_LOCKOWNER - Release Lockowner + State . . . . . . . . . . . . . . . . . . . . . . . 198 + 15. NFS Version 4 Callback Procedures . . . . . . . . . . . . 199 + 15.1. Procedure 0: CB_NULL - No Operation . . . . . . . . . . 199 + 15.2. Procedure 1: CB_COMPOUND - Compound Operations . . . . 200 + 15.2.1. Operation 3: CB_GETATTR - Get Attributes . . . . . . 202 + 15.2.2. Operation 4: CB_RECALL - Recall an Open Delegation . 203 + 16. Security Considerations . . . . . . . . . . . . . . . . . 205 + 17. IANA Considerations . . . . . . . . . . . . . . . . . . . 206 + 17.1. Named Attribute Definition . . . . . . . . . . . . . . 206 + 18. RPC definition file . . . . . . . . . . . . . . . . . . . 207 + 19. Bibliography . . . . . . . . . . . . . . . . . . . . . . 238 + 20. Authors . . . . . . . . . . . . . . . . . . . . . . . . . 243 + 20.1. Editor's Address . . . . . . . . . . . . . . . . . . . 243 + 20.2. Authors' Addresses . . . . . . . . . . . . . . . . . . 243 + 20.3. Acknowledgements . . . . . . . . . . . . . . . . . . . 244 + 21. Full Copyright Statement . . . . . . . . . . . . . . . . 245 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 1. Introduction The NFS version 4 protocol is a further revision of the NFS protocol defined already by versions 2 [RFC1094] and 3 [RFC1813]. It retains the essential characteristics of previous versions: design for easy recovery, independent of transport protocols, operating systems and filesystems, simplicity, and good performance. The NFS version 4 revision has the following goals: @@ -298,21 +300,21 @@ To provide a reasonable context for the reader, the major features of NFS version 4 protocol will be reviewed in brief. This will be done to provide an appropriate context for both the reader who is familiar with the previous versions of the NFS protocol and the reader that is new to the NFS protocols. For the reader new to the NFS protocols, there is still a fundamental knowledge that is expected. The reader should be familiar with the XDR and RPC protocols as described in [RFC1831] and [RFC1832]. A basic knowledge of file systems and distributed file systems is expected as well. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 1.1.1. RPC and Security As with previous versions of NFS, the External Data Representation (XDR) and Remote Procedure Call (RPC) mechanisms used for the NFS version 4 protocol are those defined in [RFC1831] and [RFC1832]. To meet end to end security requirements, the RPCSEC_GSS framework [RFC2203] will be used to extend the basic RPC security. With the use of RPCSEC_GSS, various mechanisms can be provided to offer authentication, integrity, and privacy to the NFS version 4 protocol. @@ -352,21 +354,21 @@ request are evaluated in order by the server. Once an operation returns a failing result, the evaluation ends and the results of all evaluated operations are returned to the client. The NFS version 4 protocol continues to have the client refer to a file or directory at the server by a "filehandle". The COMPOUND procedure has a method of passing a filehandle from one operation to another within the sequence of operations. There is a concept of a "current filehandle" and "saved filehandle". Most operations use the -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 "current filehandle" as the file system object to operate upon. The "saved filehandle" is used as temporary filehandle storage within a COMPOUND procedure as well as an additional operand for certain operations. 1.1.3. File System Model The general file system model used for the NFS version 4 protocol is the same as previous versions. The server file system is @@ -404,21 +406,21 @@ file attributes. Like the additional filehandle type, the classification of file attributes has been done to ease server implementations along with extending the overall functionality of the NFS protocol. This attribute model is structured to be extensible such that new attributes can be introduced in minor revisions of the protocol without requiring significant rework. The three classifications are: mandatory, recommended and named attributes. This is a significant departure from the previous -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 attribute model used in the NFS protocol. Previously, the attributes for the file system and file objects were a fixed set of mainly Unix attributes. If the server or client did not support a particular attribute, it would have to simulate the attribute the best it could. Mandatory attributes are the minimal set of file or file system attributes that must be provided by the server and must be properly represented by the server. Recommended attributes represent different file system types and operating environments. The @@ -456,21 +458,21 @@ The NFS version 4 protocol introduces OPEN and CLOSE operations. The OPEN operation provides a single point where file lookup, creation, and share semantics can be combined. The CLOSE operation also provides for the release of state accumulated by OPEN. 1.1.5. File locking With the NFS version 4 protocol, the support for byte range file locking is part of the NFS protocol. The file locking support is -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 structured so that an RPC callback mechanism is not required. This is a departure from the previous versions of the NFS file locking protocol, Network Lock Manager (NLM). The state associated with file locks is maintained at the server under a lease-based model. The server defines a single lease period for all state held by a NFS client. If the client does not renew its lease within the defined period, all state associated with the client's lease may be released by the server. The client may renew its lease with use of the RENEW operation or implicitly by use of other operations (primarily READ). @@ -507,21 +509,21 @@ Delegations can be recalled by the server. If another client requests access to the file in such a way that the access conflicts with the granted delegation, the server is able to notify the initial client and recall the delegation. This requires that a callback path exist between the server and client. If this callback path does not exist, then delegations can not be granted. The essence of a delegation is that it allows the client to locally service operations such as OPEN, CLOSE, LOCK, LOCKU, READ, WRITE without immediate interaction with the server. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 1.2. General Definitions The following definitions are provided for the purpose of providing an appropriate context for the reader. Client The "client" is the entity that accesses the NFS server's resources. The client may be an application which contains the logic to access the NFS server directly. The client may also be the traditional operating system client remote @@ -561,48 +563,48 @@ NFS version 4 servers must be able to recover without data loss from multiple power failures (including cascading power failures, that is, several power failures in quick succession), operating system failures, and hardware failure of components other than the storage medium itself (for example, disk, nonvolatile RAM). Some examples of stable storage that are allowable for an NFS server include: -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 1. Media commit of data, that is, the modified data has been successfully written to the disk media, for example, the disk platter. 2. An immediate reply disk drive with battery-backed on-drive intermediate storage or uninterruptible power system (UPS). 3. Server commit of data with battery-backed intermediate storage and recovery software. 4. Cache commit with uninterruptible power system (UPS) and recovery software. - Stateid A 64-bit quantity returned by a server that uniquely - defines the locking state granted by the server for a - specific lock owner for a specific file. + Stateid A 128-bit quantity returned by a server that uniquely + defines the open and locking state provided by the server + for a specific open or lock owner for a specific file. Stateids composed of all bits 0 or all bits 1 have special meaning and are reserved values. Verifier A 64-bit quantity generated by the client that the server can use to determine if the client has restarted and lost all previous lock state. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 2. Protocol Data Types The syntax and semantics to describe the data types of the NFS version 4 protocol are defined in the XDR [RFC1832] and RPC [RFC1831] documents. The next sections build upon the XDR data types to define types and structures specific to this protocol. 2.1. Basic Data Types @@ -642,21 +644,21 @@ mode4 typedef uint32_t mode4; Mode attribute data type nfs_cookie4 typedef uint64_t nfs_cookie4; Opaque cookie value for READDIR nfs_fh4 typedef opaque nfs_fh4; Filehandle definition; NFS4_FHSIZE is defined as 128 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 nfs_ftype4 enum nfs_ftype4; Various defined file types nfsstat4 enum nfsstat4; Return value for operations offset4 typedef uint64_t offset4; Various offset designations (READ, WRITE, LOCK, COMMIT) @@ -695,21 +697,21 @@ The nfstime4 structure gives the number of seconds and nanoseconds since midnight or 0 hour January 1, 1970 Coordinated Universal Time (UTC). Values greater than zero for the seconds field denote dates after the 0 hour January 1, 1970. Values less than zero for the seconds field denote dates before the 0 hour January 1, 1970. In both cases, the nseconds field is to be added to the seconds field for the final time representation. For example, if the time to be represented is one-half second before 0 hour January 1, 1970, the seconds field would have a -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 value of negative one (-1) and the nseconds fields would have a value of one-half second (500000000). Values greater than 999,999,999 for nseconds are considered invalid. This data type is used to pass time and date information. A server converts to and from its local representation of time when processing time values, preserving as much accuracy as possible. If the precision of timestamps stored for a file system object is less than defined, loss of precision can occur. @@ -746,21 +748,21 @@ This data type represents additional information for the device file types NF4CHR and NF4BLK. fsid4 struct fsid4 { uint64_t major; uint64_t minor; }; -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 This type is the file system identifier that is used as a mandatory attribute. fs_location4 struct fs_location4 { utf8string server<>; pathname4 rootpath; }; @@ -797,24 +799,24 @@ +-----------+-----------+-----------+-- change_info4 struct change_info4 { bool atomic; changeid4 before; changeid4 after; }; -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 This structure is used with the CREATE, LINK, REMOVE, RENAME - operations to let the client the know value of the change + operations to let the client know the value of the change attribute for the directory in which the target file system object resides. clientaddr4 struct clientaddr4 { /* see struct rpcb in RFC 1833 */ string r_netid<>; /* network id */ string r_addr<>; /* universal address */ }; @@ -831,53 +833,63 @@ }; This structure is used by the client to inform the server of its call back address; includes the program number and client address. nfs_client_id4 struct nfs_client_id4 { verifier4 verifier; - opaque id<>; + opaque id; }; This structure is part of the arguments to the SETCLIENTID - operation. + operation. NFS4_OPAQUE_LIMIT is defined as 1024. - nfs_lockowner4 + open_owner4 - struct nfs_lockowner4 { + struct open_owner4 { clientid4 clientid; - opaque owner<>; + opaque owner; }; - This structure is used to identify the owner of a OPEN share or - file lock. + This structure is used to identify the owner of open state. + NFS4_OPAQUE_LIMIT is defined as 1024. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + + lock_owner4 + + struct nfs_lockowner4 { + clientid4 clientid; + opaque owner; + }; + + This structure is used to identify the owner of file locking + state. NFS4_OPAQUE_LIMIT is defined as 1024. stateid4 struct stateid4 { uint32_t seqid; opaque other[12]; }; This strucutre is used for the various state sharing mechanisms between the client and server. For the client, this data structure is read-only. The seqid value is the only field that the client should interpret. See the section for the OPEN operation for further description of how the seqid field is to be interpreted. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 3. RPC and Security Flavor The NFS version 4 protocol is a Remote Procedure Call (RPC) application that uses RPC version 2 and the corresponding eXternal Data Representation (XDR) as defined in [RFC1831] and [RFC1832]. The RPCSEC_GSS security flavor as defined in [RFC2203] MUST be used as the mechanism to deliver stronger security for the NFS version 4 protocol. @@ -917,21 +929,21 @@ of varying security mechanisms by the RPC layer without the additional implementation overhead of adding RPC security flavors. For NFS version 4, the RPCSEC_GSS security flavor MUST be used to enable the mandatory security mechanism. Other flavors, such as, AUTH_NONE, AUTH_SYS, and AUTH_DH MAY be implemented as well. 3.2.1. Security mechanisms for NFS version 4 The use of RPCSEC_GSS requires selection of: mechanism, quality of -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 protection, and service (authentication, integrity, privacy). The remainder of this document will refer to these three parameters of the RPCSEC_GSS security as the security triple. 3.2.1.1. Kerberos V5 as security triple The Kerberos V5 GSS-API mechanism as described in [RFC1964] MUST be implemented and provide the following security triples. @@ -971,38 +983,38 @@ 1 2 3 4 5 ----------------------------------------------------------------------- 390006 lipkey 1.3.6.1.5.5.9 negotiated rpc_gss_svc_none 390007 lipkey-i 1.3.6.1.5.5.9 negotiated rpc_gss_svc_integrity 390008 lipkey-p 1.3.6.1.5.5.9 negotiated rpc_gss_svc_privacy The mechanism algorithm is listed as "negotiated". This is because LIPKEY is layered on SPKM-3 and in SPKM-3 [RFC2847] the -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 confidentiality and integrity algorithms are negotiated. Since SPKM-3 specifies HMAC-MD5 for integrity as MANDATORY, 128 bit cast5CBC for confidentiality for privacy as MANDATORY, and further specifies that HMAC-MD5 and cast5CBC MUST be listed first before weaker algorithms, specifying "negotiated" in column 4 does not impair interoperability. In the event an SPKM-3 peer does not support the mandatory algorithms, the other peer is free to accept or reject the GSS-API context creation. Because SPKM-3 negotiates the algorithms, subsequent calls to LIPKEY's GSS_Wrap() and GSS_GetMIC() by RPCSEC_GSS will use a quality of protection value of 0 (zero). See section 5.2 of [RFC2025] for an explanation. LIPKEY uses SPKM-3 to create a secure channel in which to pass a user - name and password from the client to the user. Once the user name + name and password from the client to the server. Once the user name and password have been accepted by the server, calls to the LIPKEY context are redirected to the SPKM-3 context. See [RFC2847] for more details. 3.2.1.3. SPKM-3 as a security triple The SPKM-3 GSS-API mechanism as described in [RFC2847] MUST be implemented and provide the following security triples. The definition of the columns matches the previous subsection "Kerberos V5 as security triple". @@ -1022,21 +1034,21 @@ explanation. Even though LIPKEY is layered over SPKM-3, SPKM-3 is specified as a mandatory set of triples to handle the situations where the initiator (the client) is anonymous or where the initiator has its own certificate. If the initiator is anonymous, there will not be a user name and password to send to the target (the server). If the initiator has its own certificate, then using passwords is superfluous. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 3.3. Security Negotiation With the NFS version 4 server potentially offering multiple security mechanisms, the client needs a method to determine or negotiate which mechanism is to be used for its communication with the server. The NFS server may have multiple points within its file system name space that are available for use by NFS clients. In turn the NFS server may be configured such that each of these entry points may have different or multiple security mechanisms in use. @@ -1074,21 +1086,21 @@ The callback RPC (described later) must mutually authenticate the NFS server to the principal that acquired the clientid (also described later), using the same security flavor the original SETCLIENTID operation used. Because LIPKEY is layered over SPKM-3, it is permissible for the server to use SPKM-3 and not LIPKEY for the callback even if the client used LIPKEY for SETCLIENTID. For AUTH_NONE, there are no principals, so this is a non-issue. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 For AUTH_SYS, the server simply uses the AUTH_SYS credential that the user used when it set up the delegation. For AUTH_DH, one commonly used convention is that the server uses the credential corresponding to this AUTH_DH principal: unix.host@domain where host and domain are variables corresponding to the name of @@ -1129,38 +1141,38 @@ be used. This effectively means that the client will use a certificate to authenticate and identify the initiator to the target on the NFS server. Using SPKM-3 and not LIPKEY has the following advantages: o When the server does a callback, it must authenticate to the principal used in the SETCLIENTID. Even if LIPKEY is used, because LIPKEY is layered over SPKM-3, the NFS client will need to have a certificate that corresponds to the principal used in -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 the SETCLIENTID operation. From an administrative perspective, having a user name, password, and certificate for both the client and server is redundant. o LIPKEY was intended to minimize additional infrastructure requirements beyond a certificate for the target, and the expectation is that existing password infrastructure can be leveraged for the initiator. In some environments, a per-host password does not exist yet. If certificates are used for any per-host principals, then additional password infrastructure is not needed. o In cases when a host is both an NFS client and server, it can share the same per-host certificate. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 4. Filehandles The filehandle in the NFS protocol is a per server unique identifier for a file system object. The contents of the filehandle are opaque to the client. Therefore, the server is responsible for translating the filehandle to an internal representation of the file system object. Since the filehandle is the client's reference to an object and the client may cache this reference, the server SHOULD not reuse a filehandle for another file system object. If the server needs to @@ -1199,21 +1211,21 @@ 4.1.1. Root Filehandle The first of the special filehandles is the ROOT filehandle. The ROOT filehandle is the "conceptual" root of the file system name space at the NFS server. The client uses or starts with the ROOT filehandle by employing the PUTROOTFH operation. The PUTROOTFH operation instructs the server to set the "current" filehandle to the ROOT of the server's file tree. Once this PUTROOTFH operation is used, the client can then traverse the entirety of the server's file -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 tree with the LOOKUP procedure. A complete discussion of the server name space is in the section "NFS Server Name Space". 4.1.2. Public Filehandle The second special filehandle is the PUBLIC filehandle. Unlike the ROOT filehandle, the PUBLIC filehandle may be bound or represent an arbitrary file system object at the server. The server is responsible for this binding. It may be that the PUBLIC filehandle @@ -1251,21 +1263,21 @@ filehandle differently, a file attribute is defined which may be used by the client to determine the filehandle types being returned by the server. 4.2.1. General Properties of a Filehandle The filehandle contains all the information the server needs to distinguish an individual file. To the client, the filehandle is opaque. The client stores filehandles for use in a later request and -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 can compare two filehandles from the same server for equality by doing a byte-by-byte comparison. However, the client MUST NOT otherwise interpret the contents of filehandles. If two filehandles from the same server are equal, they MUST refer to the same file. If they are not equal, the client may use information provided by the server, in the form of file attributes, to determine whether they denote the same files or different files. The client would do this as necessary for client side caching. Servers SHOULD try to maintain a one-to-one correspondence between filehandles and files but this is @@ -1304,21 +1316,21 @@ file system containing the object is no longer available. The file system may become unavailable if it exists on removable media and the media is no longer available at the server or the file system in whole has been destroyed or the file system has simply been removed from the server's name space (i.e. unmounted in a Unix environment). 4.2.3. Volatile Filehandle A volatile filehandle does not share the same longevity -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 characteristics of a persistent filehandle. The server may determine that a volatile filehandle is no longer valid at many different points in time. If the server can definitively determine that a volatile filehandle refers to an object that has been removed, the server should return NFS4ERR_STALE to the client (as is the case for persistent filehandles). In all other cases where the server determines that a volatile filehandle can no longer be used, it should return an error of NFS4ERR_FHEXPIRED. @@ -1358,21 +1370,21 @@ REMOVE that would affect an OPEN file or any of the components leading to the OPEN file. In addition, the server should deny all RENAME or REMOVE requests during the grace or lease period upon server restart. The reader may be wondering why there are three FH4_VOL* bits and why FH4_VOLATILE_ANY is exclusive of FH4_VOL_MIGRATION and FH4_VOL_RENAME. If the a filehandle is normally persistent but cannot persist across a file set migration, then the presence of the -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 FH4_VOL_MIGRATION or FH4_VOL_RENAME tells the client that it can treat the file handle as persistent for purposes of maintaining a file name to file handle cache, except for the specific event described by the bit. However, FH4_VOLATILE_ANY tells the client that it should not maintain such a cache for unopened files. A server MUST not present FH4_VOLATILE_ANY with FH4_VOL_MIGRATION or FH4_VOL_RENAME as this will lead to confusion. FH4_VOLATILE_ANY implies that the file handle will expire upon migration or rename, in addition to other events. @@ -1408,21 +1420,21 @@ 4.3. Client Recovery from Filehandle Expiration If possible, the client SHOULD recover from the receipt of an NFS4ERR_FHEXPIRED error. The client must take on additional responsibility so that it may prepare itself to recover from the expiration of a volatile filehandle. If the server returns persistent filehandles, the client does not need these additional steps. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 For volatile filehandles, most commonly the client will need to store the component names leading up to and including the file system object in question. With these names, the client should be able to recover by finding a filehandle in the name space that is still available or by starting at the root of the server's file system name space. If the expired filehandle refers to an object that has been removed from the file system, obviously the client will not be able to @@ -1435,21 +1447,21 @@ the file is open, it is possible that the client may be able to recover. The client can determine the new path name based on the processing of the rename request. The client can then regenerate the new filehandle based on the new path name. The client could also use the compound operation mechanism to construct a set of operations like: RENAME A B LOOKUP B GETFH -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 5. File Attributes To meet the requirements of extensibility and increased interoperability with non-Unix platforms, attributes must be handled in a flexible manner. The NFS Version 3 fattr3 structure contains a fixed list of attributes that not all clients and servers are able to support or care about. The fattr3 structure can not be extended as new needs arise and it provides no way to indicate non-support. With the NFS Version 4 protocol, the client will be able to ask what @@ -1488,21 +1500,21 @@ encouraged to define their new attributes as recommended attributes by bringing them to the IETF standards-track process. The set of attributes which are classified as mandatory is deliberately small since servers must do whatever it takes to support them. The recommended attributes may be unsupported; though a server should support as many as it can. Attributes are deemed mandatory if the data is both needed by a large number of clients and is not otherwise reasonably computable by the client when support is not -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 provided on the server. 5.1. Mandatory Attributes These MUST be supported by every NFS Version 4 client and server in order to ensure a minimum level of interoperability. The server must store and return these attributes and the client must be able to function with an attribute set limited to these attributes. With just the mandatory attributes some client functionality may be @@ -1540,395 +1552,513 @@ OPENATTR operation returns a filehandle for a virtual "attribute directory" and further perusal of the name space may be done using READDIR and LOOKUP operations on this filehandle. Named attributes may then be examined or changed by normal READ and WRITE and CREATE operations on the filehandles returned from READDIR and LOOKUP. Named attributes may have attributes. It is recommended that servers support arbitrary named attributes. A client should not depend on the ability to store any named attributes -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 in the server's file system. If a server does support named attributes, a client which is also able to handle them should be able to copy a file's data and meta-data with complete transparency from one location to another; this would imply that names allowed for regular directory entries are valid for named attribute names as well. Names of attributes will not be controlled by this document or other IETF standards track documents. See the section "IANA Considerations" for further discussion. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 5.4. Mandatory Attributes - Definitions Name # DataType Access Description ___________________________________________________________________ - supp_attr 0 bitmap READ The bit vector which + supp_attr 0 bitmap READ + The bit vector which would retrieve all mandatory and recommended attributes that are supported for this object. - type 1 nfs4_ftype READ The type of the object + type 1 nfs4_ftype READ + The type of the object (file, directory, symlink) - fh_expire_type 2 uint32 READ Server uses this to + fh_expire_type 2 uint32 READ + Server uses this to specify filehandle expiration behavior to the client. See the section "Filehandles" for additional description. - change 3 uint64 READ A value created by the + change 3 uint64 READ + A value created by the server that the client can use to determine if file data, directory contents or attributes of the object have been modified. The server may return the object's time_modify attribute for this attribute's value but only if the file system object can not be updated more frequently than the resolution of time_modify. - size 4 uint64 R/W The size of the object + size 4 uint64 R/W + The size of the object in bytes. - link_support 5 bool READ Does the object's file + link_support 5 bool READ + Does the object's file system supports hard links? -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - symlink_support 6 bool READ Does the object's file + symlink_support 6 bool READ + Does the object's file system supports symbolic links? - named_attr 7 bool READ Does this object have + named_attr 7 bool READ + Does this object have named attributes? - fsid 8 fsid4 READ Unique file system + fsid 8 fsid4 READ + Unique file system identifier for the file system holding this object. fsid contains major and minor components each of which are uint64. - unique_handles 9 bool READ Are two distinct + unique_handles 9 bool READ + Are two distinct filehandles guaranteed to refer to two different file system objects? - lease_time 10 nfs_lease4 READ Duration of leases at + lease_time 10 nfs_lease4 READ + Duration of leases at server in seconds. - rdattr_error 11 enum READ Error returned from + rdattr_error 11 enum READ + Error returned from getattr during readdir. - filehandle 19 nfs_fh4 READ The filehandle of this + filehandle 19 nfs_fh4 READ + The filehandle of this object (primarily for readdir requests). -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 5.5. Recommended Attributes - Definitions Name # Data Type Access Description _____________________________________________________________________ - ACL 12 nfsace4<> R/W The access control + ACL 12 nfsace4<> R/W + The access control list for the object. - aclsupport 13 uint32 READ Indicates what types + aclsupport 13 uint32 READ + Indicates what types of ACLs are supported on the current file system. - archive 14 bool R/W Whether or not this + archive 14 bool R/W + Whether or not this file has been archived since the time of last modification (deprecated in favor of time_backup). - cansettime 15 bool READ Is the server able to + cansettime 15 bool READ + Is the server able to change the times for a file system object as specified in a SETATTR operation? - case_insensitive 16 bool READ Are filename + case_insensitive 16 bool READ + Are filename comparisons on this file system case insensitive? - case_preserving 17 bool READ Is filename case on + case_preserving 17 bool READ + Is filename case on this file system preserved? - chown_restricted 18 bool READ If TRUE, the server + chown_restricted 18 bool READ + If TRUE, the server will reject any request to change either the owner or the group associated with a file if the caller is not a privileged user (for example, "root" in Unix operating environments or in NT the "Take Ownership" privilege) -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - fileid 20 uint64 READ A number uniquely + fileid 20 uint64 READ + A number uniquely identifying the file within the file system. - files_avail 21 uint64 READ File slots available + files_avail 21 uint64 READ + File slots available to this user on the file system containing this object - this should be the smallest relevant limit. - files_free 22 uint64 READ Free file slots on + files_free 22 uint64 READ + Free file slots on the file system containing this object - this should be the smallest relevant limit. - files_total 23 uint64 READ Total file slots on + files_total 23 uint64 READ + Total file slots on the file system containing this object. - fs_locations 24 fs_locations READ Locations where this + fs_locations 24 fs_locations READ + Locations where this file system may be found. If the server returns NFS4ERR_MOVED as an error, this attribute must be supported. - hidden 25 bool R/W Is file considered + hidden 25 bool R/W + Is file considered hidden with respect to the WIN32 API? - homogeneous 26 bool READ Whether or not this + homogeneous 26 bool READ + Whether or not this object's file system is homogeneous, i.e. are per file system attributes the same for all file system's objects. - maxfilesize 27 uint64 READ Maximum supported + maxfilesize 27 uint64 READ + Maximum supported file size for the file system of this object. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - maxlink 28 uint32 READ Maximum number of + maxlink 28 uint32 READ + Maximum number of links for this object. - maxname 29 uint32 READ Maximum filename size + maxname 29 uint32 READ + Maximum filename size supported for this object. - maxread 30 uint64 READ Maximum read size + maxread 30 uint64 READ + Maximum read size supported for this object. - maxwrite 31 uint64 READ Maximum write size + maxwrite 31 uint64 READ + Maximum write size supported for this object. This attribute SHOULD be supported if the file is writable. Lack of this attribute can lead to the client either wasting bandwidth or not receiving the best performance. - mimetype 32 utf8<> R/W MIME body + mimetype 32 utf8<> R/W + MIME body type/subtype of this object. - mode 33 mode4 R/W Unix-style permission + mode 33 mode4 R/W + Unix-style permission bits for this object (deprecated in favor of ACLs) - no_trunc 34 bool READ If a name longer than + no_trunc 34 bool READ + If a name longer than name_max is used, will an error be returned or will the name be truncated? - numlinks 35 uint32 READ Number of hard links + numlinks 35 uint32 READ + Number of hard links to this object. - owner 36 utf8<> R/W The string name of + owner 36 utf8<> R/W + The string name of the owner of this object. - owner_group 37 utf8<> R/W The string name of + owner_group 37 utf8<> R/W + The string name of the group ownership of this object. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - quota_avail_hard 38 uint64 READ For definition see + quota_avail_hard 38 uint64 READ + For definition see "Quota Attributes" section below. - quota_avail_soft 39 uint64 READ For definition see + quota_avail_soft 39 uint64 READ + For definition see "Quota Attributes" section below. - quota_used 40 uint64 READ For definition see + quota_used 40 uint64 READ + For definition see "Quota Attributes" section below. - rawdev 41 specdata4 READ Raw device + rawdev 41 specdata4 READ + Raw device identifier. Unix device major/minor node information. - space_avail 42 uint64 READ Disk space in bytes + space_avail 42 uint64 READ + Disk space in bytes available to this user on the file system containing this object - this should be the smallest relevant limit. - space_free 43 uint64 READ Free disk space in + space_free 43 uint64 READ + Free disk space in bytes on the file system containing this object - this should be the smallest relevant limit. - space_total 44 uint64 READ Total disk space in + space_total 44 uint64 READ + Total disk space in bytes on the file system containing this object. - space_used 45 uint64 READ Number of file system + space_used 45 uint64 READ + Number of file system bytes allocated to this object. - system 46 bool R/W Is this file a system + system 46 bool R/W + Is this file a system file with respect to the WIN32 API? - time_access 47 nfstime4 READ The time of last + time_access 47 nfstime4 READ + The time of last access to the object. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - time_access_set 48 settime4 WRITE Set the time of last + time_access_set 48 settime4 WRITE + Set the time of last access to the object. SETATTR use only. - time_backup 49 nfstime4 R/W The time of last + time_backup 49 nfstime4 R/W + The time of last backup of the object. - time_create 50 nfstime4 R/W The time of creation + time_create 50 nfstime4 R/W + The time of creation of the object. This attribute does not have any relation to the traditional Unix file attribute "ctime" or "change time". - time_delta 51 nfstime4 READ Smallest useful + time_delta 51 nfstime4 READ + Smallest useful server time granularity. - time_metadata 52 nfstime4 R/W The time of last + time_metadata 52 nfstime4 R/W + The time of last meta-data modification of the object. - time_modify 53 nfstime4 READ The time of last + time_modify 53 nfstime4 READ + The time of last modification to the object. - time_modify_set 54 settime4 WRITE Set the time of last + time_modify_set 54 settime4 WRITE + Set the time of last modification to the object. SETATTR use only. 5.6. Interpreting owner and owner_group - The recommended attributes "owner" and "owner_group" are represented - in terms of a UTF-8 string. To avoid a representation that is tied - to a particular underlying implementation at the client or server, - the use of the UTF-8 string has been chosen. Note that section 6.1 - of [RFC2624] provides additional rationale. It is expected that the - client and server will have their own local representation of owner - and owner_group that is used for local storage or presentation to the - end user. Therefore, it is expected that when these attributes are + The recommended attributes "owner" and "owner_group" (and also users + and groups within the "acl" attribute) are represented in terms of a + UTF-8 string. To avoid a representation that is tied to a particular + underlying implementation at the client or server, the use of the + UTF-8 string has been chosen. Note that section 6.1 of [RFC2624] + provides additional rationale. It is expected that the client and + server will have their own local representation of owner and + owner_group that is used for local storage or presentation to the end + user. Therefore, it is expected that when these attributes are transferred between the client and server that the local representation is translated to a syntax of the form "user@dns_domain". This will allow for a client and server that do not use the same local representation the ability to translate to a common syntax that can be interpreted by both. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - The translation is not specified as part of the protocol. This - allows various solutions to be employed. For example, a local - translation table may be consulted that maps between a numeric id to - the user@dns_domain syntax. A name service may also be used to - accomplish the translation. The "dns_domain" portion of the owner - string is meant to be a DNS domain name. For example, user@ietf.org. + Similarly, security principals may be represented in different ways + by different security mechanisms. Servers normally translate these + representations into a common format, generally that used by local + storage, to serve as a means of identifying the users corresponding + to these security principals. When these local identifiers are + translated to the form of the owner attribute, associated with files + created by such principals they identify, in a common format, the + users associated with each corresponding set of security principals. + + The translation used to interpret owner and group strings is not + specified as part of the protocol. This allows various solutions to + be employed. For example, a local translation table may be consulted + that maps between a numeric id to the user@dns_domain syntax. A name + service may also be used to accomplish the translation. A server may + provide a more general service, not limited by any particular + translation (which would only translate a limited set of possible + strings) by storing the owner and owner_group attributes in local + storage without any translation or it may augment a translation + method by storing the entire string for attributes for which no + translation is available while using the local representation for + those cases in which a translation is available. + + Servers that do not provide support for all possible values of the + owner and owner_group attributes, should return an error + (NFS4ERR_BADOWNER) when a string is presented that has no + translation, as the value to be set for a SETATTR of the owner, + owner_group, or acl attributes. When a server does accept an owner + or owner_group value as valid on a SETATTR (and similarly for the + owner and group strings in an acl), it is promising to return that + same string when a corresponding GETATTR is done. Configuration + changes and ill-constructed name translations (those that contain + aliasing) may make that promise impossible to honor. Servers should + make appropriate efforts to avoid a situation in which these + attributes have their values changed when no real change to ownership + has occurred. + + The "dns_domain" portion of the owner string is meant to be a DNS + domain name. For example, user@ietf.org. Servers should accept as + valid a set of users for at least one domain. A server may treat + other domains as having no valid translations. A more general + service is provided when a server is capable of accepting users for + multiple domains, or for all domains, subject to security + constraints. In the case where there is no translation available to the client or server, the attribute value must be constructed without the "@". Therefore, the absence of the @ from the owner or owner_group - attribute signifies that no translation was available and the - receiver of the attribute should not place any special meaning with - the attribute value. Even though the attribute value can not be - translated, it may still be useful. In the case of a client, the - attribute string may be used for local display of ownership. + attribute signifies that no translation was available at the sender + and that the receiver of the attribute should not use that string as + a basis for translation into its own internal format. Even though + the attribute value can not be translated, it may still be useful. + In the case of a client, the attribute string may be used for local + +Draft Specification NFS version 4 Protocol July 2002 + + display of ownership. + + To provide a greater degree of compatibility with previous versions + of NFS (i.e. v2 and v3), which identified users and groups by 32-bit + unsigned uid's and gid's, owner and group strings that consist of + decimal numeric values with no leading zeros can be given a special + interpretation by clients and servers which choose to provide such + support. The receiver may treat such a user or group string as + representing the same user as would be represented by a v2/v3 uid or + gid having the corresponding numeric value. A server is not + obligated to accept such a string, but may return an NFS4ERR_BADOWNER + instead. To avoid this mechanism being used to subvert user and + group translation, so that a client might pass all of the owners and + groups in numeric form, a server SHOULD return an NFS4ERR_BADOWNER + error when there is a valid translation for the user or owner + designated in this way. In that case, the client must use the + appropriate name@domain string and not the special form for + compatibility. + + The owner string "nobody" may be used to designate an anonymous user, + which will be associated with a file created by a security principal + that cannot be mapped through normal means to the owner attribute. 5.7. Character Case Attributes With respect to the case_insensitive and case_preserving attributes, each UCS-4 character (which UTF-8 encodes) has a "long descriptive name" [RFC1345] which may or may not included the word "CAPITAL" or "SMALL". The presence of SMALL or CAPITAL allows an NFS server to implement unambiguous and efficient table driven mappings for case insensitive comparisons, and non-case-preserving storage. For general character handling and internationalization issues, see the @@ -1942,29 +2072,29 @@ quota_avail_soft The value in bytes which represents the amount of additional disk space that can be allocated to this file or directory before the user may reasonably be warned. It is understood that this space may be consumed by allocations to other files or directories though there is a rule as to which other files or directories. quota_avail_hard The value in bytes which represent the amount of additional disk + +Draft Specification NFS version 4 Protocol July 2002 + space beyond the current allocation that can be allocated to this file or directory before further allocations will be refused. It is understood that this space may be consumed by allocations to other files or directories. quota_used - -Draft Specification NFS version 4 Protocol November 2001 - The value in bytes which represent the amount of disc space used by this file or directory and possibly a number of other similar files or directories, where the set of "similar" meets at least the criterion that allocating space to any file or directory in the set will reduce the "quota_avail_hard" of every other file or directory in the set. Note that there may be a number of distinct but overlapping sets of files or directories for which a quota_used value is maintained. E.g. "all files with a given owner", "all files with @@ -1977,48 +2107,51 @@ 5.9. Access Control Lists The NFS ACL attribute is an array of access control entries (ACE). There are various access control entry types. The server is able to communicate which ACE types are supported by returning the appropriate value within the aclsupport attribute. The types of ACEs are defined as follows: Type Description _____________________________________________________ - ALLOW Explicitly grants the access defined in + ALLOW + Explicitly grants the access defined in acemask4 to the file or directory. - DENY Explicitly denies the access defined in + DENY + Explicitly denies the access defined in acemask4 to the file or directory. - AUDIT LOG (system dependent) any access + AUDIT + LOG (system dependent) any access attempt to a file or directory which uses any of the access methods specified in acemask4. - ALARM Generate a system ALARM (system + ALARM + Generate a system ALARM (system dependent) when any access attempt is made to a file or directory for the access methods specified in acemask4. The NFS ACE attribute is defined as follows: +Draft Specification NFS version 4 Protocol July 2002 + typedef uint32_t acetype4; typedef uint32_t aceflag4; typedef uint32_t acemask4; struct nfsace4 { acetype4 type; aceflag4 flag; - -Draft Specification NFS version 4 Protocol November 2001 - acemask4 access_mask; utf8string who; }; To determine if an ACCESS or OPEN request succeeds each nfsace4 entry is processed in order by the server. Only ACEs which have a "who" that matches the requester are considered. Each ACE is processed until all of the bits of the requester's access have been ALLOWED. Once a bit (see below) has been ALLOWED by an ACCESS_ALLOWED_ACE, it is no longer considered in the processing of later ACEs. If an @@ -2048,27 +2181,27 @@ 5.9.2. ACE flag The "flag" field contains values based on the following descriptions. ACE4_FILE_INHERIT_ACE Can be placed on a directory and indicates that this ACE should be added to each new non-directory file created. +Draft Specification NFS version 4 Protocol July 2002 + ACE4_DIRECTORY_INHERIT_ACE Can be placed on a directory and indicates that this ACE should be added to each new directory created. -Draft Specification NFS version 4 Protocol November 2001 - ACE4_INHERIT_ONLY_ACE Can be placed on a directory but does not apply to the directory, only to newly created files/directories as specified by the above two flags. ACE4_NO_PROPAGATE_INHERIT_ACE Can be placed on a directory. Normally when a new directory is created and an ACE exists on the parent directory which is marked @@ -2096,114 +2229,142 @@ ACE4_FAILED_ACCESS_ACE_FLAG causes the ALARM or AUDIT if the ACCESS or OPEN call fails. ACE4_IDENTIFIER_GROUP Indicates that the "who" refers to a GROUP as defined under Unix. The bitmask constants used for the flag field are as follows: const ACE4_FILE_INHERIT_ACE = 0x00000001; + +Draft Specification NFS version 4 Protocol July 2002 + const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; const ACE4_INHERIT_ONLY_ACE = 0x00000008; const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; const ACE4_IDENTIFIER_GROUP = 0x00000040; -Draft Specification NFS version 4 Protocol November 2001 - 5.9.3. ACE Access Mask The access_mask field contains values based on the following: Access Description _______________________________________________________________ - READ_DATA Permission to read the data of the file - LIST_DIRECTORY Permission to list the contents of a + READ_DATA + Permission to read the data of the file + LIST_DIRECTORY + Permission to list the contents of a directory - WRITE_DATA Permission to modify the file's data - ADD_FILE Permission to add a new file to a + WRITE_DATA + Permission to modify the file's data + ADD_FILE + Permission to add a new file to a directory - APPEND_DATA Permission to append data to a file - ADD_SUBDIRECTORY Permission to create a subdirectory to a + APPEND_DATA + Permission to append data to a file + ADD_SUBDIRECTORY + Permission to create a subdirectory to a directory - READ_NAMED_ATTRS Permission to read the named attributes + READ_NAMED_ATTRS + Permission to read the named attributes of a file - WRITE_NAMED_ATTRS Permission to write the named attributes + WRITE_NAMED_ATTRS + Permission to write the named attributes of a file - EXECUTE Permission to execute a file - DELETE_CHILD Permission to delete a file or directory + EXECUTE + Permission to execute a file + DELETE_CHILD + Permission to delete a file or directory within a directory - READ_ATTRIBUTES The ability to read basic attributes + READ_ATTRIBUTES + The ability to read basic attributes (non-acls) of a file - WRITE_ATTRIBUTES Permission to change basic attributes + WRITE_ATTRIBUTES + Permission to change basic attributes (non-acls) of a file - DELETE Permission to Delete the file - READ_ACL Permission to Read the ACL - WRITE_ACL Permission to Write the ACL - WRITE_OWNER Permission to change the owner - SYNCHRONIZE Permission to access file locally at the + DELETE + Permission to Delete the file + READ_ACL + Permission to Read the ACL + WRITE_ACL + Permission to Write the ACL + WRITE_OWNER + Permission to change the owner + SYNCHRONIZE + Permission to access file locally at the server with synchronous reads and writes The bitmask constants used for the access mask field are as follows: const ACE4_READ_DATA = 0x00000001; const ACE4_LIST_DIRECTORY = 0x00000001; const ACE4_WRITE_DATA = 0x00000002; const ACE4_ADD_FILE = 0x00000002; const ACE4_APPEND_DATA = 0x00000004; const ACE4_ADD_SUBDIRECTORY = 0x00000004; const ACE4_READ_NAMED_ATTRS = 0x00000008; + +Draft Specification NFS version 4 Protocol July 2002 + const ACE4_WRITE_NAMED_ATTRS = 0x00000010; const ACE4_EXECUTE = 0x00000020; const ACE4_DELETE_CHILD = 0x00000040; const ACE4_READ_ATTRIBUTES = 0x00000080; const ACE4_WRITE_ATTRIBUTES = 0x00000100; const ACE4_DELETE = 0x00010000; const ACE4_READ_ACL = 0x00020000; - -Draft Specification NFS version 4 Protocol November 2001 - const ACE4_WRITE_ACL = 0x00040000; const ACE4_WRITE_OWNER = 0x00080000; const ACE4_SYNCHRONIZE = 0x00100000; 5.9.4. ACE who There are several special identifiers ("who") which need to be understood universally. Some of these identifiers cannot be understood when an NFS client accesses the server, but have meaning when a local process accesses the file. The ability to display and modify these permissions is permitted over NFS. Who Description _______________________________________________________________ - "OWNER" The owner of the file. - "GROUP" The group associated with the file. - "EVERYONE" The world. - "INTERACTIVE" Accessed from an interactive terminal. - "NETWORK" Accessed via the network. - "DIALUP" Accessed as a dialup user to the server. - "BATCH" Accessed from a batch job. - "ANONYMOUS" Accessed without any authentication. - "AUTHENTICATED" Any authenticated user (opposite of + "OWNER" + The owner of the file. + "GROUP" + The group associated with the file. + "EVERYONE" + The world. + "INTERACTIVE" + Accessed from an interactive terminal. + "NETWORK" + Accessed via the network. + "DIALUP" + Accessed as a dialup user to the server. + "BATCH" + Accessed from a batch job. + "ANONYMOUS" + Accessed without any authentication. + "AUTHENTICATED" + Any authenticated user (opposite of ANONYMOUS) - "SERVICE" Access from a system service. + "SERVICE" + Access from a system service. To avoid conflict, these special identifiers are distinguish by an appended "@" and should appear in the form "xxxx@" (note: no domain name after the "@"). For example: ANONYMOUS@. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 6. File System Migration and Replication With the use of the recommended attribute "fs_locations", the NFS version 4 server has a method of providing file system migration or replication services. For the purposes of migration and replication, a file system will be defined as all files that share a given fsid (both major and minor values are the same). The fs_locations attribute provides a list of file system locations. @@ -2236,31 +2397,31 @@ writable and has a single copy. The expected use of migration is for load balancing or general resource reallocation. The protocol does not specify how the file system will be moved between servers. This server-to-server transfer mechanism is left to the server implementor. However, the method used to communicate the migration event between client and server is specified here. Once the servers participating in the migration have completed the move of the file system, the error NFS4ERR_MOVED will be returned for subsequent requests received by the original server. The - NFS4ERR_MOVED error is returned for all operations except GETATTR. - Upon receiving the NFS4ERR_MOVED error, the client will obtain the - value of the fs_locations attribute. The client will then use the - contents of the attribute to redirect its requests to the specified - server. To facilitate the use of GETATTR, operations such as PUTFH + NFS4ERR_MOVED error is returned for all operations except PUTFH and + GETATTR. Upon receiving the NFS4ERR_MOVED error, the client will + obtain the value of the fs_locations attribute. The client will then + use the contents of the attribute to redirect its requests to the + specified server. To facilitate the use of GETATTR, operations such -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - must also be accepted by the server for the migrated file system's - filehandles. Note that if the server returns NFS4ERR_MOVED, the - server MUST support the fs_locations attribute. + as PUTFH must also be accepted by the server for the migrated file + system's filehandles. Note that if the server returns NFS4ERR_MOVED, + the server MUST support the fs_locations attribute. If the client requests more attributes than just fs_locations, the server may return fs_locations only. This is to be expected since the server has migrated the file system and may not have a method of obtaining additional attribute data. The server implementor needs to be careful in developing a migration solution. The server must consider all of the state information clients may have outstanding at the server. This includes but is not limited to locking/share state, delegation state, and asynchronous @@ -2295,21 +2456,21 @@ The fs_locations struct and attribute then contains an array of locations. Since the name space of each server may be constructed differently, the "fs_root" field is provided. The path represented by fs_root represents the location of the file system in the server's name space. Therefore, the fs_root path is only associated with the server from which the fs_locations attribute was obtained. The fs_root path is meant to aid the client in locating the file system at the various servers listed. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 As an example, there is a replicated file system located at two servers (servA and servB). At servA the file system is located at path "/a/b/c". At servB the file system is located at path "/x/y/z". In this example the client accesses the file system first at servA with a multi-component lookup path of "/a/b/c/d". Since the client used a multi-component lookup to obtain the filehandle at "/a/b/c/d", it is unaware that the file system's root is located in servA's name space at "/a/b/c". When the client switches to servB, it will need to determine that the directory it first referenced at servA is now @@ -2337,21 +2498,21 @@ of the fh_expire_type attribute, whether volatile filehandles will expire at the migration or replication event. If the bit FH4_VOL_MIGRATION is set in the fh_expire_type attribute, the client must treat the volatile filehandle as if the server had returned the NFS4ERR_FHEXPIRED error. At the migration or replication event in the presence of the FH4_VOL_MIGRATION bit, the client will not present the original or old volatile file handle to the new server. The client will start its communication with the new server by recovering its filehandles using the saved file names. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 7. NFS Server Name Space 7.1. Server Exports On a UNIX server the name space describes all the files reachable by pathnames under the root directory or "/". On a Windows NT server the name space constitutes all the files on disks named by mapped disk letters. NFS server administrators rarely make the entire server's file system name space available to NFS clients. More often @@ -2389,21 +2550,21 @@ server's name space on the client: it is static. If the server administrator adds a new export the client will be unaware of it. 7.3. Server Pseudo File System NFS version 4 servers avoid this name space inconsistency by presenting all the exports within the framework of a single server name space. An NFS version 4 client uses LOOKUP and READDIR operations to browse seamlessly from one export to another. Portions -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 of the server name space that are not exported are bridged via a "pseudo file system" that provides a view of exported directories only. A pseudo file system has a unique fsid and behaves like a normal, read only file system. Based on the construction of the server's name space, it is possible that multiple pseudo file systems may exist. For example, /a pseudo file system @@ -2441,21 +2602,21 @@ 7.6. Exported Root If the server's root file system is exported, one might conclude that a pseudo-file system is not needed. This would be wrong. Assume the following file systems on a server: / disk1 (exported) /a disk2 (not exported) -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 /a/b disk3 (exported) Because disk2 is not exported, disk3 cannot be reached with simple LOOKUPs. The server must bridge the gap with a pseudo-file system. 7.7. Mount Point Crossing The server file system environment may be constructed in such a way that one file system contains a directory which is 'covered' or @@ -2488,21 +2649,21 @@ viewability of portions of the pseudo file system based on the server's perception of the client's ability to authenticate itself properly. However, with the support of multiple security mechanisms and the ability to negotiate the appropriate use of these mechanisms, the server is unable to properly determine if a client will be able to authenticate itself. If, based on its policies, the server chooses to limit the contents of the pseudo file system, the server may effectively hide file systems from a client that may otherwise have legitimate access. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 8. File Locking and Share Reservations Integrating locking into the NFS protocol necessarily causes it to be state-full. With the inclusion of "share" file locks the protocol becomes substantially more dependent on state than the traditional combination of NFS and NLM [XNFS]. There are three components to making this state manageable: o Clear division between client and server @@ -2516,47 +2677,47 @@ communicates its view of this state to the server as needed. The client is also able to detect inconsistent state before modifying a file. To support Win32 "share" locks it is necessary to atomically OPEN or CREATE files. Having a separate share/unshare operation would not allow correct implementation of the Win32 OpenFile API. In order to correctly implement share semantics, the previous NFS protocol mechanisms used when a file is opened or created (LOOKUP, CREATE, ACCESS) need to be replaced. The NFS version 4 protocol has an OPEN - operation that subsumes the functionality of LOOKUP, CREATE, and - ACCESS. However, because many operations require a filehandle, the - traditional LOOKUP is preserved to map a file name to filehandle - without establishing state on the server. The policy of granting - access or modifying files is managed by the server based on the - client's state. These mechanisms can implement policy ranging from - advisory only locking to full mandatory locking. + operation that subsumes the NFS version 3 methodology of LOOKUP, + CREATE, and ACCESS. However, because many operations require a + filehandle, the traditional LOOKUP is preserved to map a file name to + filehandle without establishing state on the server. The policy of + granting access or modifying files is managed by the server based on + the client's state. These mechanisms can implement policy ranging + from advisory only locking to full mandatory locking. 8.1. Locking It is assumed that manipulating a lock is rare when compared to READ and WRITE operations. It is also assumed that crashes and network partitions are relatively rare. Therefore it is important that the READ and WRITE operations have a lightweight mechanism to indicate if they possess a held lock. A lock request contains the heavyweight information required to establish a lock and uniquely define the lock owner. The following sections describe the transition from the heavy weight information to the eventual stateid used for most client and server locking and lease interactions. 8.1.1. Client ID For each LOCK request, the client must identify itself to the server. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 This is done in such a way as to allow for correct lock identification and crash recovery. Client identification is accomplished with two values. o A verifier that is used to detect client reboots. o A variable length opaque array to uniquely define a client. For an operating system this may be a fully qualified host @@ -2594,39 +2755,38 @@ a switched union that returns, in addition to NFS4ERR_CLID_INUSE, the network address (the rpcbind netid and universal address) of the client that is using the id. 2 Client is re-connecting to the server after a client reboot In this case, the client still generates an nfs_client_id but the nfs_client_id.id field will be the same as the nfs_client_id.id generated prior to reboot. If the server finds that the principal/uid is equal to the previously - "registered" nfs_client_id.id, then locks associated with + "registered" nfs_client_id.id, the server creates and -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - the old nfs_client_id are immediately released. If the - principal/uid is not equal, then this is a rogue client and - the request is returned in error. For more discussion of - crash recovery semantics, see the section on "Crash + returns a new clientid in response to the SETCLIENTID. If + the principal/uid is not equal, then this is a rogue client + and the request is returned in error. For more discussion + of crash recovery semantics, see the section on "Crash Recovery". - It is possible for a retransmission of request to be - received by the server after the server has acted upon and - responded to the original client request. Therefore to - mitigate effects of the retransmission of the SETCLIENTID - operation, the client and server use a confirmation step. - The server returns a confirmation verifier that the client - then sends to the server in the SETCLIENTID_CONFIRM - operation. Once the server receives the confirmation from - the client, the locking state for the client is released. + It is possible for a retransmission of request to be received by the + server after the server has acted upon and responded to the original + client request. Therefore to mitigate effects of the retransmission + of the SETCLIENTID operation, the client and server use a + confirmation step. The client uses the SETCLIENTID_CONFIRM operation + with the server provided clientid to confirm the client's use of the + new clientid. Once the server receives the confirmation from the + client, the locking state for the client is released. In both cases, upon success, NFS4_OK is returned. To help reduce the amount of data transferred on OPEN and LOCK, the server will also return a unique 64-bit clientid value that is a shorthand reference to the nfs_client_id values presented by the client. From this point forward, the client will use the clientid to refer to itself. The clientid assigned by the server should be chosen so that it will not conflict with a clientid previously assigned by the server. This applies across server restarts or reboots. When a clientid is @@ -2649,25 +2809,24 @@ for its clientid, the server may choose to release the clientid. The server may make this choice for an inactive client so that resources are not consumed by those intermittently active clients. If the client contacts the server after this release, the server must ensure the client receives the appropriate error so that it will use the SETCLIENTID/SETCLIENTID_CONFIRM sequence to establish a new identity. It should be clear that the server must be very hesitant to release a clientid since the resulting work on the client to recover from such an event will be the same burden as if the server had failed and restarted. Typically a server would not release a clientid unless - -Draft Specification NFS version 4 Protocol November 2001 - there had been no activity from that client for many minutes. +Draft Specification NFS version 4 Protocol July 2002 + 8.1.3. nfs_lockowner and stateid Definition When requesting a lock, the client must present to the server the clientid and an identifier for the owner of the requested lock. These two fields are referred to as the nfs_lockowner and the definition of those fields are: o A clientid returned by the server as part of the client's use of the SETCLIENTID operation. @@ -2702,26 +2861,26 @@ operations has occurred). The error NFS4ERR_OLD_STATEID should be returned. This error condition will only occur when the client issues a locking request which changes a stateid while an I/O request that uses that stateid is outstanding. o The stateid was generated by the current server instance but the stateid does not designate a locking state for any active lockowner-file pair. The error NFS4ERR_BAD_STATEID should be - -Draft Specification NFS version 4 Protocol November 2001 - returned. This error condition will occur when there has been a logic + +Draft Specification NFS version 4 Protocol July 2002 + error on the part of the client or server. This should not happen. One mechanism that may be used to satisfy these requirements is for the server to divide stateids into three fields: o A server verifier which uniquely designates a particular server instantiation. o An index into a table of locking-state structures. @@ -2730,61 +2889,114 @@ associated with the same index into the locking-state table. By matching the incoming stateid and its field values with the state held at the server, the server is able to easily determine if a stateid is valid for its current instantiation and state. If the stateid is not valid, the appropriate error can be supplied to the client. 8.1.4. Use of the stateid - All READ and WRITE operations contain a stateid. If the - nfs_lockowner performs a READ or WRITE on a range of bytes within a - locked range, the stateid (previously returned by the server) must be - used to indicate that the appropriate lock (record or share) is held. - If no state is established by the client, either record lock or share - lock, a stateid of all bits 0 is used. If no conflicting locks are - held on the file, the server may service the READ or WRITE operation. - If a conflict with an explicit lock occurs, an error is returned for - the operation (NFS4ERR_LOCKED). This allows "mandatory locking" to be - implemented. + All READ, WRITE and SETATTR operations contain a stateid. For the + purposes of this section, SETATTR operations which change the size + attribute of a file are treated as if they are writing the area + between the old and new size (i.e. the range truncated or added to + the file by means of the SETATTR), even where SETATTR is not + explicitly mentioned in the text. - A stateid of all bits 1 (one) allows READ operations to bypass record - locking checks at the server. However, WRITE operations with stateid - with bits all 1 (one) do not bypass record locking checks. File - locking checks are handled by the OPEN operation (see the section - "OPEN/CLOSE Operations"). + If the nfs_lockowner performs a READ or WRITE in a situation in which + it has established a lock on the server (and for these purposes any + OPEN constitutes a share lock) the stateid (previously returned by + the server) must be used to indicate what locks, including both + record and share locks, are held by the lockowner. If no state is + established by the client, either record lock or share lock, a + stateid of all bits 0 is used. Regardless of whether a stateid of + all bits 0, or a stateid returned by the server is used, if no + conflicting locks are held on the file, the server may service the + READ or WRITE operation. If a conflict with an explicit lock occurs, + an error is returned for the operation (NFS4ERR_LOCKED). This allows + "mandatory locking" to be implemented. + + Share locks are established by OPEN operations and by their nature + are mandatory in that when the OPEN denies READ or WRITE operations, + that denial results in such operations being rejected with error + NFS4ERR_LOCKED. Record locks may be implemented by the server as + either mandatory or advisory, or the choice of mandatory or advisory + behavior may be determined by the server on the basis of the file + being accessed. When record locks are advisory, they only prevent + the granting of conflicting lock requests and have no effect on + +Draft Specification NFS version 4 Protocol July 2002 + + READ's or WRITE's. Mandatory record locks, however, prevent + conflicting IO operations and when they are attempted, they are + rejected with NFS4ERR_LOCKED. + + Every stateid other than the special stateid values noted above, + whether returned by an OPEN-type operation (i.e. OPEN, + OPEN_DOWNGRADE), or by a LOCK-type operation (i.e. LOCK or LOCKU), + defines an access mode for the file (i.e. READ, WRITE, or READ_WRITE) + as established by the original OPEN which began the stateid sequence, + and as modified by subsequent OPEN's and OPEN_DOWNGRADE's within that + stateid sequence. When a READ, WRITE, or SETATTR which specifies the + size attribute, is done, the operation is subject to checking against + the access mode to verify that the operation is appropriate given the + OPEN with which the operation is associated. + + In the case of WRITE-type operations (i.e. WRITE's and SETATTR's + which set size), the server must verify that the access mode allows + writing and return an NFS4ERR_OPENMODE error if it does not. In the + case, of READ, the server may perform the corresponding check on the + access mode, or it may choose to allow READ on opens for WRITE only, + to accommodate clients whose write implementation may unavoidably do + reads (e.g. due to buffer cache constraints). However, even if + READ's are allowed in these circumstances, the server MUST still + check for locks that conflict with the READ (e.g. another open + specify denial of READ's). Note that a server which does enforce the + access mode check on READ's need not explicitly check for conflicting + share reservations since the existence of OPEN for read access + guarantees that no conflicting share reservation can exist. + + A stateid of all bits 1 (one) allows READ operations to bypass + locking checks at the server. However, WRITE operations with a + stateid with bits all 1 (one) do not bypass locking checks and are + treated exactly the same as if a stateid of all bits 0 were used. An explicit lock may not be granted while a READ or WRITE operation - with conflicting implicit locking is being performed. + with conflicting implicit locking is being performed. For the + purposes of this paragraph, a READ is considered as having an + implicit shared record lock for the area being read while a WRITE is + considered as having an implicit exclusive record lock for the area + being written (and similarly for SETATTR's that set size as discussed + above). 8.1.5. Sequencing of Lock Requests Locking is different than most NFS operations as it requires "at- most-one" semantics that are not provided by ONCRPC. ONCRPC over a - -Draft Specification NFS version 4 Protocol November 2001 - reliable transport is not sufficient because a sequence of locking requests may span multiple TCP connections. In the face of retransmission or reordering, lock or unlock requests must have a well defined and consistent behavior. To accomplish this, each lock request contains a sequence number that is a consecutively increasing + +Draft Specification NFS version 4 Protocol July 2002 + integer. Different nfs_lockowners have different sequences. The server maintains the last sequence number (L) received and the response that was returned. Note that for requests that contain a sequence number, for each nfs_lockowner, there should be no more than one outstanding request. - If a request with a previous sequence number (r < L) is received, it - is rejected with the return of error NFS4ERR_BAD_SEQID. Given a + If a request (r) with a previous sequence number (r < L) is received, + it is rejected with the return of error NFS4ERR_BAD_SEQID. Given a properly-functioning client, the response to (r) must have been received before the last request (L) was sent. If a duplicate of last request (r == L) is received, the stored response is returned. If a request beyond the next sequence (r == L + 2) is received, it is rejected with the return of error NFS4ERR_BAD_SEQID. Sequence history is reinitialized whenever the client verifier changes. Since the sequence number is represented with an unsigned 32-bit integer, the arithmetic involved with the sequence number is mod 2^32. @@ -2796,39 +3008,39 @@ algorithm for removing unneeded requests. However, the last lock request and response on a given nfs_lockowner must be cached as long as the lock state exists on the server. 8.1.6. Recovery from Replayed Requests As described above, the sequence number is per nfs_lockowner. As long as the server maintains the last sequence number received and follows the methods described above, there are no risks of a Byzantine router re-sending old requests. The server need only - maintain the nfs_lockowner, sequence number state as long as there + maintain the (nfs_lockowner, sequence number) state as long as there are open files or closed files with locks outstanding. LOCK, LOCKU, OPEN, OPEN_DOWNGRADE, and CLOSE each contain a sequence number and therefore the risk of the replay of these operations resulting in undesired effects is non-existent while the server maintains the nfs_lockowner state. 8.1.7. Releasing nfs_lockowner State When a particular nfs_lockowner no longer holds open or file locking - -Draft Specification NFS version 4 Protocol November 2001 - state at the server, the server may choose to release the sequence number state associated with the nfs_lockowner. The server may make this choice based on lease expiration, for the reclamation of server memory, or other implementation specific details. In any event, the server is able to do this safely only when the nfs_lockowner no + +Draft Specification NFS version 4 Protocol July 2002 + longer is being utilized by the client. The server may choose to hold the nfs_lockowner state in the event that retransmitted requests are received. However, the period to hold this state is implementation specific. In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is retransmitted after the server has previously released the nfs_lockowner state, the server will find that the nfs_lockowner has no files open and an error will be returned to the client. If the nfs_lockowner does have a file open, the stateid will not match and @@ -2839,48 +3051,49 @@ previously released by the server, the use of the OPEN_CONFIRM operation will prevent incorrect behavior. When the server observes the use of the nfs_lockowner for the first time, it will direct the client to perform the OPEN_CONFIRM for the corresponding OPEN. This sequence establishes the use of an nfs_lockowner and associated sequence number. See the section "OPEN_CONFIRM - Confirm Open" for further details. 8.2. Lock Ranges - The protocol allows a lock owner to request a lock with one byte - range and then either upgrade or unlock a sub-range of the initial - lock. It is expected that this will be an uncommon type of request. - In any case, servers or server file systems may not be able to - support sub-range lock semantics. In the event that a server - receives a locking request that represents a sub-range of current - locking state for the lock owner, the server is allowed to return the - error NFS4ERR_LOCK_RANGE to signify that it does not support sub- - range lock operations. Therefore, the client should be prepared to - receive this error and, if appropriate, report the error to the - requesting application. + The protocol allows a lock owner to request a lock with a byte range + and then either upgrade or unlock a sub-range of the initial lock. + It is expected that this will be an uncommon type of request. In any + case, servers or server file systems may not be able to support sub- + range lock semantics. In the event that a server receives a locking + request that represents a sub-range of current locking state for the + lock owner, the server is allowed to return the error + NFS4ERR_LOCK_RANGE to signify that it does not support sub-range lock + operations. Therefore, the client should be prepared to receive this + error and, if appropriate, report the error to the requesting + application. The client is discouraged from combining multiple independent locking ranges that happen to be adjacent into a single request since the server may not support sub-range requests and for reasons related to the recovery of file locking state in the event of server failure. As discussed in the section "Server Failure and Recovery" below, the server may employ certain optimizations during recovery that work effectively only when the client's behavior during lock recovery is similar to the client's locking behavior prior to server failure. -Draft Specification NFS version 4 Protocol November 2001 - 8.3. Blocking Locks Some clients require the support of blocking locks. The NFS version 4 protocol must not rely on a callback mechanism and therefore is unable to notify a client when a previously denied lock has been + +Draft Specification NFS version 4 Protocol July 2002 + granted. Clients have no choice but to continually poll for the lock. This presents a fairness problem. Two new lock types are added, READW and WRITEW, and are used to indicate to the server that the client is requesting a blocking lock. The server should maintain an ordered list of pending blocking locks. When the conflicting lock is released, the server may wait the lease period for the first waiting client to re-request the lock. After the lease period expires the next waiting client request is allowed the lock. Clients are required to poll at an interval sufficiently small that it is likely to acquire the lock in a timely manner. The server is not @@ -2905,36 +3118,36 @@ renewals may not be denied if the lease interval has not expired. The following events cause implicit renewal of all of the leases for a given client (i.e. all those sharing a given clientid). Each of these is a positive indication that the client is still active and that the associated state held at the server, for the client, is still valid. o An OPEN with a valid clientid. - o Any operation made with a valid stateid (CLOSE, DELEGRETURN, - LOCK, LOCKU, OPEN, OPEN_CONFIRM, READ, RENEW, SETATTR, WRITE). - This does not include the special stateids of all bits 0 or all - bits 1. + o Any operation made with a valid stateid (CLOSE, DELEGPURGE, + DELEGRETURN, LOCK, LOCKU, OPEN, OPEN_CONFIRM, OPEN_DOWNGRADE, + READ, RENEW, SETATTR, SETCLIENTID_CONFIRM, WRITE). This does + not include the special stateids of all bits 0 or all bits 1. Note that if the client had restarted or rebooted, the client would not be making these requests without issuing - the SETCLIENTID operation. The use of the SETCLIENTID + the SETCLIENTID/SETCLIENTID_CONFIRM sequence. The use of + the SETCLIENTID/SETCLIENTID_CONFIRM operations notifies the + server to drop the locking state associated with the + client. -Draft Specification NFS version 4 Protocol November 2001 + If the server has rebooted, the stateids - operation (possibly with the addition of the optional - SETCLIENTID_CONFIRM operation) notifies the server to drop - the locking state associated with the client. +Draft Specification NFS version 4 Protocol July 2002 - If the server has rebooted, the stateids (NFS4ERR_STALE_STATEID error) or the clientid (NFS4ERR_STALE_CLIENTID error) will not be valid hence preventing spurious renewals. This approach allows for low overhead lease renewal which scales well. In the typical case no extra RPC calls are required for lease renewal and in the worst case one RPC is required every lease period (i.e. a RENEW operation). The number of locks held by the client is not a factor since all state for the client is involved with the lease renewal action. @@ -2960,33 +3173,34 @@ locks when the associated leases have expired. Conflicting locks from another client may only be granted after this lease expiration. If the client is able to restart or reinitialize within the lease period the client may be forced to wait the remainder of the lease period before obtaining new locks. To minimize client delay upon restart, lock requests are associated with an instance of the client by a client supplied verifier. This verifier is part of the initial SETCLIENTID call made by the client. The server returns a clientid as a result of the SETCLIENTID - operation. The client then confirms the use of the verifier with + operation. The client then confirms the use of the clientid with SETCLIENTID_CONFIRM. The clientid in combination with an opaque owner field is then used by the client to identify the lock owner for OPEN. This chain of associations is then used to identify all locks for a particular client. -Draft Specification NFS version 4 Protocol November 2001 - Since the verifier will be changed by the client upon each initialization, the server can compare a new verifier to the verifier associated with currently held locks and determine that they do not match. This signifies the client's new instantiation and subsequent loss of locking state. As a result, the server is free to release + +Draft Specification NFS version 4 Protocol July 2002 + all locks held which are associated with the old clientid which was derived from the old verifier. For secure environments, a change in the verifier must only cause the release of locks associated with the authenticated requester. This is required to prevent a rogue entity from freeing otherwise valid locks. Note that the verifier must have the same uniqueness properties of the verifier for the COMMIT operation. @@ -3019,28 +3233,28 @@ CLAIM_PREVIOUS). During the grace period, the server must reject READ and WRITE operations and non-reclaim locking requests (i.e. other LOCK and OPEN operations) with an error of NFS4ERR_GRACE. If the server can reliably determine that granting a non-reclaim request will not conflict with reclamation of locks by other clients, the NFS4ERR_GRACE error does not have to be returned and the non- reclaim client request can be serviced. For the server to be able to service READ and WRITE operations during the grace period, it must again be able to guarantee that no possible conflict could arise - -Draft Specification NFS version 4 Protocol November 2001 - between an impending reclaim locking request and the READ or WRITE operation. If the server is unable to offer that guarantee, the NFS4ERR_GRACE error must be returned to the client. For a server to provide simple, valid handling during the grace + +Draft Specification NFS version 4 Protocol July 2002 + period, the easiest method is to simply reject all non-reclaim locking requests and READ and WRITE operations by returning the NFS4ERR_GRACE error. However, a server may keep information about granted locks in stable storage. With this information, the server could determine if a regular lock or READ or WRITE operation can be safely processed. For example, if a count of locks on a given file is available in stable storage, the server can track reclaimed locks for the file and when all reclaims have been processed, non-reclaim locking requests @@ -3073,28 +3287,28 @@ 8.5.3. Network Partitions and Recovery If the duration of a network partition is greater than the lease period provided by the server, the server will have not received a lease renewal from the client. If this occurs, the server may free all locks held for the client. As a result, all stateids held by the client will become invalid or stale. Once the client is able to reach the server after such a network partition, all I/O submitted by the client with the now invalid stateids will fail with the server returning the error NFS4ERR_EXPIRED. Once this error is received, - -Draft Specification NFS version 4 Protocol November 2001 - the client will suitably notify the application that held the lock. 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 + +Draft Specification NFS version 4 Protocol July 2002 + 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 continues to hold locks beyond the expiration of a client's lease, the server MUST employ a method of recording this fact in its stable storage. Conflicting locks requests from another client may be serviced after the lease expiration. There are various scenarios involving server failure after such an event that require the storage of these lease expirations or network partitions. One @@ -3122,32 +3336,32 @@ conflicting lock. The choice of the amount and type of state information that is stored is left to the implementor. In any case, the server must have enough state information to enable correct recovery from multiple partitions and multiple server failures. 8.6. Recovery from a Lock Request Timeout or Abort In the event a lock request times out, a client may decide to not retry the request. The client may also abort the request when the process for which it was issued is terminated (e.g. in UNIX due to a - signal. It is possible though that the server received the request + signal). It is possible though that the server received the request and acted upon it. This would change the state on the server without the client being aware of the change. It is paramount that the client re-synchronize state with server before it attempts any other - -Draft Specification NFS version 4 Protocol November 2001 - operation that takes a seqid and/or a stateid with the same nfs_lockowner. This is straightforward to do without a special re- synchronize operation. Since the server maintains the last lock request and response + +Draft Specification NFS version 4 Protocol July 2002 + received on the nfs_lockowner, for each nfs_lockowner, the client should cache the last lock request it sent such that the lock request did not receive a response. From this, the next time the client does a lock operation for the nfs_lockowner, it can send the cached request, if there is one, and if the request was one that established state (e.g. a LOCK or OPEN operation) the client can follow up with a request to remove the state (e.g. a LOCKU or CLOSE operation). With this approach, the sequencing and stateid information on the client and server for the given nfs_lockowner will re-synchronize and in turn the lock state will re-synchronize. @@ -3180,28 +3394,28 @@ have occurred on the server and thus determine if it is possible that a lease period expiration could have occurred. The third lock revocation event can occur as a result of administrative intervention within the lease period. While this is considered a rare event, it is possible that the server's administrator has decided to release or revoke a particular lock held by the client. As a result of revocation, the client will receive an error of NFS4ERR_EXPIRED and the error is received within the lease period for the lock. In this instance the client may assume that - -Draft Specification NFS version 4 Protocol November 2001 - only the nfs_lockowner's locks have been lost. The client notifies the lock holder appropriately. The client may not assume the lease period has been renewed as a result of failed operation. When the client determines the lease period may have expired, the + +Draft Specification NFS version 4 Protocol July 2002 + client must mark all locks held for the associated lease as "unvalidated". This means the client has been unable to re-establish or confirm the appropriate lock state with the server. As described in the previous section on crash recovery, there are scenarios in which the server may grant conflicting locks after the lease period has expired for a client. When it is possible that the lease period has expired, the client must validate each lock currently held to ensure that a conflicting lock has not been granted. The client may accomplish this task by issuing an I/O request, either a pending I/O or a zero-length read, specifying the stateid associated with the @@ -3232,27 +3446,28 @@ const OPEN4_SHARE_ACCESS_READ = 0x00000001; const OPEN4_SHARE_ACCESS_WRITE = 0x00000002; const OPEN4_SHARE_ACCESS_BOTH = 0x00000003; const OPEN4_SHARE_DENY_NONE = 0x00000000; const OPEN4_SHARE_DENY_READ = 0x00000001; const OPEN4_SHARE_DENY_WRITE = 0x00000002; const OPEN4_SHARE_DENY_BOTH = 0x00000003; -Draft Specification NFS version 4 Protocol November 2001 - 8.9. OPEN/CLOSE Operations To provide correct share semantics, a client MUST use the OPEN operation to obtain the initial filehandle and indicate the desired access and what if any access to deny. Even if the client intends to + +Draft Specification NFS version 4 Protocol July 2002 + use a stateid of all 0's or all 1's, it must still obtain the filehandle for the regular file with the OPEN operation so the appropriate share semantics can be applied. For clients that do not have a deny mode built into their open programming interfaces, deny equal to NONE should be used. The OPEN operation with the CREATE flag, also subsumes the CREATE operation for regular files as used in previous versions of the NFS protocol. This allows a create with a share to be done atomically. @@ -3285,28 +3500,28 @@ in the OPEN'ed object being designated by the same filehandle. When the server chooses to export multiple filehandles corresponding to the same file object and returns different filehandles on two different OPEN's of the same file object, the server MUST NOT "OR" together the access and deny bits and coalesce the two open files. Instead the server must maintain separate OPEN's with separate stateid's and will require separate CLOSE's to free them. When multiple open files on the client are merged into a single open - -Draft Specification NFS version 4 Protocol November 2001 - file object on the server, the close of one of the open files (on the client) may necessitate change of the access and deny status of the open file on the server. This is because the union of the access and deny bits for the remaining open's may be smaller (i.e. a proper subset) than previously. The OPEN_DOWNGRADE operation is used to + +Draft Specification NFS version 4 Protocol July 2002 + make the necessary change and the client should use it to update the server so that share reservation requests by other clients are handled properly. 8.11. Short and Long Leases When determining the time period for the server lease, the usual lease tradeoffs apply. Short leases are good for fast server recovery at a cost of increased RENEW or READ (with zero length) requests. Longer leases are certainly kinder and gentler to large @@ -3334,29 +3549,30 @@ retransmitted. To take propagation delay into account, the client should subtract it from lease times (e.g. if the client estimates the one-way propagation delay as 200 msec, then it can assume that the lease is already 200 msec old when it gets it). In addition, it will take another 200 msec to get a response back to the server. So the client must send a lock renewal or write data back to the server 400 msec before the lease would expire. -Draft Specification NFS version 4 Protocol November 2001 - 8.13. Migration, Replication and State When responsibility for handling a given file system is transferred to a new server (migration) or the client chooses to use an alternate server (e.g. in response to server unresponsiveness) in the context of file system replication, the appropriate handling of state shared between the client and server (i.e. locks, leases, stateid's, and + +Draft Specification NFS version 4 Protocol July 2002 + clientid's) is as described below. The handling differs between migration and replication. For related discussion of file server state and recover of such see the sections under "File Locking and Share Reservations" 8.13.1. Migration and State In the case of migration, the servers involved in the migration of a file system SHOULD transfer all server state from the original to the new server. This must be done in a way that is transparent to the @@ -3386,30 +3602,30 @@ client must be prepared to receive either NFS4ERR_STALE_CLIENTID or NFS4ERR_STALE_STATEID from the new server. The client should then recover its state information as it normally would in response to a server failure. The new server must take care to allow for the recovery of state information as it would in the event of server restart. 8.13.2. Replication and State Since client switch-over in the case of replication is not under - -Draft Specification NFS version 4 Protocol November 2001 - server control, the handling of state is different. In this case, leases, stateid's and clientid's do not have validity across a transition from one server to another. The client must re-establish its locks on the new server. This can be compared to the re- establishment of locks by means of reclaim-type requests after a server reboot. The difference is that the server has no provision to distinguish requests reclaiming locks from those obtaining new locks + +Draft Specification NFS version 4 Protocol July 2002 + or to defer the latter. Thus, a client re-establishing a lock on the new server (by means of a LOCK or OPEN request), may have the requests denied due to a conflicting lock. Since replication is intended for read-only use of filesystems, such denial of locks should not pose large difficulties in practice. When an attempt to re-establish a lock on a new server is denied, the client should treat the situation as if his original lock had been revoked. 8.13.3. Notification of Migrated Lease @@ -3434,21 +3650,21 @@ perform some operation, such as a RENEW, on each file system associated with the server in question. When the client receives an NFS4ERR_MOVED error, the client can follow the normal process to obtain the new server information (through the fs_locations attribute) and perform renewal of those leases on the new server. If the server has not had state transferred to it transparently, it will receive either NFS4ERR_STALE_CLIENTID or NFS4ERR_STALE_STATEID from the new server, as described above, and can then recover state information as it does in the event of server failure. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 9. Client-Side Caching Client-side caching of data, of file attributes, and of file names is essential to providing good performance with the NFS protocol. Providing distributed cache coherence is a difficult problem and previous versions of the NFS protocol have not attempted it. Instead, several NFS client implementation techniques have been used to reduce the problems that a lack of coherence poses for users. These techniques have not been clearly defined by earlier protocol @@ -3488,21 +3704,21 @@ performance is to allow a client that repeatedly opens a file to do so without reference to the server. This is done until potentially conflicting operations from another client actually occur. A similar situation arises in connection with file locking. Sending file lock and unlock requests to the server as well as the read and write requests necessary to make data caching consistent with the locking semantics (see the section "Data Caching and File Locking") can severely limit performance. When locking is used to provide -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 protection against infrequent conflicts, a large penalty is incurred. This penalty may discourage the use of file locking by applications. The NFS version 4 protocol provides more aggressive caching strategies with the following design goals: o Compatibility with a large range of server semantics. o Provide the same caching benefits as previous versions of the @@ -3541,21 +3757,21 @@ on them. Preliminary testing of callback functionality by means of a CB_NULL procedure determines whether callbacks can be supported. The CB_NULL procedure checks the continuity of the callback path. A server makes a preliminary assessment of callback availability to a given client and avoids delegating responsibilities until it has determined that callbacks are supported. Because the granting of a delegation is always conditional upon the absence of conflicting access, clients must not assume that a delegation will be granted and they must always be prepared for OPENs to be processed without any -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 delegations being granted. Once granted, a delegation behaves in most ways like a lock. There is an associated lease that is subject to renewal together with all of the other leases held by that client. Unlike locks, an operation by a second client to a delegated file will cause the server to recall a delegation through a callback. @@ -3594,21 +3810,21 @@ There are three situations that delegation recovery must deal with: o Client reboot or restart o Server reboot or restart o Network partition (full or callback-only) In the event the client reboots or restarts, the failure to renew -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 leases will result in the revocation of record locks and share reservations. Delegations, however, may be treated a bit differently. There will be situations in which delegations will need to be reestablished after a client reboots or restarts. The reason for this is the client may have file data stored locally and this data was associated with the previously held delegations. The client will need to reestablish the appropriate file state on the server. @@ -3648,21 +3864,21 @@ are to be continued. o The use of callbacks is not to be depended upon until the client has proven its ability to receive them. When a network partition occurs, delegations are subject to freeing by the server when the lease renewal period expires. This is similar to the behavior for locks and share reservations. For delegations, however, the server may extend the period in which conflicting -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 requests are held off. Eventually the occurrence of a conflicting request from another client will cause revocation of the delegation. A loss of the callback path (e.g. by later network configuration change) will have the same effect. A recall request will fail and revocation of the delegation will result. A client normally finds out about revocation of a delegation when it uses a stateid associated with a delegation and receives the error NFS4ERR_EXPIRED. It also may find out about delegation revocation @@ -3701,21 +3917,21 @@ data to applications or modify it on behalf of an application when it would not be valid to obtain or modify that same data via a READ or WRITE operation. Furthermore, in the absence of open delegation (see the section "Open Delegation") two additional rules apply. Note that these rules are obeyed in practice by many NFS version 2 and version 3 clients. o First, cached data present on a client must be revalidated after -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 doing an OPEN. This is to ensure that the data for the OPENed file is still correctly reflected in the client's cache. This validation must be done at least when the client's OPEN operation includes DENY=WRITE or BOTH thus terminating a period in which other clients may have had the opportunity to open the file with WRITE access. Clients may choose to do the revalidation more often (i.e. at OPENs specifying DENY=NONE) to parallel the NFS version 3 protocol's practice for the benefit of users assuming this degree of cache revalidation. @@ -3755,21 +3971,21 @@ o First, when a client obtains a file lock for a particular region, the data cache corresponding to that region (if any cache data exists) must be revalidated. If the change attribute indicates that the file may have been updated since the cached data was obtained, the client must flush or invalidate the cached data for the newly locked region. A client might choose to invalidate all of non-modified cached data that it has for the file but the only requirement for correct operation is to invalidate all of the data in the newly locked region. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 o Second, before releasing a write lock for a region, all modified data for that region must be flushed to the server. The modified data must also be written to stable storage. Note that flushing data to the server and the invalidation of cached data must reflect the actual byte ranges locked or unlocked. Rounding these up or down to reflect client cache block boundaries will cause problems if not carefully done. For example, writing a modified block when only half of that block is within an area being @@ -3809,21 +4025,21 @@ areas covered by an appropriate record lock and those for which there are modifications not covered by a record lock. Any writes done for the former class of files must not include areas not locked and thus not modified on the client. 9.3.3. Data Caching and Mandatory File Locking Client side data caching needs to respect mandatory file locking when it is in effect. The presence of mandatory file locking for a given -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 file is indicated in the result flags for an OPEN. When mandatory locking is in effect for a file, the client must check for an appropriate file lock for data being read or written. If a lock exists for the range being read or written, the client may satisfy the request using the client's validated cache. If an appropriate file lock is not held for the range of the read or write, the read or write request must not be satisfied by the client's cache and the request must be sent to the server for processing. When a read or write request partially overlaps a locked region, the request should @@ -3862,29 +4078,29 @@ the same server side object: o If GETATTR directed to two filehandles have different values of the fsid attribute, then the filehandles represent distinct objects. o If GETATTR for any file with an fsid that matches the fsid of the two filehandles in question returns a unique_handles attribute with a value of TRUE, then the two objects are -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 distinct. o If GETATTR directed to the two filehandles does not return the - fileid attribute for one or both of the handles, then the it - cannot be determined whether the two objects are the same. - Therefore, operations which depend on that knowledge (e.g. - client side data caching) cannot be done reliably. + fileid attribute for one or both of the handles, then it cannot + be determined whether the two objects are the same. Therefore, + operations which depend on that knowledge (e.g. client side data + caching) cannot be done reliably. o If GETATTR directed to the two filehandles returns different values for the fileid attribute, then they are distinct objects. o Otherwise they are the same object. 9.4. Open Delegation When a file is being OPENed, the server may delegate further handling of opens and closes for that file to the opening client. Any such @@ -3916,34 +4132,34 @@ o The existence of any server-specific semantics of OPEN/CLOSE that would make the required handling incompatible with the prescribed handling that the delegated client would apply (see below). There are two types of open delegations, read and write. A read open delegation allows a client to handle, on its own, requests to open a file for reading that do not deny read access to others. Multiple read open delegations may be outstanding simultaneously and do not -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 conflict. A write open delegation allows the client to handle, on its own, all opens. Only one write open delegation may exist for a given file at a given time and it is inconsistent with any read open delegations. When a client has a read open delegation, it may not make any changes to the contents or attributes of the file but it is assured that no other client may do so. When a client has a write open delegation, it may modify the file data since no other client will be accessing the file's data. The client holding a write delegation may only affect file attributes which are intimately connected with the file - data: object_size, time_modify, change. + data: size, time_modify, change. When a client has an open delegation, it does not send OPENs or CLOSEs to the server but updates the appropriate status internally. For a read open delegation, opens that cannot be handled locally (opens for write or that deny read access) must be sent to the server. When an open delegation is made, the response to the OPEN contains an open delegation structure which specifies the following: @@ -3969,21 +4185,21 @@ being denied so that the checks can be made by the server itself. o The access and deny bits for the request and the file as described in the section "Share Reservations". o The read and write permissions as determined below. The nfsace4 passed with delegation can be used to avoid frequent ACCESS calls. The permission check should be as follows: -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 o If the nfsace4 indicates that the open may be done, then it should be granted without reference to the server. o If the nfsace4 indicates that the open may not be done, then an ACCESS request must be sent to the server to obtain the definitive answer. The server may return an nfsace4 that is more restrictive than the actual ACL of the file. This includes an nfsace4 that specifies @@ -4023,21 +4239,21 @@ Therefore, READs or WRITEs with a special stateid done by another client will force the server to recall a write open delegation. A WRITE with a special stateid done by another client will force a recall of read open delegations. With delegations, a client is able to avoid writing data to the server when the CLOSE of a file is serviced. The CLOSE operation is the usual point at which the client is notified of a lack of stable storage for the modified file data generated by the application. At -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 the CLOSE, file data is written to the server and through normal accounting the server is able to determine if the available file system space for the data has been exceeded (i.e. server returns NFS4ERR_NOSPC or NFS4ERR_DQUOT). This accounting includes quotas. The introduction of delegations requires that a alternative method be in place for the same type of communication to occur between client and server. In the delegation response, the server provides either the limit of @@ -4075,21 +4291,21 @@ locking. This can be done since the delegation implies that there can be no conflicting locks. Similarly, all of the revalidations that would normally be associated with obtaining locks and the flushing of data associated with the releasing of locks need not be done. 9.4.3. Recall of Open Delegation The following events necessitate recall of an open delegation: -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 o Potentially conflicting OPEN request (or READ/WRITE done with "special" stateid) o SETATTR issued by another client o REMOVE request for the file o RENAME request for the file as either source or target of the RENAME @@ -4103,21 +4319,21 @@ In addition to the situations above, the server may choose to recall open delegations at any time if resource constraints make it advisable to do so. Clients should always be prepared for the possibility of recall. The server needs to employ special handling for a GETATTR where the target is a file that has a write open delegation in effect. In this case, the client holding the delegation needs to be interrogated. The server will use a CB_GETATTR callback, if the GETATTR attribute bits include any of the attributes that a write open delegate may - modify (object_size, time_modify, change). + modify (size, time_modify, change). When a client receives a recall for an open delegation, it needs to update state on the server before returning the delegation. These same updates must be done whenever a client chooses to return a delegation voluntarily. The following items of state need to be dealt with: o If the file associated with the delegation is no longer open and no previous CLOSE operation has been sent to the server, a CLOSE operation must be sent to the server. @@ -4129,39 +4345,39 @@ OPEN requests are done with the claim type of CLAIM_DELEGATE_CUR. This will allow the presentation of the delegation stateid so that the client can establish the appropriate rights to perform the OPEN. (see the section "Operation 18: OPEN" for details.) o If there are granted file locks, the corresponding LOCK operations need to be performed. This applies to the write open delegation case only. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 o For a write open delegation, if at the time of recall the file is not open for write, all modified data for the file must be flushed to the server. If the delegation had not existed, the client would have done this data flush before the CLOSE operation. o For a write open delegation when a file is still open at the time of recall, any modified data for the file needs to be flushed to the server. o With the write open delegation in place, it is possible that the file was truncated during the duration of the delegation. For example, the truncation could have occurred as a result of an - OPEN UNCHECKED with a object_size attribute value of zero. - Therefore, if a truncation of the file has occurred and this - operation has not been propagated to the server, the truncation - must occur before any modified data is written to the server. + OPEN UNCHECKED with a size attribute value of zero. Therefore, + if a truncation of the file has occurred and this operation has + not been propagated to the server, the truncation must occur + before any modified data is written to the server. In the case of write open delegation, file locking imposes some additional requirements. The flushing of any modified data in any region for which a write lock was released while the write open delegation was in effect is what is required to precisely maintain the associated invariant. However, because the write open delegation implies no other locking by other clients, a simpler implementation is to flush all modified data for the file (as described just above) if any write lock has been released while the write open delegation was in effect. @@ -4182,21 +4398,21 @@ Recovery for Write Open Delegation" for additional details. 9.5. Data Caching and Revocation When locks and delegations are revoked, the assumptions upon which successful caching depend are no longer guaranteed. The owner of the locks or share reservations which have been revoked needs to be notified. This notification includes applications with a file open that has a corresponding delegation which has been revoked. Cached -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 data associated with the revocation must be removed from the client. In the case of modified data existing in the client's cache, that data must be removed from the client without it being written to the server. As mentioned, the assumptions made by the client are no longer valid at the point when a lock or delegation has been revoked. For example, another client may have been granted a conflicting lock after the revocation of the lock at the first client. Therefore, the data within the lock range may have been modified by the other client. Obviously, the first client is unable to guarantee to the @@ -4232,39 +4448,39 @@ name in the file system name space to ease recovery. Unless the client can determine that the file has not modified by any other client, this technique must be limited to situations in which a client has a complete cached copy of the file in question. Use of such a technique may be limited to files under a certain size or may only be used when sufficient disk space is guaranteed to be available within the target file system and when the client has sufficient buffering resources to keep the cached copy available until it is properly stored to the target file system. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 9.6. Attribute Caching The attributes discussed in this section do not include named attributes. Individual named attributes are analogous to files and caching of the data for these needs to be handled just as data caching is for ordinary files. Similarly, LOOKUP results from an OPENATTR directory are to be cached on the same basis as any other pathnames and similarly for directory contents. Clients may cache file attributes obtained from the server and use them to avoid subsequent GETATTR requests. Such caching is write through in that modification to file attributes is always done by means of requests to the server and should not be done locally and cached. The exception to this are modifications to attributes that are intimately connected with data caching. Therefore, extending a file by writing data to the local data cache is reflected immediately - in the object_size as seen on the client without this change being + in the size as seen on the client without this change being immediately reflected on the server. Normally such changes are not propagated directly to the server but when the modified data is flushed to the server, analogous attribute changes are made on the server. When open delegation is in effect, the modified attributes may be returned to the server in the response to a CB_RECALL call. The result of local caching of attributes is that the attribute caches maintained on individual clients will not be coherent. Changes made in one order on the server may be seen in a different order on one client and in a third order on a different client. @@ -4287,21 +4503,21 @@ server, the updated attribute set is requested as part of the containing RPC. This includes directory operations that update attributes indirectly. This is accomplished by following the modifying operation with a GETATTR operation and then using the results of the GETATTR to update the client's cached attributes. Note that if the full set of attributes to be cached is requested by READDIR, the results can be cached by the client on the same basis as attributes obtained via GETATTR. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 A client may validate its cached version of attributes for a file by fetching only the change attribute and assuming that if the change attribute has the same value as it did when the attributes were cached, then no attributes have changed. The possible exception is the attribute time_access. 9.7. Name Caching The results of LOOKUP and READDIR operations may be cached to avoid @@ -4341,21 +4557,21 @@ indicates no modification, the name cache can be updated on the client to reflect the directory operation and the associated timeout extended. The post-operation change value needs to be saved as the basis for future change_info4 comparisons. As demonstrated by the scenario above, name caching requires that the client revalidate name cache data by inspecting the change attribute of a directory at the point when the name cache item was cached. This requires that the server update the change attribute for -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 directories when the contents of the corresponding directory is modified. For a client to use the change_info4 information appropriately and correctly, the server must report the pre and post operation change attribute values atomically. When the server is unable to report the before and after values atomically with respect to the directory operation, the server must indicate that fact in the change_info4 return value. When the information is not atomically reported, the client should not assume that other clients have not changed the directory. @@ -4395,25 +4611,25 @@ This requires that the server update the change attribute for directories when the contents of the corresponding directory is modified. For a client to use the change_info4 information appropriately and correctly, the server must report the pre and post operation change attribute values atomically. When the server is unable to report the before and after values atomically with respect to the directory operation, the server must indicate that fact in the change_info4 return value. When the information is not atomically reported, the client should not assume that other clients have not -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 changed the directory. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 10. Minor Versioning To address the requirement of an NFS protocol that can evolve as the need arises, the NFS version 4 protocol contains the rules and framework to allow for future minor changes or versioning. The base assumption with respect to minor versioning is that any future accepted minor version must follow the IETF process and be documented in a standards track RFC. Therefore, each minor version @@ -4448,21 +4664,21 @@ documented attribute. Since attribute results are specified as an opaque array of per-attribute XDR encoded results, the complexity of adding new attributes in the midst of the current definitions will be too burdensome. 3 Minor versions must not modify the structure of an existing operation's arguments or results. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 Again the complexity of handling multiple structure definitions for a single operation is too burdensome. New operations should be added instead of modifying existing structures for a minor version. This rule does not preclude the following adaptations in a minor version. o adding bits to flag fields such as new attributes to @@ -4496,21 +4712,21 @@ the request as an XDR decode error. This approach allows for the obsolescence of an operation while maintaining its structure so that a future minor version can reintroduce the operation. 8.1 Minor versions may declare attributes mandatory to NOT implement. 8.2 Minor versions may declare flag bits or enumeration values as mandatory to NOT implement. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 9 Minor versions may downgrade features from mandatory to recommended, or recommended to optional. 10 Minor versions may upgrade features from optional to recommended or recommended to mandatory. 11 A client and server that support minor version X must support minor versions 0 (zero) through X-1 as well. @@ -4519,21 +4735,21 @@ This rule allows for the introduction of new functionality and forces the use of implementation experience before designating a feature as mandatory. 13 A client MUST NOT attempt to use a stateid, file handle, or similar returned object from the COMPOUND procedure with minor version X for another COMPOUND procedure with minor version Y, where X != Y. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 11. Internationalization The primary issue in which NFS needs to deal with internationalization, or I18N, is with respect to file names and other strings as used within the protocol. The choice of string representation must allow reasonable name/string access to clients which use various languages. The UTF-8 encoding of the UCS as defined by [ISO10646] allows for this type of access and follows the policy described in "IETF Policy on Character Sets and Languages", @@ -4574,21 +4790,21 @@ server like: /component-1/component-2/component-3 Each component could have been created with a different locale. If one issues CREATE with multi-component path name, and if some of the leading components already exist, what is to be done with the existing components? Is the current locale attribute replaced with the user's current one? These types of situations quickly become too -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 complex when there is an alternate solution. If the NFS version 4 protocol used a universal 16 bit or 32 bit character set (or an encoding of a 16 bit or 32 bit character set into octets), then the server and client need not care if the locale of the user accessing the file is different than the locale of the user who created the file. The unique 16 bit or 32 bit encoding of the character allows for determination of what language the character is from and also how to display that character on the client. The @@ -4624,21 +4840,21 @@ UCS-4 a four octet per character encoding that permits the encoding of up to 2^31 characters. UTF UTF is an abbreviation of the term "UCS transformation format" and is used in the naming of various standards for encoding of UCS characters as described below. UTF-1 Only historical interest; it has been removed from 10646-1 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 UTF-7 Encodes the entire "repertoire" of UCS "characters using only octets with the higher order bit clear". [RFC2152] describes UTF-7. UTF-7 accomplishes this by reserving one of the 7bit US-ASCII characters as a "shift" character to indicate non-US-ASCII characters. UTF-8 Unlike UTF-7, uses all 8 bits of the octets. US-ASCII characters are encoded as before unchanged. Any octet with the high bit cleared can only mean a US-ASCII character. @@ -4675,21 +4891,21 @@ UTF-8 solves problems for NFS that exist with the use of UCS and Unicode. UTF-8 will encode 16 bit and 32 bit characters in a way that will be compact for most users. The encoding table from UCS-4 to UTF-8, as copied from [RFC2279]: UCS-4 range (hex.) UTF-8 octet sequence (binary) 0000 0000-0000 007F 0xxxxxxx 0000 0080-0000 07FF 110xxxxx 10xxxxxx 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 0001 0000-001F FFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 0020 0000-03FF FFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 0400 0000-7FFF FFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx See [RFC2279] for precise encoding and decoding rules. Note because of UTF-16, the algorithm from Unicode/UCS-2 to UTF-8 needs to account for the reserved range between D800 and DFFF. @@ -4726,75 +4942,77 @@ The NFS version 4 protocol does not mandate the use of a particular normalization form at this time. A later revision of this specification may specify a particular normalization form. Therefore, the server and client can expect that they may receive unnormalized characters within protocol requests and responses. If the operating environment requires normalization, then the implementation must normalize the various UTF-8 encoded strings within the protocol before presenting the information to an application (at the client) or local file system (at the server). -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 12. Error Definitions NFS error numbers are assigned to failed operations within a compound request. A compound request contains a number of NFS operations that have their results encoded in sequence in a compound reply. The results of successful operations will consist of an NFS4_OK status followed by the encoded results of the operation. If an NFS operation fails, an error status will be entered in the reply and the compound request will be terminated. A description of each defined error follows: NFS4_OK Indicates the operation completed successfully. - NFS4ERR_ACCES Permission denied. The caller does not have the + NFS4ERR_ACCESS Permission denied. The caller does not have the correct permission to perform the requested operation. Contrast this with NFS4ERR_PERM, which restricts itself to owner or privileged user permission failures. NFS4ERR_ATTRNOTSUPP An attribute specified is not supported by the server. Does not apply to the GETATTR operation. NFS4ERR_BADHANDLE Illegal NFS file handle. The file handle failed internal consistency checks. + NFS4ERR_BADOWNER An owner, owner_group, or ACL attribute value + can not be translated to local representation. + NFS4ERR_BADTYPE An attempt was made to create an object of a type not supported by the server. NFS4ERR_BAD_COOKIE READDIR cookie is stale. NFS4ERR_BAD_SEQID The sequence number in a locking request is neither the next expected number or the last number processed. NFS4ERR_BAD_STATEID A stateid generated by the current server instance, but which does not designate any locking state (either current or superseded) for a current lockowner-file pair, was used. NFS4ERR_BADXDR The server encountered an XDR decoding error while processing an operation. NFS4ERR_CLID_INUSE The SETCLIENTID procedure has found that a client id is already in use by another client. +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_DELAY The server initiated the request, but was not able to complete it in a timely fashion. The client should wait and then try the request - -Draft Specification NFS version 4 Protocol November 2001 - with a new RPC transaction ID. For example, this error should be returned from a server that supports hierarchical storage and receives a request to process a file that has been migrated. In this case, the server should start the immigration process and respond to client with this error. This error may also occur when a necessary delegation recall makes processing a request in a timely fashion impossible. @@ -4830,26 +5048,26 @@ server that does not support this operation. NFS4ERR_IO I/O error. A hard error (for example, a disk error) occurred while processing the requested operation. NFS4ERR_ISDIR Is a directory. The caller specified a directory in a non-directory operation. NFS4ERR_LEASE_MOVED A lease being renewed is associated with a file - system that has been migrated to a new server. - NFS4ERR_LOCKED A read or write operation was attempted on a +Draft Specification NFS version 4 Protocol July 2002 -Draft Specification NFS version 4 Protocol November 2001 + system that has been migrated to a new server. + NFS4ERR_LOCKED A read or write operation was attempted on a locked file. NFS4ERR_LOCK_RANGE A lock request is operating on a sub-range of a current lock for the lock owner and the server does not support this type of request. NFS4ERR_MINOR_VERS_MISMATCH The server has received a request that specifies an unsupported minor version. The server must return a COMPOUND4res with a zero @@ -4885,37 +5103,42 @@ state has not been provided to another client. NFS4ERR_NOSPC No space left on device. The operation would have caused the server's file system to exceed its limit. NFS4ERR_NOTDIR Not a directory. The caller specified a non- directory in a directory operation. NFS4ERR_NOTEMPTY An attempt was made to remove a directory that + +Draft Specification NFS version 4 Protocol July 2002 + was not empty. NFS4ERR_NOTSUPP Operation is not supported. -Draft Specification NFS version 4 Protocol November 2001 - NFS4ERR_NOT_SAME This error is returned by the VERIFY operation to signify that the attributes compared were not the same as provided in the client's request. NFS4ERR_NXIO I/O error. No such device or address. NFS4ERR_OLD_STATEID A stateid which designates the locking state for a lockowner-file at an earlier time was used. + NFS4ERR_OPENMODE The client attempted a READ, WRITE, or SETATTR + operation not sanctioned by the stateid passed + (e.g. writing to a file opened only for read). + NFS4ERR_PERM Not owner. The operation was not allowed because the caller is either not a privileged user (root) or not the owner of the target of the operation. NFS4ERR_READDIR_NOSPC The encoded response to a READDIR request exceeds the size limit set by the initial request. NFS4ERR_RECLAIM_BAD The reclaim provided by the client does not @@ -4935,31 +5158,30 @@ resource exhaustion related to the processing of the COMPOUND procedure. NFS4ERR_ROFS Read-only file system. A modifying operation was attempted on a read-only file system. NFS4ERR_SAME This error is returned by the NVERIFY operation to signify that the attributes compared were the same as provided in the client's request. +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_SERVERFAULT An error occurred on the server which does not map to any of the legal NFS version 4 protocol error values. The client should translate this into an appropriate error. UNIX clients may choose to translate this to EIO. NFS4ERR_SHARE_DENIED An attempt to OPEN a file with a share reservation has failed because of a share - -Draft Specification NFS version 4 Protocol November 2001 - conflict. NFS4ERR_STALE Invalid file handle. The file handle given in the arguments was invalid. The file referred to by that file handle no longer exists or access to it has been revoked. NFS4ERR_STALE_CLIENTID A clientid not recognized by the server was used in a locking or SETCLIENTID_CONFIRM request. @@ -4975,21 +5197,21 @@ NFS4ERR_TOOSMALL Buffer or request is too small. NFS4ERR_WRONGSEC The security mechanism being used by the client for the procedure does not match the server's security policy. The client should change the security mechanism being used and retry the operation. NFS4ERR_XDEV Attempt to do a cross-device hard link. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 13. NFS Version 4 Requests For the NFS version 4 RPC program, there are two traditional RPC procedures: NULL and COMPOUND. All other functionality is defined as a set of operations and these operations are defined in normal XDR/RPC syntax and semantics. However, these operations are encapsulated within the COMPOUND procedure. This requires that the client combine one or more of the NFS version 4 operations into a single request. @@ -5012,59 +5234,65 @@ performance within high latency networks. The client can avoid cumulative latency of multiple RPCs by combining multiple dependent operations into a single COMPOUND procedure. A compound operation may provide for protocol simplification by allowing the client to combine basic procedures into a single request that is customized for the client's environment. The CB_COMPOUND procedure precisely parallels the features of COMPOUND as described above. - The basics of the COMPOUND procedures construction is: + The basic structure of the COMPOUND procedure is: - +-----------+-----------+-----------+-- - | op + args | op + args | op + args | - +-----------+-----------+-----------+-- + +-----+--------------+--------+-----------+-----------+-----------+-- + | tag | minorversion | numops | op + args | op + args | op + args | + +-----+--------------+--------+-----------+-----------+-----------+-- - and the reply looks like this: + and the reply's structure is: - +------------+-----------------------+-----------------------+-- - |last status | status + op + results | status + op + results | - +------------+-----------------------+-----------------------+-- + +------------+-----+--------+-----------------------+-- + |last status | tag | numres | status + op + results | + +------------+-----+--------+-----------------------+-- -13.2. Evaluation of a Compound Request + The numops and numres fields, used in the depiction above, represent + the count for the counted array encoding use to signify the number of + arguments or results encoded in the request and response. As per the + XDR encoding, these counts must match exactly the number of operation - The server will process the COMPOUND procedure by evaluating each of +Draft Specification NFS version 4 Protocol July 2002 -Draft Specification NFS version 4 Protocol November 2001 + arguments or results encoded. + +13.2. Evaluation of a Compound Request + The server will process the COMPOUND procedure by evaluating each of the operations within the COMPOUND procedure in order. Each component operation consists of a 32 bit operation code, followed by the argument of length determined by the type of operation. The results of each operation are encoded in sequence into a reply buffer. The results of each operation are preceded by the opcode and a status code (normally zero). If an operation results in a non-zero status code, the status will be encoded and evaluation of the compound sequence will halt and the reply will be returned. Note that evaluation stops even in the event of "non error" conditions such as NFS4ERR_SAME. There are no atomicity requirements for the operations contained within the COMPOUND procedure. The operations being evaluated as part of a COMPOUND request may be evaluated simultaneously with other COMPOUND requests that the server receives. It is the client's responsibility for recovering from any partially completed COMPOUND procedure. Partially completed COMPOUND procedures may occur at any point due to errors such as - NFS4ERR_RESOURCE and NFS4ERR_LONG_DELAY. This may occur even given - an otherwise valid operation string. Further, a server reboot which + NFS4ERR_RESOURCE and NFS4ERR_DELAY. This may occur even given an + otherwise valid operation string. Further, a server reboot which occurs in the middle of processing a COMPOUND procedure may leave the client with the difficult task of determining how far COMPOUND processing has proceeded. Therefore, the client should avoid overly complex COMPOUND procedures in the event of the failure of an operation within the procedure. Each operation assumes a "current" and "saved" filehandle that is available as part of the execution context of the compound request. Operations may set, change, or return the current filehandle. The "saved" filehandle is used for temporary storage of a filehandle @@ -5075,37 +5303,38 @@ NFS version 4 operations that modify the file system are synchronous. When an operation is successfully completed at the server, the client can depend that any data associated with the request is now on stable storage (the one exception is in the case of the file data in a WRITE operation with the UNSTABLE option specified). This implies that any previous operations within the same compound request are also reflected in stable storage. This behavior enables the client's ability to recover from a partially executed compound request which may resulted from the failure of the server. For + +Draft Specification NFS version 4 Protocol July 2002 + example, if a compound request contains operations A and B and the server is unable to send a response to the client, depending on the progress the server made in servicing the request the result of both operations may be reflected in stable storage or just operation A may be reflected. The server must not have just the results of operation B in stable storage. -Draft Specification NFS version 4 Protocol November 2001 - 13.4. Operation Values The operations encoded in the COMPOUND procedure are identified by operation values. To avoid overlap with the RPC procedure numbers, operations 0 (zero) and 1 are not defined. Operation 2 is not defined but reserved for future use with minor versioning. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14. NFS Version 4 Procedures 14.1. Procedure 0: NULL - No Operation SYNOPSIS ARGUMENT @@ -5121,21 +5350,21 @@ Standard NULL procedure. Void argument, void response. This procedure has no functionality associated with it. Because of this it is sometimes used to measure the overhead of processing a service request. Therefore, the server should ensure that no unnecessary work is done in servicing this procedure. ERRORS None. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2. Procedure 1: COMPOUND - Compound Operations SYNOPSIS compoundargs -> compoundres ARGUMENT union nfs_argop4 switch (nfs_opnum4 argop) { @@ -5170,21 +5399,21 @@ the COMPOUND procedure as a wrapper. The COMPOUND procedure is used to combine individual operations into a single RPC request. The server interprets each of the operations in turn. If an operation is executed by the server and the status of that operation is NFS4_OK, then the next operation in the COMPOUND procedure is executed. The server continues this process until there are no more operations to be executed or one of the operations has a status value other than NFS4_OK. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 In the processing of the COMPOUND procedure, the server may find that it does not have the available resources to execute any or all of the operations within the COMPOUND sequence. In this case, the error NFS4ERR_RESOURCE will be returned for the particular operation within the COMPOUND procedure where the resource exhaustion occurred. This assumes that all previous operations within the COMPOUND sequence have been evaluated successfully. The results for all of the evaluated operations must be returned to the client. @@ -5225,50 +5454,51 @@ returned. If an operation array contains an operation 2 and the minorversion field is non-zero and the server does not support the minor version, the server returns an error of NFS4ERR_MINOR_VERS_MISMATCH. Therefore, the NFS4ERR_MINOR_VERS_MISMATCH error takes precedence over all other errors. It is possible that the server receives a request that contains an operation that is beyond the last defined operation (e.g. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 OP_WRITE). In this case, the server obviously will fail the unknown operation. If this occurs, the server will return an operation "opcode" that is 1 greater than the largest defined operation. For example, the server would return an opcode of OP_WRITE + 1. The server would then return a status of NFS4ERR_NOTSUPP to indicate an operation that is not defined and therefore not supported. - IMPLEMENTATION + The definition of the "tag" in the request is left to the + implementor. It may be used to summarize the content of the + compound request for the benefit of packet sniffers and engineers + debugging implementations. However, the value of "tag" in the + response MUST be the same value as provided in the request. - Note that the definition of the "tag" in both the request and - response are left to the implementor. It may be used to summarize - the content of the compound request for the benefit of packet - sniffers and engineers debugging implementations. + IMPLEMENTATION Since an error of any type may occur after only a portion of the operations have been evaluated, the client must be prepared to recover from any failure. If the source of an NFS4ERR_RESOURCE error was a complex or lengthy set of operations, it is likely that if the number of operations were reduced the server would be able to evaluate them successfully. Therefore, the client is responsible for dealing with this type of complexity in recovery. ERRORS All errors defined in the protocol -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.1. Operation 3: ACCESS - Check Access Rights SYNOPSIS (cfh), accessreq -> supported, accessrights ARGUMENT const ACCESS4_READ = 0x00000001; @@ -5304,21 +5534,21 @@ system object specified by the current filehandle. The client encodes the set of access rights that are to be checked in the bit mask "access". The server checks the permissions encoded in the bit mask. If a status of NFS4_OK is returned, two bit masks are included in the response. The first, "supported", represents the access rights for which the server can verify reliably. The second, "access", represents the access rights available to the user for the filehandle provided. On success, the current filehandle retains its value. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 Note that the supported field will contain only as many values as was originally sent in the arguments. For example, if the client sends an ACCESS operation with only the ACCESS4_READ value set and the server supports this value, the server will return only ACCESS4_READ even if it could have reliably checked other values. The results of this operation are necessarily advisory in nature. A return status of NFS4_OK and the appropriate bit set in the bit mask does not imply that such access will be allowed to the file @@ -5358,21 +5588,21 @@ the same ID space as the client. In these cases (and perhaps others), the client can not reliably perform an access check with only current file attributes. In the NFS version 2 protocol, the only reliable way to determine whether an operation was allowed was to try it and see if it succeeded or failed. Using the ACCESS procedure in the NFS version 4 protocol, the client can ask the server to indicate whether or not one or more classes of operations are permitted. The ACCESS -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 operation is provided to allow clients to check before doing a series of operations which will result in an access failure. The OPEN operation provides a point where the server can verify access to the file object and method to return that information to the client. The ACCESS operation is still useful for directory operations or for use in the case the UNIX API "access" is used on the client. The information returned by the server in response to an ACCESS @@ -5392,80 +5622,88 @@ determined by the access permissions on the directory in which the file resides, instead of being determined by the permissions of the file itself. Therefore, the mask returned enumerating which access rights can be determined will have the ACCESS4_DELETE value set to 0. This indicates to the client that the server was unable to check that particular access right. The ACCESS4_DELETE bit in the access mask returned will then be ignored by the client. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.2. Operation 4: CLOSE - Close File SYNOPSIS - (cfh), seqid, stateid -> stateid + (cfh), seqid, open_stateid -> open_stateid ARGUMENT struct CLOSE4args { /* CURRENT_FH: object */ seqid4 seqid - stateid4 stateid; + stateid4 open_stateid; }; RESULT union CLOSE4res switch (nfsstat4 status) { case NFS4_OK: - stateid4 stateid; + stateid4 open_stateid; default: void; }; DESCRIPTION - The CLOSE operation releases share reservations for the file as - specified by the current filehandle. The share reservations and - other state information released at the server as a result of this - CLOSE is only associated with the supplied stateid. The sequence - id provides for the correct ordering. State associated with other - OPENs is not affected. + The CLOSE operation releases share reservations for the regular or + named attribute file as specified by the current filehandle. The + share reservations and other state information released at the + server as a result of this CLOSE is only associated with the + supplied stateid. The sequence id provides for the correct + ordering. State associated with other OPENs is not affected. If record locks are held, the client SHOULD release all locks before issuing a CLOSE. The server MAY free all outstanding locks on CLOSE but some servers may not support the CLOSE of a file that still has record locks held. The server MUST return failure if any locks would exist after the CLOSE. On success, the current filehandle retains its value. IMPLEMENTATION - ERRORS + Even though CLOSE returns a stateid, this stateid is not useful to + the client and should be treated as deprecated. CLOSE "shuts down" + the state associated with all OPENs for the file by a single -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + + open_owner. As noted above, CLOSE will either release all file + locking state or return an error. Therefore, the stateid returned + by CLOSE is not useful for operations that follow. + + ERRORS NFS4ERR_BADHANDLE NFS4ERR_BAD_SEQID NFS4ERR_BAD_STATEID NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL @@ -5473,21 +5711,21 @@ NFS4ERR_LEASE_MOVED NFS4ERR_LOCKS_HELD NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_OLD_STATEID NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_STATEID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.3. Operation 5: COMMIT - Commit Cached Data SYNOPSIS (cfh), offset, count -> verifier ARGUMENT struct COMMIT4args { @@ -5525,21 +5763,21 @@ The server returns a write verifier upon successful completion of the COMMIT. The write verifier is used by the client to determine if the server has restarted or rebooted between the initial WRITE(s) and the COMMIT. The client does this by comparing the write verifier returned from the initial writes and the verifier returned by the COMMIT procedure. The server must vary the value of the write verifier at each server event or instantiation that may lead to a loss of uncommitted data. Most commonly this occurs when the server is rebooted; however, other events at the server -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 may result in uncommitted data loss as well. On success, the current filehandle retains its value. IMPLEMENTATION The COMMIT procedure is similar in operation and semantics to the POSIX fsync(2) system call that synchronizes a file's state with the disk (file data and metadata is flushed to disk or stable @@ -5579,21 +5817,21 @@ close. In this case, the client would gather all of the buffers for this file that contain uncommitted data, do the COMMIT operation with an offset of 0 and count of 0, and then free all of those buffers. Any other dirty buffers would be sent to the server in the normal fashion. After a buffer is written by the client with the stable parameter set to UNSTABLE4, the buffer must be considered as modified by the client until the buffer has either been flushed via a COMMIT -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 operation or written via a WRITE operation with stable parameter set to FILE_SYNC4 or DATA_SYNC4. This is done to prevent the buffer from being freed and reused before the data can be flushed to stable storage on the server. When a response is returned from either a WRITE or a COMMIT operation and it contains a write verifier that is different than previously returned by the server, the client will need to retransmit all of the buffers containing uncommitted cached data to @@ -5606,135 +5844,154 @@ COMMIT operation to flush all of the data on the server to stable storage. The timing of these retransmissions is left to the implementor. The above description applies to page-cache-based systems as well as buffer-cache-based systems. In those systems, the virtual memory system will need to be modified instead of the buffer cache. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_FHEXPIRED + NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_ISDIR - NFS4ERR_LOCKED NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.4. Operation 6: CREATE - Create a Non-Regular File Object SYNOPSIS - (cfh), name, type -> (cfh), change_info + (cfh), name, type, attrs -> (cfh), change_info, attrs_set ARGUMENT union createtype4 switch (nfs_ftype4 type) { case NF4LNK: linktext4 linkdata; case NF4BLK: case NF4CHR: specdata4 devdata; case NF4SOCK: case NF4FIFO: case NF4DIR: void; }; struct CREATE4args { /* CURRENT_FH: directory for creation */ component4 objname; createtype4 objtype; + fattr4 createattrs; }; RESULT struct CREATE4resok { change_info4 cinfo; + bitmap4 attrset; /* attributes set */ }; union CREATE4res switch (nfsstat4 status) { case NFS4_OK: CREATE4resok resok4; default: void; }; DESCRIPTION The CREATE operation creates a non-regular file object in a directory with a given name. The OPEN procedure MUST be used to create a regular file. - The objname specifies the name for the new object. If the objname - has a length of 0 (zero), the error NFS4ERR_INVAL will be returned. - The objtype determines the type of object to be created: directory, - symlink, etc. + The objname specifies the name for the new object. The objtype + determines the type of object to be created: directory, symlink, -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + + etc. If an object of the same name already exists in the directory, the server will return the error NFS4ERR_EXIST. For the directory where the new file object was created, the server returns change_info4 information in cinfo. With the atomic field of the change_info4 struct, the server will indicate if the before and after change attributes were obtained atomically with respect to the file object creation. If the objname has a length of 0 (zero), or if objname does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned. The current filehandle is replaced by that of the new object. + The createattrs specifies the initial set of attributes for the + object. The set of attributes may include any writable attribute + valid for the object type. When the operation is successful, the + server will return to the client an attribute mask signifying which + attributes were successfully set for the object. + IMPLEMENTATION If the client desires to set attribute values after the create, a SETATTR operation can be added to the COMPOUND request so that the appropriate attributes will be set. + It may be that the server's implementation places special meaning + on the names "." and ".." where they refer to special directories. + If this is the case and the client requests to CREATE a directory + (or other object) with these names, the server may return + NFS4ERR_INVAL. However, if the server does not place special + meaning on these names and a file object already exists with a + matching name, the server may return NFS4ERR_EXIST. + ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_ATTRNOTSUPP NFS4ERR_BADHANDLE NFS4ERR_BADTYPE NFS4ERR_BADXDR NFS4ERR_DQUOT NFS4ERR_EXIST NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED + +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_NAMETOOLONG NFS4ERR_NOFILEHANDLE NFS4ERR_NOSPC NFS4ERR_NOTDIR NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.5. Operation 7: DELEGPURGE - Purge Delegations Awaiting Recovery SYNOPSIS clientid -> ARGUMENT struct DELEGPURGE4args { @@ -5768,54 +6025,57 @@ it received the results and committed them to the client's stable storage. ERRORS NFS4ERR_BADXDR NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE_CLIENTID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.6. Operation 8: DELEGRETURN - Return Delegation SYNOPSIS - stateid -> + (cfh), stateid -> ARGUMENT struct DELEGRETURN4args { + /* CURRENT_FH: delegated file */ stateid4 stateid; }; RESULT struct DELEGRETURN4res { nfsstat4 status; }; DESCRIPTION - Returns the delegation represented by the given stateid. + Returns the delegation represented by the current filehandle and + stateid. ERRORS NFS4ERR_BAD_STATEID NFS4ERR_BADXDR + NFS4ERR_EXPIRED NFS4ERR_OLD_STATEID NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE_STATEID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.7. Operation 9: GETATTR - Get Attributes SYNOPSIS (cfh), attrbits -> attrbits, attrvals ARGUMENT struct GETATTR4args { @@ -5852,41 +6112,41 @@ value then it must not return the attribute value and must not set the attribute bit in the result bitmap. The server must return an error if it supports an attribute but cannot obtain its value. In that case no attribute values will be returned. All servers must support the mandatory attributes as specified in the section "File Attributes". On success, the current filehandle retains its value. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 IMPLEMENTATION ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.8. Operation 10: GETFH - Get Current Filehandle SYNOPSIS (cfh) -> filehandle ARGUMENT /* CURRENT_FH: */ @@ -5921,29 +6181,29 @@ PUTFH (directory filehandle) LOOKUP (entry name) GETFH ERRORS NFS4ERR_BADHANDLE NFS4ERR_FHEXPIRED NFS4ERR_MOVED -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.9. Operation 11: LINK - Create Link to a File SYNOPSIS (sfh), (cfh), newname -> (cfh), change_info ARGUMENT struct LINK4args { @@ -5965,126 +6225,156 @@ void; }; DESCRIPTION The LINK operation creates an additional newname for the file represented by the saved filehandle, as set by the SAVEFH operation, in the directory represented by the current filehandle. The existing file and the target directory must reside within the same file system on the server. On success, the current filehandle - will continue to be the target directory. + will continue to be the target directory. If an object exists in + the target directory with the same name as newname, the server must + return NFS4ERR_EXIST. For the target directory, the server returns change_info4 information in cinfo. With the atomic field of the change_info4 struct, the server will indicate if the before and after change attributes were obtained atomically with respect to the link creation. If the newname has a length of 0 (zero), or if newname does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned. - IMPLEMENTATION +Draft Specification NFS version 4 Protocol July 2002 -Draft Specification NFS version 4 Protocol November 2001 + IMPLEMENTATION Changes to any property of the "hard" linked files are reflected in all of the linked files. When a link is made to a file, the attributes for the file should have a value for numlinks that is one greater than the value before the LINK operation. - The comments under RENAME regarding object and target residing on - the same file system apply here as well. The comments regarding the - target name applies as well. + The statement "file and the target directory must reside within the + same file system on the server" means that the fsid fields in the + attributes for the objects are the same. If they reside on + different file systems, the error, NFS4ERR_XDEV, is returned. On + some servers, the filenames, "." and "..", are illegal as newname. + + In the case that newname is already linked to the file represented + by the saved filehandle, the server will return NFS4ERR_EXIST. Note that symbolic links are created with the CREATE operation. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_DQUOT NFS4ERR_EXIST NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_ISDIR NFS4ERR_MLINK NFS4ERR_MOVED NFS4ERR_NAMETOOLONG + NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE NFS4ERR_NOSPC NFS4ERR_NOTDIR NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC NFS4ERR_XDEV -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.10. Operation 12: LOCK - Create Lock SYNOPSIS - (cfh) type, seqid, reclaim, stateid, offset, length -> stateid, - access + (cfh) locktype, reclaim, offset, length, locker -> stateid ARGUMENT + struct open_to_lock_owner4 { + seqid4 open_seqid; + stateid4 open_stateid; + seqid4 lock_seqid; + lock_owner4 lock_owner; + }; + + struct exist_lock_owner4 { + stateid4 lock_stateid; + seqid4 lock_seqid; + }; + + union locker4 switch (bool new_lock_owner) { + case TRUE: + open_to_lock_owner4 open_owner; + case FALSE: + exist_lock_owner4 lock_owner; + }; + enum nfs4_lock_type { READ_LT = 1, WRITE_LT = 2, READW_LT = 3, /* blocking read */ WRITEW_LT = 4 /* blocking write */ }; struct LOCK4args { /* CURRENT_FH: file */ nfs_lock_type4 locktype; - seqid4 seqid; bool reclaim; - stateid4 stateid; offset4 offset; length4 length; + locker4 locker; }; RESULT struct LOCK4denied { - nfs_lockowner4 owner; offset4 offset; length4 length; + nfs_lock_type4 locktype; + +Draft Specification NFS version 4 Protocol July 2002 + + lock_owner4 owner; + }; + + struct LOCK4resok { + stateid4 lock_stateid; }; union LOCK4res switch (nfsstat4 status) { case NFS4_OK: - stateid4 stateid; + LOCK4resok resok4; case NFS4ERR_DENIED: LOCK4denied denied; default: void; }; DESCRIPTION The LOCK operation requests a record lock for the byte range specified by the offset and length parameters. The lock type is also specified to be one of the nfs4_lock_types. If this is a - -Draft Specification NFS version 4 Protocol November 2001 - reclaim request, the reclaim parameter will be TRUE; Bytes in a file may be locked even if those bytes are not currently allocated to the file. To lock the file from a specific offset through the end-of-file (no matter how long the file actually is) use a length field with all bits set to 1 (one). To lock the entire file, use an offset of 0 (zero) and a length with all bits set to 1. A length of 0 is reserved and should not be used. In the case that the lock is denied, the owner, offset, and length @@ -6095,24 +6385,27 @@ IMPLEMENTATION If the server is unable to determine the exact offset and length of the conflicting lock, the same offset and length that were provided in the arguments should be returned in the denied results. The File Locking section contains a full description of this and the other file locking operations. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BAD_SEQID NFS4ERR_BAD_STATEID + +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_DENIED NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_ISDIR NFS4ERR_LEASE_MOVED NFS4ERR_LOCK_RANGE @@ -6122,21 +6415,21 @@ NFS4ERR_OLD_STATEID NFS4ERR_RECLAIM_BAD NFS4ERR_RECLAIM_CONFLICT NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_CLIENTID NFS4ERR_STALE_STATEID NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.11. Operation 13: LOCKT - Test For Lock SYNOPSIS (cfh) type, owner, offset, length -> {void, NFS4ERR_DENIED -> owner} ARGUMENT @@ -6172,53 +6465,53 @@ If a conflicting lock exists, the owner, offset, length, and type of the conflicting lock are returned; if no lock is held, nothing other than NFS4_OK is returned. On success, the current filehandle retains its value. IMPLEMENTATION If the server is unable to determine the exact offset and length of -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 the conflicting lock, the same offset and length that were provided in the arguments should be returned in the denied results. The File Locking section contains further discussion of the file locking mechanisms. LOCKT uses nfs_lockowner4 instead of a stateid4, as LOCK does, to identify the owner so that the client does not have to open the file to test for the existence of a lock. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_DENIED NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_ISDIR NFS4ERR_LEASE_MOVED NFS4ERR_LOCK_RANGE NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_CLIENTID NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.12. Operation 14: LOCKU - Unlock File SYNOPSIS (cfh) type, seqid, stateid, offset, length -> stateid ARGUMENT struct LOCKU4args { @@ -6246,44 +6539,45 @@ On success, the current filehandle retains its value. IMPLEMENTATION The File Locking section contains a full description of this and the other file locking procedures. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BAD_SEQID NFS4ERR_BAD_STATEID NFS4ERR_BADXDR NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_GRACE NFS4ERR_INVAL + NFS4ERR_ISDIR NFS4ERR_LOCK_RANGE NFS4ERR_LEASE_MOVED NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_OLD_STATEID NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_CLIENTID NFS4ERR_STALE_STATEID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.13. Operation 15: LOOKUP - Lookup Filename SYNOPSIS (cfh), component -> (cfh) ARGUMENT struct LOOKUP4args { @@ -6313,21 +6607,21 @@ If the component is a zero length string or if any component does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned. IMPLEMENTATION If the client wants to acheive the effect of a multi-component lookup, it may construct a COMPOUND request such as (and obtain each filehandle): -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 PUTFH (directory filehandle) LOOKUP "pub" GETFH LOOKUP "foo" GETFH LOOKUP "bar" GETFH NFS version 4 servers depart from the semantics of previous NFS @@ -6356,41 +6650,41 @@ filenames that are modified by symbolic links encountered during the lookup process. If the current file handle supplied is not a directory but a symbolic link, the error NFS4ERR_SYMLINK is returned as the error. For all other non-directory file types, the error NFS4ERR_NOTDIR is returned. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NAMETOOLONG NFS4ERR_NOENT -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_NOFILEHANDLE NFS4ERR_NOTDIR NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_SYMLINK NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.14. Operation 16: LOOKUPP - Lookup Parent Directory SYNOPSIS (cfh) -> (cfh) ARGUMENT /* CURRENT_FH: object */ @@ -6401,51 +6695,51 @@ struct LOOKUPP4res { /* CURRENT_FH: directory */ nfsstat4 status; }; DESCRIPTION The current filehandle is assumed to refer to a regular directory or a named attribute directory. LOOKUPP assigns the filehandle for its parent directory to be the current filehandle. If there is no - parent directory an NFS4ERR_ENOENT error must be returned. - Therefore, NFS4ERR_ENOENT will be returned by the server when the + parent directory an NFS4ERR_NOENT error must be returned. + Therefore, NFS4ERR_NOENT will be returned by the server when the current filehandle is at the root or top of the server's file tree. IMPLEMENTATION As for LOOKUP, LOOKUPP will also cross mountpoints. If the current filehandle is not a directory or named attribute directory, the error NFS4ERR_NOTDIR is returned. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE NFS4ERR_NOTDIR NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.15. Operation 17: NVERIFY - Verify Difference in Attributes SYNOPSIS (cfh), fattr -> - ARGUMENT struct NVERIFY4args { @@ -6479,42 +6773,42 @@ PUTFH (public) LOOKUP "pub" "foo" "bar" NVERIFY attrbits attrs READ 0 32767 In the case that a recommended attribute is specified in the NVERIFY operation and the server does not support that attribute for the file system object, the error NFS4ERR_NOTSUPP is returned to the client. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_ATTRNOTSUPP NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_SAME NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.16. Operation 18: OPEN - Open a Regular File SYNOPSIS (cfh), claim, openhow, owner, seqid, access, deny -> (cfh), stateid, cinfo, rflags, open_confirm, attrset delegation ARGUMENT @@ -6553,21 +6847,21 @@ void; }; /* Next definitions used for OPEN delegation */ enum limit_by4 { NFS_LIMIT_SIZE = 1, NFS_LIMIT_BLOCKS = 2 /* others as needed */ }; -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 struct nfs_modified_limit4 { uint32_t num_blocks; uint32_t bytes_per_block; }; union nfs_space_limit4 switch (limit_by4 limitby) { /* limit specified as file size */ case NFS_LIMIT_SIZE: uint64_t filesize; @@ -6608,21 +6902,21 @@ * rather than by name. */ case CLAIM_PREVIOUS: /* CURRENT_FH: file being reclaimed */ open_delegation_type4 delegate_type; /* * Right to file based on a delegation granted by the server. * File is specified by name. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 */ case CLAIM_DELEGATE_CUR: /* CURRENT_FH: directory */ open_claim_delegate_cur4 delegate_cur_info; /* Right to file based on a delegation granted to a previous boot * instance of the client. File is specified by name. */ case CLAIM_DELEGATE_PREV: @@ -6661,28 +6955,29 @@ open. */ }; union open_delegation4 switch (open_delegation_type4 delegation_type) { case OPEN_DELEGATE_NONE: void; case OPEN_DELEGATE_READ: open_read_delegation4 read; -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 case OPEN_DELEGATE_WRITE: open_write_delegation4 write; }; const OPEN4_RESULT_MLOCK = 0x00000001; const OPEN4_RESULT_CONFIRM= 0x00000002; + const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004; struct OPEN4resok { stateid4 stateid; /* Stateid for open */ change_info4 cinfo; /* Directory Change Info */ uint32_t rflags; /* Result flags */ bitmap4 attrset; /* attributes on create */ open_delegation4 delegation; /* Info on any open delegation */ }; @@ -6712,38 +7007,38 @@ DESCRIPTION The OPEN operation creates and/or opens a regular file in a directory with the provided name. If the file does not exist at the server and creation is desired, specification of the method of creation is provided by the openhow parameter. The client has the choice of three creation methods: UNCHECKED, GUARDED, or EXCLUSIVE. UNCHECKED means that the file should be created if a file of that - name does not exist and encountering an existing regular file of -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + name does not exist and encountering an existing regular file of that name is not an error. For this type of create, createattrs specifies the initial set of attributes for the file. The set of attributes may include any writable attribute valid for regular files. When an UNCHECKED create encounters an existing file, the attributes specified by createattrs is not used, except that when - an object_size of zero is specified, the existing file is - truncated. If GUARDED is specified, the server checks for the - presence of a duplicate object by name before performing the - create. If a duplicate exists, an error of NFS4ERR_EXIST is - returned as the status. If the object does not exist, the request - is performed as described for UNCHECKED. For each of these cases - (UNCHECKED and GUARDED) where the operation is successful, the - server will return to the client an attribute mask signifying which - attributes were successfully set for the object. + an size of zero is specified, the existing file is truncated. If + GUARDED is specified, the server checks for the presence of a + duplicate object by name before performing the create. If a + duplicate exists, an error of NFS4ERR_EXIST is returned as the + status. If the object does not exist, the request is performed as + described for UNCHECKED. For each of these cases (UNCHECKED and + GUARDED) where the operation is successful, the server will return + to the client an attribute mask signifying which attributes were + successfully set for the object. EXCLUSIVE specifies that the server is to follow exclusive creation semantics, using the verifier to ensure exclusive creation of the target. The server should check for the presence of a duplicate object by name. If the object does not exist, the server creates the object and stores the verifier with the object. If the object does exist and the stored verifier matches the client provided verifier, the server uses the existing object as the newly created object. If the stored verifier does not match, then an error of NFS4ERR_EXIST is returned. No attributes may be provided in this @@ -6767,48 +7062,52 @@ specifies at OPEN the required access and deny modes. For clients that do not directly support SHAREs (i.e. Unix), the expected deny value is DENY_NONE. In the case that there is a existing SHARE reservation that conflicts with the OPEN request, the server returns the error NFS4ERR_DENIED. For a complete SHARE request, the client must provide values for the owner and seqid fields for the OPEN argument. For additional discussion of SHARE semantics see the section on 'Share Reservations'. In the case that the client is recovering state from a server - failure, the reclaim field of the OPEN argument is used to signify -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + failure, the reclaim field of the OPEN argument is used to signify that the request is meant to reclaim state previously held. The "claim" field of the OPEN argument is used to specify the file to be opened and the state information which the client claims to possess. There are four basic claim types which cover the various situations for an OPEN. They are as follows: - CLAIM_NULL For the client, this is a new OPEN + CLAIM_NULL + For the client, this is a new OPEN request and there is no previous state associate with the file for the client. - CLAIM_PREVIOUS The client is claiming basic OPEN state + CLAIM_PREVIOUS + The client is claiming basic OPEN state for a file that was held previous to a server reboot. Generally used when a server is returning persistent file handles; the client may not have the file name to reclaim the OPEN. - CLAIM_DELEGATE_CUR The client is claiming a delegation for + CLAIM_DELEGATE_CUR + The client is claiming a delegation for OPEN as granted by the server. Generally this is done as part of recalling a delegation. - CLAIM_DELEGATE_PREV The client is claiming a delegation + CLAIM_DELEGATE_PREV + The client is claiming a delegation granted to a previous client instance; used after the client reboots. For OPEN requests whose claim type is other than CLAIM_PREVIOUS (i.e. requests other than those devoted to reclaiming opens after a server reboot) that reach the server during its grace or lease expiration period, the server returns an error of NFS4ERR_GRACE. For any OPEN request, the server may return an open delegation, which allows further opens and closes to be handled locally on the @@ -6820,34 +7119,44 @@ delegation type is claimed. In this case, delegation will always be granted, although the server may specify an immediate recall in the delegation structure. The rflags returned by a successful OPEN allow the server to return information governing how the open file is to be handled. OPEN4_RESULT_MLOCK indicates to the caller that mandatory locking is in effect for this file and the client should act appropriately with regard to data cached on the client. OPEN4_RESULT_CONFIRM indicates that the client MUST execute an OPEN_CONFIRM operation - before using the open file. + before using the open file. OPEN4_RESULT_LOCKTYPE_POSIX indicates -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + + the server's file locking behavior is Posix like with respect to + lock range coalescing. From this the client can choose to manage + file locking state in a way to handle a mis-match of file locking + management. If the component is of zero length or if the component does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned. When an OPEN is done and the specified lockowner already has the resulting filehandle open, the result is to "OR" together the new share and deny status together with the existing status. In this case, only a single CLOSE need be done, even though multiple OPEN's were completed. + If the underlying filesystem at the server is only accessible in a + read-only mode and the OPEN request has specified ACCESS_WRITE or + ACCESS_BOTH, the server will return NFS4ERR_ROFS to indicate a + read-only filesystem. + IMPLEMENTATION The OPEN procedure contains support for EXCLUSIVE create. The mechanism is similar to the support in NFS version 3 [RFC1813]. As in NFS version 3, this mechanism provides reliable exclusive creation. Exclusive create is invoked when the how parameter is EXCLUSIVE. In this case, the client provides a verifier that can reasonably be expected to be unique. A combination of a client identifier, perhaps the client network address, and a unique number generated by the client, perhaps the RPC transaction identifier, @@ -6865,97 +7174,102 @@ normally volatile duplicate request cache for storage of the verifier. The duplicate request cache in volatile storage does not survive a crash and may actually flush on a long network partition, opening failure windows. In the UNIX local file system environment, the expected storage location for the verifier on creation is the meta-data (time stamps) of the object. For this reason, an exclusive object create may not include initial attributes because the server would have nowhere to store the verifier. +Draft Specification NFS version 4 Protocol July 2002 + If the server can not support these exclusive create semantics, possibly because of the requirement to commit the verifier to stable storage, it should fail the OPEN request with the error, NFS4ERR_NOTSUPP. During an exclusive CREATE request, if the object already exists, the server reconstructs the object's verifier and compares it with the verifier in the request. If they match, the server treats the request as a success. The request is presumed to be a duplicate of an earlier, successful request for which the reply was lost and - -Draft Specification NFS version 4 Protocol November 2001 - that the server duplicate request cache mechanism did not detect. If the verifiers do not match, the request is rejected with the status, NFS4ERR_EXIST. Once the client has performed a successful exclusive create, it must issue a SETATTR to set the correct object attributes. Until it does so, it should not rely upon any of the object attributes, since the server implementation may need to overload object meta- data to store the verifier. The subsequent SETATTR must not occur in the same COMPOUND request as the OPEN. This separation will guarantee that the exclusive create mechanism will continue to function properly in the face of retransmission of the request. Use of the GUARDED attribute does not provide exactly-once semantics. In particular, if a reply is lost and the server does not detect the retransmission of the request, the procedure can fail with NFS4ERR_EXIST, even though the create was performed - successfully. + successfully. The client would use this behavior in the case that + the application has not requested an exclusive create but has asked + to have the file truncated when the file is opened. In the case of + the client timing out and retransmitting the create request, the + client can use GUARDED to prevent against a sequence like: create, + write, create (retransmitted) from occurring. For SHARE reservations, the client must specify a value for access that is one of READ, WRITE, or BOTH. For deny, the client must specify one of NONE, READ, WRITE, or BOTH. If the client fails to do this, the server must return NFS4ERR_INVAL. If the component provided to OPEN is a symbolic link, the error NFS4ERR_SYMLINK will be returned to the client. If the current filehandle is not a directory, the error NFS4ERR_NOTDIR will be returned. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_ATTRNOTSUPP NFS4ERR_BAD_SEQID NFS4ERR_BADXDR NFS4ERR_DELAY + +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_DQUOT NFS4ERR_EXIST + NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_IO NFS4ERR_ISDIR NFS4ERR_LEASE_MOVED NFS4ERR_MOVED NFS4ERR_NAMETOOLONG - NFS4ERR_NOENT + NFS4ERR_NOENT* NFS4ERR_NOFILEHANDLE NFS4ERR_NO_GRACE NFS4ERR_NOSPC NFS4ERR_NOTDIR NFS4ERR_NOTSUPP - -Draft Specification NFS version 4 Protocol November 2001 - NFS4ERR_RECLAIM_BAD NFS4ERR_RECLAIM_CONFLICT NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_SHARE_DENIED NFS4ERR_STALE_CLIENTID NFS4ERR_SYMLINK -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.17. Operation 19: OPENATTR - Open Named Attribute Directory SYNOPSIS (cfh) createdir -> (cfh) ARGUMENT struct OPENATTR4args { @@ -6991,42 +7305,43 @@ attribute directory assumes that the server has implemented named attribute support in this fashion and is not required to do so by this definition. IMPLEMENTATION If the server does not support named attributes for the current filehandle, an error of NFS4ERR_NOTSUPP will be returned to the client. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY - NFS4ERR_EROFS + NFS4ERR_ROFS NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE + NFS4ERR_NOSPC NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.18. Operation 20: OPEN_CONFIRM - Confirm Open SYNOPSIS (cfh), seqid, stateid-> stateid ARGUMENT struct OPEN_CONFIRM4args { @@ -7063,21 +7378,21 @@ server. On success, the current filehandle retains its value. IMPLEMENTATION A given client might generate many nfs_lockowner data structures for a given clientid. The client will periodically either dispose of its nfs_lockowners or stop using them for indefinite periods of -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 time. The latter situation is why the NFS version 4 protocol does not have a an explicit operation to exit an nfs_lockowner: such an operation is of no use in that situation. Instead, to avoid unbounded memory use, the server needs to implement a strategy for disposing of nfs_lockowners that have no current lock, open, or delegation state for any files and have not been used recently. The time period used to determine when to dispose of nfs_lockowners is an implementation choice. The time period should certainly be no less than the lease time plus any grace period the server wishes @@ -7118,42 +7433,42 @@ OPEN_CONFIRM but with the wrong stateid? Then, even if the seqid is correct, the server returns NFS4ERR_BAD_STATEID, because the server assumes the operation is a replay: if the server has no established OPEN state, then there is no way, for example, a LOCK operation could be valid. Third, neither of the two aforementioned events occur for the nfs_lockowner within the lease period. In this case, the OPEN state is cancelled and disposal of the nfs_lockowner can occur. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 ERRORS NFS4ERR_BADHANDLE NFS4ERR_BAD_SEQID NFS4ERR_BADXDR NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_ISDIR NFS4ERR_MOVED NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File Access SYNOPSIS (cfh), stateid, seqid, access, deny -> stateid ARGUMENT struct OPEN_DOWNGRADE4args { @@ -7190,37 +7505,37 @@ error NFS4ERR_INVAL should be returned. Since access and deny bits are subsets of those already granted, it is not possible for this request to be denied because of conflicting share reservations. On success, the current filehandle retains its value. ERRORS NFS4ERR_BADHANDLE -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_BAD_SEQID NFS4ERR_BAD_STATEID NFS4ERR_BADXDR NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_OLD_STATEID NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_STATEID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.20. Operation 22: PUTFH - Set Current Filehandle SYNOPSIS filehandle -> (cfh) ARGUMENT struct PUTFH4args { @@ -7248,21 +7563,21 @@ NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_FHEXPIRED NFS4ERR_MOVED NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.21. Operation 23: PUTPUBFH - Set Public Filehandle SYNOPSIS - -> (cfh) ARGUMENT void; @@ -7274,32 +7589,73 @@ nfsstat4 status; }; DESCRIPTION Replaces the current filehandle with the filehandle that represents the public filehandle of the server's name space. This filehandle may be different from the "root" filehandle which may be associated with some other directory on the server. + The public filehandle represents the concepts embodied in RFC 2054, + RFC 2055, RFC 2224. The intent for NFS version 4 is that the + public filehandle (represented by the PUTPUBFH operation) be used + as a method of providing WebNFS server compatibility with NFS + versions 2 and 3. + + The public filehandle and the root filehandle (represented by the + PUTROOTFH operation) should be equivalent. If the public and root + filehandles are not equivalent, then the public filehandle MUST be + a descendant of the root filehandle. + IMPLEMENTATION Used as the first operator in an NFS request to set the context for following operations. + With the NFS version 2 and 3 public filehandle, the client is able + to specify whether the path name provided in the LOOKUP should be + evaluated as either an absolute path relative to the server's root + or relative to the public filehandle. RFC 2224 contains further + discussion of the functionality. With NFSv4, that type of + specification is not directly available in the LOOKUP operation. + The reason for this is because the component separators needed to + specify absolute vs. relative are not allowed in NFS version 4. + +Draft Specification NFS version 4 Protocol July 2002 + + Therefore, the client is responsible for constructing its request + such that the use of either PUTROOTFH or PUTPUBFH are used to + signify absolute or relative evaluation of an NFS URL respectively. + + Note that there are warnings mentioned in RFC 2224 with respect to + the use of absolute evaluation and the restrictions the server may + place on that evaluation with respect to how much of its namespace + has been made available. These same warnings apply to NFS version + 4. It is likely, therefore that because of server implementation + details, an NFS version 3 absolute public filehandle lookup may + behave differently than an NFS version 4 absolute resolution. + + There is a form of security negotiation as described in RFC 2755 + that uses the public filehandle a method of employing SNEGO. This + method is not available with NFS version 4 as filehandles are not + overloaded with special meaning and therefore do not provide the + same framework as NFS versions 2 and 3. Clients should therefore + use the security negotiation mechanisms described in this RFC. + ERRORS NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.22. Operation 24: PUTROOTFH - Set Root Filehandle SYNOPSIS - -> (cfh) ARGUMENT void; @@ -7323,27 +7679,27 @@ Commonly used as the first operator in an NFS request to set the context for following operations. ERRORS NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.23. Operation 25: READ - Read from File SYNOPSIS - (cfh), offset, count, stateid -> eof, data + (cfh), stateid, offset, count -> eof, data ARGUMENT struct READ4args { /* CURRENT_FH: file */ stateid4 stateid; offset4 offset; count4 count; }; @@ -7375,21 +7731,21 @@ checking. If the client specifies a count value of 0 (zero), the READ succeeds and returns 0 (zero) bytes of data again subject to access permissions checking. The server may choose to return fewer bytes than specified by the client. The client needs to check for this condition and handle the condition appropriately. The stateid value for a READ request represents a value returned -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 from a previous record lock or share reservation request. Used by the server to verify that the associated lock is still valid and to update lease timeouts for the client. If the read ended at the end-of-file (formally, in a correctly formed READ request, if offset + count is equal to the size of the file), or the read request extends beyond the size of the file (if offset + count is greater than the size of the file), eof is returned as TRUE; otherwise it is FALSE. A successful READ of an @@ -7416,54 +7772,54 @@ the read request return. Server resource exhaustion may also occur necessitating a smaller read return. If the file is locked the server will return an NFS4ERR_LOCKED error. Since the lock may be of short duration, the client may choose to retransmit the READ request (with exponential backoff) until the operation succeeds. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BAD_STATEID NFS4ERR_BADXDR NFS4ERR_DELAY - NFS4ERR_DENIED NFS4ERR_EXPIRED NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_IO + NFS4ERR_ISDIR -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - NFS4ERR_ISDIR - NFS4ERR_LOCKED NFS4ERR_LEASE_MOVED + NFS4ERR_LOCKED NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NXIO NFS4ERR_OLD_STATEID + NFS4ERR_OPENMODE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_STATEID NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.24. Operation 26: READDIR - Read Directory SYNOPSIS (cfh), cookie, cookieverf, dircount, maxcount, attr_request -> - cookieverf { cookie, name, attributes } + cookieverf { cookie, name, attrs } ARGUMENT struct READDIR4args { /* CURRENT_FH: directory */ nfs_cookie4 cookie; verifier4 cookieverf; count4 dircount; count4 maxcount; bitmap4 attr_request; @@ -7494,21 +7850,21 @@ default: void; }; DESCRIPTION The READDIR operation retrieves a variable number of entries from a file system directory and returns client requested attributes for each entry along with information to allow the client to request -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 additional directory entries in a subsequent READDIR. The arguments contain a cookie value that represents where the READDIR should start within the directory. A value of 0 (zero) for the cookie is used to start reading at the beginning of the directory. For subsequent READDIR requests, the client specifies a cookie value that is provided by the server on a previous READDIR request. @@ -7549,21 +7905,21 @@ Ideally, the cookie value should not change if the directory is modified since the client may be caching these values. In some cases, the server may encounter an error while obtaining the attributes for a directory entry. Instead of returning an error for the entire READDIR operation, the server can instead return the attribute 'fattr4_rdattr_error'. With this, the server is able to communicate the failure to the client and not fail the entire operation in the instance of what might be a transient -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 failure. Obviously, the client must request the fattr4_rdattr_error attribute for this method to work properly. If the client does not request the attribute, the server has no choice but to return failure for the entire READDIR operation. For some file system environments, the directory entries "." and ".." have special meaning and in other environments, they may not. If the server supports these special entries within a directory, they should not be returned to the client as part of the READDIR @@ -7603,52 +7959,52 @@ may not be able to properly handle this type of failure. The use of the cookieverf will also protect the client from using READDIR cookie values that may be stale. For example, if the file system has been migrated, the server may or may not be able to use the same cookie values to service READDIR as the previous server used. With the client providing the cookieverf, the server is able to provide the appropriate response to the client. This prevents the case where the server may accept a cookie value but the -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 underlying directory has changed and the response is invalid from the client's context of its previous READDIR. Since some servers will not be returning "." and ".." entries as has been done with previous versions of the NFS protocol, the client that requires these entries be present in READDIR responses must fabricate them. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BAD_COOKIE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NOTDIR NFS4ERR_NOTSUPP NFS4ERR_READDIR_NOSPC NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_TOOSMALL NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.25. Operation 27: READLINK - Read Symbolic Link SYNOPSIS (cfh) -> linktext ARGUMENT /* CURRENT_FH: symlink */ @@ -7685,39 +8041,39 @@ name that is not meaningful to the server operating system in a symbolic link. A READLINK operation returns the data to the client for interpretation. If different implementations want to share access to symbolic links, then they must agree on the interpretation of the data in the symbolic link. The READLINK operation is only allowed on objects of type NF4LNK. The server should return the error, NFS4ERR_INVAL, if the object is not of type, NF4LNK. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.26. Operation 28: REMOVE - Remove Filesystem Object SYNOPSIS (cfh), filename -> change_info ARGUMENT struct REMOVE4args { @@ -7754,65 +8110,65 @@ If the target has a length of 0 (zero), or if target does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned. On success, the current filehandle retains its value. IMPLEMENTATION NFS versions 2 and 3 required a different operator RMDIR for -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 directory removal. NFS version 4 REMOVE can be used to delete any directory entry independent of its file type. The concept of last reference is server specific. However, if the numlinks field in the previous attributes of the object had the value 1, the client should not rely on referring to the object via a file handle. Likewise, the client should not rely on the resources (disk space, directory entry, and so on) formerly associated with the object becoming immediately available. Thus, if a client needs to be able to continue to access a file after using REMOVE to remove it, the client should take steps to make sure that the file will still be accessible. The usual mechanism used is to RENAME the file from its old name to a new hidden name. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO NFS4ERR_MOVED NFS4ERR_NAMETOOLONG NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE NFS4ERR_NOTDIR NFS4ERR_NOTEMPTY NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.27. Operation 29: RENAME - Rename Directory Entry SYNOPSIS - (sfh), oldname (cfh), newname -> source_change_info, + (sfh), oldname, (cfh), newname -> source_change_info, target_change_info ARGUMENT struct RENAME4args { /* SAVED_FH: source directory */ component4 oldname; /* CURRENT_FH: target directory */ component4 newname; }; @@ -7844,31 +8200,36 @@ If the target directory already contains an entry with the name, newname, the source object must be compatible with the target: either both are non-directories or both are directories and the target must be empty. If compatible, the existing target is removed before the rename occurs. If they are not compatible or if the target is a directory but not empty, the server will return the error, NFS4ERR_EXIST. If oldname and newname both refer to the same file (they might be -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 hard links of each other), then RENAME should perform no action and return success. For both directories involved in the RENAME, the server returns change_info4 information. With the atomic field of the change_info4 struct, the server will indicate if the before and after change attributes were obtained atomically with respect to the rename. + If the oldname refers to a named attribute and the saved and + current filehandles refer to different filesystem objects, the + server will return NFS4ERR_XDEV just as if the saved and current + filehandles represented directories on different filesystems. + If the oldname or newname has a length of 0 (zero), or if oldname or newname does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned. IMPLEMENTATION The RENAME operation must be atomic to the client. The statement "source and target directories must reside on the same file system on the server" means that the fsid fields in the attributes for the directories are the same. If they reside on different file systems, @@ -7876,51 +8237,53 @@ A filehandle may or may not become stale or expire on a rename. However, server implementors are strongly encouraged to attempt to keep file handles from becoming stale or expiring in this fashion. On some servers, the filenames, "." and "..", are illegal as either oldname or newname. In addition, neither oldname nor newname can be an alias for the source directory. These servers will return the error, NFS4ERR_INVAL, in these cases. + If either of the source or target filehandles are not directories, + the server will return NFS4ERR_NOTDIR. + ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_DQUOT NFS4ERR_EXIST NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_IO - NFS4ERR_ISDIR + +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_MOVED NFS4ERR_NAMETOOLONG NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE NFS4ERR_NOSPC NFS4ERR_NOTDIR NFS4ERR_NOTEMPTY - -Draft Specification NFS version 4 Protocol November 2001 - NFS4ERR_NOTSUPP NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC NFS4ERR_XDEV -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.28. Operation 30: RENEW - Renew a Lease SYNOPSIS clientid -> () ARGUMENT struct RENEW4args { @@ -7949,21 +8312,21 @@ NFS4ERR_EXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_LEASE_MOVED NFS4ERR_MOVED NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE_CLIENTID NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.29. Operation 31: RESTOREFH - Restore Saved Filehandle SYNOPSIS (sfh) -> (cfh) ARGUMENT /* SAVED_FH: */ @@ -7998,29 +8361,29 @@ GETATTR attrbits (file attributes) RESTOREFH GETATTR attrbits (post-op dir attrs) ERRORS NFS4ERR_BADHANDLE NFS4ERR_FHEXPIRED NFS4ERR_MOVED -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.30. Operation 32: SAVEFH - Save Current Filehandle SYNOPSIS (cfh) -> (sfh) ARGUMENT /* CURRENT_FH: */ @@ -8047,32 +8410,32 @@ NFS4ERR_BADHANDLE NFS4ERR_FHEXPIRED NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.31. Operation 33: SECINFO - Obtain Available Security SYNOPSIS (cfh), name -> { secinfo } ARGUMENT struct SECINFO4args { - /* CURRENT_FH: */ + /* CURRENT_FH: directory */ component4 name; }; RESULT enum rpc_gss_svc_t { RPC_GSS_SVC_NONE = 1, RPC_GSS_SVC_INTEGRITY = 2, RPC_GSS_SVC_PRIVACY = 3 }; @@ -8095,40 +8458,43 @@ union SECINFO4res switch (nfsstat4 status) { case NFS4_OK: SECINFO4resok resok4; default: void; }; DESCRIPTION The SECINFO operation is used by the client to obtain a list of - valid RPC authentication flavors for a specific file handle, file - name pair. The result will contain an array which represents the + valid RPC authentication flavors for a specific directory + filehandle, file name pair. The result will contain an array which -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - security mechanisms available. The array entries are represented - by the secinfo4 structure. The field 'flavor' will contain a value - of AUTH_NONE, AUTH_SYS (as defined in [RFC1831]), or RPCSEC_GSS (as - defined in [RFC2203]). + represents the security mechanisms available. The array entries + are represented by the secinfo4 structure. The field 'flavor' will + contain a value of AUTH_NONE, AUTH_SYS (as defined in [RFC1831]), + or RPCSEC_GSS (as defined in [RFC2203]). - For the flavors, AUTH_NONE, and AUTH_SYS no additional security + For the flavors AUTH_NONE and AUTH_SYS, no additional security information is returned. For a return value of RPCSEC_GSS, a security triple is returned that contains the mechanism object id (as defined in [RFC2078]), the quality of protection (as defined in [RFC2078]) and the service type (as defined in [RFC2203]). It is possible for SECINFO to return multiple entries with flavor equal to RPCSEC_GSS with different security triple values. On success, the current filehandle retains its value. + If the name has a length of 0 (zero), or if name does not obey the + UTF-8 definition, the error NFS4ERR_INVAL will be returned. + IMPLEMENTATION The SECINFO operation is expected to be used by the NFS client when the error value of NFS4ERR_WRONGSEC is returned from another NFS operation. This signifies to the client that the server's security policy is different from what the client is currently using. At this point, the client is expected to obtain a list of possible security flavors and choose what best suits its policies. It is recommended that the client issue the SECINFO call protected @@ -8138,37 +8504,41 @@ that the client might select a weaker algorithm in the set allowed by server, making the client and/or server vulnerable to further attacks. ERRORS NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_FHEXPIRED + NFS4ERR_INVAL NFS4ERR_MOVED NFS4ERR_NAMETOOLONG NFS4ERR_NOENT NFS4ERR_NOFILEHANDLE NFS4ERR_NOTDIR NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE + +Draft Specification NFS version 4 Protocol July 2002 + NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.32. Operation 34: SETATTR - Set Attributes SYNOPSIS - (cfh), attrbits, attrvals -> - + (cfh), stateid, attrmask, attr_vals -> attrsset ARGUMENT struct SETATTR4args { /* CURRENT_FH: target object */ stateid4 stateid; fattr4 obj_attributes; }; RESULT @@ -8177,108 +8547,152 @@ nfsstat4 status; bitmap4 attrsset; }; DESCRIPTION The SETATTR operation changes one or more of the attributes of a file system object. The new attributes are specified with a bitmap and the attributes that follow the bitmap in bit order. - The stateid is necessary for SETATTRs that change the size of a - file (modify the attribute object_size). This stateid represents a - record lock, share reservation, or delegation which must be valid - for the SETATTR to modify the file data. A valid stateid would - always be specified. When the file size is not changed, the - special stateid consisting of all bits 0 (zero) should be used. + The stateid argument for SETATTR is used to provide file locking + context that is necessary for SETATTR requests that set the size + attribute. Since setting the size attribute modifies the file's + data, it has the same locking requirements as a corresponding + WRITE. Any SETATTR that sets the size attribute is incompatible + with a share lock that specifies DENY_WRITE. The area between the + old end-of-file and the new end-of-file is considered to be + modified just as would have been the case had the area in question + been specified as the target of WRITE, for the purpose of checking + conflicts with record locks, for those cases in which a server is + implementing mandatory record locking behavior. A valid stateid + should always be specified. When the file size attribute is not + set, the special stateid consisting of all bits zero should be + passed. On either success or failure of the operation, the server will return the attrsset bitmask to represent what (if any) attributes - were successfully set. + were successfully set. The attrsset in the response is a subset of + the bitmap4 that is part of the obj_attributes in the argument. On success, the current filehandle retains its value. +Draft Specification NFS version 4 Protocol July 2002 + IMPLEMENTATION + If the request specifies the owner attribute to be set, the server + should allow the operation to succeed if the current owner of the + object matches the value specified in the request. Some servers + may be implemented in a way as to prohibit the setting of the owner + attribute unless the requestor has privilege to do so. If the + server is lenient in this one case of matching owner values, the + client implementation may be simplified in cases of creation of an + object followed by a SETATTR. + The file size attribute is used to request changes to the size of a file. A value of 0 (zero) causes the file to be truncated, a value less than the current size of the file causes data from new size to the end of the file to be discarded, and a size greater than the current size of the file causes logically zeroed data bytes to be added to the end of the file. Servers are free to implement this - -Draft Specification NFS version 4 Protocol November 2001 - using holes or actual zero data bytes. Clients should not make any assumptions regarding a server's implementation of this feature, beyond that the bytes returned will be zeroed. Servers must support extending the file size via SETATTR. SETATTR is not guaranteed atomic. A failed SETATTR may partially change a file's attributes. Changing the size of a file with SETATTR indirectly changes the time_modify. A client must account for this as size changes can result in data deletion. + The attributes time_access_set and time_modify_set are write-only + attributes constructed as a switched union so the client can direct + the server in setting the time values. If the switched union + specifies SET_TO_CLIENT_TIME4, the client has provided an nfstime4 + to be used for the operation. If the switch union does not specify + SET_TO_CLIENT_TIME4, the server is to use its current time for the + SETATTR operation. + If server and client times differ, programs that compare client time to file times can break. A time maintenance protocol should be used to limit client/server time skew. - If the server cannot successfully set all the attributes it must - return an NFS4ERR_INVAL error. If the server can only support 32 - bit offsets and sizes, a SETATTR request to set the size of a file - to larger than can be represented in 32 bits will be rejected with - this same error. + Use of a COMPOUND containing a VERIFY operation specifying only the + time_metadata attribute, immediately followed by a SETATTR, + provides a means whereby a client may specify a request that + emulates the functionality of the SETATTR guard mechanism of NFS + version 3. Since the function of the guard mechanism is to avoid + changes to the file attributes based on stale information, delays + between checking of the guard condition and the setting of the + attributes have the potential to compromise this function, as would + the corresponding delay in the NFS version 4 emulation. Therefore, + NFS version 4 servers should take care to avoid such delays, to the + degree possible, when executing such a request. + +Draft Specification NFS version 4 Protocol July 2002 + + If the server does not support an attribute as requested by the + client, the server should return NFS4ERR_ATTRNOTSUPP. + + A mask of the attibutes actually set is returned by SETATTR in all + cases. That mask must not include attributes bits not requested to + be set by the client, and must be equal to the mask of attributes + requested to be set only if the SETATTR completes without error. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_ATTRNOTSUPP NFS4ERR_BADHANDLE NFS4ERR_BAD_STATEID NFS4ERR_BADXDR NFS4ERR_DELAY - NFS4ERR_DENIED NFS4ERR_DQUOT NFS4ERR_EXPIRED NFS4ERR_FBIG NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_IO + NFS4ERR_ISDIR + NFS4ERR_LOCKED NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NOSPC NFS4ERR_NOTSUPP NFS4ERR_OLD_STATEID + NFS4ERR_OPENMODE NFS4ERR_PERM NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_STATEID NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.33. Operation 35: SETCLIENTID - Negotiate Clientid SYNOPSIS client, callback -> clientid ARGUMENT struct SETCLIENTID4args { nfs_client_id4 client; cb_client4 callback; + uint32_t callback_ident; }; RESULT struct SETCLIENTID4resok { clientid4 clientid; }; union SETCLIENTID4res switch (nfsstat4 status) { case NFS4_OK: @@ -8298,56 +8712,60 @@ locking requests and for a confirmation step. The client will use the SETCLIENTID_CONFIRM operation to return the clientid, as a verifier, to the server. At that point, the client may use the clientid in subsequent operations that require an nfs_lockowner. The callback information provided in this operation will be used if the client is provided an open delegation at a future point. Therefore, the client must correctly reflect the program and port numbers for the callback program at the time SETCLIENTID is used. + The callback_ident value is used by the server on the callback. + The client can use the callback_ident as a method of use a single + callback RPC program number while still being able to determine + which server is initiating the callback. + +Draft Specification NFS version 4 Protocol July 2002 + IMPLEMENTATION The server takes the verifier and client identification supplied in the nfs_client_id4 and searches for a match of the client - -Draft Specification NFS version 4 Protocol November 2001 - identification. If no match is found the server saves the principal/uid information along with the verifier and client identification and returns a unique clientid that is used as a shorthand reference to the supplied information. - If the server finds matching client identification and a - corresponding match in principal/uid, the server releases all - locking state for the client and returns a new clientid. - + If the server finds a matching client identification, the server + will only assign a new clientid if the principal/uid matches the + original entry. This is to protect against rogue clients + attempting to release client state indiscriminately at the server. The principal, or principal to user-identifier mapping is taken from the credential presented in the RPC. As mentioned, the server will use the credential and associated principal for the matching with existing clientids. If the client is a traditional host-based client like a Unix NFS client, then the credential presented may be the host credential. If the client is a user level client or lightweight client, the credential used may be the end user's credential. The client should take care in choosing an appropriate credential since denial of service attacks could be attempted by a rogue client that has access to the credential. ERRORS NFS4ERR_BADXDR NFS4ERR_CLID_INUSE NFS4ERR_INVAL NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Clientid SYNOPSIS clientid -> - ARGUMENT struct SETCLIENTID_CONFIRM4args { @@ -8368,34 +8786,32 @@ responds with a simple status of success or failure. IMPLEMENTATION The client must use the SETCLIENTID_CONFIRM operation to confirm its use of client identifier. If the server is holding state for a client which has presented a new verifier via SETCLIENTID, then the state will not be released, as described in the section "Client Failure and Recovery", until a valid SETCLIENTID_CONFIRM is received. Upon successful confirmation the server will release the - previous state held on behalf of the client. The server should - choose a confirmation cookie value that is reasonably unique for - the client. + previous state held on behalf of the client. ERRORS NFS4ERR_BADXDR NFS4ERR_CLID_INUSE NFS4ERR_INVAL NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE_CLIENTID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.35. Operation 37: VERIFY - Verify Same Attributes SYNOPSIS (cfh), fattr -> - ARGUMENT struct VERIFY4args { @@ -8433,50 +8849,49 @@ REMOVE (file name) This sequence does not prevent a second client from removing and creating a new file in the middle of this sequence but it does help avoid the unintended result. In the case that a recommended attribute is specified in the VERIFY operation and the server does not support that attribute for the file system object, the error NFS4ERR_NOTSUPP is returned to the -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 client. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_ATTRNOTSUPP NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_DELAY NFS4ERR_FHEXPIRED NFS4ERR_INVAL NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NOTSUPP NFS4ERR_NOT_SAME NFS4ERR_RESOURCE NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 14.2.36. Operation 38: WRITE - Write to File SYNOPSIS - (cfh), offset, count, stability, stateid, data -> count, committed, - verifier + (cfh), stateid, offset, stable, data -> count, committed, writeverf ARGUMENT enum stable_how4 { UNSTABLE4 = 0, DATA_SYNC4 = 1, FILE_SYNC4 = 2 }; struct WRITE4args { @@ -8501,27 +8916,28 @@ default: void; }; DESCRIPTION The WRITE operation is used to write data to a regular file. The target file is specified by the current filehandle. The offset specifies the offset where the data should be written. An offset of 0 (zero) specifies that the write should start at the beginning - of the file. The count represents the number of bytes of data that - are to be written. If the count is 0 (zero), the WRITE will - succeed and return a count of 0 (zero) subject to permissions - checking. The server may choose to write fewer bytes than - requested by the client. + of the file. The count, as encoded as part of the opaque data + parameter, represents the number of bytes of data that are to be + written. If the count is 0 (zero), the WRITE will succeed and + return a count of 0 (zero) subject to permissions checking. The + server may choose to write fewer bytes than requested by the + client. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 Part of the write request is a specification of how the write is to be performed. The client specifies with the stable parameter the method of how the data is to be processed by the server. If stable is FILE_SYNC4, the server must commit the data written plus all file system metadata to stable storage before returning results. This corresponds to the NFS version 2 protocol semantics. Any other behavior constitutes a protocol violation. If stable is DATA_SYNC4, then the server must commit all of the data to stable storage and enough of the metadata to retrieve the data before @@ -8552,49 +8968,49 @@ data and metadata to stable storage, committed should be set to FILE_SYNC4. If the level of commitment was at least as strong as DATA_SYNC4, then committed should be set to DATA_SYNC4. Otherwise, committed must be returned as UNSTABLE4. If stable was FILE4_SYNC, then committed must also be FILE_SYNC4: anything else constitutes a protocol violation. If stable was DATA_SYNC4, then committed may be FILE_SYNC4 or DATA_SYNC4: anything else constitutes a protocol violation. If stable was UNSTABLE4, then committed may be either FILE_SYNC4, DATA_SYNC4, or UNSTABLE4. - The final portion of the result is the write verifier, verf. The - write verifier is a cookie that the client can use to determine - whether the server has changed state between a call to WRITE and a - subsequent call to either WRITE or COMMIT. This cookie must be - consistent during a single instance of the NFS version 4 protocol - service and must be unique between instances of the NFS version 4 - protocol server, where uncommitted data may be lost. + The final portion of the result is the write verifier. The write + verifier is a cookie that the client can use to determine whether + the server has changed instance (boot) state between a call to + WRITE and a subsequent call to either WRITE or COMMIT. This cookie + must be consistent during a single instance of the NFS version 4 + protocol service and must be unique between instances of the NFS + version 4 protocol server, where uncommitted data may be lost. If a client writes data to the server with the stable argument set -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 to UNSTABLE4 and the reply yields a committed response of DATA_SYNC4 or UNSTABLE4, the client will follow up some time in the future with a COMMIT operation to synchronize outstanding asynchronous data and metadata with the server's stable storage, barring client error. It is possible that due to client crash or other error that a subsequent COMMIT will not be received by the server. On success, the current filehandle retains its value. IMPLEMENTATION - It is possible for the server to write fewer than count bytes of - data. In this case, the server should not return an error unless - no data was written at all. If the server writes less than count - bytes, the client should issue another WRITE to write the remaining - data. + It is possible for the server to write fewer bytes of data than + requested by the client. In this case, the server should not + return an error unless no data was written at all. If the server + writes less than the number of bytes specified, the client should + issue another WRITE to write the remaining data. It is assumed that the act of writing data to a file will cause the time_modified of the file to be updated. However, the time_modified of the file should not be changed unless the contents of the file are changed. Thus, a WRITE request with count set to 0 should not cause the time_modified of the file to be updated. The definition of stable storage has been historically a point of contention. The following expected properties of stable storage may help in resolving design issues in the implementation. Stable @@ -8613,67 +9029,113 @@ allows the client to detect server reboots. This information is required so that the client can safely determine whether the server could have lost cached data. If the server fails unexpectedly and the client has uncommitted data from previous WRITE requests (done with the stable argument set to UNSTABLE4 and in which the result committed was returned as UNSTABLE4 as well) it may not have flushed cached data to stable storage. The burden of recovery is on the client and the client will need to retransmit the data to the server. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 A suggested verifier would be to use the time that the server was booted or the time the server was last started (if restarting the server without a reboot results in lost buffers). The committed field in the results allows the client to do more effective caching. If the server is committing all WRITE requests to stable storage, then it should return with committed set to FILE_SYNC4, regardless of the value of the stable field in the arguments. A server that uses an NVRAM accelerator may choose to implement this policy. The client can use this to increase the effectiveness of the cache by discarding cached data that has already been committed on the server. Some implementations may return NFS4ERR_NOSPC instead of - NFS4ERR_DQUOT when a user's quota is exceeded. + NFS4ERR_DQUOT when a user's quota is exceeded. In the case that + the current filehandle is a directory, the server will return + NFS4ERR_ISDIR. If the current filehandle is not a regular file or + a directory, the server will return NFS4ERR_INVAL. ERRORS - NFS4ERR_ACCES + NFS4ERR_ACCESS NFS4ERR_BADHANDLE NFS4ERR_BAD_STATEID NFS4ERR_BADXDR NFS4ERR_DELAY - NFS4ERR_DENIED NFS4ERR_DQUOT NFS4ERR_EXPIRED NFS4ERR_FBIG NFS4ERR_FHEXPIRED NFS4ERR_GRACE NFS4ERR_INVAL NFS4ERR_IO + NFS4ERR_ISDIR NFS4ERR_LEASE_MOVED NFS4ERR_LOCKED NFS4ERR_MOVED NFS4ERR_NOFILEHANDLE NFS4ERR_NOSPC + NFS4ERR_NXIO NFS4ERR_OLD_STATEID + NFS4ERR_OPENMODE NFS4ERR_RESOURCE NFS4ERR_ROFS NFS4ERR_SERVERFAULT NFS4ERR_STALE NFS4ERR_STALE_STATEID NFS4ERR_WRONGSEC -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + +14.2.37. Operation 39: RELEASE_LOCKOWNER - Release Lockowner State + + SYNOPSIS + + lockowner -> () + + ARGUMENT + + struct RELEASE_LOCKOWNER4args { + lock_owner4 lock_owner; + }; + + RESULT + + struct RELEASE_LOCKOWNER4res { + nfsstat4 status; + }; + + DESCRIPTION + + This operation is used to notify the server that the lock_owner is + no longer in use by the client. This allows the server to release + cached state related to the specified lock_owner. + + IMPLEMENTATION + + The client may choose to use this operation to ease the amount of + server state that is cached. + + ERRORS + + NFS4ERR_BADXDR + NFS4ERR_EXPIRED + NFS4ERR_GRACE + NFS4ERR_LEASE_MOVED + NFS4ERR_RESOURCE + NFS4ERR_SERVERFAULT + NFS4ERR_STALE_CLIENTID + +Draft Specification NFS version 4 Protocol July 2002 15. NFS Version 4 Callback Procedures The procedures used for callbacks are defined in the following sections. In the interest of clarity, the terms "client" and "server" refer to NFS clients and servers, despite the fact that for an individual callback RPC, the sense of these terms would be precisely the opposite. 15.1. Procedure 0: CB_NULL - No Operation @@ -8694,21 +9156,21 @@ Standard NULL procedure. Void argument, void response. Even though there is no direct functionality associated with this procedure, the server will use CB_NULL to confirm the existence of a path for RPCs from server to client. ERRORS None. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 15.2. Procedure 1: CB_COMPOUND - Compound Operations SYNOPSIS compoundargs -> compoundres ARGUMENT enum nfs_cb_opnum4 { @@ -8717,20 +9179,21 @@ }; union nfs_cb_argop4 switch (unsigned argop) { case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; case OP_CB_RECALL: CB_RECALL4args opcbrecall; }; struct CB_COMPOUND4args { utf8string tag; uint32_t minorversion; + uint32_t callback_ident; nfs_cb_argop4 argarray<>; }; RESULT union nfs_cb_resop4 switch (unsigned resop){ case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; case OP_CB_RECALL: CB_RECALL4res opcbrecall; }; @@ -8744,51 +9207,62 @@ The CB_COMPOUND procedure is used to combine one or more of the callback procedures into a single RPC request. The main callback RPC program has two main procedures: CB_NULL and CB_COMPOUND. All other operations use the CB_COMPOUND procedure as a wrapper. In the processing of the CB_COMPOUND procedure, the client may find that it does not have the available resources to execute any or all of the operations within the CB_COMPOUND sequence. In this case, the error NFS4ERR_RESOURCE will be returned for the particular - operation within the CB_COMPOUND procedure where the resource -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + operation within the CB_COMPOUND procedure where the resource exhaustion occurred. This assumes that all previous operations within the CB_COMPOUND sequence have been evaluated successfully. Contained within the CB_COMPOUND results is a 'status' field. This status must be equivalent to the status of the last operation that was executed within the CB_COMPOUND procedure. Therefore, if an operation incurred an error then the 'status' value will be the same error value as is being returned for the operation that failed. + The definition of the "tag" in the request is left to the + implementor. It may be used to summarize the content of the + callback compound request for the benefit of packet sniffers and + engineers debugging implementations. However, the value of "tag" + in the response MUST be the same value as provided in the request. + + The value of callback_ident is supplied by the client during + SETCLIENTID. The server must use the client supplied + callback_ident during the CB_COMPOUND to allow the client to + properly identify the server. + IMPLEMENTATION The CB_COMPOUND procedure is used to combine individual operations into a single RPC request. The client interprets each of the operations in turn. If an operation is executed by the client and the status of that operation is NFS4_OK, then the next operation in the CB_COMPOUND procedure is executed. The client continues this process until there are no more operations to be executed or one of the operations has a status value other than NFS4_OK. ERRORS NFS4ERR_BADHANDLE NFS4ERR_BAD_STATEID NFS4ERR_RESOURCE -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 15.2.1. Operation 3: CB_GETATTR - Get Attributes SYNOPSIS fh, attrbits -> attrbits, attrvals ARGUMENT struct CB_GETATTR4args { @@ -8814,30 +9288,30 @@ The CB_GETATTR operation is used to obtain the attributes modified by an open delegate to allow the server to respond to GETATTR requests for a file which is the subject of an open delegation. If the handle specified is not one for which the client holds a write open delegation, an NFS4ERR_BADHANDLE error is returned. IMPLEMENTATION The client returns attrbits and the associated attribute values - only for attributes that it may change (change, time_modify, - object_size). + only for attributes that it may change (change, time_modify, size). ERRORS NFS4ERR_BADHANDLE NFS4ERR_BADXDR NFS4ERR_RESOURCE + NFS4ERR_SERVERFAULT -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 15.2.2. Operation 4: CB_RECALL - Recall an Open Delegation SYNOPSIS stateid, truncate, fh -> status ARGUMENT struct CB_RECALL4args { @@ -8873,82 +9347,84 @@ The client should reply to the callback immediately. Replying does not complete the recall. The recall is not complete until the delegation is returned using a DELEGRETURN. ERRORS NFS4ERR_BADHANDLE NFS4ERR_BAD_STATEID -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 NFS4ERR_BADXDR NFS4ERR_RESOURCE + NFS4ERR_SERVERFAULT -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 16. Security Considerations The major security feature to consider is the authentication of the user making the request of NFS service. Consideration should also be given to the integrity and privacy of this NFS request. These specific issues are discussed as part of the section on "RPC and Security Flavor". -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 17. IANA Considerations 17.1. Named Attribute Definition The NFS version 4 protocol provides for the association of named attributes to files. The name space identifiers for these attributes are defined as string names. The protocol does not define the specific assignment of the name space for these file attributes; the application developer or system vendor is allowed to define the attribute, its semantics, and the associated name. Even though this name space will not be specifically controlled to prevent collisions, the application developer or system vendor is strongly encouraged to provide the name assignment and associated semantics for attributes via an Informational RFC. This will provide for interoperability where common interests exist. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 18. RPC definition file /* - * Copyright (C) The Internet Society (1998,1999,2000,2001). + * Copyright (C) The Internet Society (1998,1999,2000,2001,2002). * All Rights Reserved. */ /* * nfs4_prot.x * */ - %#pragma ident "@(#)nfs4_prot.x 1.104 01/11/14" + %#pragma ident "@(#)nfs4_prot.x 1.109" /* * Basic typedefs for RFC 1832 data type definitions */ typedef int int32_t; typedef unsigned int uint32_t; typedef hyper int64_t; typedef unsigned hyper uint64_t; /* * Sizes */ const NFS4_FHSIZE = 128; const NFS4_VERIFIER_SIZE = 8; + const NFS4_OPAQUE_LIMIT = 1024; /* * File types */ enum nfs_ftype4 { NF4REG = 1, /* Regular File */ NF4DIR = 2, /* Directory */ NF4BLK = 3, /* Special File - block device */ NF4CHR = 4, /* Special File - character device */ NF4LNK = 5, /* Symbolic Link */ @@ -8959,25 +9435,25 @@ }; /* * Error status */ enum nfsstat4 { NFS4_OK = 0, NFS4ERR_PERM = 1, NFS4ERR_NOENT = 2, NFS4ERR_IO = 5, - NFS4ERR_NXIO = 6, -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 - NFS4ERR_ACCES = 13, + NFS4ERR_NXIO = 6, + NFS4ERR_ACCESS = 13, NFS4ERR_EXIST = 17, NFS4ERR_XDEV = 18, NFS4ERR_NODEV = 19, NFS4ERR_NOTDIR = 20, NFS4ERR_ISDIR = 21, NFS4ERR_INVAL = 22, NFS4ERR_FBIG = 27, NFS4ERR_NOSPC = 28, NFS4ERR_ROFS = 30, NFS4ERR_MLINK = 31, @@ -9013,24 +9489,27 @@ NFS4ERR_NOT_SAME = 10027,/* verify - attrs not same */ NFS4ERR_LOCK_RANGE = 10028, NFS4ERR_SYMLINK = 10029, NFS4ERR_READDIR_NOSPC = 10030, NFS4ERR_LEASE_MOVED = 10031, NFS4ERR_ATTRNOTSUPP = 10032, NFS4ERR_NO_GRACE = 10033, NFS4ERR_RECLAIM_BAD = 10034, NFS4ERR_RECLAIM_CONFLICT = 10035, NFS4ERR_BADXDR = 10036, - NFS4ERR_LOCKS_HELD = 10037 - }; + NFS4ERR_LOCKS_HELD = 10037, -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 + + NFS4ERR_OPENMODE = 10038, + NFS4ERR_BADOWNER = 10039 + }; /* * Basic data types */ typedef uint32_t bitmap4<>; typedef uint64_t offset4; typedef uint32_t count4; typedef uint64_t length4; typedef uint64_t clientid4; typedef uint32_t seqid4; @@ -9065,27 +9544,27 @@ default: void; }; /* * File access handle */ typedef opaque nfs_fh4; /* + +Draft Specification NFS version 4 Protocol July 2002 + * File attribute definitions */ /* - -Draft Specification NFS version 4 Protocol November 2001 - * FSID structure for major/minor */ struct fsid4 { uint64_t major; uint64_t minor; }; /* * Filesystem locations attribute for relocation/migration */ @@ -9118,27 +9597,27 @@ * acetype4 values, others can be added as needed. */ const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; /* * ACE flag */ + +Draft Specification NFS version 4 Protocol July 2002 + typedef uint32_t aceflag4; /* * ACE flag values - -Draft Specification NFS version 4 Protocol November 2001 - */ const ACE4_FILE_INHERIT_ACE = 0x00000001; const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; const ACE4_INHERIT_ONLY_ACE = 0x00000008; const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; const ACE4_IDENTIFIER_GROUP = 0x00000040; /* @@ -9172,27 +9651,27 @@ * ACE4_GENERIC_READ -- defined as combination of * ACE4_READ_ACL | * ACE4_READ_DATA | * ACE4_READ_ATTRIBUTES | * ACE4_SYNCHRONIZE */ const ACE4_GENERIC_READ = 0x00120081; /* + +Draft Specification NFS version 4 Protocol July 2002 + * ACE4_GENERIC_WRITE -- defined as combination of * ACE4_READ_ACL | * ACE4_WRITE_DATA | * ACE4_WRITE_ATTRIBUTES | - -Draft Specification NFS version 4 Protocol November 2001 - * ACE4_WRITE_ACL | * ACE4_APPEND_DATA | * ACE4_SYNCHRONIZE */ const ACE4_GENERIC_WRITE = 0x00160106; /* * ACE4_GENERIC_EXECUTE -- defined as combination of * ACE4_READ_ACL * ACE4_READ_ATTRIBUTES @@ -9224,27 +9703,27 @@ * Values for fattr4_fh_expire_type */ const FH4_PERSISTENT = 0x00000000; const FH4_NOEXPIRE_WITH_OPEN = 0x00000001; const FH4_VOLATILE_ANY = 0x00000002; const FH4_VOL_MIGRATION = 0x00000004; const FH4_VOL_RENAME = 0x00000008; typedef bitmap4 fattr4_supported_attrs; typedef nfs_ftype4 fattr4_type; + +Draft Specification NFS version 4 Protocol July 2002 + typedef uint32_t fattr4_fh_expire_type; typedef changeid4 fattr4_change; typedef uint64_t fattr4_size; typedef bool fattr4_link_support; - -Draft Specification NFS version 4 Protocol November 2001 - typedef bool fattr4_symlink_support; typedef bool fattr4_named_attr; typedef fsid4 fattr4_fsid; typedef bool fattr4_unique_handles; typedef uint32_t fattr4_lease_time; typedef nfsstat4 fattr4_rdattr_error; typedef nfsace4 fattr4_acl<>; typedef uint32_t fattr4_aclsupport; typedef bool fattr4_archive; @@ -9279,25 +9758,26 @@ typedef uint64_t fattr4_space_free; typedef uint64_t fattr4_space_total; typedef uint64_t fattr4_space_used; typedef bool fattr4_system; typedef nfstime4 fattr4_time_access; typedef settime4 fattr4_time_access_set; typedef nfstime4 fattr4_time_backup; typedef nfstime4 fattr4_time_create; typedef nfstime4 fattr4_time_delta; typedef nfstime4 fattr4_time_metadata; + +Draft Specification NFS version 4 Protocol July 2002 + typedef nfstime4 fattr4_time_modify; typedef settime4 fattr4_time_modify_set; -Draft Specification NFS version 4 Protocol November 2001 - /* * Mandatory Attributes */ const FATTR4_SUPPORTED_ATTRS = 0; const FATTR4_TYPE = 1; const FATTR4_FH_EXPIRE_TYPE = 2; const FATTR4_CHANGE = 3; const FATTR4_SIZE = 4; const FATTR4_LINK_SUPPORT = 5; const FATTR4_SYMLINK_SUPPORT = 6; @@ -9332,27 +9812,27 @@ const FATTR4_MAXWRITE = 31; const FATTR4_MIMETYPE = 32; const FATTR4_MODE = 33; const FATTR4_NO_TRUNC = 34; const FATTR4_NUMLINKS = 35; const FATTR4_OWNER = 36; const FATTR4_OWNER_GROUP = 37; const FATTR4_QUOTA_AVAIL_HARD = 38; const FATTR4_QUOTA_AVAIL_SOFT = 39; const FATTR4_QUOTA_USED = 40; + +Draft Specification NFS version 4 Protocol July 2002 + const FATTR4_RAWDEV = 41; const FATTR4_SPACE_AVAIL = 42; const FATTR4_SPACE_FREE = 43; const FATTR4_SPACE_TOTAL = 44; - -Draft Specification NFS version 4 Protocol November 2001 - const FATTR4_SPACE_USED = 45; const FATTR4_SYSTEM = 46; const FATTR4_TIME_ACCESS = 47; const FATTR4_TIME_ACCESS_SET = 48; const FATTR4_TIME_BACKUP = 49; const FATTR4_TIME_CREATE = 50; const FATTR4_TIME_DELTA = 51; const FATTR4_TIME_METADATA = 52; const FATTR4_TIME_MODIFY = 53; const FATTR4_TIME_MODIFY_SET = 54; @@ -9386,51 +9866,51 @@ * Callback program info as provided by the client */ struct cb_client4 { uint32_t cb_program; clientaddr4 cb_location; }; /* * Stateid */ + +Draft Specification NFS version 4 Protocol July 2002 + struct stateid4 { uint32_t seqid; opaque other[12]; }; -Draft Specification NFS version 4 Protocol November 2001 - /* * Client ID */ struct nfs_client_id4 { verifier4 verifier; - opaque id<>; + opaque id; }; struct open_owner4 { clientid4 clientid; - opaque owner<>; + opaque owner; }; struct lock_owner4 { clientid4 clientid; - opaque owner<>; + opaque owner; }; enum nfs_lock_type4 { READ_LT = 1, WRITE_LT = 2, READW_LT = 3, /* blocking read */ - WRITEW_LT = 4, /* blocking write */ - RELEASE_STATE = 5 /* release lock_stateid at server */ + WRITEW_LT = 4 /* blocking write */ }; /* * ACCESS: Check access permission */ const ACCESS4_READ = 0x00000001; const ACCESS4_LOOKUP = 0x00000002; const ACCESS4_MODIFY = 0x00000004; const ACCESS4_EXTEND = 0x00000008; const ACCESS4_DELETE = 0x00000010; @@ -9441,27 +9921,28 @@ uint32_t access; }; struct ACCESS4resok { uint32_t supported; uint32_t access; }; union ACCESS4res switch (nfsstat4 status) { case NFS4_OK: + +Draft Specification NFS version 4 Protocol July 2002 + ACCESS4resok resok4; default: void; }; -Draft Specification NFS version 4 Protocol November 2001 - /* * CLOSE: Close a file and release share locks */ struct CLOSE4args { /* CURRENT_FH: object */ seqid4 seqid; stateid4 open_stateid; }; union CLOSE4res switch (nfsstat4 status) { @@ -9494,28 +9975,28 @@ /* * CREATE: Create a non-regular file */ union createtype4 switch (nfs_ftype4 type) { case NF4LNK: linktext4 linkdata; case NF4BLK: case NF4CHR: specdata4 devdata; case NF4SOCK: + +Draft Specification NFS version 4 Protocol July 2002 + case NF4FIFO: case NF4DIR: void; default: void; /* server should return NFS4ERR_BADTYPE */ - -Draft Specification NFS version 4 Protocol November 2001 - }; struct CREATE4args { /* CURRENT_FH: directory for creation */ createtype4 objtype; component4 objname; fattr4 createattrs; }; struct CREATE4resok { @@ -9538,39 +10019,40 @@ }; struct DELEGPURGE4res { nfsstat4 status; }; /* * DELEGRETURN: Return a delegation */ struct DELEGRETURN4args { + /* CURRENT_FH: delegated file */ stateid4 deleg_stateid; }; struct DELEGRETURN4res { nfsstat4 status; }; /* * GETATTR: Get file attributes */ + +Draft Specification NFS version 4 Protocol July 2002 + struct GETATTR4args { /* CURRENT_FH: directory or file */ bitmap4 attr_request; }; struct GETATTR4resok { - -Draft Specification NFS version 4 Protocol November 2001 - fattr4 obj_attributes; }; union GETATTR4res switch (nfsstat4 status) { case NFS4_OK: GETATTR4resok resok4; default: void; }; @@ -9603,29 +10085,29 @@ union LINK4res switch (nfsstat4 status) { case NFS4_OK: LINK4resok resok4; default: void; }; /* * For LOCK, transition from open_owner to new lock_owner + +Draft Specification NFS version 4 Protocol July 2002 + */ struct open_to_lock_owner4 { seqid4 open_seqid; stateid4 open_stateid; seqid4 lock_seqid; lock_owner4 lock_owner; - -Draft Specification NFS version 4 Protocol November 2001 - }; /* * For LOCK, existing lock_owner continues to request file locks */ struct exist_lock_owner4 { stateid4 lock_stateid; seqid4 lock_seqid; }; @@ -9658,29 +10140,29 @@ struct LOCK4resok { stateid4 lock_stateid; }; union LOCK4res switch (nfsstat4 status) { case NFS4_OK: LOCK4resok resok4; case NFS4ERR_DENIED: LOCK4denied denied; default: + +Draft Specification NFS version 4 Protocol July 2002 + void; }; struct LOCKT4args { /* CURRENT_FH: file */ nfs_lock_type4 locktype; - -Draft Specification NFS version 4 Protocol November 2001 - offset4 offset; length4 length; lock_owner4 owner; }; union LOCKT4res switch (nfsstat4 status) { case NFS4ERR_DENIED: LOCK4denied denied; case NFS4_OK: void; @@ -9713,29 +10195,29 @@ }; struct LOOKUP4res { /* CURRENT_FH: object */ nfsstat4 status; }; /* * LOOKUPP: Lookup parent directory */ + +Draft Specification NFS version 4 Protocol July 2002 + struct LOOKUPP4res { /* CURRENT_FH: directory */ nfsstat4 status; }; /* - -Draft Specification NFS version 4 Protocol November 2001 - * NVERIFY: Verify attributes different */ struct NVERIFY4args { /* CURRENT_FH: object */ fattr4 obj_attributes; }; struct NVERIFY4res { nfsstat4 status; }; @@ -9769,27 +10251,27 @@ void; }; /* Next definitions used for OPEN delegation */ enum limit_by4 { NFS_LIMIT_SIZE = 1, NFS_LIMIT_BLOCKS = 2 /* others as needed */ }; +Draft Specification NFS version 4 Protocol July 2002 + struct nfs_modified_limit4 { uint32_t num_blocks; uint32_t bytes_per_block; }; -Draft Specification NFS version 4 Protocol November 2001 - union nfs_space_limit4 switch (limit_by4 limitby) { /* limit specified as file size */ case NFS_LIMIT_SIZE: uint64_t filesize; /* limit specified by number of blocks */ case NFS_LIMIT_BLOCKS: nfs_modified_limit4 mod_blocks; } ; /* @@ -9823,28 +10305,27 @@ }; union open_claim4 switch (open_claim_type4 claim) { /* * No special rights to file. Ordinary OPEN of the specified file. */ case CLAIM_NULL: /* CURRENT_FH: directory */ component4 file; +Draft Specification NFS version 4 Protocol July 2002 + /* * Right to the file established by an open previous to server * reboot. File identified by filehandle obtained at that time * rather than by name. */ - -Draft Specification NFS version 4 Protocol November 2001 - case CLAIM_PREVIOUS: /* CURRENT_FH: file being reclaimed */ open_delegation_type4 delegate_type; /* * Right to file based on a delegation granted by the server. * File is specified by name. */ case CLAIM_DELEGATE_CUR: /* CURRENT_FH: directory */ @@ -9878,28 +10359,28 @@ (CLAIM_PREVIOUS) */ nfsace4 permissions; /* Defines users who don't need an ACCESS call to open for read */ }; struct open_write_delegation4 { stateid4 stateid; /* Stateid for delegation */ bool recall; /* Pre-recalled flag for delegations obtained + +Draft Specification NFS version 4 Protocol July 2002 + by reclaim (CLAIM_PREVIOUS) */ nfs_space_limit4 space_limit; /* Defines condition that the client must check to determine whether the - -Draft Specification NFS version 4 Protocol November 2001 - file needs to be flushed to the server on close. */ nfsace4 permissions; /* Defines users who don't need an ACCESS call as part of a delegated open. */ }; union open_delegation4 @@ -9912,48 +10393,51 @@ open_write_delegation4 write; }; /* * Result flags */ /* Mandatory locking is in effect for this file. */ const OPEN4_RESULT_MLOCK = 0x00000001; /* Client must confirm open */ const OPEN4_RESULT_CONFIRM = 0x00000002; + /* Type of file locking behavior at the server */ + const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004; struct OPEN4resok { stateid4 stateid; /* Stateid for open */ change_info4 cinfo; /* Directory Change Info */ uint32_t rflags; /* Result flags */ bitmap4 attrset; /* attribute set for create*/ open_delegation4 delegation; /* Info on any open delegation */ }; union OPEN4res switch (nfsstat4 status) { case NFS4_OK: /* CURRENT_FH: opened file */ OPEN4resok resok4; default: void; }; /* + +Draft Specification NFS version 4 Protocol July 2002 + * OPENATTR: open named attributes directory */ struct OPENATTR4args { /* CURRENT_FH: object */ bool createdir; }; -Draft Specification NFS version 4 Protocol November 2001 - struct OPENATTR4res { /* CURRENT_FH: named attr directory */ nfsstat4 status; }; /* * OPEN_CONFIRM: confirm the open */ struct OPEN_CONFIRM4args { /* CURRENT_FH: opened file */ @@ -9985,30 +10469,30 @@ struct OPEN_DOWNGRADE4resok { stateid4 open_stateid; }; union OPEN_DOWNGRADE4res switch(nfsstat4 status) { case NFS4_OK: OPEN_DOWNGRADE4resok resok4; default: void; + +Draft Specification NFS version 4 Protocol July 2002 + }; /* * PUTFH: Set current filehandle */ struct PUTFH4args { nfs_fh4 object; - -Draft Specification NFS version 4 Protocol November 2001 - }; struct PUTFH4res { /* CURRENT_FH: */ nfsstat4 status; }; /* * PUTPUBFH: Set public filehandle */ @@ -10040,30 +10524,29 @@ opaque data<>; }; union READ4res switch (nfsstat4 status) { case NFS4_OK: READ4resok resok4; default: void; }; +Draft Specification NFS version 4 Protocol July 2002 + /* * READDIR: Read directory */ struct READDIR4args { /* CURRENT_FH: directory */ nfs_cookie4 cookie; verifier4 cookieverf; - -Draft Specification NFS version 4 Protocol November 2001 - count4 dircount; count4 maxcount; bitmap4 attr_request; }; struct entry4 { nfs_cookie4 cookie; component4 name; fattr4 attrs; entry4 *nextentry; @@ -10093,30 +10576,30 @@ linktext4 link; }; union READLINK4res switch (nfsstat4 status) { case NFS4_OK: READLINK4resok resok4; default: void; }; +Draft Specification NFS version 4 Protocol July 2002 + /* * REMOVE: Remove filesystem object */ struct REMOVE4args { /* CURRENT_FH: directory */ component4 target; }; -Draft Specification NFS version 4 Protocol November 2001 - struct REMOVE4resok { change_info4 cinfo; }; union REMOVE4res switch (nfsstat4 status) { case NFS4_OK: REMOVE4resok resok4; default: void; }; @@ -10147,31 +10630,31 @@ * RENEW: Renew a Lease */ struct RENEW4args { clientid4 clientid; }; struct RENEW4res { nfsstat4 status; }; +Draft Specification NFS version 4 Protocol July 2002 + /* * RESTOREFH: Restore saved filehandle */ struct RESTOREFH4res { /* CURRENT_FH: value of saved fh */ nfsstat4 status; }; -Draft Specification NFS version 4 Protocol November 2001 - /* * SAVEFH: Save current filehandle */ struct SAVEFH4res { /* SAVED_FH: value of current fh */ nfsstat4 status; }; /* * SECINFO: Obtain Available Security Mechanisms @@ -10201,48 +10684,49 @@ case RPCSEC_GSS: rpcsec_gss_info flavor_info; default: void; }; typedef secinfo4 SECINFO4resok<>; union SECINFO4res switch (nfsstat4 status) { case NFS4_OK: + +Draft Specification NFS version 4 Protocol July 2002 + SECINFO4resok resok4; default: void; }; /* * SETATTR: Set attributes */ struct SETATTR4args { - -Draft Specification NFS version 4 Protocol November 2001 - /* CURRENT_FH: target object */ stateid4 stateid; fattr4 obj_attributes; }; struct SETATTR4res { nfsstat4 status; bitmap4 attrsset; }; /* * SETCLIENTID */ struct SETCLIENTID4args { nfs_client_id4 client; cb_client4 callback; + uint32_t callback_ident; }; struct SETCLIENTID4resok { clientid4 clientid; }; union SETCLIENTID4res switch (nfsstat4 status) { case NFS4_OK: SETCLIENTID4resok resok4; case NFS4ERR_CLID_INUSE: @@ -10255,33 +10739,33 @@ clientid4 clientid; }; struct SETCLIENTID_CONFIRM4res { nfsstat4 status; }; /* * VERIFY: Verify attributes same */ + +Draft Specification NFS version 4 Protocol July 2002 + struct VERIFY4args { /* CURRENT_FH: object */ fattr4 obj_attributes; }; struct VERIFY4res { nfsstat4 status; }; /* - -Draft Specification NFS version 4 Protocol November 2001 - * WRITE: Write to file */ enum stable_how4 { UNSTABLE4 = 0, DATA_SYNC4 = 1, FILE_SYNC4 = 2 }; struct WRITE4args { /* CURRENT_FH: file */ @@ -10298,21 +10782,35 @@ }; union WRITE4res switch (nfsstat4 status) { case NFS4_OK: WRITE4resok resok4; default: void; }; /* + * RELEASE_LOCKOWNER: Notify server to release lockowner + */ + struct RELEASE_LOCKOWNER4args { + lock_owner4 lock_owner; + }; + + struct RELEASE_LOCKOWNER4res { + nfsstat4 status; + }; + + /* * Operation arrays + +Draft Specification NFS version 4 Protocol July 2002 + */ enum nfs_opnum4 { OP_ACCESS = 3, OP_CLOSE = 4, OP_COMMIT = 5, OP_CREATE = 6, OP_DELEGPURGE = 7, OP_DELEGRETURN = 8, OP_GETATTR = 9, @@ -10320,53 +10818,54 @@ OP_LINK = 11, OP_LOCK = 12, OP_LOCKT = 13, OP_LOCKU = 14, OP_LOOKUP = 15, OP_LOOKUPP = 16, OP_NVERIFY = 17, OP_OPEN = 18, OP_OPENATTR = 19, OP_OPEN_CONFIRM = 20, - -Draft Specification NFS version 4 Protocol November 2001 - OP_OPEN_DOWNGRADE = 21, OP_PUTFH = 22, OP_PUTPUBFH = 23, OP_PUTROOTFH = 24, OP_READ = 25, OP_READDIR = 26, OP_READLINK = 27, OP_REMOVE = 28, OP_RENAME = 29, OP_RENEW = 30, OP_RESTOREFH = 31, OP_SAVEFH = 32, OP_SECINFO = 33, OP_SETATTR = 34, OP_SETCLIENTID = 35, OP_SETCLIENTID_CONFIRM = 36, OP_VERIFY = 37, - OP_WRITE = 38 + OP_WRITE = 38, + OP_RELEASE_LOCKOWNER = 39 }; union nfs_argop4 switch (nfs_opnum4 argop) { case OP_ACCESS: ACCESS4args opaccess; case OP_CLOSE: CLOSE4args opclose; case OP_COMMIT: COMMIT4args opcommit; case OP_CREATE: CREATE4args opcreate; case OP_DELEGPURGE: DELEGPURGE4args opdelegpurge; case OP_DELEGRETURN: DELEGRETURN4args opdelegreturn; case OP_GETATTR: GETATTR4args opgetattr; case OP_GETFH: void; case OP_LINK: LINK4args oplink; + +Draft Specification NFS version 4 Protocol July 2002 + case OP_LOCK: LOCK4args oplock; case OP_LOCKT: LOCKT4args oplockt; case OP_LOCKU: LOCKU4args oplocku; case OP_LOOKUP: LOOKUP4args oplookup; case OP_LOOKUPP: void; case OP_NVERIFY: NVERIFY4args opnverify; case OP_OPEN: OPEN4args opopen; case OP_OPENATTR: OPENATTR4args opopenattr; case OP_OPEN_CONFIRM: OPEN_CONFIRM4args opopen_confirm; case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4args opopen_downgrade; @@ -10375,29 +10874,28 @@ case OP_PUTROOTFH: void; case OP_READ: READ4args opread; case OP_READDIR: READDIR4args opreaddir; case OP_READLINK: void; case OP_REMOVE: REMOVE4args opremove; case OP_RENAME: RENAME4args oprename; case OP_RENEW: RENEW4args oprenew; case OP_RESTOREFH: void; case OP_SAVEFH: void; case OP_SECINFO: SECINFO4args opsecinfo; - -Draft Specification NFS version 4 Protocol November 2001 - case OP_SETATTR: SETATTR4args opsetattr; case OP_SETCLIENTID: SETCLIENTID4args opsetclientid; case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args opsetclientid_confirm; case OP_VERIFY: VERIFY4args opverify; case OP_WRITE: WRITE4args opwrite; + case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4args + oprelease_lockowner; }; union nfs_resop4 switch (nfs_opnum4 resop){ case OP_ACCESS: ACCESS4res opaccess; case OP_CLOSE: CLOSE4res opclose; case OP_COMMIT: COMMIT4res opcommit; case OP_CREATE: CREATE4res opcreate; case OP_DELEGPURGE: DELEGPURGE4res opdelegpurge; case OP_DELEGRETURN: DELEGRETURN4res opdelegreturn; case OP_GETATTR: GETATTR4res opgetattr; @@ -10406,47 +10904,49 @@ case OP_LOCK: LOCK4res oplock; case OP_LOCKT: LOCKT4res oplockt; case OP_LOCKU: LOCKU4res oplocku; case OP_LOOKUP: LOOKUP4res oplookup; case OP_LOOKUPP: LOOKUPP4res oplookupp; case OP_NVERIFY: NVERIFY4res opnverify; case OP_OPEN: OPEN4res opopen; case OP_OPENATTR: OPENATTR4res opopenattr; case OP_OPEN_CONFIRM: OPEN_CONFIRM4res opopen_confirm; case OP_OPEN_DOWNGRADE: OPEN_DOWNGRADE4res opopen_downgrade; + +Draft Specification NFS version 4 Protocol July 2002 + case OP_PUTFH: PUTFH4res opputfh; case OP_PUTPUBFH: PUTPUBFH4res opputpubfh; case OP_PUTROOTFH: PUTROOTFH4res opputrootfh; case OP_READ: READ4res opread; case OP_READDIR: READDIR4res opreaddir; case OP_READLINK: READLINK4res opreadlink; case OP_REMOVE: REMOVE4res opremove; case OP_RENAME: RENAME4res oprename; case OP_RENEW: RENEW4res oprenew; case OP_RESTOREFH: RESTOREFH4res oprestorefh; case OP_SAVEFH: SAVEFH4res opsavefh; case OP_SECINFO: SECINFO4res opsecinfo; case OP_SETATTR: SETATTR4res opsetattr; case OP_SETCLIENTID: SETCLIENTID4res opsetclientid; case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4res opsetclientid_confirm; case OP_VERIFY: VERIFY4res opverify; case OP_WRITE: WRITE4res opwrite; + case OP_RELEASE_LOCKOWNER: RELEASE_LOCKOWNER4res + oprelease_lockowner; }; struct COMPOUND4args { utf8string tag; uint32_t minorversion; nfs_argop4 argarray<>; - -Draft Specification NFS version 4 Protocol November 2001 - }; struct COMPOUND4res { nfsstat4 status; utf8string tag; nfs_resop4 resarray<>; }; /* * Remote file service routines @@ -10457,20 +10957,23 @@ NFSPROC4_NULL(void) = 0; COMPOUND4res NFSPROC4_COMPOUND(COMPOUND4args) = 1; } = 4; } = 100003; /* * NFS4 Callback Procedure Definitions and Program + +Draft Specification NFS version 4 Protocol July 2002 + */ /* * CB_GETATTR: Get Current Attributes */ struct CB_GETATTR4args { nfs_fh4 fh; bitmap4 attr_request; }; @@ -10483,23 +10986,20 @@ CB_GETATTR4resok resok4; default: void; }; /* * CB_RECALL: Recall an Open Delegation */ struct CB_RECALL4args { stateid4 stateid; - -Draft Specification NFS version 4 Protocol November 2001 - bool truncate; nfs_fh4 fh; }; struct CB_RECALL4res { nfsstat4 status; }; /* * Various definitions for CB_COMPOUND @@ -10512,23 +11012,26 @@ union nfs_cb_argop4 switch (unsigned argop) { case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr; case OP_CB_RECALL: CB_RECALL4args opcbrecall; }; union nfs_cb_resop4 switch (unsigned resop){ case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr; case OP_CB_RECALL: CB_RECALL4res opcbrecall; }; +Draft Specification NFS version 4 Protocol July 2002 + struct CB_COMPOUND4args { utf8string tag; uint32_t minorversion; + uint32_t callback_ident; nfs_cb_argop4 argarray<>; }; struct CB_COMPOUND4res { nfsstat4 status; utf8string tag; nfs_cb_resop4 resarray<>; }; /* @@ -10538,21 +11041,21 @@ */ program NFS4_CALLBACK { version NFS_CB { void CB_NULL(void) = 0; CB_COMPOUND4res CB_COMPOUND(CB_COMPOUND4args) = 1; } = 1; } = 0x40000000; -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 19. Bibliography [Floyd] S. Floyd, V. Jacobson, "The Synchronization of Periodic Routing Messages," IEEE/ACM Transactions on Networking, 2(2), pp. 122-136, April 1994. [Gray] C. Gray, D. Cheriton, "Leases: An Efficient Fault-Tolerant Mechanism @@ -10586,21 +11089,21 @@ Association, Berkeley, CA, January 1991. Describes performance work in tuning the 4.3BSD Reno NFS implementation. Describes performance improvement (reduced CPU loading) through elimination of data copies. [Mogul] Mogul, Jeffrey C., "A Recovery Protocol for Spritely NFS," USENIX File System Workshop Proceedings, Ann Arbor, MI, USENIX Association, Berkeley, CA, May 1992. Second paper on Spritely NFS proposes a lease-based scheme for recovering state of consistency protocol. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 [Nowicki] Nowicki, Bill, "Transport Issues in the Network File System," ACM SIGCOMM newsletter Computer Communication Review, April 1989. A brief description of the basis for the dynamic retransmission work. [Pawlowski] Pawlowski, Brian, Ron Hixon, Mark Stein, Joseph Tumminaro, "Network Computing in the UNIX and IBM Mainframe Environment," Uniforum `89 Conf. Proc., (1989) Description of an NFS server implementation for @@ -10633,21 +11136,21 @@ [RFC1831] Srinivasan, R., "RPC: Remote Procedure Call Protocol Specification Version 2", RFC1831, Sun Microsystems, Inc., August 1995. http://www.ietf.org/rfc/rfc1831.txt [RFC1832] Srinivasan, R., "XDR: External Data Representation Standard", RFC1832, Sun Microsystems, Inc., August 1995. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 http://www.ietf.org/rfc/rfc1832.txt [RFC1833] Srinivasan, R., "Binding Protocols for ONC RPC Version 2", RFC1833, Sun Microsystems, Inc., August 1995. http://www.ietf.org/rfc/rfc1833.txt [RFC2025] @@ -10679,21 +11182,21 @@ RFC2152, Apple Computer, Inc., May 1997 http://www.ietf.org/rfc/rfc2152.txt [RFC2203] Eisler, M., Chiu, A., Ling, L., "RPCSEC_GSS Protocol Specification", RFC2203, Sun Microsystems, Inc., August 1995. http://www.ietf.org/rfc/rfc2203.txt -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and Languages", RFC2277, UNINETT, January 1998. http://www.ietf.org/rfc/rfc2277.txt [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC2279, Alis Technologies, January 1998. @@ -10728,21 +11231,21 @@ offs. [Srinivasan] Srinivasan, V., Jeffrey C. Mogul, "Spritely NFS: Implementation and Performance of Cache Consistency Protocols", WRL Research Report 89/5, Digital Equipment Corporation Western Research Laboratory, 100 Hamilton Ave., Palo Alto, CA, 94301, May 1989. This paper analyzes the effect of applying a Sprite-like consistency protocol applied to standard NFS. The issues of recovery in a stateful environment are -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 covered in [Mogul]. [Unicode1] The Unicode Consortium, "The Unicode Standard, Version 3.0", Addison-Wesley Developers Press, Reading, MA, 2000. ISBN 0-201- 61633-5. More information available at: http://www.unicode.org/ @@ -10752,21 +11255,21 @@ http://www.unicode.org/unicode/standard/unsupported.html [XNFS] The Open Group, Protocols for Interworking: XNFS, Version 3W, The Open Group, 1010 El Camino Real Suite 380, Menlo Park, CA 94025, ISBN 1-85912-184-5, February 1998. HTML version available: http://www.opengroup.org -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 20. Authors 20.1. Editor's Address Spencer Shepler Sun Microsystems, Inc. 7808 Moonflower Drive Austin, Texas 78750 @@ -10801,45 +11304,45 @@ Waltham, MA 02451 Phone: +1 781-895-4949 E-mail: dnoveck@netapp.com David Robinson Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303 -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 Phone: +1 650-786-5088 E-mail: david.robinson@sun.com Robert Thurlow Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303 Phone: +1 650-786-5096 E-mail: robert.thurlow@sun.com 20.3. Acknowledgements The author thanks and acknowledges: Neil Brown for his extensive review and comments of various drafts. -Draft Specification NFS version 4 Protocol November 2001 +Draft Specification NFS version 4 Protocol July 2002 21. Full Copyright Statement - "Copyright (C) The Internet Society (2000,2001). - All Rights Reserved. + "Copyright (C) The Internet Society (2000-2002). All Rights + Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of