Internet Engineering Task Force (IETF)                    T. Haynes, Ed.
Request for Comments: 7530                                  Primary Data
Obsoletes: 3530                                           D. Noveck, Ed.
Category: Standards Track                                           Dell
ISSN: 2070-1721                                               March 2015
        
Internet Engineering Task Force (IETF)                    T. Haynes, Ed.
Request for Comments: 7530                                  Primary Data
Obsoletes: 3530                                           D. Noveck, Ed.
Category: Standards Track                                           Dell
ISSN: 2070-1721                                               March 2015
        

Network File System (NFS) Version 4 Protocol

网络文件系统(NFS)版本4协议

Abstract

摘要

The Network File System (NFS) version 4 protocol is a distributed file system protocol that builds on the heritage of NFS protocol version 2 (RFC 1094) and version 3 (RFC 1813). 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 has been added. Of course, attention has been applied to making NFS version 4 operate well in an Internet environment.

网络文件系统(NFS)版本4协议是一种分布式文件系统协议,它建立在NFS协议版本2(RFC 1094)和版本3(RFC 1813)的基础上。与早期版本不同,NFS版本4协议支持传统的文件访问,同时集成了对文件锁定和装载协议的支持。此外,还增加了对强安全性(及其协商)、复合操作、客户端缓存和国际化的支持。当然,人们已经注意到使NFS版本4在Internet环境中运行良好。

This document, together with the companion External Data Representation (XDR) description document, RFC 7531, obsoletes RFC 3530 as the definition of the NFS version 4 protocol.

本文档以及附带的外部数据表示(XDR)描述文档RFC 7531将RFC 3530废弃为NFS版本4协议的定义。

Status of This Memo

关于下段备忘

This is an Internet Standards Track document.

这是一份互联网标准跟踪文件。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7530.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc7530.

Copyright Notice

版权公告

Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2015 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.

本文件可能包含2008年11月10日之前发布或公开的IETF文件或IETF贡献中的材料。控制某些材料版权的人员可能未授予IETF信托允许在IETF标准流程之外修改此类材料的权利。在未从控制此类材料版权的人员处获得充分许可的情况下,不得在IETF标准流程之外修改本文件,也不得在IETF标准流程之外创建其衍生作品,除了将其格式化以RFC形式发布或将其翻译成英语以外的其他语言。

Table of Contents

目录

   1. Introduction ....................................................8
      1.1. Requirements Language ......................................8
      1.2. NFS Version 4 Goals ........................................8
      1.3. Definitions in the Companion Document RFC 7531 Are
           Authoritative ..............................................9
      1.4. Overview of NFSv4 Features .................................9
           1.4.1. RPC and Security ....................................9
           1.4.2. Procedure and Operation Structure ..................10
           1.4.3. File System Model ..................................10
           1.4.4. OPEN and CLOSE .....................................12
           1.4.5. File Locking .......................................12
           1.4.6. Client Caching and Delegation ......................13
      1.5. General Definitions .......................................14
      1.6. Changes since RFC 3530 ....................................16
      1.7. Changes between RFC 3010 and RFC 3530 .....................16
   2. Protocol Data Types ............................................18
      2.1. Basic Data Types ..........................................18
      2.2. Structured Data Types .....................................21
        
   1. Introduction ....................................................8
      1.1. Requirements Language ......................................8
      1.2. NFS Version 4 Goals ........................................8
      1.3. Definitions in the Companion Document RFC 7531 Are
           Authoritative ..............................................9
      1.4. Overview of NFSv4 Features .................................9
           1.4.1. RPC and Security ....................................9
           1.4.2. Procedure and Operation Structure ..................10
           1.4.3. File System Model ..................................10
           1.4.4. OPEN and CLOSE .....................................12
           1.4.5. File Locking .......................................12
           1.4.6. Client Caching and Delegation ......................13
      1.5. General Definitions .......................................14
      1.6. Changes since RFC 3530 ....................................16
      1.7. Changes between RFC 3010 and RFC 3530 .....................16
   2. Protocol Data Types ............................................18
      2.1. Basic Data Types ..........................................18
      2.2. Structured Data Types .....................................21
        
   3. RPC and Security Flavor ........................................25
      3.1. Ports and Transports ......................................25
           3.1.1. Client Retransmission Behavior .....................26
      3.2. Security Flavors ..........................................27
           3.2.1. Security Mechanisms for NFSv4 ......................27
      3.3. Security Negotiation ......................................28
           3.3.1. SECINFO ............................................29
           3.3.2. Security Error .....................................29
           3.3.3. Callback RPC Authentication ........................29
   4. Filehandles ....................................................30
      4.1. Obtaining the First Filehandle ............................30
           4.1.1. Root Filehandle ....................................31
           4.1.2. Public Filehandle ..................................31
      4.2. Filehandle Types ..........................................31
           4.2.1. General Properties of a Filehandle .................32
           4.2.2. Persistent Filehandle ..............................32
           4.2.3. Volatile Filehandle ................................33
           4.2.4. One Method of Constructing a Volatile Filehandle ...34
      4.3. Client Recovery from Filehandle Expiration ................35
   5. Attributes .....................................................35
      5.1. REQUIRED Attributes .......................................37
      5.2. RECOMMENDED Attributes ....................................37
      5.3. Named Attributes ..........................................37
      5.4. Classification of Attributes ..............................39
      5.5. Set-Only and Get-Only Attributes ..........................40
      5.6. REQUIRED Attributes - List and Definition References ......40
      5.7. RECOMMENDED Attributes - List and Definition References ...41
      5.8. Attribute Definitions .....................................42
           5.8.1. Definitions of REQUIRED Attributes .................42
           5.8.2. Definitions of Uncategorized RECOMMENDED
                  Attributes .........................................45
      5.9. Interpreting owner and owner_group ........................51
      5.10. Character Case Attributes ................................53
   6. Access Control Attributes ......................................54
      6.1. Goals .....................................................54
      6.2. File Attributes Discussion ................................55
           6.2.1. Attribute 12: acl ..................................55
           6.2.2. Attribute 33: mode .................................70
      6.3. Common Methods ............................................71
           6.3.1. Interpreting an ACL ................................71
           6.3.2. Computing a mode Attribute from an ACL .............72
      6.4. Requirements ..............................................73
           6.4.1. Setting the mode and/or ACL Attributes .............74
           6.4.2. Retrieving the mode and/or ACL Attributes ..........75
           6.4.3. Creating New Objects ...............................75
        
   3. RPC and Security Flavor ........................................25
      3.1. Ports and Transports ......................................25
           3.1.1. Client Retransmission Behavior .....................26
      3.2. Security Flavors ..........................................27
           3.2.1. Security Mechanisms for NFSv4 ......................27
      3.3. Security Negotiation ......................................28
           3.3.1. SECINFO ............................................29
           3.3.2. Security Error .....................................29
           3.3.3. Callback RPC Authentication ........................29
   4. Filehandles ....................................................30
      4.1. Obtaining the First Filehandle ............................30
           4.1.1. Root Filehandle ....................................31
           4.1.2. Public Filehandle ..................................31
      4.2. Filehandle Types ..........................................31
           4.2.1. General Properties of a Filehandle .................32
           4.2.2. Persistent Filehandle ..............................32
           4.2.3. Volatile Filehandle ................................33
           4.2.4. One Method of Constructing a Volatile Filehandle ...34
      4.3. Client Recovery from Filehandle Expiration ................35
   5. Attributes .....................................................35
      5.1. REQUIRED Attributes .......................................37
      5.2. RECOMMENDED Attributes ....................................37
      5.3. Named Attributes ..........................................37
      5.4. Classification of Attributes ..............................39
      5.5. Set-Only and Get-Only Attributes ..........................40
      5.6. REQUIRED Attributes - List and Definition References ......40
      5.7. RECOMMENDED Attributes - List and Definition References ...41
      5.8. Attribute Definitions .....................................42
           5.8.1. Definitions of REQUIRED Attributes .................42
           5.8.2. Definitions of Uncategorized RECOMMENDED
                  Attributes .........................................45
      5.9. Interpreting owner and owner_group ........................51
      5.10. Character Case Attributes ................................53
   6. Access Control Attributes ......................................54
      6.1. Goals .....................................................54
      6.2. File Attributes Discussion ................................55
           6.2.1. Attribute 12: acl ..................................55
           6.2.2. Attribute 33: mode .................................70
      6.3. Common Methods ............................................71
           6.3.1. Interpreting an ACL ................................71
           6.3.2. Computing a mode Attribute from an ACL .............72
      6.4. Requirements ..............................................73
           6.4.1. Setting the mode and/or ACL Attributes .............74
           6.4.2. Retrieving the mode and/or ACL Attributes ..........75
           6.4.3. Creating New Objects ...............................75
        
   7. NFS Server Namespace ...........................................77
      7.1. Server Exports ............................................77
      7.2. Browsing Exports ..........................................77
      7.3. Server Pseudo-File System .................................78
      7.4. Multiple Roots ............................................79
      7.5. Filehandle Volatility .....................................79
      7.6. Exported Root .............................................79
      7.7. Mount Point Crossing ......................................79
      7.8. Security Policy and Namespace Presentation ................80
   8. Multi-Server Namespace .........................................81
      8.1. Location Attributes .......................................81
      8.2. File System Presence or Absence ...........................81
      8.3. Getting Attributes for an Absent File System ..............83
           8.3.1. GETATTR within an Absent File System ...............83
           8.3.2. READDIR and Absent File Systems ....................84
      8.4. Uses of Location Information ..............................84
           8.4.1. File System Replication ............................85
           8.4.2. File System Migration ..............................86
           8.4.3. Referrals ..........................................86
      8.5. Location Entries and Server Identity ......................87
      8.6. Additional Client-Side Considerations .....................88
      8.7. Effecting File System Referrals ...........................89
           8.7.1. Referral Example (LOOKUP) ..........................89
           8.7.2. Referral Example (READDIR) .........................93
      8.8. The Attribute fs_locations ................................96
   9. File Locking and Share Reservations ............................98
      9.1. Opens and Byte-Range Locks ................................99
           9.1.1. Client ID ..........................................99
           9.1.2. Server Release of Client ID .......................102
           9.1.3. Use of Seqids .....................................103
           9.1.4. Stateid Definition ................................104
           9.1.5. Lock-Owner ........................................110
           9.1.6. Use of the Stateid and Locking ....................110
           9.1.7. Sequencing of Lock Requests .......................113
           9.1.8. Recovery from Replayed Requests ...................114
           9.1.9. Interactions of Multiple Sequence Values ..........114
           9.1.10. Releasing State-Owner State ......................115
           9.1.11. Use of Open Confirmation .........................116
      9.2. Lock Ranges ..............................................117
      9.3. Upgrading and Downgrading Locks ..........................117
      9.4. Blocking Locks ...........................................118
      9.5. Lease Renewal ............................................119
      9.6. Crash Recovery ...........................................120
           9.6.1. Client Failure and Recovery .......................120
           9.6.2. Server Failure and Recovery .......................120
           9.6.3. Network Partitions and Recovery ...................122
      9.7. Recovery from a Lock Request Timeout or Abort ............130
      9.8. Server Revocation of Locks ...............................130
        
   7. NFS Server Namespace ...........................................77
      7.1. Server Exports ............................................77
      7.2. Browsing Exports ..........................................77
      7.3. Server Pseudo-File System .................................78
      7.4. Multiple Roots ............................................79
      7.5. Filehandle Volatility .....................................79
      7.6. Exported Root .............................................79
      7.7. Mount Point Crossing ......................................79
      7.8. Security Policy and Namespace Presentation ................80
   8. Multi-Server Namespace .........................................81
      8.1. Location Attributes .......................................81
      8.2. File System Presence or Absence ...........................81
      8.3. Getting Attributes for an Absent File System ..............83
           8.3.1. GETATTR within an Absent File System ...............83
           8.3.2. READDIR and Absent File Systems ....................84
      8.4. Uses of Location Information ..............................84
           8.4.1. File System Replication ............................85
           8.4.2. File System Migration ..............................86
           8.4.3. Referrals ..........................................86
      8.5. Location Entries and Server Identity ......................87
      8.6. Additional Client-Side Considerations .....................88
      8.7. Effecting File System Referrals ...........................89
           8.7.1. Referral Example (LOOKUP) ..........................89
           8.7.2. Referral Example (READDIR) .........................93
      8.8. The Attribute fs_locations ................................96
   9. File Locking and Share Reservations ............................98
      9.1. Opens and Byte-Range Locks ................................99
           9.1.1. Client ID ..........................................99
           9.1.2. Server Release of Client ID .......................102
           9.1.3. Use of Seqids .....................................103
           9.1.4. Stateid Definition ................................104
           9.1.5. Lock-Owner ........................................110
           9.1.6. Use of the Stateid and Locking ....................110
           9.1.7. Sequencing of Lock Requests .......................113
           9.1.8. Recovery from Replayed Requests ...................114
           9.1.9. Interactions of Multiple Sequence Values ..........114
           9.1.10. Releasing State-Owner State ......................115
           9.1.11. Use of Open Confirmation .........................116
      9.2. Lock Ranges ..............................................117
      9.3. Upgrading and Downgrading Locks ..........................117
      9.4. Blocking Locks ...........................................118
      9.5. Lease Renewal ............................................119
      9.6. Crash Recovery ...........................................120
           9.6.1. Client Failure and Recovery .......................120
           9.6.2. Server Failure and Recovery .......................120
           9.6.3. Network Partitions and Recovery ...................122
      9.7. Recovery from a Lock Request Timeout or Abort ............130
      9.8. Server Revocation of Locks ...............................130
        
      9.9. Share Reservations .......................................132
      9.10. OPEN/CLOSE Operations ...................................132
           9.10.1. Close and Retention of State Information .........133
      9.11. Open Upgrade and Downgrade ..............................134
      9.12. Short and Long Leases ...................................135
      9.13. Clocks, Propagation Delay, and Calculating Lease
            Expiration ..............................................135
      9.14. Migration, Replication, and State .......................136
           9.14.1. Migration and State ..............................136
           9.14.2. Replication and State ............................137
           9.14.3. Notification of Migrated Lease ...................137
           9.14.4. Migration and the lease_time Attribute ...........138
   10. Client-Side Caching ..........................................139
      10.1. Performance Challenges for Client-Side Caching ..........139
      10.2. Delegation and Callbacks ................................140
           10.2.1. Delegation Recovery ..............................142
      10.3. Data Caching ............................................147
           10.3.1. Data Caching and OPENs ...........................147
           10.3.2. Data Caching and File Locking ....................148
           10.3.3. Data Caching and Mandatory File Locking ..........150
           10.3.4. Data Caching and File Identity ...................150
      10.4. Open Delegation .........................................151
           10.4.1. Open Delegation and Data Caching .................154
           10.4.2. Open Delegation and File Locks ...................155
           10.4.3. Handling of CB_GETATTR ...........................155
           10.4.4. Recall of Open Delegation ........................158
           10.4.5. OPEN Delegation Race with CB_RECALL ..............160
           10.4.6. Clients That Fail to Honor Delegation Recalls ....161
           10.4.7. Delegation Revocation ............................162
      10.5. Data Caching and Revocation .............................162
           10.5.1. Revocation Recovery for Write Open Delegation ....163
      10.6. Attribute Caching .......................................164
      10.7. Data and Metadata Caching and Memory-Mapped Files .......166
      10.8. Name Caching ............................................168
      10.9. Directory Caching .......................................169
   11. Minor Versioning .............................................170
   12. Internationalization .........................................170
      12.1. Introduction ............................................170
      12.2. Limitations on Internationalization-Related
            Processing in the NFSv4 Context .........................172
      12.3. Summary of Server Behavior Types ........................173
      12.4. String Encoding .........................................173
      12.5. Normalization ...........................................174
      12.6. Types with Processing Defined by Other Internet Areas ...175
      12.7. Errors Related to UTF-8 .................................177
      12.8. Servers That Accept File Component Names That
            Are Not Valid UTF-8 Strings .............................177
        
      9.9. Share Reservations .......................................132
      9.10. OPEN/CLOSE Operations ...................................132
           9.10.1. Close and Retention of State Information .........133
      9.11. Open Upgrade and Downgrade ..............................134
      9.12. Short and Long Leases ...................................135
      9.13. Clocks, Propagation Delay, and Calculating Lease
            Expiration ..............................................135
      9.14. Migration, Replication, and State .......................136
           9.14.1. Migration and State ..............................136
           9.14.2. Replication and State ............................137
           9.14.3. Notification of Migrated Lease ...................137
           9.14.4. Migration and the lease_time Attribute ...........138
   10. Client-Side Caching ..........................................139
      10.1. Performance Challenges for Client-Side Caching ..........139
      10.2. Delegation and Callbacks ................................140
           10.2.1. Delegation Recovery ..............................142
      10.3. Data Caching ............................................147
           10.3.1. Data Caching and OPENs ...........................147
           10.3.2. Data Caching and File Locking ....................148
           10.3.3. Data Caching and Mandatory File Locking ..........150
           10.3.4. Data Caching and File Identity ...................150
      10.4. Open Delegation .........................................151
           10.4.1. Open Delegation and Data Caching .................154
           10.4.2. Open Delegation and File Locks ...................155
           10.4.3. Handling of CB_GETATTR ...........................155
           10.4.4. Recall of Open Delegation ........................158
           10.4.5. OPEN Delegation Race with CB_RECALL ..............160
           10.4.6. Clients That Fail to Honor Delegation Recalls ....161
           10.4.7. Delegation Revocation ............................162
      10.5. Data Caching and Revocation .............................162
           10.5.1. Revocation Recovery for Write Open Delegation ....163
      10.6. Attribute Caching .......................................164
      10.7. Data and Metadata Caching and Memory-Mapped Files .......166
      10.8. Name Caching ............................................168
      10.9. Directory Caching .......................................169
   11. Minor Versioning .............................................170
   12. Internationalization .........................................170
      12.1. Introduction ............................................170
      12.2. Limitations on Internationalization-Related
            Processing in the NFSv4 Context .........................172
      12.3. Summary of Server Behavior Types ........................173
      12.4. String Encoding .........................................173
      12.5. Normalization ...........................................174
      12.6. Types with Processing Defined by Other Internet Areas ...175
      12.7. Errors Related to UTF-8 .................................177
      12.8. Servers That Accept File Component Names That
            Are Not Valid UTF-8 Strings .............................177
        
   13. Error Values .................................................178
      13.1. Error Definitions .......................................179
           13.1.1. General Errors ...................................180
           13.1.2. Filehandle Errors ................................181
           13.1.3. Compound Structure Errors ........................183
           13.1.4. File System Errors ...............................184
           13.1.5. State Management Errors ..........................186
           13.1.6. Security Errors ..................................187
           13.1.7. Name Errors ......................................187
           13.1.8. Locking Errors ...................................188
           13.1.9. Reclaim Errors ...................................190
           13.1.10. Client Management Errors ........................191
           13.1.11. Attribute Handling Errors .......................191
           13.1.12. Miscellaneous Errors ............................191
      13.2. Operations and Their Valid Errors .......................192
      13.3. Callback Operations and Their Valid Errors ..............200
      13.4. Errors and the Operations That Use Them .................201
   14. NFSv4 Requests ...............................................206
      14.1. COMPOUND Procedure ......................................207
      14.2. Evaluation of a COMPOUND Request ........................207
      14.3. Synchronous Modifying Operations ........................208
      14.4. Operation Values ........................................208
   15. NFSv4 Procedures .............................................209
      15.1. Procedure 0: NULL - No Operation ........................209
      15.2. Procedure 1: COMPOUND - COMPOUND Operations .............210
   16. NFSv4 Operations .............................................214
      16.1. Operation 3: ACCESS - Check Access Rights ...............214
      16.2. Operation 4: CLOSE - Close File .........................217
      16.3. Operation 5: COMMIT - Commit Cached Data ................218
      16.4. Operation 6: CREATE - Create a Non-regular File Object ..221
      16.5. Operation 7: DELEGPURGE - Purge Delegations
            Awaiting Recovery .......................................224
      16.6. Operation 8: DELEGRETURN - Return Delegation ............226
      16.7. Operation 9: GETATTR - Get Attributes ...................227
      16.8. Operation 10: GETFH - Get Current Filehandle ............229
      16.9. Operation 11: LINK - Create Link to a File ..............230
      16.10. Operation 12: LOCK - Create Lock .......................232
      16.11. Operation 13: LOCKT - Test for Lock ....................236
      16.12. Operation 14: LOCKU - Unlock File ......................238
      16.13. Operation 15: LOOKUP - Look Up Filename ................240
      16.14. Operation 16: LOOKUPP - Look Up Parent Directory .......242
      16.15. Operation 17: NVERIFY - Verify Difference in
             Attributes .............................................243
      16.16. Operation 18: OPEN - Open a Regular File ...............245
        
   13. Error Values .................................................178
      13.1. Error Definitions .......................................179
           13.1.1. General Errors ...................................180
           13.1.2. Filehandle Errors ................................181
           13.1.3. Compound Structure Errors ........................183
           13.1.4. File System Errors ...............................184
           13.1.5. State Management Errors ..........................186
           13.1.6. Security Errors ..................................187
           13.1.7. Name Errors ......................................187
           13.1.8. Locking Errors ...................................188
           13.1.9. Reclaim Errors ...................................190
           13.1.10. Client Management Errors ........................191
           13.1.11. Attribute Handling Errors .......................191
           13.1.12. Miscellaneous Errors ............................191
      13.2. Operations and Their Valid Errors .......................192
      13.3. Callback Operations and Their Valid Errors ..............200
      13.4. Errors and the Operations That Use Them .................201
   14. NFSv4 Requests ...............................................206
      14.1. COMPOUND Procedure ......................................207
      14.2. Evaluation of a COMPOUND Request ........................207
      14.3. Synchronous Modifying Operations ........................208
      14.4. Operation Values ........................................208
   15. NFSv4 Procedures .............................................209
      15.1. Procedure 0: NULL - No Operation ........................209
      15.2. Procedure 1: COMPOUND - COMPOUND Operations .............210
   16. NFSv4 Operations .............................................214
      16.1. Operation 3: ACCESS - Check Access Rights ...............214
      16.2. Operation 4: CLOSE - Close File .........................217
      16.3. Operation 5: COMMIT - Commit Cached Data ................218
      16.4. Operation 6: CREATE - Create a Non-regular File Object ..221
      16.5. Operation 7: DELEGPURGE - Purge Delegations
            Awaiting Recovery .......................................224
      16.6. Operation 8: DELEGRETURN - Return Delegation ............226
      16.7. Operation 9: GETATTR - Get Attributes ...................227
      16.8. Operation 10: GETFH - Get Current Filehandle ............229
      16.9. Operation 11: LINK - Create Link to a File ..............230
      16.10. Operation 12: LOCK - Create Lock .......................232
      16.11. Operation 13: LOCKT - Test for Lock ....................236
      16.12. Operation 14: LOCKU - Unlock File ......................238
      16.13. Operation 15: LOOKUP - Look Up Filename ................240
      16.14. Operation 16: LOOKUPP - Look Up Parent Directory .......242
      16.15. Operation 17: NVERIFY - Verify Difference in
             Attributes .............................................243
      16.16. Operation 18: OPEN - Open a Regular File ...............245
        
      16.17. Operation 19: OPENATTR - Open Named Attribute
             Directory ..............................................256
      16.18. Operation 20: OPEN_CONFIRM - Confirm Open ..............257
      16.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File
             Access .................................................260
      16.20. Operation 22: PUTFH - Set Current Filehandle ...........262
      16.21. Operation 23: PUTPUBFH - Set Public Filehandle .........263
      16.22. Operation 24: PUTROOTFH - Set Root Filehandle ..........265
      16.23. Operation 25: READ - Read from File ....................266
      16.24. Operation 26: READDIR - Read Directory .................269
      16.25. Operation 27: READLINK - Read Symbolic Link ............273
      16.26. Operation 28: REMOVE - Remove File System Object .......274
      16.27. Operation 29: RENAME - Rename Directory Entry ..........276
      16.28. Operation 30: RENEW - Renew a Lease ....................278
      16.29. Operation 31: RESTOREFH - Restore Saved Filehandle .....280
      16.30. Operation 32: SAVEFH - Save Current Filehandle .........281
      16.31. Operation 33: SECINFO - Obtain Available Security ......282
      16.32. Operation 34: SETATTR - Set Attributes .................286
      16.33. Operation 35: SETCLIENTID - Negotiate Client ID ........289
      16.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Client ID ..293
      16.35. Operation 37: VERIFY - Verify Same Attributes ..........297
      16.36. Operation 38: WRITE - Write to File ....................299
      16.37. Operation 39: RELEASE_LOCKOWNER - Release
             Lock-Owner State .......................................304
      16.38. Operation 10044: ILLEGAL - Illegal Operation ...........305
   17. NFSv4 Callback Procedures ....................................306
      17.1. Procedure 0: CB_NULL - No Operation .....................306
      17.2. Procedure 1: CB_COMPOUND - COMPOUND Operations ..........307
   18. NFSv4 Callback Operations ....................................309
      18.1. Operation 3: CB_GETATTR - Get Attributes ................309
      18.2. Operation 4: CB_RECALL - Recall an Open Delegation ......310
      18.3. Operation 10044: CB_ILLEGAL - Illegal Callback
            Operation ...............................................311
   19. Security Considerations ......................................312
   20. IANA Considerations ..........................................314
      20.1. Named Attribute Definitions .............................314
           20.1.1. Initial Registry .................................315
           20.1.2. Updating Registrations ...........................315
      20.2. Updates to Existing IANA Registries .....................315
   21. References ...................................................316
      21.1. Normative References ....................................316
      21.2. Informative References ..................................318
   Acknowledgments ..................................................322
   Authors' Addresses ...............................................323
        
      16.17. Operation 19: OPENATTR - Open Named Attribute
             Directory ..............................................256
      16.18. Operation 20: OPEN_CONFIRM - Confirm Open ..............257
      16.19. Operation 21: OPEN_DOWNGRADE - Reduce Open File
             Access .................................................260
      16.20. Operation 22: PUTFH - Set Current Filehandle ...........262
      16.21. Operation 23: PUTPUBFH - Set Public Filehandle .........263
      16.22. Operation 24: PUTROOTFH - Set Root Filehandle ..........265
      16.23. Operation 25: READ - Read from File ....................266
      16.24. Operation 26: READDIR - Read Directory .................269
      16.25. Operation 27: READLINK - Read Symbolic Link ............273
      16.26. Operation 28: REMOVE - Remove File System Object .......274
      16.27. Operation 29: RENAME - Rename Directory Entry ..........276
      16.28. Operation 30: RENEW - Renew a Lease ....................278
      16.29. Operation 31: RESTOREFH - Restore Saved Filehandle .....280
      16.30. Operation 32: SAVEFH - Save Current Filehandle .........281
      16.31. Operation 33: SECINFO - Obtain Available Security ......282
      16.32. Operation 34: SETATTR - Set Attributes .................286
      16.33. Operation 35: SETCLIENTID - Negotiate Client ID ........289
      16.34. Operation 36: SETCLIENTID_CONFIRM - Confirm Client ID ..293
      16.35. Operation 37: VERIFY - Verify Same Attributes ..........297
      16.36. Operation 38: WRITE - Write to File ....................299
      16.37. Operation 39: RELEASE_LOCKOWNER - Release
             Lock-Owner State .......................................304
      16.38. Operation 10044: ILLEGAL - Illegal Operation ...........305
   17. NFSv4 Callback Procedures ....................................306
      17.1. Procedure 0: CB_NULL - No Operation .....................306
      17.2. Procedure 1: CB_COMPOUND - COMPOUND Operations ..........307
   18. NFSv4 Callback Operations ....................................309
      18.1. Operation 3: CB_GETATTR - Get Attributes ................309
      18.2. Operation 4: CB_RECALL - Recall an Open Delegation ......310
      18.3. Operation 10044: CB_ILLEGAL - Illegal Callback
            Operation ...............................................311
   19. Security Considerations ......................................312
   20. IANA Considerations ..........................................314
      20.1. Named Attribute Definitions .............................314
           20.1.1. Initial Registry .................................315
           20.1.2. Updating Registrations ...........................315
      20.2. Updates to Existing IANA Registries .....................315
   21. References ...................................................316
      21.1. Normative References ....................................316
      21.2. Informative References ..................................318
   Acknowledgments ..................................................322
   Authors' Addresses ...............................................323
        
1. Introduction
1. 介绍
1.1. Requirements Language
1.1. 需求语言

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 [RFC2119], except where "REQUIRED" and "RECOMMENDED" are used as qualifiers to distinguish classes of attributes as described in Sections 1.4.3.2 and 5 of this document.

本文件中的关键词“必须”、“不得”、“要求”、“应”、“不得”、“应”、“不应”、“建议”、“可”和“可选”应按照RFC 2119[RFC2119]中所述进行解释,但“要求”和“建议”除外用作限定符,以区分本文件第1.4.3.2和5节所述的属性类别。

1.2. NFS Version 4 Goals
1.2. NFS版本4目标

The Network File System version 4 (NFSv4) 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 file systems; simplicity; and good performance. The NFSv4 revision has the following goals:

网络文件系统版本4(NFSv4)协议是版本2[RFC1094]和版本3[RFC1813]已经定义的NFS协议的进一步修订版。它保留了以前版本的基本特征:易于恢复的设计;独立于传输协议、操作系统和文件系统;简单性能良好。NFSv4修订版具有以下目标:

o Improved access and good performance on the Internet.

o 改进了Internet上的访问和良好性能。

The protocol is designed to transit firewalls easily, perform well where latency is high and bandwidth is low, and scale to very large numbers of clients per server.

该协议设计用于轻松传输防火墙,在延迟高、带宽低的情况下性能良好,并可扩展到每台服务器上的大量客户端。

o Strong security with negotiation built into the protocol.

o 协议内置协商功能,安全性强。

The protocol builds on the work of the Open Network Computing (ONC) Remote Procedure Call (RPC) working group in supporting the RPCSEC_GSS protocol (see both [RFC2203] and [RFC5403]). Additionally, the NFSv4 protocol provides a mechanism to allow clients and servers the ability to negotiate security and require clients and servers to support a minimal set of security schemes.

该协议建立在开放网络计算(ONC)远程过程调用(RPC)工作组支持RPCSEC_GSS协议的工作基础上(参见[RFC2203]和[RFC5403])。此外,NFSv4协议提供了一种机制,允许客户端和服务器协商安全性,并要求客户端和服务器支持一组最小的安全方案。

o Good cross-platform interoperability.

o 良好的跨平台互操作性。

The protocol features a file system model that provides a useful, common set of features that does not unduly favor one file system or operating system over another.

该协议以一个文件系统模型为特色,该模型提供了一组有用的、通用的特性,这些特性不会过分偏向于一个文件系统或操作系统而不是另一个文件系统或操作系统。

o Designed for protocol extensions.

o 专为协议扩展而设计。

The protocol is designed to accept standard extensions that do not compromise backward compatibility.

该协议旨在接受不损害向后兼容性的标准扩展。

This document, together with the companion External Data Representation (XDR) description document [RFC7531], obsoletes [RFC3530] as the authoritative document describing NFSv4. It does not introduce any over-the-wire protocol changes, in the sense that previously valid requests remain valid.

本文件连同配套的外部数据表示(XDR)描述文件[RFC7531]一起,将[RFC3530]废弃为描述NFSv4的权威文件。它不会引入任何跨线协议更改,因为以前有效的请求仍然有效。

1.3. Definitions in the Companion Document RFC 7531 Are Authoritative
1.3. 随附文件RFC 7531中的定义具有权威性

The "Network File System (NFS) Version 4 External Data Representation Standard (XDR) Description" [RFC7531] contains the definitions in XDR description language of the constructs used by the protocol. Inside this document, several of the constructs are reproduced for purposes of explanation. The reader is warned of the possibility of errors in the reproduced constructs outside of [RFC7531]. For any part of the document that is inconsistent with [RFC7531], [RFC7531] is to be considered authoritative.

“网络文件系统(NFS)第4版外部数据表示标准(XDR)描述”[RFC7531]包含协议使用的结构的XDR描述语言定义。在本文件中,为了便于解释,复制了一些结构。读者被警告在[RFC7531]之外的复制结构中可能存在错误。对于文件中与[RFC7531]不一致的任何部分,[RFC7531]将被视为权威。

1.4. Overview of NFSv4 Features
1.4. NFSv4特性概述

To provide a reasonable context for the reader, the major features of the NFSv4 protocol will be reviewed in brief. This is done to provide an appropriate context for both the reader who is familiar with the previous versions of the NFS protocol and the reader who is new to the NFS protocols. For the reader new to the NFS protocols, some fundamental knowledge is still expected. The reader should be familiar with the XDR and RPC protocols as described in [RFC4506] and [RFC5531]. A basic knowledge of file systems and distributed file systems is expected as well.

为了给读者提供一个合理的上下文,将简要回顾NFSv4协议的主要特征。这样做是为了为熟悉以前版本的NFS协议的读者和不熟悉NFS协议的读者提供适当的上下文。对于初次接触NFS协议的读者,仍然需要一些基础知识。读者应熟悉[RFC4506]和[RFC5531]中所述的XDR和RPC协议。具备文件系统和分布式文件系统的基本知识。

1.4.1. RPC and Security
1.4.1. RPC与安全

As with previous versions of NFS, the XDR and RPC mechanisms used for the NFSv4 protocol are those defined in [RFC4506] and [RFC5531]. To meet end-to-end security requirements, the RPCSEC_GSS framework (both version 1 in [RFC2203] and version 2 in [RFC5403]) 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 NFSv4 protocol. Kerberos V5 will be used as described in [RFC4121] to provide one security framework. With the use of RPCSEC_GSS, other mechanisms may also be specified and used for NFSv4 security.

与以前版本的NFS一样,NFSv4协议使用的XDR和RPC机制是[RFC4506]和[RFC5531]中定义的机制。为了满足端到端安全性要求,将使用RPCSEC_GSS框架(RFC2203中的版本1和RFC5403中的版本2)扩展基本RPC安全性。通过使用RPCSEC_GSS,可以提供各种机制来为NFSv4协议提供身份验证、完整性和隐私。Kerberos V5将按[RFC4121]中所述使用,以提供一个安全框架。通过使用RPCSEC_GSS,还可以指定其他机制并用于NFSv4安全性。

To enable in-band security negotiation, the NFSv4 protocol has added a new operation that provides the client with a method of querying the server about its policies regarding which security mechanisms must be used for access to the server's file system resources. With this, the client can securely match the security mechanism that meets the policies specified at both the client and server.

为了启用带内安全协商,NFSv4协议添加了一个新的操作,该操作为客户端提供了一种查询服务器策略的方法,该策略涉及访问服务器文件系统资源必须使用哪些安全机制。这样,客户机就可以安全地匹配满足客户机和服务器上指定的策略的安全机制。

1.4.2. Procedure and Operation Structure
1.4.2. 程序及运作架构

A significant departure from the previous versions of the NFS protocol is the introduction of the COMPOUND procedure. For the NFSv4 protocol, there are two RPC procedures: NULL and COMPOUND. The COMPOUND procedure is defined in terms of operations, and these operations correspond more closely to the traditional NFS procedures.

与以前版本的NFS协议不同的一个重要区别是引入了复合过程。对于NFSv4协议,有两个RPC过程:NULL和component。复合过程是根据操作定义的,这些操作与传统的NFS过程更接近。

With the use of the COMPOUND procedure, the client is able to build simple or complex requests. These COMPOUND requests allow for a reduction in the number of RPCs needed for logical file system operations. For example, without previous contact with a server a client will be able to read data from a file in one request by combining LOOKUP, OPEN, and READ operations in a single COMPOUND RPC. With previous versions of the NFS protocol, this type of single request was not possible.

通过使用复合过程,客户机能够构建简单或复杂的请求。这些复合请求允许减少逻辑文件系统操作所需的RPC数量。例如,如果以前没有与服务器联系,客户端将能够通过在单个复合RPC中组合查找、打开和读取操作,在一个请求中从文件读取数据。对于以前版本的NFS协议,这种类型的单一请求是不可能的。

The model used for COMPOUND is very simple. There is no logical OR or ANDing of operations. The operations combined within a COMPOUND 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.

用于化合物的模型非常简单。操作之间没有逻辑或AND。复合请求中组合的操作由服务器按顺序进行评估。一旦操作返回失败的结果,评估将结束,所有评估操作的结果将返回给客户端。

The NFSv4 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 a saved filehandle. Most operations use the 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.

NFSv4协议继续让客户端通过“文件句柄”引用服务器上的文件或目录。复合过程有一种在操作序列中将文件句柄从一个操作传递到另一个操作的方法。有当前文件句柄和已保存文件句柄的概念。大多数操作使用当前文件句柄作为要操作的文件系统对象。保存的文件句柄用作复合过程中的临时文件句柄存储,以及某些操作的附加操作数。

1.4.3. File System Model
1.4.3. 文件系统模型

The general file system model used for the NFSv4 protocol is the same as previous versions. The server file system is hierarchical, with the regular files contained within being treated as opaque byte streams. In a slight departure, file and directory names are encoded with UTF-8 to deal with the basics of internationalization.

NFSv4协议使用的通用文件系统模型与以前的版本相同。服务器文件系统是分层的,其中包含的常规文件被视为不透明的字节流。稍微不同的是,文件名和目录名用UTF-8编码,以处理国际化的基础知识。

The NFSv4 protocol does not require a separate protocol to provide for the initial mapping between pathname and filehandle. Instead of using the older MOUNT protocol for this mapping, the server provides a root filehandle that represents the logical root or top of the file system tree provided by the server. The server provides multiple file systems by gluing them together with pseudo-file systems. These pseudo-file systems provide for potential gaps in the pathnames between real file systems.

NFSv4协议不需要单独的协议来提供路径名和文件句柄之间的初始映射。服务器提供了一个根文件句柄,表示服务器提供的文件系统树的逻辑根或顶部,而不是使用较旧的装载协议进行此映射。服务器通过将多个文件系统与伪文件系统粘合在一起来提供多个文件系统。这些伪文件系统为实际文件系统之间的路径名提供了潜在的间隙。

1.4.3.1. Filehandle Types
1.4.3.1. 文件句柄类型

In previous versions of the NFS protocol, the filehandle provided by the server was guaranteed to be valid or persistent for the lifetime of the file system object to which it referred. For some server implementations, this persistence requirement has been difficult to meet. For the NFSv4 protocol, this requirement has been relaxed by introducing another type of filehandle -- volatile. With persistent and volatile filehandle types, the server implementation can match the abilities of the file system at the server along with the operating environment. The client will have knowledge of the type of filehandle being provided by the server and can be prepared to deal with the semantics of each.

在NFS协议的早期版本中,服务器提供的filehandle保证在其引用的文件系统对象的生命周期内有效或持久。对于某些服务器实现,这种持久性需求一直难以满足。对于NFSv4协议,通过引入另一种类型的文件句柄(volatile)放宽了这一要求。对于持久性和易失性文件句柄类型,服务器实现可以与服务器上的文件系统的能力以及操作环境相匹配。客户机将了解服务器提供的文件句柄类型,并准备好处理每个文件句柄的语义。

1.4.3.2. Attribute Types
1.4.3.2. 属性类型

The NFSv4 protocol has a rich and extensible file object attribute structure, which is divided into REQUIRED, RECOMMENDED, and named attributes (see Section 5).

NFSv4协议具有丰富且可扩展的文件对象属性结构,该结构分为必需属性、推荐属性和命名属性(参见第5节)。

Several (but not all) of the REQUIRED attributes are derived from the attributes of NFSv3 (see the definition of the fattr3 data type in [RFC1813]). An example of a REQUIRED attribute is the file object's type (Section 5.8.1.2) so that regular files can be distinguished from directories (also known as folders in some operating environments) and other types of objects. REQUIRED attributes are discussed in Section 5.1.

几个(但不是全部)必需的属性是从NFSv3的属性派生的(参见[RFC1813]中fattr3数据类型的定义)。所需属性的一个示例是文件对象的类型(第5.8.1.2节),以便将常规文件与目录(在某些操作环境中也称为文件夹)和其他类型的对象区分开来。第5.1节讨论了所需属性。

An example of the RECOMMENDED attributes is an acl (Section 6.2.1). This attribute defines an Access Control List (ACL) on a file object. An ACL provides file access control beyond the model used in NFSv3. The ACL definition allows for specification of specific sets of permissions for individual users and groups. In addition, ACL inheritance allows propagation of access permissions and restriction down a directory tree as file system objects are created. RECOMMENDED attributes are discussed in Section 5.2.

推荐属性的一个示例是acl(第6.2.1节)。此属性定义文件对象上的访问控制列表(ACL)。ACL提供了NFSv3中使用的模型之外的文件访问控制。ACL定义允许为单个用户和组指定特定的权限集。此外,ACL继承允许在创建文件系统对象时沿目录树传播访问权限和限制。第5.2节讨论了推荐属性。

A named attribute is an opaque byte stream that is associated with a directory or file and referred to by a string name. Named attributes are meant to be used by client applications as a method to associate application-specific data with a regular file or directory. NFSv4.1 modifies named attributes relative to NFSv4.0 by tightening the allowed operations in order to prevent the development of non-interoperable implementations. Named attributes are discussed in Section 5.3.

命名属性是与目录或文件关联并由字符串名称引用的不透明字节流。命名属性被客户机应用程序用作将特定于应用程序的数据与常规文件或目录关联的方法。NFSv4.1通过收紧允许的操作来修改相对于NFSv4.0的命名属性,以防止开发不可互操作的实现。命名属性在第5.3节中讨论。

1.4.3.3. Multi-Server Namespace
1.4.3.3. 多服务器名称空间

A single-server namespace is the file system hierarchy that the server presents for remote access. It is a proper subset of all the file systems available locally. NFSv4 contains a number of features to allow implementation of namespaces that cross server boundaries and that allow and facilitate a non-disruptive transfer of support for individual file systems between servers. They are all based upon attributes that allow one file system to specify alternative or new locations for that file system. That is, just as a client might traverse across local file systems on a single server, it can now traverse to a remote file system on a different server.

单个服务器名称空间是服务器为远程访问提供的文件系统层次结构。它是本地可用的所有文件系统的适当子集。NFSv4包含许多功能,允许实现跨越服务器边界的名称空间,并允许和促进在服务器之间无中断地传输对单个文件系统的支持。它们都基于允许一个文件系统为该文件系统指定替代位置或新位置的属性。也就是说,正如客户机可以跨单个服务器上的本地文件系统进行遍历一样,它现在可以遍历到不同服务器上的远程文件系统。

These attributes may be used together with the concept of absent file systems, which provide specifications for additional locations but no actual file system content. This allows a number of important facilities:

这些属性可以与缺席文件系统的概念一起使用,缺席文件系统为其他位置提供规范,但不提供实际的文件系统内容。这允许使用一些重要的设施:

o Location attributes may be used with absent file systems to implement referrals whereby one server may direct the client to a file system provided by another server. This allows extensive multi-server namespaces to be constructed.

o 位置属性可用于缺少的文件系统,以实现引用,其中一台服务器可将客户端指向另一台服务器提供的文件系统。这允许构造广泛的多服务器名称空间。

o Location attributes may be provided for present file systems to provide the locations of alternative file system instances or replicas to be used in the event that the current file system instance becomes unavailable.

o 可以为当前文件系统提供位置属性,以提供在当前文件系统实例变得不可用时使用的替代文件系统实例或副本的位置。

o Location attributes may be provided when a previously present file system becomes absent. This allows non-disruptive migration of file systems to alternative servers.

o 当以前存在的文件系统不存在时,可以提供位置属性。这允许无中断地将文件系统迁移到其他服务器。

1.4.4. OPEN and CLOSE
1.4.4. 开合

The NFSv4 protocol introduces OPEN and CLOSE operations. The OPEN operation provides a single point where file lookup, creation, and share semantics (see Section 9.9) can be combined. The CLOSE operation also provides for the release of state accumulated by OPEN.

NFSv4协议引入了打开和关闭操作。“打开”操作提供了一个单一点,在这里可以组合文件查找、创建和共享语义(请参见第9.9节)。关闭操作还可释放打开累积的状态。

1.4.5. File Locking
1.4.5. 文件锁定

With the NFSv4 protocol, the support for byte-range file locking is part of the NFS protocol. The file locking support is 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) [RFC1813]. 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 an NFS client.

对于NFSv4协议,对字节范围文件锁定的支持是NFS协议的一部分。文件锁定支持的结构不需要RPC回调机制。这与以前版本的NFS文件锁定协议Network Lock Manager(NLM)[RFC1813]不同。与文件锁关联的状态在基于租约的模型下在服务器上维护。服务器为NFS客户端持有的所有状态定义一个租用期。

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 by use of the RENEW operation or implicitly by use of other operations (primarily READ).

如果客户端未在定义的期限内续订其租约,则服务器可能会释放与客户端租约关联的所有状态。客户可以通过使用“续订”操作或通过使用其他操作(主要是READ)来间接续订其租约。

1.4.6. Client Caching and Delegation
1.4.6. 客户端缓存和委托

The file, attribute, and directory caching for the NFSv4 protocol is similar to previous versions. Attributes and directory information are cached for a duration determined by the client. At the end of a predefined timeout, the client will query the server to see if the related file system object has been updated.

NFSv4协议的文件、属性和目录缓存与以前的版本类似。属性和目录信息的缓存时间由客户端确定。在预定义超时结束时,客户端将查询服务器,查看相关文件系统对象是否已更新。

For file data, the client checks its cache validity when the file is opened. A query is sent to the server to determine if the file has been changed. Based on this information, the client determines if the data cache for the file should be kept or released. Also, when the file is closed, any modified data is written to the server.

对于文件数据,客户端在打开文件时检查其缓存有效性。将向服务器发送查询,以确定文件是否已更改。根据此信息,客户机确定是保留还是释放文件的数据缓存。此外,当文件关闭时,任何修改的数据都会写入服务器。

If an application wants to serialize access to file data, file locking of the file data ranges in question should be used.

若应用程序想要序列化对文件数据的访问,那个么应该使用有问题的文件数据范围的文件锁定。

The major addition to NFSv4 in the area of caching is the ability of the server to delegate certain responsibilities to the client. When the server grants a delegation for a file to a client, the client is guaranteed certain semantics with respect to the sharing of that file with other clients. At OPEN, the server may provide the client either a read (OPEN_DELEGATE_READ) or a write (OPEN_DELEGATE_WRITE) delegation for the file (see Section 10.4). If the client is granted an OPEN_DELEGATE_READ delegation, it is assured that no other client has the ability to write to the file for the duration of the delegation. If the client is granted an OPEN_DELEGATE_WRITE delegation, the client is assured that no other client has read or write access to the file.

NFSv4在缓存领域的主要新增功能是服务器将某些职责委托给客户端的能力。当服务器向客户机授予文件的委托时,客户机可以保证与其他客户机共享该文件时具有一定的语义。打开时,服务器可以为客户端提供文件的读取(打开\u委托\u读取)或写入(打开\u委托\u写入)委托(参见第10.4节)。如果客户机被授予OPEN_DELEGATE_READ委派,则可以确保在委派期间没有其他客户机能够写入文件。如果客户机被授予OPEN_DELEGATE_WRITE委托,则可以确保没有其他客户机对该文件具有读写访问权限。

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 cannot be granted. The essence of a delegation is that it allows the client to locally service operations such as OPEN, CLOSE, LOCK, LOCKU, READ, or WRITE without immediate interaction with the server.

服务器可以调用委托。如果另一个客户端请求访问该文件,并且访问与授予的委托冲突,则服务器能够通知初始客户端并重新调用该委托。这要求在服务器和客户端之间存在回调路径。如果此回调路径不存在,则无法授予委派。委托的本质是,它允许客户端在本地为操作(如打开、关闭、锁定、锁定、读取或写入)提供服务,而无需立即与服务器交互。

1.5. General Definitions
1.5. 一般定义

The following definitions are provided for the purpose of providing an appropriate context for the reader.

以下定义旨在为读者提供适当的上下文。

Absent File System: A file system is "absent" when a namespace component does not have a backing file system.

缺少文件系统:当命名空间组件没有支持文件系统时,文件系统是“缺少”的。

Anonymous Stateid: The Anonymous Stateid is a special locking object and is defined in Section 9.1.4.3.

匿名Stateid:匿名Stateid是一个特殊的锁定对象,在第9.1.4.3节中定义。

Byte: In this document, a byte is an octet, i.e., a datum exactly 8 bits in length.

字节:在本文档中,字节是八位字节,即长度正好为8位的数据。

Client: The client is the entity that accesses the NFS server's resources. The client may be an application that contains the logic to access the NFS server directly. The client may also be the traditional operating system client that provides remote file system services for a set of applications.

客户端:客户端是访问NFS服务器资源的实体。客户端可能是包含直接访问NFS服务器的逻辑的应用程序。客户端也可以是为一组应用程序提供远程文件系统服务的传统操作系统客户端。

With reference to byte-range locking, the client is also the entity that maintains a set of locks on behalf of one or more applications. This client is responsible for crash or failure recovery for those locks it manages.

关于字节范围锁定,客户机也是代表一个或多个应用程序维护一组锁的实体。此客户端负责其管理的锁的崩溃或故障恢复。

Note that multiple clients may share the same transport and connection, and multiple clients may exist on the same network node.

请注意,多个客户端可能共享相同的传输和连接,并且多个客户端可能存在于同一网络节点上。

Client ID: The client ID is a 64-bit quantity used as a unique, shorthand reference to a client-supplied verifier and ID. The server is responsible for supplying the client ID.

客户机ID:客户机ID是一个64位的数量,用作对客户机提供的验证器和ID的唯一、简写引用。服务器负责提供客户机ID。

File System: The file system is the collection of objects on a server that share the same fsid attribute (see Section 5.8.1.9).

文件系统:文件系统是服务器上共享相同fsid属性的对象的集合(参见第5.8.1.9节)。

Lease: A lease is an interval of time defined by the server for which the client is irrevocably granted a lock. At the end of a lease period the lock may be revoked if the lease has not been extended. The lock must be revoked if a conflicting lock has been granted after the lease interval.

租约:租约是由服务器定义的一段时间间隔,对于该时间间隔,客户端被不可撤销地授予锁。在租赁期结束时,如果租赁期未延长,则可撤销锁定。如果在租约间隔后授予了冲突的锁,则必须撤销该锁。

All leases granted by a server have the same fixed duration. Note that the fixed interval duration was chosen to alleviate the expense a server would have in maintaining state about variable-length leases across server failures.

服务器授予的所有租约具有相同的固定期限。请注意,选择固定间隔持续时间是为了减轻服务器在维护跨服务器故障的可变长度租约状态时的开销。

Lock: The term "lock" is used to refer to record (byte-range) locks as well as share reservations unless specifically stated otherwise.

锁定:除非另有特别说明,否则术语“锁定”用于指记录(字节范围)锁定以及共享保留。

Lock-Owner: Each byte-range lock is associated with a specific lock-owner and an open-owner. The lock-owner consists of a client ID and an opaque owner string. The client presents this to the server to establish the ownership of the byte-range lock as needed.

锁所有者:每个字节范围锁都与特定的锁所有者和打开的所有者相关联。锁所有者由客户端ID和不透明所有者字符串组成。客户机根据需要将其呈现给服务器,以建立字节范围锁的所有权。

Open-Owner: Each open file is associated with a specific open-owner, which consists of a client ID and an opaque owner string. The client presents this to the server to establish the ownership of the open as needed.

打开所有者:每个打开的文件都与特定的打开所有者关联,该所有者由客户端ID和不透明的所有者字符串组成。客户机将此信息呈现给服务器,以根据需要确定开放式数据库的所有权。

READ Bypass Stateid: The READ Bypass Stateid is a special locking object and is defined in Section 9.1.4.3.

读取旁路Stateid:读取旁路Stateid是一个特殊的锁定对象,在第9.1.4.3节中定义。

Server: The "server" is the entity responsible for coordinating client access to a set of file systems.

服务器:“服务器”是负责协调客户端对一组文件系统的访问的实体。

Stable Storage: NFSv4 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, non-volatile RAM).

稳定存储:NFSv4服务器必须能够从多个电源故障(包括级联电源故障,即连续几次电源故障)、操作系统故障和存储介质本身以外的组件(例如,磁盘、非易失性RAM)的硬件故障中恢复而不丢失数据。

Some examples of stable storage that are allowable for an NFS server include:

NFS服务器允许的一些稳定存储示例包括:

(1) Media commit of data. That is, the modified data has been successfully written to the disk media -- for example, the disk platter.

(1) 媒体提交数据。也就是说,修改后的数据已成功写入磁盘介质——例如,磁盘盘片。

(2) An immediate reply disk drive with battery-backed on-drive intermediate storage or uninterruptible power system (UPS).

(2) 立即回复磁盘驱动器,在驱动器中间存储器或不间断电源系统(UPS)上备有电池。

(3) Server commit of data with battery-backed intermediate storage and recovery software.

(3) 使用电池备份的中间存储和恢复软件进行服务器数据提交。

(4) Cache commit with UPS and recovery software.

(4) 使用UPS和恢复软件进行缓存提交。

Stateid: A stateid is a 128-bit quantity returned by a server that uniquely identifies the open and locking states provided by the server for a specific open-owner or lock-owner/open-owner pair for a specific file and type of lock.

Stateid:Stateid是服务器返回的128位数量,它唯一标识服务器为特定打开所有者或特定文件和锁类型的锁所有者/打开所有者对提供的打开和锁定状态。

Verifier: A verifier is 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.

验证器:验证器是由客户端生成的64位数量,服务器可以使用它来确定客户端是否已重新启动并丢失所有以前的锁定状态。

1.6. Changes since RFC 3530
1.6. 自RFC 3530以来的变化

The main changes from RFC 3530 [RFC3530] are:

RFC 3530[RFC3530]的主要变化如下:

o The XDR definition has been moved to a companion document [RFC7531].

o XDR定义已移至附带文档[RFC7531]。

o The IETF intellectual property statements were updated to the latest version.

o IETF知识产权声明已更新至最新版本。

o There is a restructured and more complete explanation of multi-server namespace features.

o 对多服务器名称空间特性有一个重新构造的更完整的解释。

o The handling of domain names was updated to reflect Internationalized Domain Names in Applications (IDNA) [RFC5891].

o 对域名的处理进行了更新,以反映应用程序中的国际化域名(IDNA)[RFC5891]。

o The previously required LIPKEY and SPKM-3 security mechanisms have been removed.

o 先前需要的LIPKEY和SPKM-3安全机制已被删除。

o Some clarification was provided regarding a client re-establishing callback information to the new server if state has been migrated.

o 对于在状态已迁移的情况下客户端重新建立新服务器的回调信息,提供了一些说明。

o A third edge case was added for courtesy locks and network partitions.

o 为门控锁和网络分区添加了第三个edge案例。

o The definition of stateid was strengthened.

o 国家ID的定义得到加强。

1.7. Changes between RFC 3010 and RFC 3530
1.7. RFC 3010和RFC 3530之间的更改

The definition of the NFSv4 protocol in [RFC3530] replaced and obsoleted the definition present in [RFC3010]. While portions of the two documents remained the same, there were substantive changes in others. The changes made between [RFC3010] and [RFC3530] reflect implementation experience and further review of the protocol.

[RFC3530]中NFSv4协议的定义取代并废除了[RFC3010]中的定义。虽然这两份文件的某些部分保持不变,但其他部分有实质性变化。[RFC3010]和[RFC3530]之间的变更反映了实施经验和协议的进一步审查。

The following list is not inclusive of all changes but presents some of the most notable changes or additions made:

以下列表不包括所有更改,但列出了一些最显著的更改或添加:

o The state model has added an open_owner4 identifier. This was done to accommodate POSIX-based clients and the model they use for file locking. For POSIX clients, an open_owner4 would correspond to a file descriptor potentially shared amongst a set of processes and the lock_owner4 identifier would correspond to a process that is locking a file.

o 状态模型添加了一个open_owner4标识符。这样做是为了适应基于POSIX的客户端及其用于文件锁定的模型。对于POSIX客户端,open_owner4将对应于一组进程之间可能共享的文件描述符,lock_owner4标识符将对应于锁定文件的进程。

o Added clarifications and error conditions for the handling of the owner and group attributes. Since these attributes are string based (as opposed to the numeric uid/gid of previous versions of NFS), translations may not be available and hence the changes made.

o 为处理所有者和组属性添加了澄清和错误条件。由于这些属性是基于字符串的(与以前版本的NFS的数字uid/gid相反),翻译可能不可用,因此会进行更改。

o Added clarifications for the ACL and mode attributes to address evaluation and partial support.

o 增加了ACL和模式属性的澄清,以解决评估和部分支持问题。

o For identifiers that are defined as XDR opaque, set limits on their size.

o 对于定义为XDR不透明的标识符,设置其大小限制。

o Added the mounted_on_fileid attribute to allow POSIX clients to correctly construct local mounts.

o 添加了mounted_on_fileid属性,以允许POSIX客户端正确构造本地装载。

o Modified the SETCLIENTID/SETCLIENTID_CONFIRM operations to deal correctly with confirmation details along with adding the ability to specify new client callback information. Also added clarification of the callback information itself.

o 修改了SETCLIENTID/SETCLIENTID_确认操作,以正确处理确认详细信息,并添加了指定新客户端回调信息的功能。还添加了回调信息本身的澄清。

o Added a new operation RELEASE_LOCKOWNER to enable notifying the server that a lock_owner4 will no longer be used by the client.

o 添加了一个新的操作RELEASE_LOCKOWNER,以允许通知服务器客户端将不再使用锁所有者4。

o Added RENEW operation changes to identify the client correctly and allow for additional error returns.

o 添加了续订操作更改,以正确识别客户端并允许其他错误返回。

o Verified error return possibilities for all operations.

o 已验证所有操作的错误返回可能性。

o Removed use of the pathname4 data type from LOOKUP and OPEN in favor of having the client construct a sequence of LOOKUP operations to achieve the same effect.

o 从LOOKUP和OPEN中删除了pathname4数据类型的使用,以便让客户端构造一系列查找操作来实现相同的效果。

2. Protocol Data Types
2. 协议数据类型

The syntax and semantics to describe the data types of the NFSv4 protocol are defined in the XDR [RFC4506] and RPC [RFC5531] documents. The next sections build upon the XDR data types to define types and structures specific to this protocol. As a reminder, the size constants and authoritative definitions can be found in [RFC7531].

XDR[RFC4506]和RPC[RFC5531]文档中定义了描述NFSv4协议数据类型的语法和语义。下一节将基于XDR数据类型来定义特定于此协议的类型和结构。作为提醒,尺寸常数和权威定义可在[RFC7531]中找到。

2.1. Basic Data Types
2.1. 基本数据类型

Table 1 lists the base NFSv4 data types.

表1列出了基本NFSv4数据类型。

   +-----------------+-------------------------------------------------+
   | Data Type       | Definition                                      |
   +-----------------+-------------------------------------------------+
   | int32_t         | typedef int int32_t;                            |
   |                 |                                                 |
   | uint32_t        | typedef unsigned int uint32_t;                  |
   |                 |                                                 |
   | int64_t         | typedef hyper int64_t;                          |
   |                 |                                                 |
   | uint64_t        | typedef unsigned hyper uint64_t;                |
   |                 |                                                 |
   | attrlist4       | typedef opaque attrlist4<>;                     |
   |                 |                                                 |
   |                 | Used for file/directory attributes.             |
   |                 |                                                 |
   | bitmap4         | typedef uint32_t bitmap4<>;                     |
   |                 |                                                 |
   |                 | Used in attribute array encoding.               |
   |                 |                                                 |
   | changeid4       | typedef uint64_t changeid4;                     |
   |                 |                                                 |
   |                 | Used in the definition of change_info4.         |
   |                 |                                                 |
   | clientid4       | typedef uint64_t clientid4;                     |
   |                 |                                                 |
   |                 | Shorthand reference to client identification.   |
   |                 |                                                 |
   | count4          | typedef uint32_t count4;                        |
   |                 |                                                 |
   |                 | Various count parameters (READ, WRITE, COMMIT). |
   |                 |                                                 |
   | length4         | typedef uint64_t length4;                       |
   |                 |                                                 |
   |                 | Describes LOCK lengths.                         |
   |                 |                                                 |
        
   +-----------------+-------------------------------------------------+
   | Data Type       | Definition                                      |
   +-----------------+-------------------------------------------------+
   | int32_t         | typedef int int32_t;                            |
   |                 |                                                 |
   | uint32_t        | typedef unsigned int uint32_t;                  |
   |                 |                                                 |
   | int64_t         | typedef hyper int64_t;                          |
   |                 |                                                 |
   | uint64_t        | typedef unsigned hyper uint64_t;                |
   |                 |                                                 |
   | attrlist4       | typedef opaque attrlist4<>;                     |
   |                 |                                                 |
   |                 | Used for file/directory attributes.             |
   |                 |                                                 |
   | bitmap4         | typedef uint32_t bitmap4<>;                     |
   |                 |                                                 |
   |                 | Used in attribute array encoding.               |
   |                 |                                                 |
   | changeid4       | typedef uint64_t changeid4;                     |
   |                 |                                                 |
   |                 | Used in the definition of change_info4.         |
   |                 |                                                 |
   | clientid4       | typedef uint64_t clientid4;                     |
   |                 |                                                 |
   |                 | Shorthand reference to client identification.   |
   |                 |                                                 |
   | count4          | typedef uint32_t count4;                        |
   |                 |                                                 |
   |                 | Various count parameters (READ, WRITE, COMMIT). |
   |                 |                                                 |
   | length4         | typedef uint64_t length4;                       |
   |                 |                                                 |
   |                 | Describes LOCK lengths.                         |
   |                 |                                                 |
        
   | 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<NFS4_FHSIZE>;            |
   |                 |                                                 |
   |                 | Filehandle definition.                          |
   |                 |                                                 |
   | nfs_ftype4      | enum nfs_ftype4;                                |
   |                 |                                                 |
   |                 | Various defined file types.                     |
   |                 |                                                 |
   | nfsstat4        | enum nfsstat4;                                  |
   |                 |                                                 |
   |                 | Return value for operations.                    |
   |                 |                                                 |
   | nfs_lease4      | typedef uint32_t nfs_lease4;                    |
   |                 |                                                 |
   |                 | Duration of a lease in seconds.                 |
   |                 |                                                 |
   | offset4         | typedef uint64_t offset4;                       |
   |                 |                                                 |
   |                 | Various offset designations (READ, WRITE, LOCK, |
   |                 | COMMIT).                                        |
   |                 |                                                 |
   | qop4            | typedef uint32_t qop4;                          |
   |                 |                                                 |
   |                 | Quality of protection designation in SECINFO.   |
   |                 |                                                 |
   | sec_oid4        | typedef opaque sec_oid4<>;                      |
   |                 |                                                 |
   |                 | Security Object Identifier.  The sec_oid4 data  |
   |                 | type is not really opaque.  Instead, it         |
   |                 | contains an ASN.1 OBJECT IDENTIFIER as used by  |
   |                 | GSS-API in the mech_type argument to            |
   |                 | GSS_Init_sec_context.  See [RFC2743] for        |
   |                 | details.                                        |
   |                 |                                                 |
   | seqid4          | typedef uint32_t seqid4;                        |
   |                 |                                                 |
   |                 | Sequence identifier used for file locking.      |
   |                 |                                                 |
        
   | 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<NFS4_FHSIZE>;            |
   |                 |                                                 |
   |                 | Filehandle definition.                          |
   |                 |                                                 |
   | nfs_ftype4      | enum nfs_ftype4;                                |
   |                 |                                                 |
   |                 | Various defined file types.                     |
   |                 |                                                 |
   | nfsstat4        | enum nfsstat4;                                  |
   |                 |                                                 |
   |                 | Return value for operations.                    |
   |                 |                                                 |
   | nfs_lease4      | typedef uint32_t nfs_lease4;                    |
   |                 |                                                 |
   |                 | Duration of a lease in seconds.                 |
   |                 |                                                 |
   | offset4         | typedef uint64_t offset4;                       |
   |                 |                                                 |
   |                 | Various offset designations (READ, WRITE, LOCK, |
   |                 | COMMIT).                                        |
   |                 |                                                 |
   | qop4            | typedef uint32_t qop4;                          |
   |                 |                                                 |
   |                 | Quality of protection designation in SECINFO.   |
   |                 |                                                 |
   | sec_oid4        | typedef opaque sec_oid4<>;                      |
   |                 |                                                 |
   |                 | Security Object Identifier.  The sec_oid4 data  |
   |                 | type is not really opaque.  Instead, it         |
   |                 | contains an ASN.1 OBJECT IDENTIFIER as used by  |
   |                 | GSS-API in the mech_type argument to            |
   |                 | GSS_Init_sec_context.  See [RFC2743] for        |
   |                 | details.                                        |
   |                 |                                                 |
   | seqid4          | typedef uint32_t seqid4;                        |
   |                 |                                                 |
   |                 | Sequence identifier used for file locking.      |
   |                 |                                                 |
        
   | utf8string      | typedef opaque utf8string<>;                    |
   |                 |                                                 |
   |                 | UTF-8 encoding for strings.                     |
   |                 |                                                 |
   | utf8str_cis     | typedef utf8string utf8str_cis;                 |
   |                 |                                                 |
   |                 | Case-insensitive UTF-8 string.                  |
   |                 |                                                 |
   | utf8str_cs      | typedef utf8string utf8str_cs;                  |
   |                 |                                                 |
   |                 | Case-sensitive UTF-8 string.                    |
   |                 |                                                 |
   | utf8str_mixed   | typedef utf8string utf8str_mixed;               |
   |                 |                                                 |
   |                 | UTF-8 strings with a case-sensitive prefix and  |
   |                 | a case-insensitive suffix.                      |
   |                 |                                                 |
   | component4      | typedef utf8str_cs component4;                  |
   |                 |                                                 |
   |                 | Represents pathname components.                 |
   |                 |                                                 |
   | linktext4       | typedef opaque linktext4<>;                     |
   |                 |                                                 |
   |                 | Symbolic link contents ("symbolic link" is      |
   |                 | defined in an Open Group [openg_symlink]        |
   |                 | standard).                                      |
   |                 |                                                 |
   | ascii_REQUIRED4 | typedef utf8string ascii_REQUIRED4;             |
   |                 |                                                 |
   |                 | String is sent as ASCII and thus is             |
   |                 | automatically UTF-8.                            |
   |                 |                                                 |
   | pathname4       | typedef component4 pathname4<>;                 |
   |                 |                                                 |
   |                 | Represents pathname for fs_locations.           |
   |                 |                                                 |
   | nfs_lockid4     | typedef uint64_t nfs_lockid4;                   |
   |                 |                                                 |
   | verifier4       | typedef opaque verifier4[NFS4_VERIFIER_SIZE];   |
   |                 |                                                 |
   |                 | Verifier used for various operations (COMMIT,   |
   |                 | CREATE, OPEN, READDIR, WRITE)                   |
   |                 | NFS4_VERIFIER_SIZE is defined as 8.             |
   +-----------------+-------------------------------------------------+
        
   | utf8string      | typedef opaque utf8string<>;                    |
   |                 |                                                 |
   |                 | UTF-8 encoding for strings.                     |
   |                 |                                                 |
   | utf8str_cis     | typedef utf8string utf8str_cis;                 |
   |                 |                                                 |
   |                 | Case-insensitive UTF-8 string.                  |
   |                 |                                                 |
   | utf8str_cs      | typedef utf8string utf8str_cs;                  |
   |                 |                                                 |
   |                 | Case-sensitive UTF-8 string.                    |
   |                 |                                                 |
   | utf8str_mixed   | typedef utf8string utf8str_mixed;               |
   |                 |                                                 |
   |                 | UTF-8 strings with a case-sensitive prefix and  |
   |                 | a case-insensitive suffix.                      |
   |                 |                                                 |
   | component4      | typedef utf8str_cs component4;                  |
   |                 |                                                 |
   |                 | Represents pathname components.                 |
   |                 |                                                 |
   | linktext4       | typedef opaque linktext4<>;                     |
   |                 |                                                 |
   |                 | Symbolic link contents ("symbolic link" is      |
   |                 | defined in an Open Group [openg_symlink]        |
   |                 | standard).                                      |
   |                 |                                                 |
   | ascii_REQUIRED4 | typedef utf8string ascii_REQUIRED4;             |
   |                 |                                                 |
   |                 | String is sent as ASCII and thus is             |
   |                 | automatically UTF-8.                            |
   |                 |                                                 |
   | pathname4       | typedef component4 pathname4<>;                 |
   |                 |                                                 |
   |                 | Represents pathname for fs_locations.           |
   |                 |                                                 |
   | nfs_lockid4     | typedef uint64_t nfs_lockid4;                   |
   |                 |                                                 |
   | verifier4       | typedef opaque verifier4[NFS4_VERIFIER_SIZE];   |
   |                 |                                                 |
   |                 | Verifier used for various operations (COMMIT,   |
   |                 | CREATE, OPEN, READDIR, WRITE)                   |
   |                 | NFS4_VERIFIER_SIZE is defined as 8.             |
   +-----------------+-------------------------------------------------+
        

Table 1: Base NFSv4 Data Types

表1:基本NFSv4数据类型

2.2. Structured Data Types
2.2. 结构化数据类型
2.2.1. nfstime4
2.2.1. nfstime4
   struct nfstime4 {
           int64_t         seconds;
           uint32_t        nseconds;
   };
        
   struct nfstime4 {
           int64_t         seconds;
           uint32_t        nseconds;
   };
        

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 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.

nfstime4结构给出了自1970年1月1日协调世界时(UTC)午夜或0小时后的秒数和纳秒数。秒字段大于零的值表示1970年1月1日0小时后的日期。秒字段小于零的值表示1970年1月1日0小时之前的日期。在这两种情况下,N秒字段将添加到秒字段中,作为最终时间表示。例如,如果要表示的时间是1970年1月1日0小时之前的半秒,则秒字段的值为负1(-1),而秒字段的值为半秒(500000000)。对于N秒,大于9999999的值被视为无效。

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. An adjunct time maintenance protocol is recommended to reduce client and server time skew.

此数据类型用于传递时间和日期信息。在处理时间值时,服务器会在本地表示的时间之间进行转换,以尽可能保持准确性。如果为文件系统对象存储的时间戳的精度小于定义的精度,则可能会发生精度损失。建议使用附加的时间维护协议来减少客户端和服务器的时间偏差。

2.2.2. time_how4
2.2.2. 时间如何
   enum time_how4 {
           SET_TO_SERVER_TIME4 = 0,
           SET_TO_CLIENT_TIME4 = 1
   };
        
   enum time_how4 {
           SET_TO_SERVER_TIME4 = 0,
           SET_TO_CLIENT_TIME4 = 1
   };
        
2.2.3. settime4
2.2.3. 设置时间4
   union settime4 switch (time_how4 set_it) {
    case SET_TO_CLIENT_TIME4:
            nfstime4       time;
    default:
            void;
   };
        
   union settime4 switch (time_how4 set_it) {
    case SET_TO_CLIENT_TIME4:
            nfstime4       time;
    default:
            void;
   };
        

The above definitions are used as the attribute definitions to set time values. If set_it is SET_TO_SERVER_TIME4, then the server uses its local representation of time for the time value.

以上定义用作设置时间值的属性定义。如果将其设置为服务器时间4,则服务器使用其本地时间表示形式作为时间值。

2.2.4. specdata4
2.2.4. 规范数据4
   struct specdata4 {
           uint32_t specdata1; /* major device number */
           uint32_t specdata2; /* minor device number */
   };
        
   struct specdata4 {
           uint32_t specdata1; /* major device number */
           uint32_t specdata2; /* minor device number */
   };
        

This data type represents additional information for the device file types NF4CHR and NF4BLK.

此数据类型表示设备文件类型NF4CHR和NF4BLK的附加信息。

2.2.5. fsid4
2.2.5. fsid4
   struct fsid4 {
           uint64_t        major;
           uint64_t        minor;
   };
        
   struct fsid4 {
           uint64_t        major;
           uint64_t        minor;
   };
        

This type is the file system identifier that is used as a REQUIRED attribute.

此类型是用作必需属性的文件系统标识符。

2.2.6. fs_location4
2.2.6. fs_位置4
   struct fs_location4 {
           utf8str_cis             server<>;
           pathname4               rootpath;
   };
        
   struct fs_location4 {
           utf8str_cis             server<>;
           pathname4               rootpath;
   };
        
2.2.7. fs_locations4
2.2.7. fs_位置4
   struct fs_locations4 {
           pathname4       fs_root;
           fs_location4    locations<>;
   };
        
   struct fs_locations4 {
           pathname4       fs_root;
           fs_location4    locations<>;
   };
        

The fs_location4 and fs_locations4 data types are used for the fs_locations RECOMMENDED attribute, which is used for migration and replication support.

fs_location4和fs_locations4数据类型用于fs_locations RECOMMENDED属性,该属性用于迁移和复制支持。

2.2.8. fattr4
2.2.8. 胖子4
   struct fattr4 {
           bitmap4         attrmask;
           attrlist4       attr_vals;
   };
        
   struct fattr4 {
           bitmap4         attrmask;
           attrlist4       attr_vals;
   };
        

The fattr4 structure is used to represent file and directory attributes.

fattr4结构用于表示文件和目录属性。

The bitmap is a counted array of 32-bit integers used to contain bit values. The position of the integer in the array that contains bit n can be computed from the expression (n / 32), and its bit within that integer is (n mod 32).

位图是一个32位整数的计数数组,用于包含位值。整数在包含位n的数组中的位置可以从表达式(n/32)计算出来,其在该整数中的位是(n mod 32)。

                       0            1
     +-----------+-----------+-----------+--
     |  count    | 31  ..  0 | 63  .. 32 |
     +-----------+-----------+-----------+--
        
                       0            1
     +-----------+-----------+-----------+--
     |  count    | 31  ..  0 | 63  .. 32 |
     +-----------+-----------+-----------+--
        
2.2.9. change_info4
2.2.9. 更改信息4
   struct change_info4 {
           bool            atomic;
           changeid4       before;
           changeid4       after;
   };
        
   struct change_info4 {
           bool            atomic;
           changeid4       before;
           changeid4       after;
   };
        

This structure is used with the CREATE, LINK, REMOVE, and RENAME operations to let the client know the value of the change attribute for the directory in which the target file system object resides.

此结构与创建、链接、删除和重命名操作一起使用,以让客户端知道目标文件系统对象所在目录的change属性的值。

2.2.10. clientaddr4
2.2.10. 客户地址4
   struct clientaddr4 {
           /* see struct rpcb in RFC 1833 */
           string r_netid<>;    /* network id */
           string r_addr<>;     /* universal address */
   };
        
   struct clientaddr4 {
           /* see struct rpcb in RFC 1833 */
           string r_netid<>;    /* network id */
           string r_addr<>;     /* universal address */
   };
        

The clientaddr4 structure is used as part of the SETCLIENTID operation, either (1) to specify the address of the client that is using a client ID or (2) as part of the callback registration. The r_netid and r_addr fields respectively contain a network id and universal address. The network id and universal address concepts, together with formats for TCP over IPv4 and TCP over IPv6, are defined in [RFC5665], specifically Tables 2 and 3 and Sections 5.2.3.3 and 5.2.3.4.

ClientAddress4结构用作SETCLIENTID操作的一部分,可以(1)指定使用客户端ID的客户端的地址,也可以(2)作为回调注册的一部分。r_netid和r_addr字段分别包含网络id和通用地址。[RFC5665]中定义了网络id和通用地址概念以及IPv4上的TCP和IPv6上的TCP格式,特别是表2和表3以及第5.2.3.3和5.2.3.4节。

2.2.11. cb_client4
2.2.11. cb_客户4
   struct cb_client4 {
           unsigned int    cb_program;
           clientaddr4     cb_location;
   };
        
   struct cb_client4 {
           unsigned int    cb_program;
           clientaddr4     cb_location;
   };
        

This structure is used by the client to inform the server of its callback address; it includes the program number and client address.

客户端使用此结构通知服务器其回调地址;它包括程序编号和客户端地址。

2.2.12. nfs_client_id4
2.2.12. nfs_客户端_id4
   struct nfs_client_id4 {
           verifier4       verifier;
           opaque          id<NFS4_OPAQUE_LIMIT>;
   };
        
   struct nfs_client_id4 {
           verifier4       verifier;
           opaque          id<NFS4_OPAQUE_LIMIT>;
   };
        

This structure is part of the arguments to the SETCLIENTID operation.

此结构是SETCLIENTID操作参数的一部分。

2.2.13. open_owner4
2.2.13. 开放式所有者4
   struct open_owner4 {
           clientid4       clientid;
           opaque          owner<NFS4_OPAQUE_LIMIT>;
   };
        
   struct open_owner4 {
           clientid4       clientid;
           opaque          owner<NFS4_OPAQUE_LIMIT>;
   };
        

This structure is used to identify the owner of open state.

此结构用于标识打开状态的所有者。

2.2.14. lock_owner4
2.2.14. 锁定所有者4
   struct lock_owner4 {
           clientid4       clientid;
           opaque          owner<NFS4_OPAQUE_LIMIT>;
   };
        
   struct lock_owner4 {
           clientid4       clientid;
           opaque          owner<NFS4_OPAQUE_LIMIT>;
   };
        

This structure is used to identify the owner of file locking state.

此结构用于标识文件锁定状态的所有者。

2.2.15. open_to_lock_owner4
2.2.15. 打开至锁定所有者4
   struct open_to_lock_owner4 {
           seqid4          open_seqid;
           stateid4        open_stateid;
           seqid4          lock_seqid;
           lock_owner4     lock_owner;
   };
        
   struct open_to_lock_owner4 {
           seqid4          open_seqid;
           stateid4        open_stateid;
           seqid4          lock_seqid;
           lock_owner4     lock_owner;
   };
        

This structure is used for the first LOCK operation done for an open_owner4. It provides both the open_stateid and lock_owner such that the transition is made from a valid open_stateid sequence to that of the new lock_stateid sequence. Using this mechanism avoids the confirmation of the lock_owner/lock_seqid pair since it is tied to established state in the form of the open_stateid/open_seqid.

此结构用于为开放式所有者完成的第一次锁定操作4。它同时提供open_stateid和lock_owner,以便从有效的open_stateid序列转换为新的lock_stateid序列。使用此机制可以避免确认lock_owner/lock_seqid对,因为它以open_stateid/open_seqid的形式绑定到已建立的状态。

2.2.16. stateid4
2.2.16. 州4
   struct stateid4 {
           uint32_t        seqid;
           opaque          other[NFS4_OTHER_SIZE];
   };
        
   struct stateid4 {
           uint32_t        seqid;
           opaque          other[NFS4_OTHER_SIZE];
   };
        

This structure is used for the various state-sharing mechanisms between the client and server. For the client, this data structure is read-only. The server is required to increment the seqid field monotonically at each transition of the stateid. This is important since the client will inspect the seqid in OPEN stateids to determine the order of OPEN processing done by the server.

此结构用于客户端和服务器之间的各种状态共享机制。对于客户端,此数据结构是只读的。服务器需要在stateid的每次转换时单调递增seqid字段。这一点很重要,因为客户端将检查OPEN StateID中的seqid,以确定服务器完成的打开处理顺序。

3. RPC and Security Flavor
3. RPC与安全风格

The NFSv4 protocol is an RPC application that uses RPC version 2 and the XDR as defined in [RFC5531] and [RFC4506]. The RPCSEC_GSS security flavors as defined in version 1 ([RFC2203]) and version 2 ([RFC5403]) MUST be implemented as the mechanism to deliver stronger security for the NFSv4 protocol. However, deployment of RPCSEC_GSS is optional.

NFSv4协议是一个RPC应用程序,它使用RPC版本2和[RFC5531]和[RFC4506]中定义的XDR。版本1([RFC2203])和版本2([RFC5403])中定义的RPCSEC_GSS安全风格必须作为为NFSv4协议提供更强安全性的机制来实现。但是,RPCSEC_GSS的部署是可选的。

3.1. Ports and Transports
3.1. 港口和运输

Historically, NFSv2 and NFSv3 servers have resided on port 2049. The registered port 2049 [RFC3232] for the NFS protocol SHOULD be the default configuration. Using the registered port for NFS services means the NFS client will not need to use the RPC binding protocols as described in [RFC1833]; this will allow NFS to transit firewalls.

过去,NFSv2和NFSv3服务器位于端口2049上。NFS协议的注册端口2049[RFC3232]应为默认配置。使用NFS服务的注册端口意味着NFS客户端不需要使用[RFC1833]中所述的RPC绑定协议;这将允许NFS传输防火墙。

Where an NFSv4 implementation supports operation over the IP network protocol, the supported transport layer between NFS and IP MUST be an IETF standardized transport protocol that is specified to avoid network congestion; such transports include TCP and the Stream Control Transmission Protocol (SCTP). To enhance the possibilities for interoperability, an NFSv4 implementation MUST support operation over the TCP transport protocol.

如果NFSv4实现支持通过IP网络协议进行操作,则NFS和IP之间受支持的传输层必须是IETF标准化传输协议,该协议指定用于避免网络拥塞;此类传输包括TCP和流控制传输协议(SCTP)。为了增强互操作性的可能性,NFSv4实现必须支持TCP传输协议上的操作。

If TCP is used as the transport, the client and server SHOULD use persistent connections. This will prevent the weakening of TCP's congestion control via short-lived connections and will improve performance for the Wide Area Network (WAN) environment by eliminating the need for SYN handshakes.

如果使用TCP作为传输,则客户端和服务器应使用持久连接。这将防止通过短命连接削弱TCP的拥塞控制,并通过消除SYN握手的需要来提高广域网(WAN)环境的性能。

As noted in Section 19, the authentication model for NFSv4 has moved from machine-based to principal-based. However, this modification of the authentication model does not imply a technical requirement to

如第19节所述,NFSv4的身份验证模型已从基于机器转向基于主体。然而,对认证模型的这种修改并不意味着对

move the TCP connection management model from whole machine-based to one based on a per-user model. In particular, NFS over TCP client implementations have traditionally multiplexed traffic for multiple users over a common TCP connection between an NFS client and server. This has been true, regardless of whether the NFS client is using AUTH_SYS, AUTH_DH, RPCSEC_GSS, or any other flavor. Similarly, NFS over TCP server implementations have assumed such a model and thus scale the implementation of TCP connection management in proportion to the number of expected client machines. It is intended that NFSv4 will not modify this connection management model. NFSv4 clients that violate this assumption can expect scaling issues on the server and hence reduced service.

将TCP连接管理模型从基于整台计算机移动到基于每用户模型。特别是,NFS over TCP客户端实现传统上通过NFS客户端和服务器之间的公共TCP连接为多个用户多路传输流量。无论NFS客户端使用的是AUTH_SYS、AUTH_DH、RPCSEC_GSS还是任何其他风格,这都是正确的。类似地,NFS over TCP服务器实现也采用了这样的模型,因此TCP连接管理的实现与预期客户端计算机的数量成比例。NFSv4不会修改此连接管理模型。违反此假设的NFSv4客户端可能会在服务器上出现扩展问题,从而降低服务。

3.1.1. Client Retransmission Behavior
3.1.1. 客户端重传行为

When processing an NFSv4 request received over a reliable transport such as TCP, the NFSv4 server MUST NOT silently drop the request, except if the established transport connection has been broken. Given such a contract between NFSv4 clients and servers, clients MUST NOT retry a request unless one or both of the following are true:

当处理通过可靠传输(如TCP)接收的NFSv4请求时,NFSv4服务器不得静默丢弃该请求,除非已建立的传输连接已断开。鉴于NFSv4客户端和服务器之间存在此类约定,客户端不得重试请求,除非以下一项或两项均为真:

o The transport connection has been broken

o 传输连接已断开

o The procedure being retried is the NULL procedure

o 正在重试的过程为空过程

Since reliable transports, such as TCP, do not always synchronously inform a peer when the other peer has broken the connection (for example, when an NFS server reboots), the NFSv4 client may want to actively "probe" the connection to see if has been broken. Use of the NULL procedure is one recommended way to do so. So, when a client experiences a remote procedure call timeout (of some arbitrary implementation-specific amount), rather than retrying the remote procedure call, it could instead issue a NULL procedure call to the server. If the server has died, the transport connection break will eventually be indicated to the NFSv4 client. The client can then reconnect, and then retry the original request. If the NULL procedure call gets a response, the connection has not broken. The client can decide to wait longer for the original request's response, or it can break the transport connection and reconnect before re-sending the original request.

由于可靠的传输(如TCP)并不总是在另一个对等方断开连接时(例如,NFS服务器重新启动时)同步通知另一个对等方,因此NFSv4客户端可能希望主动“探测”该连接以查看是否断开。使用NULL过程是一种推荐的方法。因此,当客户机遇到远程过程调用超时(某种特定于实现的任意数量)时,它不会重试远程过程调用,而是可以向服务器发出NULL过程调用。如果服务器死机,传输连接中断最终将指示给NFSv4客户端。然后,客户端可以重新连接,然后重试原始请求。如果NULL过程调用得到响应,则表示连接没有中断。客户端可以决定等待原始请求的响应更长时间,也可以在重新发送原始请求之前中断传输连接并重新连接。

For callbacks from the server to the client, the same rules apply, but the server doing the callback becomes the client, and the client receiving the callback becomes the server.

对于从服务器到客户机的回调,同样的规则也适用,但执行回调的服务器成为客户机,接收回调的客户机成为服务器。

3.2. Security Flavors
3.2. 安全口味

Traditional RPC implementations have included AUTH_NONE, AUTH_SYS, AUTH_DH, and AUTH_KRB4 as security flavors. With [RFC2203], an additional security flavor of RPCSEC_GSS has been introduced, which uses the functionality of GSS-API [RFC2743]. This allows for the use of various security mechanisms by the RPC layer without the additional implementation overhead of adding RPC security flavors. For NFSv4, the RPCSEC_GSS security flavor MUST be used to enable the mandatory-to-implement security mechanism. Other flavors, such as AUTH_NONE, AUTH_SYS, and AUTH_DH, MAY be implemented as well.

传统的RPC实现包括AUTH_NONE、AUTH_SYS、AUTH_DH和AUTH_KRB4作为安全特性。[RFC2203]引入了RPCSEC_GSS的另一种安全特性,它使用GSS-API[RFC2743]的功能。这允许RPC层使用各种安全机制,而无需添加RPC安全特性的额外实现开销。对于NFSv4,必须使用RPCSEC_GSS安全特性来启用强制实现安全机制。还可以实现其他风格,例如AUTH_NONE、AUTH_SYS和AUTH_DH。

3.2.1. Security Mechanisms for NFSv4
3.2.1. NFSv4的安全机制

RPCSEC_GSS, via GSS-API, supports multiple mechanisms that provide security services. For interoperability, NFSv4 clients and servers MUST support the Kerberos V5 security mechanism.

RPCSEC_GSS通过GSS-API支持提供安全服务的多种机制。为了实现互操作性,NFSv4客户端和服务器必须支持Kerberos V5安全机制。

The use of RPCSEC_GSS requires selection of mechanism, quality of protection (QOP), and service (authentication, integrity, privacy). For the mandated security mechanisms, NFSv4 specifies that a QOP of zero is used, leaving it up to the mechanism or the mechanism's configuration to map QOP zero to an appropriate level of protection. Each mandated mechanism specifies a minimum set of cryptographic algorithms for implementing integrity and privacy. NFSv4 clients and servers MUST be implemented on operating environments that comply with the required cryptographic algorithms of each required mechanism.

RPCSEC_GSS的使用需要选择机制、保护质量(QOP)和服务(身份验证、完整性、隐私)。对于强制安全机制,NFSv4指定使用QOP为零,由机制或机制的配置将QOP零映射到适当的保护级别。每个强制机制都指定了用于实现完整性和隐私性的最小加密算法集。NFSv4客户端和服务器必须在符合每个所需机制的所需加密算法的操作环境中实现。

3.2.1.1. Kerberos V5 as a Security Triple
3.2.1.1. kerberosv5作为三重安全机制

The Kerberos V5 GSS-API mechanism as described in [RFC4121] MUST be implemented with the RPCSEC_GSS services as specified in Table 2. Both client and server MUST support each of the pseudo-flavors.

[RFC4121]中描述的Kerberos V5 GSS-API机制必须使用表2中指定的RPCSEC_GSS服务实现。客户端和服务器都必须支持每种伪风格。

     +--------+-------+----------------------+-----------------------+
     | Number | Name  | Mechanism's OID      | RPCSEC_GSS service    |
     +--------+-------+----------------------+-----------------------+
     | 390003 | krb5  | 1.2.840.113554.1.2.2 | rpc_gss_svc_none      |
     | 390004 | krb5i | 1.2.840.113554.1.2.2 | rpc_gss_svc_integrity |
     | 390005 | krb5p | 1.2.840.113554.1.2.2 | rpc_gss_svc_privacy   |
     +--------+-------+----------------------+-----------------------+
        
     +--------+-------+----------------------+-----------------------+
     | Number | Name  | Mechanism's OID      | RPCSEC_GSS service    |
     +--------+-------+----------------------+-----------------------+
     | 390003 | krb5  | 1.2.840.113554.1.2.2 | rpc_gss_svc_none      |
     | 390004 | krb5i | 1.2.840.113554.1.2.2 | rpc_gss_svc_integrity |
     | 390005 | krb5p | 1.2.840.113554.1.2.2 | rpc_gss_svc_privacy   |
     +--------+-------+----------------------+-----------------------+
        

Table 2: Mapping Pseudo-Flavor to Service

表2:将伪风格映射到服务

Note that the pseudo-flavor is presented here as a mapping aid to the implementer. Because this NFS protocol includes a method to negotiate security and it understands the GSS-API mechanism, the

请注意,伪风格在这里作为映射辅助工具提供给实现者。由于此NFS协议包含协商安全性的方法,并且它了解GSS-API机制,因此

pseudo-flavor is not needed. The pseudo-flavor is needed for NFSv3 since the security negotiation is done via the MOUNT protocol as described in [RFC2623].

伪味是不需要的。NFSv3需要伪风格,因为安全协商是通过[RFC2623]中描述的装载协议完成的。

At the time this document was specified, the Advanced Encryption Standard (AES) with HMAC-SHA1 was a required algorithm set for Kerberos V5. In contrast, when NFSv4.0 was first specified in [RFC3530], weaker algorithm sets were REQUIRED for Kerberos V5, and were REQUIRED in the NFSv4.0 specification, because the Kerberos V5 specification at the time did not specify stronger algorithms. The NFSv4 specification does not specify required algorithms for Kerberos V5, and instead, the implementer is expected to track the evolution of the Kerberos V5 standard if and when stronger algorithms are specified.

在指定本文档时,带有HMAC-SHA1的高级加密标准(AES)是Kerberos V5所需的算法集。相反,当[RFC3530]中首次指定NFSv4.0时,Kerberos V5需要较弱的算法集,NFSv4.0规范也需要较弱的算法集,因为当时的Kerberos V5规范没有指定更强的算法。NFSv4规范没有为Kerberos V5指定所需的算法,相反,如果指定了更强大的算法,则实现者应该跟踪Kerberos V5标准的发展。

3.2.1.1.1. Security Considerations for Cryptographic Algorithms in Kerberos V5

3.2.1.1.1. Kerberos V5中加密算法的安全注意事项

When deploying NFSv4, the strength of the security achieved depends on the existing Kerberos V5 infrastructure. The algorithms of Kerberos V5 are not directly exposed to or selectable by the client or server, so there is some due diligence required by the user of NFSv4 to ensure that security is acceptable where needed. Guidance is provided in [RFC6649] as to why weak algorithms should be disabled by default.

在部署NFSv4时,实现的安全性的强度取决于现有的Kerberos V5基础架构。Kerberos V5的算法不直接暴露于客户机或服务器,也不可由客户机或服务器选择,因此NFSv4的用户需要进行一些尽职调查,以确保在需要时可以接受安全性。[RFC6649]中提供了关于为什么默认情况下应禁用弱算法的指导。

3.3. Security Negotiation
3.3. 安全协商

With the NFSv4 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 can have multiple points within its file system namespace that are available for use by NFS clients. In turn, the NFS server can be configured such that each of these entry points can have different or multiple security mechanisms in use.

由于NFSv4服务器可能提供多种安全机制,客户端需要一种方法来确定或协商用于与服务器通信的机制。NFS服务器在其文件系统命名空间中可以有多个点,供NFS客户端使用。反过来,可以对NFS服务器进行配置,使每个入口点都可以使用不同或多个安全机制。

The security negotiation between client and server SHOULD be done with a secure channel to eliminate the possibility of a third party intercepting the negotiation sequence and forcing the client and server to choose a lower level of security than required or desired. See Section 19 for further discussion.

客户端和服务器之间的安全协商应使用安全通道进行,以消除第三方截获协商序列并迫使客户端和服务器选择低于要求或期望的安全级别的可能性。进一步讨论见第19节。

3.3.1. SECINFO
3.3.1. SECINFO

The SECINFO operation will allow the client to determine, on a per-filehandle basis, what security triple (see [RFC2743] and Section 16.31.4) is to be used for server access. In general, the client will not have to use the SECINFO operation, except during initial communication with the server or when the client encounters a new security policy as the client navigates the namespace. Either condition will force the client to negotiate a new security triple.

SECINFO操作将允许客户端根据每个文件句柄确定用于服务器访问的三重安全性(请参见[RFC2743]和第16.31.4节)。通常,客户机不必使用SECINFO操作,除非在与服务器的初始通信期间,或者当客户机在导航命名空间时遇到新的安全策略时。任何一种情况都会迫使客户协商新的安全协议。

3.3.2. Security Error
3.3.2. 安全错误

Based on the assumption that each NFSv4 client and server MUST support a minimum set of security (i.e., Kerberos V5 under RPCSEC_GSS), the NFS client will start its communication with the server with one of the minimal security triples. During communication with the server, the client can receive an NFS error of NFS4ERR_WRONGSEC. This error allows the server to notify the client that the security triple currently being used is not appropriate for access to the server's file system resources. The client is then responsible for determining what security triples are available at the server and choosing one that is appropriate for the client. See Section 16.31 for further discussion of how the client will respond to the NFS4ERR_WRONGSEC error and use SECINFO.

基于每个NFSv4客户端和服务器必须支持一组最低安全性(即RPCSEC_GSS下的Kerberos V5)的假设,NFS客户端将使用其中一个最低安全性三元组开始与服务器的通信。在与服务器通信期间,客户端可能会收到NFS4ERR_错误秒的NFS错误。此错误允许服务器通知客户端当前使用的安全性三元组不适合访问服务器的文件系统资源。然后,客户机负责确定服务器上有哪些安全三元组可用,并选择一个适合客户机的安全三元组。有关客户如何响应NFS4ERR_ErrorSec错误和使用SECINFO的进一步讨论,请参见第16.31节。

3.3.3. Callback RPC Authentication
3.3.3. 回调RPC身份验证

Except as noted elsewhere in this section, the callback RPC (described later) MUST mutually authenticate the NFS server to the principal that acquired the client ID (also described later), using the security flavor of the original SETCLIENTID operation used.

除本节其他地方所述外,回调RPC(稍后描述)必须使用所使用的原始SETCLIENTID操作的安全特性,向获取客户机ID(稍后描述)的主体相互验证NFS服务器。

For AUTH_NONE, there are no principals, so this is a non-issue.

对于AUTH_NONE,没有主体,因此这不是问题。

AUTH_SYS has no notions of mutual authentication or a server principal, so the callback from the server simply uses the AUTH_SYS credential that the user used when he set up the delegation.

AUTH_SYS没有相互身份验证或服务器主体的概念,因此来自服务器的回调仅使用用户在设置委派时使用的AUTH_SYS凭据。

For AUTH_DH, one commonly used convention is that the server uses the credential corresponding to this AUTH_DH principal:

对于AUTH_DH,一个常用的约定是服务器使用与此AUTH_DH主体对应的凭据:

unix.host@domain

unix。host@domain

where host and domain are variables corresponding to the name of the server host and directory services domain in which it lives, such as a Network Information System domain or a DNS domain.

其中,主机和域是与其所在的服务器主机和目录服务域(如网络信息系统域或DNS域)的名称相对应的变量。

Regardless of what security mechanism under RPCSEC_GSS is being used, the NFS server MUST identify itself in GSS-API via a GSS_C_NT_HOSTBASED_SERVICE name type. GSS_C_NT_HOSTBASED_SERVICE names are of the form:

无论使用的是RPCSEC_GSS下的哪种安全机制,NFS服务器都必须通过GSS_C_NT_HOSTBASED_服务名称类型在GSS-API中标识自己。GSS_C_NT_基于主机的_服务名称的形式如下:

service@hostname

service@hostname

For NFS, the "service" element is:

对于NFS,“服务”元素是:

nfs

nfs

Implementations of security mechanisms will convert nfs@hostname to various different forms. For Kerberos V5, the following form is RECOMMENDED:

安全机制的实现将转换为nfs@hostname以各种不同的形式。对于Kerberos V5,建议使用以下格式:

nfs/hostname

nfs/主机名

For Kerberos V5, nfs/hostname would be a server principal in the Kerberos Key Distribution Center database. This is the same principal the client acquired a GSS-API context for when it issued the SETCLIENTID operation; therefore, the realm name for the server principal must be the same for the callback as it was for the SETCLIENTID.

对于Kerberos V5,nfs/主机名将是Kerberos密钥分发中心数据库中的服务器主体。这与客户端在发出SETCLIENTID操作时获取GSS-API上下文的主体相同;因此,回调的服务器主体的域名称必须与SETCLIENTID的域名称相同。

4. Filehandles
4. 文件句柄

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.

NFS协议中的filehandle是文件系统对象的每服务器唯一标识符。文件句柄的内容对客户端是不透明的。因此,服务器负责将文件句柄转换为文件系统对象的内部表示形式。

4.1. Obtaining the First Filehandle
4.1. 获取第一个文件句柄

The operations of the NFS protocol are defined in terms of one or more filehandles. Therefore, the client needs a filehandle to initiate communication with the server. With the NFSv2 protocol [RFC1094] and the NFSv3 protocol [RFC1813], there exists an ancillary protocol to obtain this first filehandle. The MOUNT protocol, RPC program number 100005, provides the mechanism of translating a string-based file system pathname to a filehandle that can then be used by the NFS protocols.

NFS协议的操作是根据一个或多个文件句柄定义的。因此,客户端需要一个文件句柄来启动与服务器的通信。对于NFSv2协议[RFC1094]和NFSv3协议[RFC1813],存在一个辅助协议来获取第一个文件句柄。装载协议(RPC程序编号100005)提供了将基于字符串的文件系统路径名转换为NFS协议可以使用的文件句柄的机制。

The MOUNT protocol has deficiencies in the area of security and use via firewalls. This is one reason that the use of the public filehandle was introduced in [RFC2054] and [RFC2055]. With the use of the public filehandle in combination with the LOOKUP operation in

MOUNT协议在安全性和通过防火墙使用方面存在缺陷。这就是[RFC2054]和[RFC2055]中引入公共文件句柄的原因之一。将公共文件句柄与中的查找操作结合使用

the NFSv2 and NFSv3 protocols, it has been demonstrated that the MOUNT protocol is unnecessary for viable interaction between the NFS client and server.

在NFSv2和NFSv3协议中,已经证明了挂载协议对于NFS客户端和服务器之间的有效交互是不必要的。

Therefore, the NFSv4 protocol will not use an ancillary protocol for translation from string-based pathnames to a filehandle. Two special filehandles will be used as starting points for the NFS client.

因此,NFSv4协议不会使用辅助协议将基于字符串的路径名转换为文件句柄。两个特殊的文件句柄将用作NFS客户端的起点。

4.1.1. Root Filehandle
4.1.1. 根文件句柄

The first of the special filehandles is the root filehandle. The root filehandle is the "conceptual" root of the file system namespace 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 tree with the LOOKUP operation. A complete discussion of the server namespace is in Section 7.

第一个特殊文件句柄是根文件句柄。根文件句柄是NFS服务器上文件系统名称空间的“概念”根。客户端通过使用PUTROOTFH操作来使用或启动根文件句柄。PUTROOTFH操作指示服务器将当前文件句柄设置为服务器文件树的根。使用此PUTROOTFH操作后,客户机可以使用查找操作遍历服务器的整个文件树。关于服务器名称空间的完整讨论见第7节。

4.1.2. Public Filehandle
4.1.2. 公共文件句柄

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 and the root filehandle refer to the same file system object. However, it is up to the administrative software at the server and the policies of the server administrator to define the binding of the public filehandle and server file system object. The client may not make any assumptions about this binding. The client uses the public filehandle via the PUTPUBFH operation.

第二个特殊文件句柄是公共文件句柄。与根文件句柄不同,公共文件句柄可以绑定或表示服务器上的任意文件系统对象。服务器负责此绑定。公共文件句柄和根文件句柄可能引用同一个文件系统对象。但是,定义公共文件句柄和服务器文件系统对象的绑定取决于服务器上的管理软件和服务器管理员的策略。客户不得对此绑定做出任何假设。客户端通过PUTPUBFH操作使用公共文件句柄。

4.2. Filehandle Types
4.2. 文件句柄类型

In the NFSv2 and NFSv3 protocols, there was one type of filehandle with a single set of semantics, of which the primary one was that it was persistent across a server reboot. As such, this type of filehandle is termed "persistent" in NFSv4. The semantics of a persistent filehandle remain the same as before. A new type of filehandle introduced in NFSv4 is the volatile filehandle, which attempts to accommodate certain server environments.

在NFSv2和NFSv3协议中,有一种文件句柄类型具有一组语义,其中主要的一种是它在服务器重新启动时是持久的。因此,这种类型的文件句柄在NFSv4中被称为“持久的”。持久化文件句柄的语义与以前相同。NFSv4中引入的一种新型文件句柄是volatile文件句柄,它试图适应某些服务器环境。

The volatile filehandle type was introduced to address server functionality or implementation issues that make correct implementation of a persistent filehandle infeasible. Some server environments do not provide a file system level invariant that can be used to construct a persistent filehandle. The underlying server

引入volatile filehandle类型是为了解决使持久化filehandle的正确实现不可行的服务器功能或实现问题。某些服务器环境不提供可用于构造持久化文件句柄的文件系统级不变量。底层服务器

file system may not provide the invariant, or the server's file system programming interfaces may not provide access to the needed invariant. Volatile filehandles may ease the implementation of server functionality, such as hierarchical storage management or file system reorganization or migration. However, the volatile filehandle increases the implementation burden for the client.

文件系统可能不提供不变量,或者服务器的文件系统编程接口可能不提供对所需不变量的访问。易失性文件句柄可以简化服务器功能的实现,如分层存储管理或文件系统重组或迁移。但是,易失性文件句柄增加了客户端的实现负担。

Since the client will need to handle persistent and volatile filehandles differently, a file attribute is defined that may be used by the client to determine the filehandle types being returned by the server.

由于客户端需要以不同的方式处理持久性和易失性文件句柄,因此定义了一个文件属性,客户端可以使用该属性来确定服务器返回的文件句柄类型。

4.2.1. General Properties of a Filehandle
4.2.1. 文件句柄的常规属性

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 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. However, it is not required that two different filehandles refer to different file system objects. Servers SHOULD try to maintain a one-to-one correspondence between filehandles and file system objects but there may be situations in which the mapping is not one-to-one. Clients MUST use filehandle comparisons only to improve performance, not for correct behavior. All clients need to be prepared for situations in which it cannot be determined whether two different filehandles denote the same object and in such cases need to avoid assuming that objects denoted are different, as this might cause incorrect behavior. Further discussion of filehandle and attribute comparison in the context of data caching is presented in Section 10.3.4.

filehandle包含服务器区分单个文件所需的所有信息。对于客户端来说,文件句柄是不透明的。客户端存储文件句柄,以便在以后的请求中使用,并且可以通过逐字节比较来比较来自同一服务器的两个文件句柄是否相等。但是,客户端不得以其他方式解释文件句柄的内容。如果来自同一服务器的两个文件句柄相等,则它们必须引用同一文件。但是,不要求两个不同的文件句柄引用不同的文件系统对象。服务器应尝试在文件句柄和文件系统对象之间保持一对一的对应关系,但可能存在映射不是一对一的情况。客户端必须使用filehandle比较来提高性能,而不是正确的行为。所有客户端都需要为无法确定两个不同的文件句柄是否表示同一个对象的情况做好准备,在这种情况下,需要避免假设表示的对象不同,因为这可能会导致错误的行为。第10.3.4节进一步讨论了数据缓存环境中的文件句柄和属性比较。

As an example, in the case that two different pathnames when traversed at the server terminate at the same file system object, the server SHOULD return the same filehandle for each path. This can occur if a hard link is used to create two filenames that refer to the same underlying file object and associated data. For example, if paths /a/b/c and /a/d/c refer to the same file, the server SHOULD return the same filehandle for both pathname traversals.

例如,如果在服务器上遍历两个不同的路径名时终止于同一文件系统对象,则服务器应为每个路径返回相同的filehandle。如果使用硬链接创建引用同一基础文件对象和关联数据的两个文件名,则可能发生这种情况。例如,如果路径/a/b/c和/a/d/c引用同一个文件,则服务器应为两个路径名遍历返回相同的文件句柄。

4.2.2. Persistent Filehandle
4.2.2. 持久文件句柄

A persistent filehandle is defined as having a fixed value for the lifetime of the file system object to which it refers. Once the server creates the filehandle for a file system object, the server MUST accept the same filehandle for the object for the lifetime of

持久化文件句柄定义为在其引用的文件系统对象的生存期内具有固定值。一旦服务器为文件系统对象创建filehandle,服务器必须在对象的生存期内接受相同的filehandle

the object. If the server restarts or reboots, the NFS server must honor the same filehandle value as it did in the server's previous instantiation. Similarly, if the file system is migrated, the new NFS server must honor the same filehandle as the old NFS server.

物体。如果服务器重新启动或重新启动,NFS服务器必须使用与服务器上一次实例化中相同的filehandle值。类似地,如果文件系统被迁移,新的NFS服务器必须与旧的NFS服务器使用相同的文件句柄。

The persistent filehandle will become stale or invalid when the file system object is removed. When the server is presented with a persistent filehandle that refers to a deleted object, it MUST return an error of NFS4ERR_STALE. A filehandle may become stale when the 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 if the file system in whole has been destroyed, or if the file system has simply been removed from the server's namespace (i.e., unmounted in a UNIX environment).

删除文件系统对象后,持久化文件句柄将变得陈旧或无效。当服务器显示引用已删除对象的持久化文件句柄时,它必须返回NFS4ERR_STALE错误。当包含对象的文件系统不再可用时,文件句柄可能会过时。如果文件系统存在于可移动介质上,而该介质在服务器上不再可用,或者整个文件系统已被破坏,或者文件系统已从服务器的命名空间中删除(即在UNIX环境中卸载),则文件系统可能不可用。

4.2.3. Volatile Filehandle
4.2.3. 易失性文件句柄

A volatile filehandle does not share the same longevity 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.

易失性文件句柄与持久性文件句柄的寿命特征不同。服务器可能会确定易失性文件句柄在许多不同的时间点不再有效。如果服务器可以确定易失性文件句柄引用已删除的对象,则服务器应将NFS4ERR_STALE返回给客户端(与持久性文件句柄的情况相同)。在所有其他情况下,如果服务器确定无法再使用易失性文件句柄,则应返回一个错误NFS4ERR\fhu expired。

The REQUIRED attribute "fh_expire_type" is used by the client to determine what type of filehandle the server is providing for a particular file system. This attribute is a bitmask with the following values:

客户端使用必需的属性“fh_expire_type”来确定服务器为特定文件系统提供的文件句柄类型。此属性是具有以下值的位掩码:

FH4_PERSISTENT: The value of FH4_PERSISTENT is used to indicate a persistent filehandle, which is valid until the object is removed from the file system. The server will not return NFS4ERR_FHEXPIRED for this filehandle. FH4_PERSISTENT is defined as a value in which none of the bits specified below are set.

FH4_PERSISTENT:FH4_PERSISTENT的值用于指示持久化文件句柄,该句柄在对象从文件系统中删除之前有效。服务器不会为此文件句柄返回NFS4ERR_fhu expired。FH4_PERSISTENT定义为未设置以下指定位的值。

FH4_VOLATILE_ANY: The filehandle may expire at any time, except as specifically excluded (i.e., FH4_NOEXPIRE_WITH_OPEN).

FH4\u VOLATILE\u ANY:文件句柄可能随时过期,除非明确排除(即FH4\u NOEXPIRE\u打开)。

FH4_NOEXPIRE_WITH_OPEN: May only be set when FH4_VOLATILE_ANY is set. If this bit is set, then the meaning of FH4_VOLATILE_ANY is qualified to exclude any expiration of the filehandle when it is open.

FH4_NOEXPIRE_WITH_OPEN:只能在设置FH4_VOLATILE_ANY时设置。如果设置了该位,则FH4_VOLATILE_ANY的含义有资格排除文件句柄打开时的任何过期。

FH4_VOL_MIGRATION: The filehandle will expire as a result of migration. If FH4_VOLATILE_ANY is set, FH4_VOL_MIGRATION is redundant.

FH4_VOL_迁移:文件句柄将因迁移而过期。如果设置了FH4_VOLATILE_ANY,则FH4_VOL_迁移是冗余的。

FH4_VOL_RENAME: The filehandle will expire during rename. This includes a rename by the requesting client or a rename by any other client. If FH4_VOLATILE_ANY is set, FH4_VOL_RENAME is redundant.

FH4_VOL_RENAME:文件句柄将在重命名期间过期。这包括请求客户端的重命名或任何其他客户端的重命名。如果设置了FH4_VOLATILE_ANY,则FH4_VOL_RENAME是冗余的。

Servers that provide volatile filehandles that may expire while open (i.e., if FH4_VOL_MIGRATION or FH4_VOL_RENAME is set or if FH4_VOLATILE_ANY is set and FH4_NOEXPIRE_WITH_OPEN is not set) should deny a RENAME or REMOVE that would affect an OPEN file of any of the components leading to the OPEN file. In addition, the server SHOULD deny all RENAME or REMOVE requests during the grace period upon server restart.

提供易失性文件句柄的服务器在打开时可能会过期(即,如果设置了FH4_VOL_MIGRATION或FH4_VOL_RENAME,或者如果设置了FH4_volatile_ANY且未设置FH4_NOEXPIRE_WITH_open),则应拒绝重命名或删除会影响导致打开文件的任何组件的打开文件。此外,在服务器重新启动的宽限期内,服务器应拒绝所有重命名或删除请求。

Note that the bits FH4_VOL_MIGRATION and FH4_VOL_RENAME allow the client to determine that expiration has occurred whenever a specific event occurs, without an explicit filehandle expiration error from the server. FH4_VOLATILE_ANY does not provide this form of information. In situations where the server will expire many, but not all, filehandles upon migration (e.g., all but those that are open), FH4_VOLATILE_ANY (in this case, with FH4_NOEXPIRE_WITH_OPEN) is a better choice since the client may not assume that all filehandles will expire when migration occurs, and it is likely that additional expirations will occur (as a result of file CLOSE) that are separated in time from the migration event itself.

请注意,位FH4_VOL_MIGRATION和FH4_VOL_RENAME允许客户机在发生特定事件时确定是否已发生过期,而不会出现来自服务器的显式filehandle过期错误。FH4\u VOLATILE\u ANY不提供这种形式的信息。在服务器在迁移时会使许多但不是所有文件句柄过期的情况下(例如,除了那些打开的文件句柄以外的所有文件句柄),FH4_VOLATILE_ANY(在这种情况下,使用FH4_NOEXPIRE_和_open)是一个更好的选择,因为客户端可能不会假设在迁移发生时所有文件句柄都会过期,而且,很可能会发生与迁移事件本身在时间上分离的其他过期(由于文件关闭)。

4.2.4. One Method of Constructing a Volatile Filehandle
4.2.4. 构造易失性文件句柄的一种方法

A volatile filehandle, while opaque to the client, could contain:

易失性文件句柄虽然对客户端不透明,但可能包含:

[volatile bit = 1 | server boot time | slot | generation number]

[volatile bit=1 |服务器启动时间|插槽|代数]

o slot is an index in the server volatile filehandle table

o slot是服务器volatile filehandle表中的索引

o generation number is the generation number for the table entry/slot

o generation number是表项/插槽的生成编号

When the client presents a volatile filehandle, the server makes the following checks, which assume that the check for the volatile bit has passed. If the server boot time is less than the current server boot time, return NFS4ERR_FHEXPIRED. If slot is out of range, return NFS4ERR_BADHANDLE. If the generation number does not match, return NFS4ERR_FHEXPIRED.

当客户机呈现易失性文件句柄时,服务器进行以下检查,假设已通过对易失性位的检查。如果服务器引导时间小于当前服务器引导时间,则返回NFS4ERR\fhu expired。如果插槽超出范围,则返回NFS4ERR_BADHANDLE。如果生成编号不匹配,则返回NFS4ERR\fhu expired。

When the server reboots, the table is gone (it is volatile).

当服务器重新启动时,表就不存在了(它是不稳定的)。

If the volatile bit is 0, then it is a persistent filehandle with a different structure following it.

如果volatile位为0,则它是一个具有不同结构的持久文件句柄。

4.3. Client Recovery from Filehandle Expiration
4.3. 从文件句柄过期恢复客户端

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.

如果可能,客户端应在收到NFS4ERR\fhu过期错误后恢复。客户机必须承担额外的责任,以便做好准备,从易失性文件句柄过期时恢复。如果服务器返回持久化文件句柄,则客户端不需要这些附加步骤。

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 namespace that is still available or by starting at the root of the server's file system namespace.

对于易失性文件句柄,最常见的情况是,客户机需要存储指向并包括所讨论的文件系统对象的组件名称。有了这些名称,客户端应该能够通过在名称空间中找到仍然可用的文件句柄或从服务器文件系统名称空间的根开始进行恢复。

If the expired filehandle refers to an object that has been removed from the file system, obviously the client will not be able to recover from the expired filehandle.

如果过期的filehandle引用了已从文件系统中删除的对象,则客户端显然无法从过期的filehandle中恢复。

It is also possible that the expired filehandle refers to a file that has been renamed. If the file was renamed by another client, again it is possible that the original client will not be able to recover. However, in the case that the client itself is renaming the file and the file is open, it is possible that the client may be able to recover. The client can determine the new pathname based on the processing of the rename request. The client can then regenerate the new filehandle based on the new pathname. The client could also use the COMPOUND operation mechanism to construct a set of operations like:

过期的文件句柄也可能引用已重命名的文件。如果文件被另一个客户端重命名,则原始客户端也可能无法恢复。但是,如果客户机本身正在重命名文件并且文件已打开,则客户机可能能够恢复。客户端可以根据重命名请求的处理来确定新的路径名。然后,客户端可以基于新路径名重新生成新的文件句柄。客户端还可以使用复合操作机制构建一组操作,如:

RENAME A B LOOKUP B GETFH

重命名A B查找B GETFH

Note that the COMPOUND procedure does not provide atomicity. This example only reduces the overhead of recovering from an expired filehandle.

注意,复合过程不提供原子性。此示例仅减少了从过期文件句柄恢复的开销。

5. Attributes
5. 属性

To meet the requirements of extensibility and increased interoperability with non-UNIX platforms, attributes need to be handled in a flexible manner. The NFSv3 fattr3 structure contains a fixed list of attributes that not all clients and servers are able to

为了满足可扩展性和与非UNIX平台增强的互操作性的要求,需要以灵活的方式处理属性。NFSv3 fattr3结构包含一个固定的属性列表,并非所有客户机和服务器都能够这样做

support or care about. The fattr3 structure cannot be extended as new needs arise, and it provides no way to indicate non-support. With the NFSv4.0 protocol, the client is able to query what attributes the server supports and construct requests with only those supported attributes (or a subset thereof).

支持或关心。fattr3结构不能随着新需求的出现而扩展,也无法表示不支持。使用NFSv4.0协议,客户机能够查询服务器支持哪些属性,并仅使用这些支持的属性(或其子集)构造请求。

To this end, attributes are divided into three groups: REQUIRED, RECOMMENDED, and named. Both REQUIRED and RECOMMENDED attributes are supported in the NFSv4.0 protocol by a specific and well-defined encoding and are identified by number. They are requested by setting a bit in the bit vector sent in the GETATTR request; the server response includes a bit vector to list what attributes were returned in the response. New REQUIRED or RECOMMENDED attributes may be added to the NFSv4 protocol as part of a new minor version by publishing a Standards Track RFC that allocates a new attribute number value and defines the encoding for the attribute. See Section 11 for further discussion.

为此,属性分为三组:必需、推荐和命名。NFSv4.0协议中通过特定和定义良好的编码支持必需属性和推荐属性,并通过数字标识。通过在GETATTR请求中发送的位向量中设置位来请求它们;服务器响应包含一个位向量,用于列出响应中返回的属性。通过发布分配新属性编号值并定义属性编码的标准跟踪RFC,可以将新的必需或推荐属性作为新次要版本的一部分添加到NFSv4协议中。进一步讨论见第11节。

Named attributes are accessed by the OPENATTR operation, which accesses a hidden directory of attributes associated with a file system object. OPENATTR takes a filehandle for the object and returns the filehandle for the attribute hierarchy. The filehandle for the named attributes is a directory object accessible by LOOKUP or READDIR and contains files whose names represent the named attributes and whose data bytes are the value of the attribute. For example:

命名属性由OPENATTR操作访问,该操作访问与文件系统对象关联的属性的隐藏目录。OPENATTR获取对象的文件句柄,并返回属性层次结构的文件句柄。命名属性的filehandle是可由LOOKUP或READDIR访问的目录对象,包含名称表示命名属性且数据字节为属性值的文件。例如:

        +----------+-----------+---------------------------------+
        | LOOKUP   | "foo"     | ; look up file                  |
        | GETATTR  | attrbits  |                                 |
        | OPENATTR |           | ; access foo's named attributes |
        | LOOKUP   | "x11icon" | ; look up specific attribute    |
        | READ     | 0,4096    | ; read stream of bytes          |
        +----------+-----------+---------------------------------+
        
        +----------+-----------+---------------------------------+
        | LOOKUP   | "foo"     | ; look up file                  |
        | GETATTR  | attrbits  |                                 |
        | OPENATTR |           | ; access foo's named attributes |
        | LOOKUP   | "x11icon" | ; look up specific attribute    |
        | READ     | 0,4096    | ; read stream of bytes          |
        +----------+-----------+---------------------------------+
        

Named attributes are intended for data needed by applications rather than by an NFS client implementation. NFS implementers are strongly encouraged to define their new attributes as RECOMMENDED attributes by bringing them to the IETF Standards Track process.

命名属性用于应用程序而不是NFS客户端实现所需的数据。强烈鼓励NFS实现者通过将其引入IETF标准跟踪过程,将其新属性定义为推荐属性。

The set of attributes that are classified as REQUIRED is deliberately small since servers need to do whatever it takes to support them. A server should support as many of the RECOMMENDED attributes as possible; however, by their definition, the server is not required to support all of them. Attributes are deemed REQUIRED 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 provided on the server.

由于服务器需要尽一切努力来支持这些属性,因此被分类为必需的属性集故意很小。服务器应该支持尽可能多的推荐属性;但是,根据它们的定义,并不要求服务器支持所有这些功能。如果大量客户机都需要这些数据,并且当服务器上没有提供支持时,客户机无法合理地计算这些数据,则认为这些属性是必需的。

Note that the hidden directory returned by OPENATTR is a convenience for protocol processing. The client should not make any assumptions about the server's implementation of named attributes and whether or not the underlying file system at the server has a named attribute directory. Therefore, operations such as SETATTR and GETATTR on the named attribute directory are undefined.

请注意,OPENATTR返回的隐藏目录便于协议处理。客户机不应该对服务器的命名属性实现以及服务器上的底层文件系统是否具有命名属性目录做出任何假设。因此,命名属性目录上的SETATTR和GETATTR等操作是未定义的。

5.1. REQUIRED Attributes
5.1. 必需属性

These attributes MUST be supported by every NFSv4.0 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 REQUIRED attributes, some client functionality can be impaired or limited in some ways. A client can ask for any of these attributes to be returned by setting a bit in the GETATTR request. For each such bit set, the server MUST return the corresponding attribute value.

每个NFSv4.0客户端和服务器都必须支持这些属性,以确保最低级别的互操作性。服务器必须存储并返回这些属性,客户机必须能够使用限制于这些属性的属性集运行。仅使用所需的属性,某些客户端功能可能会在某些方面受到损害或限制。客户机可以通过在GETATTR请求中设置一个位来请求返回这些属性中的任何一个。对于每个这样的位集,服务器必须返回相应的属性值。

5.2. RECOMMENDED Attributes
5.2. 推荐属性

These attributes are understood well enough to warrant support in the NFSv4.0 protocol. However, they may not be supported on all clients and servers. A client MAY ask for any of these attributes to be returned by setting a bit in the GETATTR request but MUST handle the case where the server does not return them. A client MAY ask for the set of attributes the server supports and SHOULD NOT request attributes the server does not support. A server should be tolerant of requests for unsupported attributes and simply not return them, rather than considering the request an error. It is expected that servers will support all attributes they comfortably can and only fail to support attributes that are difficult to support in their operating environments. A server should provide attributes whenever they don't have to "tell lies" to the client. For example, a file modification time either should be an accurate time or should not be supported by the server. At times this will be difficult for clients, but a client is better positioned to decide whether and how to fabricate or construct an attribute or whether to do without the attribute.

对这些属性的理解足以保证NFSv4.0协议中的支持。但是,并非所有客户端和服务器都支持它们。客户机可以通过在GETATTR请求中设置一个位来请求返回这些属性中的任何一个,但必须处理服务器不返回这些属性的情况。客户端可能要求服务器支持的属性集,但不应要求服务器不支持的属性集。服务器应该容忍对不受支持的属性的请求,并且不返回它们,而不是将请求视为错误。预计服务器将支持其能够轻松支持的所有属性,并且只支持在其操作环境中难以支持的属性。只要服务器不必向客户端“撒谎”,就应该提供属性。例如,文件修改时间应该是准确的时间,或者服务器不支持。有时,这对客户机来说很困难,但客户机可以更好地决定是否以及如何制作或构造属性,或者是否不使用属性。

5.3. Named Attributes
5.3. 命名属性

These attributes are not supported by direct encoding in the NFSv4 protocol but are accessed by string names rather than numbers and correspond to an uninterpreted stream of bytes that are stored with the file system object. The namespace for these attributes may be accessed by using the OPENATTR operation. The OPENATTR operation returns a filehandle for a virtual "named attribute directory", and

NFSv4协议中的直接编码不支持这些属性,但可以通过字符串名称而不是数字来访问这些属性,并对应于与文件系统对象一起存储的未解释的字节流。可以使用OPENATTR操作访问这些属性的名称空间。OPENATTR操作返回虚拟“命名属性目录”的文件句柄,然后

further perusal and modification of the namespace may be done using operations that work on more typical directories. In particular, READDIR may be used to get a list of such named attributes, and LOOKUP and OPEN may select a particular attribute. Creation of a new named attribute may be the result of an OPEN specifying file creation.

可以使用在更典型的目录上工作的操作来进一步阅读和修改名称空间。具体而言,READDIR可用于获取此类命名属性的列表,而LOOKUP和OPEN可选择特定属性。新命名属性的创建可能是打开指定文件创建的结果。

Once an OPEN is done, named attributes may be examined and changed by normal READ and WRITE operations using the filehandles and stateids returned by OPEN.

一旦打开完成,命名属性就可以通过使用OPEN返回的filehandles和stateID的正常读写操作进行检查和更改。

Named attributes and the named attribute directory may have their own (non-named) attributes. Each of these objects must have all of the REQUIRED attributes and may have additional RECOMMENDED attributes. However, the set of attributes for named attributes and the named attribute directory need not be, and typically will not be, as large as that for other objects in that file system.

命名属性和命名属性目录可能有自己的(非命名)属性。这些对象中的每一个都必须具有所有必需的属性,并且可能具有其他建议的属性。但是,命名属性和命名属性目录的属性集不需要也通常不会像该文件系统中其他对象的属性集那样大。

Named attributes might be the target of delegations. However, since granting of delegations is at the server's discretion, a server need not support delegations on named attributes.

命名属性可能是委派的目标。但是,由于委派的授予由服务器自行决定,因此服务器不需要支持命名属性上的委派。

It is RECOMMENDED that servers support arbitrary named attributes. A client should not depend on the ability to store any named attributes in the server's file system. If a server does support named attributes, a client that is also able to handle them should be able to copy a file's data and metadata 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.

建议服务器支持任意命名属性。客户端不应依赖于在服务器的文件系统中存储任何命名属性的能力。如果服务器确实支持命名属性,那么能够处理这些属性的客户端应该能够完全透明地将文件的数据和元数据从一个位置复制到另一个位置;这意味着常规目录项允许的名称对于命名属性名称也是有效的。

In NFSv4.0, the structure of named attribute directories is restricted in a number of ways, in order to prevent the development of non-interoperable implementations in which some servers support a fully general hierarchical directory structure for named attributes while others support a limited but adequate structure for named attributes. In such an environment, clients or applications might come to depend on non-portable extensions. The restrictions are:

在NFSv4.0中,命名属性目录的结构以多种方式受到限制,以防止开发不可互操作的实现,其中一些服务器支持命名属性的完全通用层次目录结构,而另一些服务器支持有限但适当的命名属性结构。在这样的环境中,客户端或应用程序可能会依赖于不可移植的扩展。这些限制包括:

o CREATE is not allowed in a named attribute directory. Thus, such objects as symbolic links and special files are not allowed to be named attributes. Further, directories may not be created in a named attribute directory, so no hierarchical structure of named attributes for a single object is allowed.

o 不允许在命名属性目录中创建。因此,诸如符号链接和特殊文件之类的对象不允许被命名为属性。此外,可能无法在命名属性目录中创建目录,因此不允许单个对象的命名属性的层次结构。

o If OPENATTR is done on a named attribute directory or on a named attribute, the server MUST return an error.

o 如果在命名属性目录或命名属性上执行OPENATTR,则服务器必须返回错误。

o Doing a RENAME of a named attribute to a different named attribute directory or to an ordinary (i.e., non-named-attribute) directory is not allowed.

o 不允许将命名属性重命名为其他命名属性目录或普通(即非命名属性)目录。

o Creating hard links between named attribute directories or between named attribute directories and ordinary directories is not allowed.

o 不允许在命名属性目录之间或命名属性目录与普通目录之间创建硬链接。

Names of attributes will not be controlled by this document or other IETF Standards Track documents. See Section 20 for further discussion.

属性名称不受本文件或其他IETF标准跟踪文件的控制。进一步讨论见第20节。

5.4. Classification of Attributes
5.4. 属性分类

Each of the attributes accessed using SETATTR and GETATTR (i.e., REQUIRED and RECOMMENDED attributes) can be classified in one of three categories:

使用SETATTR和GETATTR访问的每个属性(即必需和推荐属性)可分为三类:

1. per-server attributes for which the value of the attribute will be the same for all file objects that share the same server.

1. 对于共享同一服务器的所有文件对象,其属性值将相同的每服务器属性。

2. per-file system attributes for which the value of the attribute will be the same for some or all file objects that share the same server and fsid attribute (Section 5.8.1.9). See below for details regarding when such sharing is in effect.

2. 对于共享相同服务器和fsid属性的某些或所有文件对象,每个文件系统属性的属性值将相同(第5.8.1.9节)。有关此类共享何时生效的详细信息,请参见下文。

3. per-file system object attributes.

3. 每个文件系统对象属性。

The handling of per-file system attributes depends on the particular attribute and the setting of the homogeneous (Section 5.8.2.12) attribute. The following rules apply:

每个文件系统属性的处理取决于特定属性和同质(第5.8.2.12节)属性的设置。以下规则适用:

1. The values of the attributes supported_attrs, fsid, homogeneous, link_support, and symlink_support are always common to all objects within the given file system.

1. 支持的属性值\u attrs、fsid、齐次、链接\u支持和符号链接\u支持对于给定文件系统中的所有对象始终是通用的。

2. For other attributes, different values may be returned for different file system objects if the attribute homogeneous is supported within the file system in question and has the value false.

2. 对于其他属性,如果所讨论的文件系统中支持同构属性且其值为false,则可能会为不同的文件系统对象返回不同的值。

The classification of attributes is as follows. Note that the attributes time_access_set and time_modify_set are not listed in this section, because they are write-only attributes corresponding to time_access and time_modify and are used in a special instance of SETATTR.

属性的分类如下。请注意,属性time_access_set和time_modify_set未在本节中列出,因为它们是与time_access和time_modify相对应的仅写属性,并在SETATTR的特殊实例中使用。

o The per-server attribute is:

o 每服务器属性为:

lease_time

租赁时间

o The per-file system attributes are:

o 每个文件系统的属性包括:

supported_attrs, fh_expire_type, link_support, symlink_support, unique_handles, aclsupport, cansettime, case_insensitive, case_preserving, chown_restricted, files_avail, files_free, files_total, fs_locations, homogeneous, maxfilesize, maxname, maxread, maxwrite, no_trunc, space_avail, space_free, space_total, and time_delta

受支持的属性、fh过期类型、链接支持、符号链接支持、唯一句柄、aclsupport、cansettime、不区分大小写、保留大小写、chown限制、文件可用、文件可用、文件总数、fs位置、同构、maxfilesize、maxname、maxread、maxwrite、no-trunc、空格可用、空格可用、空格总数和时间增量

o The per-file system object attributes are:

o 每个文件系统对象属性包括:

type, change, size, named_attr, fsid, rdattr_error, filehandle, acl, archive, fileid, hidden, maxlink, mimetype, mode, numlinks, owner, owner_group, rawdev, space_used, system, time_access, time_backup, time_create, time_metadata, time_modify, and mounted_on_fileid

类型、更改、大小、命名属性、fsid、rdattr错误、文件句柄、acl、存档、文件ID、隐藏、maxlink、mimetype、模式、numlinks、所有者、所有者组、rawdev、使用的空间、系统、时间访问、时间备份、时间创建、时间元数据、时间修改和在文件ID上装载

For quota_avail_hard, quota_avail_soft, and quota_used, see their definitions below for the appropriate classification.

有关配额\可用\硬、配额\可用\软和使用的配额\的定义,请参见下面的相应分类。

5.5. Set-Only and Get-Only Attributes
5.5. 仅设置和仅获取属性

Some REQUIRED and RECOMMENDED attributes are set-only; i.e., they can be set via SETATTR but not retrieved via GETATTR. Similarly, some REQUIRED and RECOMMENDED attributes are get-only; i.e., they can be retrieved via GETATTR but not set via SETATTR. If a client attempts to set a get-only attribute or get a set-only attribute, the server MUST return NFS4ERR_INVAL.

仅设置了一些必需和推荐的属性;i、 例如,它们可以通过SETATTR设置,但不能通过GETATTR检索。类似地,一些必需的和推荐的属性是get only;i、 例如,它们可以通过GETATTR检索,但不能通过SETATTR设置。如果客户端试图设置get only属性或get only属性,则服务器必须返回NFS4ERR_INVAL。

5.6. REQUIRED Attributes - List and Definition References
5.6. 所需属性-列表和定义参考

The list of REQUIRED attributes appears in Table 3. The meanings of the columns of the table are:

所需属性列表如表3所示。表中各列的含义如下:

o Name: The name of the attribute.

o 名称:属性的名称。

o ID: The number assigned to the attribute. In the event of conflicts between the assigned number and [RFC7531], the latter is authoritative, but in such an event, it should be resolved with errata to this document and/or [RFC7531]. See [IESG_ERRATA] for the errata process.

o ID:分配给属性的编号。如果分配的编号与[RFC7531]之间存在冲突,后者具有权威性,但在这种情况下,应使用本文件和/或[RFC7531]的勘误表予以解决。有关勘误表流程,请参见[IESG_勘误表]。

o Data Type: The XDR data type of the attribute.

o 数据类型:属性的XDR数据类型。

o Acc: Access allowed to the attribute. R means read-only (GETATTR may retrieve, SETATTR may not set). W means write-only (SETATTR may set, GETATTR may not retrieve). R W means read/write (GETATTR may retrieve, SETATTR may set).

o Acc:允许访问该属性。R表示只读(GETATTR可以检索,SETATTR可以不设置)。W表示仅写(SETATTR可以设置,GETATTR不能检索)。RW表示读/写(GETATTR可以检索,SETATTR可以设置)。

o Defined in: The section of this specification that describes the attribute.

o 定义于:本规范中描述属性的部分。

      +-----------------+----+------------+-----+-------------------+
      | Name            | ID | Data Type  | Acc | Defined in        |
      +-----------------+----+------------+-----+-------------------+
      | supported_attrs | 0  | bitmap4    | R   | Section 5.8.1.1   |
      | type            | 1  | nfs_ftype4 | R   | Section 5.8.1.2   |
      | fh_expire_type  | 2  | uint32_t   | R   | Section 5.8.1.3   |
      | change          | 3  | changeid4  | R   | Section 5.8.1.4   |
      | size            | 4  | uint64_t   | R W | Section 5.8.1.5   |
      | link_support    | 5  | bool       | R   | Section 5.8.1.6   |
      | symlink_support | 6  | bool       | R   | Section 5.8.1.7   |
      | named_attr      | 7  | bool       | R   | Section 5.8.1.8   |
      | fsid            | 8  | fsid4      | R   | Section 5.8.1.9   |
      | unique_handles  | 9  | bool       | R   | Section 5.8.1.10  |
      | lease_time      | 10 | nfs_lease4 | R   | Section 5.8.1.11  |
      | rdattr_error    | 11 | nfsstat4   | R   | Section 5.8.1.12  |
      | filehandle      | 19 | nfs_fh4    | R   | Section 5.8.1.13  |
      +-----------------+----+------------+-----+-------------------+
        
      +-----------------+----+------------+-----+-------------------+
      | Name            | ID | Data Type  | Acc | Defined in        |
      +-----------------+----+------------+-----+-------------------+
      | supported_attrs | 0  | bitmap4    | R   | Section 5.8.1.1   |
      | type            | 1  | nfs_ftype4 | R   | Section 5.8.1.2   |
      | fh_expire_type  | 2  | uint32_t   | R   | Section 5.8.1.3   |
      | change          | 3  | changeid4  | R   | Section 5.8.1.4   |
      | size            | 4  | uint64_t   | R W | Section 5.8.1.5   |
      | link_support    | 5  | bool       | R   | Section 5.8.1.6   |
      | symlink_support | 6  | bool       | R   | Section 5.8.1.7   |
      | named_attr      | 7  | bool       | R   | Section 5.8.1.8   |
      | fsid            | 8  | fsid4      | R   | Section 5.8.1.9   |
      | unique_handles  | 9  | bool       | R   | Section 5.8.1.10  |
      | lease_time      | 10 | nfs_lease4 | R   | Section 5.8.1.11  |
      | rdattr_error    | 11 | nfsstat4   | R   | Section 5.8.1.12  |
      | filehandle      | 19 | nfs_fh4    | R   | Section 5.8.1.13  |
      +-----------------+----+------------+-----+-------------------+
        

Table 3: REQUIRED Attributes

表3:所需属性

5.7. RECOMMENDED Attributes - List and Definition References
5.7. 推荐属性-列表和定义参考

The RECOMMENDED attributes are defined in Table 4. The meanings of the column headers are the same as Table 3; see Section 5.6 for the meanings.

表4中定义了推荐的属性。列标题的含义与表3相同;含义见第5.6节。

   +-------------------+----+-----------------+-----+------------------+
   | Name              | ID | Data Type       | Acc | Defined in       |
   +-------------------+----+-----------------+-----+------------------+
   | acl               | 12 | nfsace4<>       | R W | Section 6.2.1    |
   | aclsupport        | 13 | uint32_t        | R   | Section 6.2.1.2  |
   | archive           | 14 | bool            | R W | Section 5.8.2.1  |
   | cansettime        | 15 | bool            | R   | Section 5.8.2.2  |
   | case_insensitive  | 16 | bool            | R   | Section 5.8.2.3  |
   | case_preserving   | 17 | bool            | R   | Section 5.8.2.4  |
   | chown_restricted  | 18 | bool            | R   | Section 5.8.2.5  |
   | fileid            | 20 | uint64_t        | R   | Section 5.8.2.6  |
   | files_avail       | 21 | uint64_t        | R   | Section 5.8.2.7  |
   | files_free        | 22 | uint64_t        | R   | Section 5.8.2.8  |
   | files_total       | 23 | uint64_t        | R   | Section 5.8.2.9  |
        
   +-------------------+----+-----------------+-----+------------------+
   | Name              | ID | Data Type       | Acc | Defined in       |
   +-------------------+----+-----------------+-----+------------------+
   | acl               | 12 | nfsace4<>       | R W | Section 6.2.1    |
   | aclsupport        | 13 | uint32_t        | R   | Section 6.2.1.2  |
   | archive           | 14 | bool            | R W | Section 5.8.2.1  |
   | cansettime        | 15 | bool            | R   | Section 5.8.2.2  |
   | case_insensitive  | 16 | bool            | R   | Section 5.8.2.3  |
   | case_preserving   | 17 | bool            | R   | Section 5.8.2.4  |
   | chown_restricted  | 18 | bool            | R   | Section 5.8.2.5  |
   | fileid            | 20 | uint64_t        | R   | Section 5.8.2.6  |
   | files_avail       | 21 | uint64_t        | R   | Section 5.8.2.7  |
   | files_free        | 22 | uint64_t        | R   | Section 5.8.2.8  |
   | files_total       | 23 | uint64_t        | R   | Section 5.8.2.9  |
        
   | fs_locations      | 24 | fs_locations4   | R   | Section 5.8.2.10 |
   | hidden            | 25 | bool            | R W | Section 5.8.2.11 |
   | homogeneous       | 26 | bool            | R   | Section 5.8.2.12 |
   | maxfilesize       | 27 | uint64_t        | R   | Section 5.8.2.13 |
   | maxlink           | 28 | uint32_t        | R   | Section 5.8.2.14 |
   | maxname           | 29 | uint32_t        | R   | Section 5.8.2.15 |
   | maxread           | 30 | uint64_t        | R   | Section 5.8.2.16 |
   | maxwrite          | 31 | uint64_t        | R   | Section 5.8.2.17 |
   | mimetype          | 32 | ascii_          | R W | Section 5.8.2.18 |
   |                   |    |   REQUIRED4<>   |     |                  |
   | mode              | 33 | mode4           | R W | Section 6.2.2    |
   | mounted_on_fileid | 55 | uint64_t        | R   | Section 5.8.2.19 |
   | no_trunc          | 34 | bool            | R   | Section 5.8.2.20 |
   | numlinks          | 35 | uint32_t        | R   | Section 5.8.2.21 |
   | owner             | 36 | utf8str_mixed   | R W | Section 5.8.2.22 |
   | owner_group       | 37 | utf8str_mixed   | R W | Section 5.8.2.23 |
   | quota_avail_hard  | 38 | uint64_t        | R   | Section 5.8.2.24 |
   | quota_avail_soft  | 39 | uint64_t        | R   | Section 5.8.2.25 |
   | quota_used        | 40 | uint64_t        | R   | Section 5.8.2.26 |
   | rawdev            | 41 | specdata4       | R   | Section 5.8.2.27 |
   | space_avail       | 42 | uint64_t        | R   | Section 5.8.2.28 |
   | space_free        | 43 | uint64_t        | R   | Section 5.8.2.29 |
   | space_total       | 44 | uint64_t        | R   | Section 5.8.2.30 |
   | space_used        | 45 | uint64_t        | R   | Section 5.8.2.31 |
   | system            | 46 | bool            | R W | Section 5.8.2.32 |
   | time_access       | 47 | nfstime4        | R   | Section 5.8.2.33 |
   | time_access_set   | 48 | settime4        | W   | Section 5.8.2.34 |
   | time_backup       | 49 | nfstime4        | R W | Section 5.8.2.35 |
   | time_create       | 50 | nfstime4        | R W | Section 5.8.2.36 |
   | time_delta        | 51 | nfstime4        | R   | Section 5.8.2.37 |
   | time_metadata     | 52 | nfstime4        | R   | Section 5.8.2.38 |
   | time_modify       | 53 | nfstime4        | R   | Section 5.8.2.39 |
   | time_modify_set   | 54 | settime4        | W   | Section 5.8.2.40 |
   +-------------------+----+-----------------+-----+------------------+
        
   | fs_locations      | 24 | fs_locations4   | R   | Section 5.8.2.10 |
   | hidden            | 25 | bool            | R W | Section 5.8.2.11 |
   | homogeneous       | 26 | bool            | R   | Section 5.8.2.12 |
   | maxfilesize       | 27 | uint64_t        | R   | Section 5.8.2.13 |
   | maxlink           | 28 | uint32_t        | R   | Section 5.8.2.14 |
   | maxname           | 29 | uint32_t        | R   | Section 5.8.2.15 |
   | maxread           | 30 | uint64_t        | R   | Section 5.8.2.16 |
   | maxwrite          | 31 | uint64_t        | R   | Section 5.8.2.17 |
   | mimetype          | 32 | ascii_          | R W | Section 5.8.2.18 |
   |                   |    |   REQUIRED4<>   |     |                  |
   | mode              | 33 | mode4           | R W | Section 6.2.2    |
   | mounted_on_fileid | 55 | uint64_t        | R   | Section 5.8.2.19 |
   | no_trunc          | 34 | bool            | R   | Section 5.8.2.20 |
   | numlinks          | 35 | uint32_t        | R   | Section 5.8.2.21 |
   | owner             | 36 | utf8str_mixed   | R W | Section 5.8.2.22 |
   | owner_group       | 37 | utf8str_mixed   | R W | Section 5.8.2.23 |
   | quota_avail_hard  | 38 | uint64_t        | R   | Section 5.8.2.24 |
   | quota_avail_soft  | 39 | uint64_t        | R   | Section 5.8.2.25 |
   | quota_used        | 40 | uint64_t        | R   | Section 5.8.2.26 |
   | rawdev            | 41 | specdata4       | R   | Section 5.8.2.27 |
   | space_avail       | 42 | uint64_t        | R   | Section 5.8.2.28 |
   | space_free        | 43 | uint64_t        | R   | Section 5.8.2.29 |
   | space_total       | 44 | uint64_t        | R   | Section 5.8.2.30 |
   | space_used        | 45 | uint64_t        | R   | Section 5.8.2.31 |
   | system            | 46 | bool            | R W | Section 5.8.2.32 |
   | time_access       | 47 | nfstime4        | R   | Section 5.8.2.33 |
   | time_access_set   | 48 | settime4        | W   | Section 5.8.2.34 |
   | time_backup       | 49 | nfstime4        | R W | Section 5.8.2.35 |
   | time_create       | 50 | nfstime4        | R W | Section 5.8.2.36 |
   | time_delta        | 51 | nfstime4        | R   | Section 5.8.2.37 |
   | time_metadata     | 52 | nfstime4        | R   | Section 5.8.2.38 |
   | time_modify       | 53 | nfstime4        | R   | Section 5.8.2.39 |
   | time_modify_set   | 54 | settime4        | W   | Section 5.8.2.40 |
   +-------------------+----+-----------------+-----+------------------+
        

Table 4: RECOMMENDED Attributes

表4:建议属性

5.8. Attribute Definitions
5.8. 属性定义
5.8.1. Definitions of REQUIRED Attributes
5.8.1. 所需属性的定义
5.8.1.1. Attribute 0: supported_attrs
5.8.1.1. 属性0:受支持的属性

The bit vector that would retrieve all REQUIRED and RECOMMENDED attributes that are supported for this object. The scope of this attribute applies to all objects with a matching fsid.

将检索此对象支持的所有必需和推荐属性的位向量。此属性的范围适用于具有匹配fsid的所有对象。

5.8.1.2. Attribute 1: type
5.8.1.2. 属性1:类型

Designates the type of an object in terms of one of a number of special constants:

根据许多特殊常数中的一个指定对象的类型:

o NF4REG designates a regular file.

o NF4REG指定一个常规文件。

o NF4DIR designates a directory.

o NF4DIR指定一个目录。

o NF4BLK designates a block device special file.

o NF4BLK指定块设备专用文件。

o NF4CHR designates a character device special file.

o NF4CHR指定字符设备专用文件。

o NF4LNK designates a symbolic link.

o NF4LNK指定符号链接。

o NF4SOCK designates a named socket special file.

o NF4SOCK指定一个命名套接字特殊文件。

o NF4FIFO designates a fifo special file.

o NF4FIFO指定一个fifo特殊文件。

o NF4ATTRDIR designates a named attribute directory.

o NF4ATTRDIR指定一个命名的属性目录。

o NF4NAMEDATTR designates a named attribute.

o NF4NAMEDATTR指定一个命名属性。

Within the explanatory text and operation descriptions, the following phrases will be used with the meanings given below:

在解释性文本和操作说明中,将使用以下短语,其含义如下:

o The phrase "is a directory" means that the object's type attribute is NF4DIR or NF4ATTRDIR.

o 短语“is a directory”表示对象的type属性是NF4DIR或NF4ATTRDIR。

o The phrase "is a special file" means that the object's type attribute is NF4BLK, NF4CHR, NF4SOCK, or NF4FIFO.

o 短语“是一个特殊文件”表示对象的type属性是NF4BLK、NF4CHR、NF4SOCK或NF4FIFO。

o The phrase "is a regular file" means that the object's type attribute is NF4REG or NF4NAMEDATTR.

o 短语“是常规文件”表示对象的type属性是NF4REG或NF4NAMEDATTR。

o The phrase "is a symbolic link" means that the object's type attribute is NF4LNK.

o 短语“是符号链接”表示对象的type属性是NF4LNK。

5.8.1.3. Attribute 2: fh_expire_type
5.8.1.3. 属性2:fh\u过期\u类型

The server uses this to specify filehandle expiration behavior to the client. See Section 4 for additional description.

服务器使用此选项为客户端指定文件句柄过期行为。更多说明见第4节。

5.8.1.4. Attribute 3: change
5.8.1.4. 属性3:变化

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_metadata attribute for this attribute's value but only if the file system object cannot be updated more frequently than the resolution of time_metadata.

由服务器创建的值,客户端可使用该值确定对象的文件数据、目录内容或属性是否已修改。服务器可以为该属性的值返回对象的time_元数据属性,但仅当文件系统对象的更新频率不能超过time_元数据的解析频率时。

5.8.1.5. Attribute 4: size
5.8.1.5. 属性4:大小

The size of the object in bytes.

对象的大小(以字节为单位)。

5.8.1.6. Attribute 5: link_support
5.8.1.6. 属性5:链接支持

TRUE, if the object's file system supports hard links.

如果对象的文件系统支持硬链接,则为TRUE。

5.8.1.7. Attribute 6: symlink_support
5.8.1.7. 属性6:符号链接\u支持

TRUE, if the object's file system supports symbolic links.

如果对象的文件系统支持符号链接,则为TRUE。

5.8.1.8. Attribute 7: named_attr
5.8.1.8. 属性7:命名属性

TRUE, if this object has named attributes. In other words, this object has a non-empty named attribute directory.

如果此对象具有命名属性,则为TRUE。换句话说,这个对象有一个非空的命名属性目录。

5.8.1.9. Attribute 8: fsid
5.8.1.9. 属性8:fsid

Unique file system identifier for the file system holding this object. The fsid attribute has major and minor components, each of which are of data type uint64_t.

保存此对象的文件系统的唯一文件系统标识符。fsid属性有主要和次要组件,每个组件都是数据类型uint64\u t。

5.8.1.10. Attribute 9: unique_handles
5.8.1.10. 属性9:唯一的_句柄

TRUE, if two distinct filehandles are guaranteed to refer to two different file system objects.

如果保证两个不同的文件句柄引用两个不同的文件系统对象,则为TRUE。

5.8.1.11. Attribute 10: lease_time
5.8.1.11. 属性10:租赁时间

Duration of the lease at the server in seconds.

服务器上租约的持续时间(秒)。

5.8.1.12. Attribute 11: rdattr_error
5.8.1.12. 属性11:rdattr_错误

Error returned from an attempt to retrieve attributes during a READDIR operation.

在READDIR操作期间尝试检索属性时返回错误。

5.8.1.13. Attribute 19: filehandle
5.8.1.13. 属性19:文件句柄

The filehandle of this object (primarily for READDIR requests).

此对象的文件句柄(主要用于READDIR请求)。

5.8.2. Definitions of Uncategorized RECOMMENDED Attributes
5.8.2. 未分类的推荐属性的定义

The definitions of most of the RECOMMENDED attributes follow. Collections that share a common category are defined in other sections.

大多数推荐属性的定义如下。共享公共类别的集合在其他部分中定义。

5.8.2.1. Attribute 14: archive
5.8.2.1. 属性14:存档

TRUE, if this file has been archived since the time of the last modification (deprecated in favor of time_backup).

如果此文件自上次修改后已存档(不推荐使用time\u备份),则为TRUE。

5.8.2.2. Attribute 15: cansettime
5.8.2.2. 属性15:cansettime

TRUE, if the server is able to change the times for a file system object as specified in a SETATTR operation.

如果服务器能够更改SETATTR操作中指定的文件系统对象的时间,则为TRUE。

5.8.2.3. Attribute 16: case_insensitive
5.8.2.3. 属性16:不区分大小写

TRUE, if filename comparisons on this file system are case insensitive. This refers only to comparisons, and not to the case in which filenames are stored.

如果此文件系统上的文件名比较不区分大小写,则为TRUE。这只是指比较,而不是指存储文件名的情况。

5.8.2.4. Attribute 17: case_preserving
5.8.2.4. 属性17:保留大小写

TRUE, if the filename case on this file system is preserved. This refers only to how filenames are stored, and not to how they are compared. Filenames stored in mixed case might be compared using either case-insensitive or case-sensitive comparisons.

如果保留此文件系统上的文件名大小写,则为TRUE。这只是指文件名的存储方式,而不是它们的比较方式。存储在混合大小写中的文件名可以使用不区分大小写或区分大小写的比较进行比较。

5.8.2.5. Attribute 18: chown_restricted
5.8.2.5. 属性18:chown_受限

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 the "Take Ownership" privilege in Windows 2000).

如果为TRUE,则如果调用方不是特权用户(例如,UNIX操作环境中的“root”或Windows 2000中的“Take owner”特权),服务器将拒绝任何更改与文件关联的所有者或组的请求。

5.8.2.6. Attribute 20: fileid
5.8.2.6. 属性20:fileid

A number uniquely identifying the file within the file system.

在文件系统中唯一标识文件的编号。

5.8.2.7. Attribute 21: files_avail
5.8.2.7. 属性21:文件\u可用

File slots available to this user on the file system containing this object -- this should be the smallest relevant limit.

此用户在包含此对象的文件系统上可用的文件槽——这应该是最小的相关限制。

5.8.2.8. Attribute 22: files_free
5.8.2.8. 属性22:免费文件

Free file slots on the file system containing this object -- this should be the smallest relevant limit.

包含此对象的文件系统上的可用文件插槽——这应该是最小的相关限制。

5.8.2.9. Attribute 23: files_total
5.8.2.9. 属性23:文件总数

Total file slots on the file system containing this object.

包含此对象的文件系统上的文件插槽总数。

5.8.2.10. Attribute 24: fs_locations
5.8.2.10. 属性24:fs_位置

Locations where this file system may be found. If the server returns NFS4ERR_MOVED as an error, this attribute MUST be supported.

可以找到此文件系统的位置。如果服务器返回NFS4ERR_MOVED作为错误,则必须支持此属性。

The server specifies the rootpath for a given server by returning a path consisting of zero path components.

服务器通过返回由零路径组件组成的路径来指定给定服务器的根路径。

5.8.2.11. Attribute 25: hidden
5.8.2.11. 属性25:隐藏

TRUE, if the file is considered hidden with respect to the Windows API.

如果文件相对于Windows API被认为是隐藏的,则为TRUE。

5.8.2.12. Attribute 26: homogeneous
5.8.2.12. 属性26:同质

TRUE, if this object's file system is homogeneous, i.e., all objects in the file system (all objects on the server with the same fsid) have common values for all per-file system attributes.

如果此对象的文件系统是同构的,即文件系统中的所有对象(服务器上具有相同fsid的所有对象)都具有每个文件系统属性的公共值,则为TRUE。

5.8.2.13. Attribute 27: maxfilesize
5.8.2.13. 属性27:maxfilesize

Maximum supported file size for the file system of this object.

此对象的文件系统支持的最大文件大小。

5.8.2.14. Attribute 28: maxlink
5.8.2.14. 属性28:maxlink

Maximum number of hard links for this object.

此对象的最大硬链接数。

5.8.2.15. Attribute 29: maxname
5.8.2.15. 属性29:maxname

Maximum filename size supported for this object.

此对象支持的最大文件名大小。

5.8.2.16. Attribute 30: maxread
5.8.2.16. 属性30:maxread

Maximum amount of data the READ operation will return for this object.

读取操作将为此对象返回的最大数据量。

5.8.2.17. Attribute 31: maxwrite
5.8.2.17. 属性31:maxwrite

Maximum amount of data the WRITE operation will accept 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.

写入操作将为此对象接受的最大数据量。如果文件可写,则应支持此属性。缺少此属性可能会导致客户端浪费带宽或无法获得最佳性能。

5.8.2.18. Attribute 32: mimetype
5.8.2.18. 属性32:mimetype

MIME media type/subtype of this object.

此对象的MIME媒体类型/子类型。

5.8.2.19. Attribute 55: mounted_on_fileid
5.8.2.19. 属性55:在\u文件ID上装入\u

Like fileid, but if the target filehandle is the root of a file system, this attribute represents the fileid of the underlying directory.

类似于fileid,但如果目标filehandle是文件系统的根,则此属性表示基础目录的fileid。

UNIX-based operating environments connect a file system into the namespace by connecting (mounting) the file system onto the existing file object (the mount point, usually a directory) of an existing file system. When the mount point's parent directory is read via an API such as readdir() [readdir_api], the return results are directory entries, each with a component name and a fileid. The fileid of the mount point's directory entry will be different from the fileid that the stat() [stat] system call returns. The stat() system call is returning the fileid of the root of the mounted file system, whereas readdir() is returning the fileid that stat() would have returned before any file systems were mounted on the mount point.

基于UNIX的操作环境通过将文件系统连接(装载)到现有文件系统的现有文件对象(装载点,通常是目录)上,将文件系统连接到命名空间中。当通过诸如readdir()[readdir_API]之类的API读取装载点的父目录时,返回的结果是目录项,每个目录项都有一个组件名和一个文件ID。装载点目录项的fileid将不同于stat()[stat]系统调用返回的fileid。stat()系统调用返回装载的文件系统的根的fileid,而readdir()返回在装载点上装载任何文件系统之前stat()将返回的fileid。

Unlike NFSv3, NFSv4.0 allows a client's LOOKUP request to cross other file systems. The client detects the file system crossing whenever the filehandle argument of LOOKUP has an fsid attribute different from that of the filehandle returned by LOOKUP. A UNIX-based client will consider this a "mount point crossing". UNIX has a legacy scheme for allowing a process to determine its current working directory. This relies on readdir() of a mount point's parent and stat() of the mount point returning fileids as previously described. The mounted_on_fileid attribute corresponds to the fileid that readdir() would have returned, as described previously.

与NFSv3不同,NFSv4.0允许客户端的查找请求跨其他文件系统。只要LOOKUP的filehandle参数具有与LOOKUP返回的filehandle不同的fsid属性,客户端就会检测文件系统交叉。一个基于UNIX的客户端将考虑这是一个“挂载点交叉”。UNIX有一个遗留方案,允许进程确定其当前工作目录。这依赖于装载点的父级的readdir()和装载点的stat(),如前所述返回fileid。如前所述,mounted_on_fileid属性对应于readdir()将返回的fileid。

While the NFSv4.0 client could simply fabricate a fileid corresponding to what mounted_on_fileid provides (and if the server does not support mounted_on_fileid, the client has no choice), there is a risk that the client will generate a fileid that conflicts with one that is already assigned to another object in the file system. Instead, if the server can provide the mounted_on_fileid, the potential for client operational problems in this area is eliminated.

虽然NFSv4.0客户端可以简单地创建一个与mounted_on_fileid提供的内容相对应的fileid(如果服务器不支持mounted_on_fileid,则客户端别无选择),但客户端生成的fileid可能与已分配给文件系统中另一个对象的fileid冲突。相反,如果服务器可以提供挂载的\u on_文件ID,则可以消除此区域中客户端操作问题的可能性。

If the server detects that there is nothing mounted on top of the target file object, then the value for mounted_on_fileid that it returns is the same as that of the fileid attribute.

如果服务器检测到目标文件对象顶部没有装载任何内容,那么它返回的mounted_on_fileid的值与fileid属性的值相同。

The mounted_on_fileid attribute is RECOMMENDED, so the server SHOULD provide it if possible, and for a UNIX-based server, this is straightforward. Usually, mounted_on_fileid will be requested during a READDIR operation, in which case it is trivial (at least for UNIX-based servers) to return mounted_on_fileid since it is equal to the fileid of a directory entry returned by readdir(). If mounted_on_fileid is requested in a GETATTR operation, the server should obey an invariant that has it returning a value that is equal to the file object's entry in the object's parent directory, i.e., what readdir() would have returned. Some operating environments allow a series of two or more file systems to be mounted onto a single mount point. In this case, for the server to obey the aforementioned invariant, it will need to find the base mount point, and not the intermediate mount points.

建议使用mounted_on_fileid属性,因此如果可能,服务器应该提供它,对于基于UNIX的服务器,这是很简单的。通常,在READDIR操作期间会请求在\u fileid上挂载的\u,在这种情况下,返回在\u fileid上挂载的\u很简单(至少对于基于UNIX的服务器而言),因为它等于READDIR()返回的目录项的fileid。如果在GETATTR操作中请求挂载在文件ID上的文件,则服务器应遵循一个不变量,该不变量使其返回一个值,该值等于对象父目录中文件对象的条目,即readdir()将返回的值。某些操作环境允许将一系列两个或多个文件系统装载到单个装载点上。在这种情况下,为了使服务器遵守上述不变量,它需要找到基本装载点,而不是中间装载点。

5.8.2.20. Attribute 34: no_trunc
5.8.2.20. 属性34:不正确

If this attribute is TRUE, then if the client uses a filename longer than name_max, an error will be returned instead of the name being truncated.

如果此属性为TRUE,则如果客户端使用的文件名长于name_max,则将返回错误,而不是截断名称。

5.8.2.21. Attribute 35: numlinks
5.8.2.21. 属性35:numlinks

Number of hard links to this object.

指向此对象的硬链接数。

5.8.2.22. Attribute 36: owner
5.8.2.22. 属性36:所有者

The string name of the owner of this object.

此对象所有者的字符串名称。

5.8.2.23. Attribute 37: owner_group
5.8.2.23. 属性37:所有者组

The string name of the group ownership of this object.

此对象的组所有权的字符串名称。

5.8.2.24. Attribute 38: quota_avail_hard
5.8.2.24. 属性38:quota\u avail\u hard

The value in bytes that represents the amount of additional disk 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.

以字节为单位的值,表示在拒绝进一步分配之前,可以分配给此文件或目录的超出当前分配的额外磁盘空间量。可以理解的是,分配给其他文件或目录可能会占用此空间。

5.8.2.25. Attribute 39: quota_avail_soft
5.8.2.25. 属性39:quota\u avail\u soft

The value in bytes that 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 may exist server-side rules as to which other files or directories.

以字节为单位的值,表示在合理警告用户之前可以分配给此文件或目录的额外磁盘空间量。可以理解的是,分配给其他文件或目录可能会占用此空间,尽管可能存在关于哪些文件或目录的服务器端规则。

5.8.2.26. Attribute 40: quota_used
5.8.2.26. 属性40:使用的配额

The value in bytes that represents the amount of disk 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 a given group owner", etc. The server is at liberty to choose any of those sets when providing the content of the quota_used attribute but should do so in a repeatable way. The rule may be configured per file system or may be "choose the set with the smallest quota".

请注意,可能存在许多不同但重叠的文件或目录集,这些文件或目录保留了配额使用值,例如,“具有给定所有者的所有文件”、“具有给定组所有者的所有文件”,等等。当提供quota_used属性的内容时,服务器可以自由选择这些集合中的任何一个,但应以可重复的方式进行选择。规则可以按文件系统配置,也可以是“选择配额最小的集合”。

5.8.2.27. Attribute 41: rawdev
5.8.2.27. 属性41:rawdev

Raw device number of file of type NF4BLK or NF4CHR. The device number is split into major and minor numbers. If the file's type attribute is not NF4BLK or NF4CHR, this attribute SHOULD NOT be returned, and any value returned SHOULD NOT be considered useful.

NF4BLK或NF4CHR类型文件的原始设备号。设备编号分为主要编号和次要编号。如果文件的type属性不是NF4BLK或NF4CHR,则不应返回此属性,并且不应认为返回的任何值有用。

5.8.2.28. Attribute 42: space_avail
5.8.2.28. 属性42:空间可用性

Disk space in bytes available to this user on the file system containing this object -- this should be the smallest relevant limit.

在包含此对象的文件系统上,此用户可用的磁盘空间(字节)——这应该是最小的相关限制。

5.8.2.29. Attribute 43: space_free
5.8.2.29. 属性43:无空间

Free disk space in bytes on the file system containing this object -- this should be the smallest relevant limit.

包含此对象的文件系统上的可用磁盘空间(以字节为单位)——这应该是最小的相关限制。

5.8.2.30. Attribute 44: space_total
5.8.2.30. 属性44:总空间

Total disk space in bytes on the file system containing this object.

包含此对象的文件系统上的总磁盘空间(字节)。

5.8.2.31. Attribute 45: space_used
5.8.2.31. 属性45:使用的空间

Number of file system bytes allocated to this object.

分配给此对象的文件系统字节数。

5.8.2.32. Attribute 46: system
5.8.2.32. 属性46:系统

TRUE, if this file is a "system" file with respect to the Windows operating environment.

如果此文件是相对于Windows操作环境的“系统”文件,则为TRUE。

5.8.2.33. Attribute 47: time_access
5.8.2.33. 属性47:访问时间

Represents the time of last access to the object by a READ operation sent to the server. The notion of what is an "access" depends on the server's operating environment and/or the server's file system semantics. For example, for servers obeying Portable Operating System Interface (POSIX) semantics, time_access would be updated only by the READ and READDIR operations and not any of the operations that modify the content of the object [read_api], [readdir_api], [write_api]. Of course, setting the corresponding time_access_set attribute is another way to modify the time_access attribute.

表示通过发送到服务器的读取操作上次访问对象的时间。什么是“访问”的概念取决于服务器的操作环境和/或服务器的文件系统语义。例如,对于遵循可移植操作系统接口(POSIX)语义的服务器,时间访问将仅由读取和读取操作更新,而不是任何修改对象内容的操作[READ_api]、[READDIR_api]、[write_api]。当然,设置相应的time\u access\u set属性是修改time\u access属性的另一种方法。

Whenever the file object resides on a writable file system, the server should make its best efforts to record time_access into stable storage. However, to mitigate the performance effects of doing so, and most especially whenever the server is satisfying the read of the object's content from its cache, the server MAY cache access time updates and lazily write them to stable storage. It is also acceptable to give administrators of the server the option to disable time_access updates.

每当文件对象驻留在可写文件系统上时,服务器应尽最大努力记录访问稳定存储的时间。但是,为了减轻这样做对性能的影响,尤其是当服务器满足从其缓存读取对象内容的要求时,服务器可能会缓存访问时间更新,并将其惰性地写入稳定存储器。允许服务器管理员选择禁用时间访问更新也是可以接受的。

5.8.2.34. Attribute 48: time_access_set
5.8.2.34. 属性48:时间访问集

Sets the time of last access to the object. SETATTR use only.

设置上次访问对象的时间。SETATTR仅用于。

5.8.2.35. Attribute 49: time_backup
5.8.2.35. 属性49:时间备份

The time of last backup of the object.

上次备份对象的时间。

5.8.2.36. Attribute 50: time_create
5.8.2.36. 属性50:创建时间

The time of creation of the object. This attribute does not have any relation to the traditional UNIX file attribute "ctime" ("change time").

对象的创建时间。此属性与传统的UNIX文件属性“ctime”(“更改时间”)没有任何关系。

5.8.2.37. Attribute 51: time_delta
5.8.2.37. 属性51:时间增量

Smallest useful server time granularity.

最小有用的服务器时间粒度。

5.8.2.38. Attribute 52: time_metadata
5.8.2.38. 属性52:时间元数据

The time of last metadata modification of the object.

上次修改对象元数据的时间。

5.8.2.39. Attribute 53: time_modify
5.8.2.39. 属性53:时间\修改

The time of last modification to the object.

上次修改对象的时间。

5.8.2.40. Attribute 54: time_modify_set
5.8.2.40. 属性54:时间\修改\集

Sets the time of last modification to the object. SETATTR use only.

设置上次修改对象的时间。SETATTR仅用于。

5.9. Interpreting owner and owner_group
5.9. 解释所有者和所有者组

The RECOMMENDED attributes "owner" and "owner_group" (and also users and groups used as values of the who field within nfs4ace structures used in the acl attribute) are represented in the form of UTF-8 strings. This format avoids the use of a representation that is tied to a particular underlying implementation at the client or server. 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 owners and groups that is used for local storage or presentation to the application via APIs that expect such a representation. Therefore, the protocol requires that when these attributes are transferred between the client and server, the local representation is translated to a string of the form "identifier@dns_domain". This allows clients and servers that do not use the same local representation to effectively interoperate since they both use a common syntax that can be interpreted by both.

推荐的属性“owner”和“owner_group”(以及用作acl属性中使用的nfs4ace结构中who字段值的用户和组)以UTF-8字符串的形式表示。这种格式避免使用与客户机或服务器上的特定底层实现绑定的表示。请注意,[RFC2624]第6.1节提供了额外的基本原理。预期客户机和服务器将拥有自己的所有者和组的本地表示,这些所有者和组用于本地存储或通过期望这种表示的API向应用程序进行表示。因此,协议要求在客户端和服务器之间传输这些属性时,将本地表示转换为以下形式的字符串“identifier@dns_domain". 这使得不使用相同本地表示的客户机和服务器能够有效地进行互操作,因为它们都使用可以由双方解释的通用语法。

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 a numeric identifier 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

用于解释所有者和组字符串的转换未指定为协议的一部分。这允许采用各种解决方案。例如,可以参考将数字标识符映射到本地的本地翻译表user@dns_domain语法。名称服务也可用于完成翻译。服务器可以通过将所有者和所有者组属性存储在本地存储器中而不进行任何转换来提供更一般的服务,而不受任何特定转换(仅转换有限的一组可能字符串)的限制,也可以增加转换

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 user and group strings 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 or owner_group attributes or as part of the value of the acl attribute. When a server does accept a user or group string as valid on a SETATTR, it is promising to return that same string (see below) when a corresponding GETATTR is done, as long as there has been no further change in the corresponding attribute before the GETATTR. For some internationalization-related exceptions where this is not possible, see below. Configuration changes (including changes from the mapping of the string to the local representation) 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 either ownership or acls has occurred.

当显示没有翻译的字符串时,不支持用户和组字符串的所有可能值的服务器应返回一个错误(NFS4ERR_BADOWNER),作为要为所有者或所有者组属性的SETATTR设置的值,或作为acl属性值的一部分。当服务器确实接受用户或组字符串作为SETATTR上的有效字符串时,只要在GETATTR之前对应的属性没有进一步更改,则在相应的GETATTR完成时,它承诺返回相同的字符串(见下文)。对于一些无法实现国际化的例外情况,请参见下文。配置更改(包括从字符串映射到本地表示的更改)和构造错误的名称转换(那些包含别名的转换)可能会使这一承诺无法兑现。服务器应做出适当的努力,避免在所有权或ACL未发生实际更改的情况下,这些属性的值发生更改。

The "dns_domain" portion of the owner string is meant to be a DNS domain name -- for example, "user@example.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.

所有者字符串的“dns_域”部分是指dns域名,例如user@example.org". 服务器应接受至少一个域的一组用户作为有效用户。服务器可能会将其他域视为没有有效的翻译。当服务器能够接受多个域或所有域的用户时,会提供更一般的服务,但会受到安全约束。

As an implementation guide, both clients and servers may provide a means to configure the "dns_domain" portion of the owner string. For example, the DNS domain name of the host running the NFS server might be "lab.example.org", but the user names are defined in "example.org". In the absence of such a configuration, or as a default, the current DNS domain name of the server should be the value used for the "dns_domain".

作为实现指南,客户端和服务器都可以提供一种方法来配置所有者字符串的“dns_域”部分。例如,运行NFS服务器的主机的DNS域名可能是“lab.example.org”,但用户名是在“example.org”中定义的。在没有此类配置的情况下,或者默认情况下,服务器的当前DNS域名应为用于“DNS_域”的值。

As mentioned above, it is desirable that a server, when accepting a string of the form "user@domain" or "group@domain" in an attribute, return this same string when that corresponding attribute is fetched. Internationalization issues make this impossible under certain circumstances, and the client needs to take note of these. See Section 12 for a detailed discussion of these issues.

如上所述,服务器在接受表单字符串时最好user@domain“或”group@domain在属性中,获取相应属性时返回相同的字符串。国际化问题使这在某些情况下不可能实现,客户需要注意这些问题。有关这些问题的详细讨论,请参见第12节。

In the case where there is no translation available to the client or server, the attribute value will be constructed without the "@". Therefore, the absence of the "@" from the owner or owner_group attribute signifies that no translation was available at the sender

如果客户机或服务器没有可用的转换,则将构造属性值,而不使用“@”。因此,owner或owner_group属性中没有“@”表示发送方没有可用的翻译

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 cannot be translated, it may still be useful. In the case of a client, the attribute string may be used for local display of ownership.

属性的接收者不应使用该字符串作为将其转换为自身内部格式的基础。即使无法转换属性值,它仍然可能有用。对于客户端,属性字符串可用于本地显示所有权。

To provide a greater degree of compatibility with NFSv3, which identified users and groups by 32-bit unsigned user identifiers and group identifiers, owner and group strings that consist of ASCII-encoded decimal numeric values with no leading zeros can be given a special interpretation by clients and servers that 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 an NFSv3 uid or gid having the corresponding numeric value.

NFSv3通过32位无符号用户标识符和组标识符标识用户和组,为了与NFSv3提供更大程度的兼容性,选择提供此类支持的客户端和服务器可以对由ASCII编码的十进制数值组成的所有者和组字符串进行特殊解释,这些十进制数值不带前导零。接收方可以将这样的用户或组字符串视为表示将由具有相应数值的NFSv3 uid或gid表示的相同用户。

A server SHOULD reject such a numeric value if the security mechanism is using Kerberos. That is, in such a scenario, the client will already need to form "user@domain" strings. For any other security mechanism, the server SHOULD accept such numeric values. As an implementation note, the server could make such an acceptance be configurable. If the server does not support numeric values or if it is configured off, then it MUST return an NFS4ERR_BADOWNER error. If the security mechanism is using Kerberos and the client attempts to use the special form, then the 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 user@domain string and not the special form for compatibility.

如果安全机制使用Kerberos,则服务器应拒绝此类数值。也就是说,在这种情况下,客户机已经需要user@domain“弦。对于任何其他安全机制,服务器应接受此类数值。作为一个实现说明,服务器可以使这样的接受成为可配置的。如果服务器不支持数值或配置为关闭,则必须返回NFS4ERR_BADOWNER错误。如果安全机制使用Kerberos,并且客户端尝试使用特殊表单,则当存在以这种方式指定的用户或所有者的有效翻译时,服务器应返回NFS4ERR_BADOWNER错误。在这种情况下,客户必须使用适当的user@domain字符串,而不是兼容的特殊形式。

The client MUST always accept numeric values if the security mechanism is not RPCSEC_GSS. A client can determine if a server supports numeric identifiers by first attempting to provide a numeric identifier. If this attempt is rejected with an NFS4ERR_BADOWNER error, then the client should only use named identifiers of the form "user@dns_domain".

如果安全机制不是RPCSEC_GSS,则客户端必须始终接受数值。客户端可以通过首先尝试提供数字标识符来确定服务器是否支持数字标识符。如果此尝试因NFS4ERR_BADOWNER错误而被拒绝,则客户端应仅使用表单“”的命名标识符user@dns_domain".

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.

所有者字符串“nobody”可用于指定匿名用户,该用户将与安全主体创建的文件关联,该文件无法通过正常方式映射到所有者属性。

5.10. Character Case Attributes
5.10. 字符大小写属性

With respect to the case_insensitive and case_preserving attributes, case-insensitive comparisons of Unicode characters SHOULD use Unicode Default Case Folding as defined in Chapter 3 of the Unicode Standard [UNICODE] and MAY override that behavior for specific selected characters with the case folding defined in the SpecialCasing.txt [SPECIALCASING] file; see Section 3.13 of the Unicode Standard.

关于不区分大小写和保留大小写的属性,Unicode字符的不区分大小写比较应使用Unicode标准[Unicode]第3章中定义的Unicode默认大小写折叠,并可能使用SpecialCasing.txt中定义的大小写折叠覆盖特定选定字符的该行为[SPECIALCASING]文件;参见Unicode标准第3.13节。

The SpecialCasing.txt file replaces the Default Case Folding with locale- and context-dependent case folding for specific situations. An example of locale- and context-dependent case folding is that LATIN CAPITAL LETTER I ("I", U+0049) is default case folded to LATIN SMALL LETTER I ("i", U+0069). However, several languages (e.g., Turkish) treat an "I" character with a dot as a different letter than an "I" character without a dot; therefore, in such languages, unless an I is before a dot_above, the "I" (U+0049) character should be case folded to a different character, LATIN SMALL LETTER DOTLESS I (U+0131).

对于特定情况,SpecialCasing.txt文件将默认的大小写折叠替换为区域设置和上下文相关的大小写折叠。区域设置和上下文相关大小写折叠的一个示例是,拉丁大写字母I(“I”,U+0049)默认大小写折叠为拉丁小写字母I(“I”,U+0069)。但是,有几种语言(如土耳其语)将带点的“I”字符视为与不带点的“I”字符不同的字母;因此,在这些语言中,除非I在上面的点_之前,否则“I”(U+0049)字符应大小写折叠为另一个字符,即拉丁文小写字母无点I(U+0131)。

The [UNICODE] and [SPECIALCASING] references in this RFC are for version 7.0.0 of the Unicode standard, as that was the latest version of Unicode when this RFC was published. Implementations SHOULD always use the latest version of Unicode (<http://www.unicode.org/versions/latest/>).

本RFC中的[UNICODE]和[SPECIALCASING]引用适用于UNICODE标准的7.0.0版,因为这是本RFC发布时UNICODE的最新版本。实现应始终使用最新版本的Unicode(<http://www.unicode.org/versions/latest/>).

6. Access Control Attributes
6. 访问控制属性

Access Control Lists (ACLs) are file attributes that specify fine-grained access control. This section covers the "acl", "aclsupport", and "mode" file attributes, and their interactions. Note that file attributes may apply to any file system object.

访问控制列表(ACL)是指定细粒度访问控制的文件属性。本节介绍“acl”、“aclsupport”和“mode”文件属性及其交互。请注意,文件属性可以应用于任何文件系统对象。

6.1. Goals
6.1. 目标

ACLs and modes represent two well-established models for specifying permissions. This section specifies requirements that attempt to meet the following goals:

ACL和模式代表两种用于指定权限的成熟模型。本节规定了试图达到以下目标的要求:

o If a server supports the mode attribute, it should provide reasonable semantics to clients that only set and retrieve the mode attribute.

o 如果服务器支持mode属性,那么它应该为只设置和检索mode属性的客户端提供合理的语义。

o If a server supports ACL attributes, it should provide reasonable semantics to clients that only set and retrieve those attributes.

o 如果服务器支持ACL属性,它应该为只设置和检索这些属性的客户端提供合理的语义。

o On servers that support the mode attribute, if ACL attributes have never been set on an object, via inheritance or explicitly, the behavior should be traditional UNIX-like behavior.

o 在支持mode属性的服务器上,如果从未通过继承或显式在对象上设置过ACL属性,则该行为应为传统的类UNIX行为。

o On servers that support the mode attribute, if the ACL attributes have been previously set on an object, either explicitly or via inheritance:

o 在支持mode属性的服务器上,如果先前已显式或通过继承在对象上设置了ACL属性,请执行以下操作:

* Setting only the mode attribute should effectively control the traditional UNIX-like permissions of read, write, and execute on owner, owner_group, and other.

* 仅设置mode属性应该可以有效地控制对owner、owner\u组和其他对象的读、写和执行的传统类UNIX权限。

* Setting only the mode attribute should provide reasonable security. For example, setting a mode of 000 should be enough to ensure that future opens for read or write by any principal fail, regardless of a previously existing or inherited ACL.

* 仅设置mode属性应提供合理的安全性。例如,将模式设置为000应该足以确保将来打开供任何主体读取或写入失败,而不管以前存在或继承的ACL如何。

o When a mode attribute is set on an object, the ACL attributes may need to be modified so as to not conflict with the new mode. In such cases, it is desirable that the ACL keep as much information as possible. This includes information about inheritance, AUDIT and ALARM access control entries (ACEs), and permissions granted and denied that do not conflict with the new mode.

o 在对象上设置模式属性时,可能需要修改ACL属性以避免与新模式冲突。在这种情况下,希望ACL保留尽可能多的信息。这包括有关继承、审核和报警访问控制项(ACE)以及授予和拒绝的与新模式不冲突的权限的信息。

6.2. File Attributes Discussion
6.2. 文件属性讨论

Support for each of the ACL attributes is RECOMMENDED and not required, since file systems accessed using NFSv4 might not support ACLs.

由于使用NFSv4访问的文件系统可能不支持ACL,因此建议且不要求支持每个ACL属性。

6.2.1. Attribute 12: acl
6.2.1. 属性12:acl

The NFSv4.0 ACL attribute contains an array of ACEs that are associated with the file system object. Although the client can read and write the acl attribute, the server is responsible for using the ACL to perform access control. The client can use the OPEN or ACCESS operations to check access without modifying or reading data or metadata.

NFSv4.0 ACL属性包含与文件系统对象关联的ACE数组。尽管客户端可以读取和写入acl属性,但服务器负责使用acl执行访问控制。客户端可以使用OPEN或ACCESS操作来检查访问,而无需修改或读取数据或元数据。

The NFS ACE structure is defined as follows:

NFS ACE结构定义如下:

typedef uint32_t acetype4;

typedef uint32_t acetype4;

typedef uint32_t aceflag4;

typedef uint32_t aceflag4;

typedef uint32_t acemask4;

typedef uint32_t acemask4;

   struct nfsace4 {
           acetype4                type;
           aceflag4                flag;
           acemask4                access_mask;
           utf8str_mixed           who;
   };
        
   struct nfsace4 {
           acetype4                type;
           aceflag4                flag;
           acemask4                access_mask;
           utf8str_mixed           who;
   };
        

To determine if a request succeeds, the server processes each nfsace4 entry in order. Only ACEs that 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 ACCESS_DENIED_ACE

为了确定请求是否成功,服务器按顺序处理每个nfsace4条目。仅考虑具有与请求者匹配的“谁”的ACE。处理每个ACE,直到请求者访问的所有位都被允许。一旦一个位(见下文)被一个允许访问的ACE允许,它就不再被考虑在以后的ACE处理中。如果访问被拒绝

is encountered where the requester's access still has unALLOWED bits in common with the "access_mask" of the ACE, the request is denied. When the ACL is fully processed, if there are bits in the requester's mask that have not been ALLOWED or DENIED, access is denied.

如果请求者的访问仍有与ACE的“访问掩码”相同的未允许位,则请求被拒绝。完全处理ACL时,如果请求者掩码中有未被允许或拒绝的位,则拒绝访问。

Unlike the ALLOW and DENY ACE types, the ALARM and AUDIT ACE types do not affect a requester's access and instead are for triggering events as a result of a requester's access attempt. Therefore, AUDIT and ALARM ACEs are processed only after processing ALLOW and DENY ACEs.

与允许和拒绝ACE类型不同,报警和审核ACE类型不会影响请求者的访问,而是用于触发请求者尝试访问时发生的事件。因此,只有在处理“允许”和“拒绝”ACE之后,才会处理审核和报警ACE。

The NFSv4.0 ACL model is quite rich. Some server platforms may provide access control functionality that goes beyond the UNIX-style mode attribute but that is not as rich as the NFS ACL model. So that users can take advantage of this more limited functionality, the server may support the acl attributes by mapping between its ACL model and the NFSv4.0 ACL model. Servers must ensure that the ACL they actually store or enforce is at least as strict as the NFSv4 ACL that was set. It is tempting to accomplish this by rejecting any ACL that falls outside the small set that can be represented accurately. However, such an approach can render ACLs unusable without special client-side knowledge of the server's mapping, which defeats the purpose of having a common NFSv4 ACL protocol. Therefore, servers should accept every ACL that they can without compromising security. To help accomplish this, servers may make a special exception, in the case of unsupported permission bits, to the rule that bits not ALLOWED or DENIED by an ACL must be denied. For example, a UNIX-style server might choose to silently allow read attribute permissions even though an ACL does not explicitly allow those permissions. (An ACL that explicitly denies permission to read attributes should still result in a denial.)

NFSv4.0ACL模型非常丰富。某些服务器平台可能提供超越UNIX样式模式属性的访问控制功能,但没有NFS ACL模型丰富。为了使用户能够利用这一更有限的功能,服务器可以通过其acl模型和NFSv4.0 acl模型之间的映射来支持acl属性。服务器必须确保其实际存储或实施的ACL至少与设置的NFSv4 ACL一样严格。通过拒绝任何不属于可以准确表示的小集合的ACL来实现这一点是很有诱惑力的。然而,这种方法可能会使ACL在没有服务器映射的特殊客户端知识的情况下无法使用,这与使用通用NFSv4 ACL协议的目的背道而驰。因此,服务器应该在不影响安全性的情况下尽可能地接受每个ACL。为了帮助实现这一点,服务器可能会在权限位不受支持的情况下对ACL不允许或拒绝的位必须被拒绝的规则做出特殊的例外。例如,UNIX样式的服务器可能会选择以静默方式允许读取属性权限,即使ACL不显式允许这些权限。(明确拒绝读取属性权限的ACL仍应导致拒绝。)

The situation is complicated by the fact that a server may have multiple modules that enforce ACLs. For example, the enforcement for NFSv4.0 access may be different from, but not weaker than, the enforcement for local access, and both may be different from the enforcement for access through other protocols such as Server Message Block (SMB) [MS-SMB]. So it may be useful for a server to accept an ACL even if not all of its modules are able to support it.

服务器可能有多个强制ACL的模块,这一事实使情况变得复杂。例如,NFSv4.0访问的实施可能不同于但不弱于本地访问的实施,并且两者都可能不同于通过服务器消息块(SMB)[MS-SMB]等其他协议进行访问的实施。因此,即使不是所有的模块都能支持ACL,服务器接受ACL也是很有用的。

The guiding principle with regard to NFSv4 access is that the server must not accept ACLs that give an appearance of more restricted access to a file than what is actually enforced.

关于NFSv4访问的指导原则是,服务器不能接受ACL,因为这些ACL看起来对文件的访问比实际执行的访问更受限制。

6.2.1.1. ACE Type
6.2.1.1. ACE类型

The constants used for the type field (acetype4) are as follows:

类型字段(acetype4)使用的常量如下所示:

   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;
        
   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;
        

All four bit types are permitted in the acl attribute.

acl属性中允许所有四种位类型。

   +------------------------------+--------------+---------------------+
   | Value                        | Abbreviation | Description         |
   +------------------------------+--------------+---------------------+
   | ACE4_ACCESS_ALLOWED_ACE_TYPE | ALLOW        | Explicitly grants   |
   |                              |              | the access defined  |
   |                              |              | in acemask4 to the  |
   |                              |              | file or directory.  |
   |                              |              |                     |
   | ACE4_ACCESS_DENIED_ACE_TYPE  | DENY         | Explicitly denies   |
   |                              |              | the access defined  |
   |                              |              | in acemask4 to the  |
   |                              |              | file or directory.  |
   |                              |              |                     |
   | ACE4_SYSTEM_AUDIT_ACE_TYPE   | AUDIT        | LOG (in a system-   |
   |                              |              | dependent way) any  |
   |                              |              | access attempt to a |
   |                              |              | file or directory   |
   |                              |              | that uses any of    |
   |                              |              | the access methods  |
   |                              |              | specified in        |
   |                              |              | acemask4.           |
   |                              |              |                     |
   | ACE4_SYSTEM_ALARM_ACE_TYPE   | 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.           |
   +------------------------------+--------------+---------------------+
        
   +------------------------------+--------------+---------------------+
   | Value                        | Abbreviation | Description         |
   +------------------------------+--------------+---------------------+
   | ACE4_ACCESS_ALLOWED_ACE_TYPE | ALLOW        | Explicitly grants   |
   |                              |              | the access defined  |
   |                              |              | in acemask4 to the  |
   |                              |              | file or directory.  |
   |                              |              |                     |
   | ACE4_ACCESS_DENIED_ACE_TYPE  | DENY         | Explicitly denies   |
   |                              |              | the access defined  |
   |                              |              | in acemask4 to the  |
   |                              |              | file or directory.  |
   |                              |              |                     |
   | ACE4_SYSTEM_AUDIT_ACE_TYPE   | AUDIT        | LOG (in a system-   |
   |                              |              | dependent way) any  |
   |                              |              | access attempt to a |
   |                              |              | file or directory   |
   |                              |              | that uses any of    |
   |                              |              | the access methods  |
   |                              |              | specified in        |
   |                              |              | acemask4.           |
   |                              |              |                     |
   | ACE4_SYSTEM_ALARM_ACE_TYPE   | 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 "Abbreviation" column denotes how the types will be referred to throughout the rest of this section.

“缩写”列表示在本节其余部分中如何引用这些类型。

6.2.1.2. Attribute 13: aclsupport
6.2.1.2. 属性13:ACL支持

A server need not support all of the above ACE types. This attribute indicates which ACE types are supported for the current file system. The bitmask constants used to represent the above definitions within the aclsupport attribute are as follows:

服务器不需要支持上述所有ACE类型。此属性指示当前文件系统支持哪些ACE类型。用于在aclsupport属性中表示上述定义的位掩码常量如下所示:

   const ACL4_SUPPORT_ALLOW_ACL    = 0x00000001;
   const ACL4_SUPPORT_DENY_ACL     = 0x00000002;
   const ACL4_SUPPORT_AUDIT_ACL    = 0x00000004;
   const ACL4_SUPPORT_ALARM_ACL    = 0x00000008;
        
   const ACL4_SUPPORT_ALLOW_ACL    = 0x00000001;
   const ACL4_SUPPORT_DENY_ACL     = 0x00000002;
   const ACL4_SUPPORT_AUDIT_ACL    = 0x00000004;
   const ACL4_SUPPORT_ALARM_ACL    = 0x00000008;
        

Servers that support either the ALLOW or DENY ACE type SHOULD support both ALLOW and DENY ACE types.

支持ALLOW或DENY ACE类型的服务器应同时支持ALLOW和DENY ACE类型。

Clients should not attempt to set an ACE unless the server claims support for that ACE type. If the server receives a request to set an ACE that it cannot store, it MUST reject the request with NFS4ERR_ATTRNOTSUPP. If the server receives a request to set an ACE that it can store but cannot enforce, the server SHOULD reject the request with NFS4ERR_ATTRNOTSUPP.

客户端不应尝试设置ACE,除非服务器声明支持该ACE类型。如果服务器收到设置其无法存储的ACE的请求,则必须使用NFS4ERR_ATTRNOTSUPP拒绝该请求。如果服务器收到一个请求,要求设置一个它可以存储但无法执行的ACE,则服务器应使用NFS4ERR_ATTRNOTSUPP拒绝该请求。

6.2.1.3. ACE Access Mask
6.2.1.3. ACE访问掩码

The bitmask constants used for the access mask field are as follows:

用于访问掩码字段的位掩码常数如下所示:

   const ACE4_READ_DATA            = 0x00000001;
   const ACE4_LIST_DIRECTORY       = 0x00000001;
   const ACE4_WRITE_DATA           = 0x00000002;
   const ACE4_ADD_FILE             = 0x00000002;
   const ACE4_APPEND_DATA          = 0x00000004;
   const ACE4_ADD_SUBDIRECTORY     = 0x00000004;
   const ACE4_READ_NAMED_ATTRS     = 0x00000008;
   const ACE4_WRITE_NAMED_ATTRS    = 0x00000010;
   const ACE4_EXECUTE              = 0x00000020;
   const ACE4_DELETE_CHILD         = 0x00000040;
   const ACE4_READ_ATTRIBUTES      = 0x00000080;
   const ACE4_WRITE_ATTRIBUTES     = 0x00000100;
        
   const ACE4_READ_DATA            = 0x00000001;
   const ACE4_LIST_DIRECTORY       = 0x00000001;
   const ACE4_WRITE_DATA           = 0x00000002;
   const ACE4_ADD_FILE             = 0x00000002;
   const ACE4_APPEND_DATA          = 0x00000004;
   const ACE4_ADD_SUBDIRECTORY     = 0x00000004;
   const ACE4_READ_NAMED_ATTRS     = 0x00000008;
   const ACE4_WRITE_NAMED_ATTRS    = 0x00000010;
   const ACE4_EXECUTE              = 0x00000020;
   const ACE4_DELETE_CHILD         = 0x00000040;
   const ACE4_READ_ATTRIBUTES      = 0x00000080;
   const ACE4_WRITE_ATTRIBUTES     = 0x00000100;
        
   const ACE4_DELETE               = 0x00010000;
   const ACE4_READ_ACL             = 0x00020000;
   const ACE4_WRITE_ACL            = 0x00040000;
   const ACE4_WRITE_OWNER          = 0x00080000;
   const ACE4_SYNCHRONIZE          = 0x00100000;
        
   const ACE4_DELETE               = 0x00010000;
   const ACE4_READ_ACL             = 0x00020000;
   const ACE4_WRITE_ACL            = 0x00040000;
   const ACE4_WRITE_OWNER          = 0x00080000;
   const ACE4_SYNCHRONIZE          = 0x00100000;
        

Note that some masks have coincident values -- for example, ACE4_READ_DATA and ACE4_LIST_DIRECTORY. The mask entries ACE4_LIST_DIRECTORY, ACE4_ADD_FILE, and ACE4_ADD_SUBDIRECTORY are intended to be used with directory objects, while ACE4_READ_DATA, ACE4_WRITE_DATA, and ACE4_APPEND_DATA are intended to be used with non-directory objects.

请注意,某些掩码具有重合的值——例如,ACE4_读取_数据和ACE4_列表_目录。掩码条目ACE4_LIST_DIRECTORY、ACE4_ADD_FILE和ACE4_ADD_子目录用于目录对象,而ACE4_READ_DATA、ACE4_WRITE_DATA和ACE4_APPEND_DATA用于非目录对象。

6.2.1.3.1. Discussion of Mask Attributes
6.2.1.3.1. 关于遮罩属性的讨论

ACE4_READ_DATA

ACE4_读取_数据

Operation(s) affected:

受影响的行动:

READ

阅读

OPEN

打开

Discussion:

讨论:

Permission to read the data of the file.

读取文件数据的权限。

Servers SHOULD allow a user the ability to read the data of the file when only the ACE4_EXECUTE access mask bit is set.

服务器应允许用户在仅设置ACE4_EXECUTE访问掩码位时读取文件数据。

ACE4_LIST_DIRECTORY

ACE4\u列表\u目录

Operation(s) affected:

受影响的行动:

READDIR

READDIR

Discussion:

讨论:

Permission to list the contents of a directory.

列出目录内容的权限。

ACE4_WRITE_DATA

ACE4_写入_数据

Operation(s) affected:

受影响的行动:

WRITE

OPEN

打开

SETATTR of size

大小设置属性

Discussion:

讨论:

Permission to modify a file's data.

修改文件数据的权限。

ACE4_ADD_FILE

ACE4_添加_文件

Operation(s) affected:

受影响的行动:

CREATE

创造

LINK

链接

OPEN

打开

RENAME

改名

Discussion:

讨论:

Permission to add a new file in a directory. The CREATE operation is affected when nfs_ftype4 is NF4LNK, NF4BLK, NF4CHR, NF4SOCK, or NF4FIFO. (NF4DIR is not listed because it is covered by ACE4_ADD_SUBDIRECTORY.) OPEN is affected when used to create a regular file. LINK and RENAME are always affected.

在目录中添加新文件的权限。当nfs_ftype4为NF4LNK、NF4BLK、NF4CHR、NF4SOCK或NF4FIFO时,创建操作会受到影响。(NF4DIR未列出,因为它包含在ACE4_ADD_子目录中。)OPEN在用于创建常规文件时会受到影响。链接和重命名总是受到影响。

ACE4_APPEND_DATA

ACE4_追加_数据

Operation(s) affected:

受影响的行动:

WRITE

OPEN

打开

SETATTR of size

大小设置属性

Discussion:

讨论:

The ability to modify a file's data, but only starting at EOF. This allows for the notion of append-only files, by allowing ACE4_APPEND_DATA and denying ACE4_WRITE_DATA to the same user or group. If a file has an ACL such as the one described above and a WRITE request is made for somewhere other than EOF, the server SHOULD return NFS4ERR_ACCESS.

修改文件数据的能力,但仅从EOF开始。通过允许ACE4_追加_数据并拒绝ACE4_向同一用户或组写入_数据,这允许仅追加文件的概念。如果文件具有如上所述的ACL,并且对EOF以外的其他位置发出写入请求,则服务器应返回NFS4ERR_访问。

ACE4_ADD_SUBDIRECTORY

ACE4_添加_子目录

Operation(s) affected:

受影响的行动:

CREATE

创造

RENAME

改名

Discussion:

讨论:

Permission to create a subdirectory in a directory. The CREATE operation is affected when nfs_ftype4 is NF4DIR. The RENAME operation is always affected.

在目录中创建子目录的权限。当nfs_ftype4为NF4DIR时,创建操作会受到影响。重命名操作始终受到影响。

ACE4_READ_NAMED_ATTRS

ACE4\u读取\u命名\u属性

Operation(s) affected:

受影响的行动:

OPENATTR

OPENATTR

Discussion:

讨论:

Permission to read the named attributes of a file or to look up the named attributes directory. OPENATTR is affected when it is not used to create a named attribute directory. This is when 1) createdir is TRUE but a named attribute directory already exists or 2) createdir is FALSE.

读取文件的命名属性或查找命名属性目录的权限。OPENATTR不用于创建命名属性目录时会受到影响。这是指1)createdir为TRUE,但命名属性目录已存在,或2)createdir为FALSE。

ACE4_WRITE_NAMED_ATTRS

ACE4\u写入\u命名\u属性

Operation(s) affected:

受影响的行动:

OPENATTR

OPENATTR

Discussion:

讨论:

Permission to write the named attributes of a file or to create a named attribute directory. OPENATTR is affected when it is used to create a named attribute directory. This is when createdir is TRUE and no named attribute directory exists. The ability to check whether or not a named attribute directory exists depends on the ability to look it up; therefore, users also need the ACE4_READ_NAMED_ATTRS permission in order to create a named attribute directory.

写入文件的命名属性或创建命名属性目录的权限。OPENATTR用于创建命名属性目录时会受到影响。此时createdir为TRUE且不存在命名属性目录。检查命名属性目录是否存在的能力取决于查找它的能力;因此,用户还需要ACE4_READ_NAMED_ATTRS权限才能创建命名属性目录。

ACE4_EXECUTE

ACE4_执行

Operation(s) affected:

受影响的行动:

READ

阅读

Discussion:

讨论:

Permission to execute a file.

执行文件的权限。

Servers SHOULD allow a user the ability to read the data of the file when only the ACE4_EXECUTE access mask bit is set. This is because there is no way to execute a file without reading the contents. Though a server may treat ACE4_EXECUTE and ACE4_READ_DATA bits identically when deciding to permit a READ operation, it SHOULD still allow the two bits to be set independently in ACLs and MUST distinguish between them when replying to ACCESS operations. In particular, servers SHOULD NOT silently turn on one of the two bits when the other is set, as that would make it impossible for the client to correctly enforce the distinction between read and execute permissions.

服务器应允许用户在仅设置ACE4_EXECUTE访问掩码位时读取文件数据。这是因为在不读取内容的情况下无法执行文件。尽管在决定允许读取操作时,服务器可能会对ACE4_EXECUTE和ACE4_READ_数据位进行相同的处理,但仍应允许在ACL中独立设置这两个位,并且在答复访问操作时必须区分它们。特别是,当另一位被设置时,服务器不应该静默地打开这两位中的一位,因为这将使客户端无法正确执行读取和执行权限之间的区别。

As an example, following a SETATTR of the following ACL:

例如,在以下ACL的SETATTR之后:

nfsuser:ACE4_EXECUTE:ALLOW

nfsuser:ACE4_执行:允许

A subsequent GETATTR of ACL for that file SHOULD return:

该文件的ACL的后续GETATTR应返回:

nfsuser:ACE4_EXECUTE:ALLOW

nfsuser:ACE4_执行:允许

Rather than:

而不是:

         nfsuser:ACE4_EXECUTE/ACE4_READ_DATA:ALLOW
        
         nfsuser:ACE4_EXECUTE/ACE4_READ_DATA:ALLOW
        

ACE4_EXECUTE

ACE4_执行

Operation(s) affected:

受影响的行动:

LOOKUP

查找

OPEN

打开

REMOVE

去除

RENAME

改名

LINK

链接

CREATE

创造

Discussion:

讨论:

Permission to traverse/search a directory.

遍历/搜索目录的权限。

ACE4_DELETE_CHILD

ACE4_删除_子项

Operation(s) affected:

受影响的行动:

REMOVE

去除

RENAME

改名

Discussion:

讨论:

Permission to delete a file or directory within a directory. See Section 6.2.1.3.2 for information on how ACE4_DELETE and ACE4_DELETE_CHILD interact.

删除目录中的文件或目录的权限。有关ACE4_DELETE和ACE4_DELETE_CHILD如何交互的信息,请参见第6.2.1.3.2节。

ACE4_READ_ATTRIBUTES

ACE4_读取_属性

Operation(s) affected:

受影响的行动:

GETATTR of file system object attributes

文件系统对象属性的GETATTR

VERIFY

验证

NVERIFY

恩弗里

READDIR

READDIR

Discussion:

讨论:

The ability to read basic attributes (non-ACLs) of a file. On a UNIX system, basic attributes can be thought of as the stat-level attributes. Allowing this access mask bit would mean the entity can execute "ls -l" and stat. If a READDIR operation requests attributes, this mask must be allowed for the READDIR to succeed.

能够读取文件的基本属性(非ACL)。在UNIX系统上,基本属性可以看作是stat级别的属性。允许此访问掩码位意味着实体可以执行“ls-l”和stat。如果READDIR操作请求属性,则必须允许此掩码,READDIR才能成功。

ACE4_WRITE_ATTRIBUTES

ACE4_写入_属性

Operation(s) affected:

受影响的行动:

SETATTR of time_access_set, time_backup, time_create, time_modify_set, mimetype, hidden, and system

设置时间访问集、时间备份、时间创建、时间修改集、mimetype、隐藏和系统的属性

Discussion:

讨论:

Permission to change the times associated with a file or directory to an arbitrary value. Also, permission to change the mimetype, hidden and system attributes. A user having ACE4_WRITE_DATA or ACE4_WRITE_ATTRIBUTES will be allowed to set the times associated with a file to the current server time.

将与文件或目录关联的时间更改为任意值的权限。此外,还有更改mimetype、hidden和system属性的权限。允许具有ACE4_WRITE_数据或ACE4_WRITE_属性的用户将与文件关联的时间设置为当前服务器时间。

ACE4_DELETE

ACE4_删除

Operation(s) affected:

受影响的行动:

REMOVE

去除

Discussion:

讨论:

Permission to delete the file or directory. See Section 6.2.1.3.2 for information on ACE4_DELETE and ACE4_DELETE_CHILD interact.

删除文件或目录的权限。有关ACE4_DELETE和ACE4_DELETE_子交互的信息,请参见第6.2.1.3.2节。

ACE4_READ_ACL

ACE4\u读取\u ACL

Operation(s) affected:

受影响的行动:

GETATTR of acl

acl的GETATTR

NVERIFY

恩弗里

VERIFY

验证

Discussion:

讨论:

Permission to read the ACL.

读取ACL的权限。

ACE4_WRITE_ACL

ACE4_WRITE_ACL

Operation(s) affected:

受影响的行动:

SETATTR of acl and mode

acl和模式的SETATTR

Discussion:

讨论:

Permission to write the acl and mode attributes.

写入acl和模式属性的权限。

ACE4_WRITE_OWNER

ACE4_写入_所有者

Operation(s) affected:

受影响的行动:

SETATTR of owner and owner_group

所有者和所有者组的设置属性

Discussion:

讨论:

Permission to write the owner and owner_group attributes. On UNIX systems, this is the ability to execute chown() and chgrp().

写入所有者和所有者组属性的权限。在UNIX系统上,这是执行chown()和chgrp()的能力。

ACE4_SYNCHRONIZE

ACE4_同步

Operation(s) affected:

受影响的行动:

NONE

没有一个

Discussion:

讨论:

Permission to use the file object as a synchronization primitive for interprocess communication. This permission is not enforced or interpreted by the NFSv4.0 server on behalf of the client.

将文件对象用作进程间通信的同步原语的权限。NFSv4.0服务器不会代表客户端强制或解释此权限。

Typically, the ACE4_SYNCHRONIZE permission is only meaningful on local file systems, i.e., file systems not accessed via NFSv4.0. The reason that the permission bit exists is that some operating environments, such as Windows, use ACE4_SYNCHRONIZE.

通常,ACE4_SYNCHRONIZE权限仅在本地文件系统上有意义,即未通过NFSv4.0访问的文件系统。权限位存在的原因是某些操作环境(如Windows)使用ACE4\u同步。

For example, if a client copies a file that has ACE4_SYNCHRONIZE set from a local file system to an NFSv4.0 server, and then later copies the file from the NFSv4.0 server to a local file system, it is likely that if ACE4_SYNCHRONIZE was set in the original file, the client will want it set in the second copy. The first copy will not have the permission set unless the NFSv4.0 server has the means to set the ACE4_SYNCHRONIZE bit. The second copy will not have the permission set unless the NFSv4.0 server has the means to retrieve the ACE4_SYNCHRONIZE bit.

例如,如果客户端将设置了ACE4_SYNCHRONIZE的文件从本地文件系统复制到NFSv4.0服务器,然后将该文件从NFSv4.0服务器复制到本地文件系统,则如果在原始文件中设置了ACE4_SYNCHRONIZE,则客户端可能希望在第二个副本中设置该文件。除非NFSv4.0服务器具有设置ACE4_同步位的方法,否则第一个副本将不会设置权限。除非NFSv4.0服务器具有检索ACE4_同步位的方法,否则第二个副本将不具有权限集。

Server implementations need not provide the granularity of control that is implied by this list of masks. For example, POSIX-based systems might not distinguish ACE4_APPEND_DATA (the ability to append to a file) from ACE4_WRITE_DATA (the ability to modify existing contents); both masks would be tied to a single "write" permission. When such a server returns attributes to the client, it would show both ACE4_APPEND_DATA and ACE4_WRITE_DATA if and only if the write permission is enabled.

服务器实现不需要提供此掩码列表所暗示的控制粒度。例如,基于POSIX的系统可能无法区分ACE4_追加_数据(追加到文件的能力)和ACE4_写入_数据(修改现有内容的能力);两个掩码都将绑定到一个“写入”权限。当这样的服务器将属性返回给客户机时,它将显示ACE4_APPEND_数据和ACE4_WRITE_数据,前提是且仅当启用了写入权限。

If a server receives a SETATTR request that it cannot accurately implement, it should err in the direction of more restricted access, except in the previously discussed cases of execute and read. For example, suppose a server cannot distinguish overwriting data from appending new data, as described in the previous paragraph. If a client submits an ALLOW ACE where ACE4_APPEND_DATA is set but ACE4_WRITE_DATA is not (or vice versa), the server should either turn off ACE4_APPEND_DATA or reject the request with NFS4ERR_ATTRNOTSUPP.

如果服务器接收到无法准确实现的SETATTR请求,那么它应该在更受限的访问方向上出错,前面讨论的execute和read情况除外。例如,假设服务器无法区分覆盖数据和追加新数据,如前一段所述。如果客户端提交了一个允许ACE,其中设置了ACE4_APPEND_数据,但未设置ACE4_WRITE_数据(反之亦然),则服务器应关闭ACE4_APPEND_数据或使用NFS4ERR_ATTRNOTSUPP拒绝请求。

6.2.1.3.2. ACE4_DELETE versus ACE4_DELETE_CHILD
6.2.1.3.2. ACE4_DELETE与ACE4_DELETE_子项

Two access mask bits govern the ability to delete a directory entry: ACE4_DELETE on the object itself (the "target") and ACE4_DELETE_CHILD on the containing directory (the "parent").

两个访问掩码位控制删除目录项的能力:对象本身(“目标”)上的ACE4_delete和包含目录(“父目录”)上的ACE4_delete_CHILD。

Many systems also take the "sticky bit" (MODE4_SVTX) on a directory to allow unlink only to a user that owns either the target or the parent; on some such systems, the decision also depends on whether the target is writable.

许多系统还采用目录上的“粘性位”(MODE4_SVTX),只允许与拥有目标或父目录的用户解除链接;在某些这样的系统上,决策还取决于目标是否可写。

Servers SHOULD allow unlink if either ACE4_DELETE is permitted on the target or ACE4_DELETE_CHILD is permitted on the parent. (Note that this is true even if the parent or target explicitly denies the other of these permissions.)

如果目标服务器上允许ACE4_删除,或者父服务器上允许ACE4_删除子服务器,则服务器应允许取消链接。(请注意,即使父级或目标明确拒绝这些权限中的另一个,这也是正确的。)

If the ACLs in question neither explicitly ALLOW nor DENY either of the above, and if MODE4_SVTX is not set on the parent, then the server SHOULD allow the removal if and only if ACE4_ADD_FILE is permitted. In the case where MODE4_SVTX is set, the server may also require the remover to own either the parent or the target, or may require the target to be writable.

如果所讨论的ACL既不明确允许也不拒绝上述任何一项,并且如果父级上未设置MODE4_SVTX,则只有在允许ACE4_ADD_文件的情况下,服务器才应允许删除。在设置MODE4_SVTX的情况下,服务器还可能要求删除程序拥有父级或目标,或者可能要求目标可写。

This allows servers to support something close to traditional UNIX-like semantics, with ACE4_ADD_FILE taking the place of the write bit.

这允许服务器支持类似于传统UNIX的语义,用ACE4_ADD_文件代替写位。

6.2.1.4. ACE flag
6.2.1.4. 王牌旗

The bitmask constants used for the flag field are as follows:

用于标志字段的位掩码常数如下所示:

   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;
        
   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;
        

A server need not support any of these flags. If the server supports flags that are similar to, but not exactly the same as, these flags, the implementation may define a mapping between the protocol-defined flags and the implementation-defined flags.

服务器不需要支持这些标志中的任何一个。如果服务器支持与这些标志相似但不完全相同的标志,则实现可以定义协议定义标志和实现定义标志之间的映射。

For example, suppose a client tries to set an ACE with ACE4_FILE_INHERIT_ACE set but not ACE4_DIRECTORY_INHERIT_ACE. If the server does not support any form of ACL inheritance, the server should reject the request with NFS4ERR_ATTRNOTSUPP. If the server

例如,假设客户机尝试使用ACE4\u文件\u继承\u ACE集设置ACE,但不使用ACE4\u目录\u继承\u ACE。如果服务器不支持任何形式的ACL继承,则服务器应使用NFS4ERR_ATTRNOTSUPP拒绝请求。如果服务器

supports a single "inherit ACE" flag that applies to both files and directories, the server may reject the request (i.e., requiring the client to set both the file and directory inheritance flags). The server may also accept the request and silently turn on the ACE4_DIRECTORY_INHERIT_ACE flag.

支持应用于文件和目录的单个“继承ACE”标志,服务器可能会拒绝请求(即,要求客户端同时设置文件和目录继承标志)。服务器也可以接受请求并静默地打开ACE4\u目录\u继承\u ACE标志。

6.2.1.4.1. Discussion of Flag Bits
6.2.1.4.1. 关于标志位的讨论

ACE4_FILE_INHERIT_ACE Any non-directory file in any subdirectory will get this ACE inherited.

ACE4\u文件\u继承\u ACE任何子目录中的任何非目录文件都将继承此ACE。

ACE4_DIRECTORY_INHERIT_ACE Can be placed on a directory and indicates that this ACE should be added to each new directory created. If this flag is set in an ACE in an ACL attribute to be set on a non-directory file system object, the operation attempting to set the ACL SHOULD fail with NFS4ERR_ATTRNOTSUPP.

ACE4_DIRECTORY_INHERIT_ACE可放置在目录上,并指示应将此ACE添加到创建的每个新目录中。如果在要在非目录文件系统对象上设置的ACL属性的ACE中设置了此标志,则尝试设置ACL的操作将失败,并出现NFS4ERR_ATTRNOTSUPP。

ACE4_INHERIT_ONLY_ACE Can be placed on a directory but does not apply to the directory; ALLOW and DENY ACEs with this bit set do not affect access to the directory, and AUDIT and ALARM ACEs with this bit set do not trigger log or alarm events. Such ACEs only take effect once they are applied (with this bit cleared) to newly created files and directories as specified by the above two flags. If this flag is present on an ACE, but neither ACE4_DIRECTORY_INHERIT_ACE nor ACE4_FILE_INHERIT_ACE is present, then an operation attempting to set such an attribute SHOULD fail with NFS4ERR_ATTRNOTSUPP.

ACE4_INHERIT_ONLY_ACE可放置在目录上,但不适用于该目录;具有此位集的允许和拒绝ACE不会影响对目录的访问,并且具有此位集的审核和报警ACE不会触发日志或报警事件。此类ACE仅在应用于(清除此位)上述两个标志指定的新创建的文件和目录后生效。如果ACE上存在此标志,但既不存在ACE4_目录_继承_ACE,也不存在ACE4_文件_继承_ACE,则尝试设置此类属性的操作应失败,并出现NFS4ERR_ATTRNOTSUPP。

ACE4_NO_PROPAGATE_INHERIT_ACE Can be placed on a directory. This flag tells the server that inheritance of this ACE should stop at newly created child directories.

ACE4\u NO\u PROPAGATE\u INHERIT\u ACE可以放置在目录中。此标志告诉服务器,此ACE的继承应在新创建的子目录处停止。

ACE4_SUCCESSFUL_ACCESS_ACE_FLAG

ACE4\u成功访问\u ACE\u标志

ACE4_FAILED_ACCESS_ACE_FLAG The ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (SUCCESS) and ACE4_FAILED_ACCESS_ACE_FLAG (FAILED) flag bits may be set only on ACE4_SYSTEM_AUDIT_ACE_TYPE (AUDIT) and ACE4_SYSTEM_ALARM_ACE_TYPE (ALARM) ACE types. If, during the processing of the file's ACL, the server encounters an AUDIT or ALARM ACE that matches the principal attempting the OPEN, the server notes that fact and notes the presence, if any, of the SUCCESS and FAILED flags encountered in the AUDIT or ALARM ACE. Once the server completes the ACL processing, it then notes if the operation succeeded or

ACE4_失败访问_ACE_标志ACE4_成功访问_ACE_标志(成功)和ACE4_失败访问_ACE_标志(失败)位只能在ACE4_系统审计_ACE_类型(审计)和ACE4_系统报警_ACE类型(报警)ACE类型上设置。如果在处理文件的ACL期间,服务器遇到与尝试打开的主体匹配的审核或报警ACE,则服务器会记录该事实,并记录审核或报警ACE中遇到的成功和失败标志(如果有)。一旦服务器完成ACL处理,它就会记录操作是否成功

failed. If the operation succeeded, and if the SUCCESS flag was set for a matching AUDIT or ALARM ACE, then the appropriate AUDIT or ALARM event occurs. If the operation failed, and if the FAILED flag was set for the matching AUDIT or ALARM ACE, then the appropriate AUDIT or ALARM event occurs. Either or both of the SUCCESS or FAILED can be set, but if neither is set, the AUDIT or ALARM ACE is not useful.

失败。如果操作成功,并且为匹配的审核或报警ACE设置了成功标志,则会发生相应的审核或报警事件。如果操作失败,并且如果为匹配的审核或报警ACE设置了失败标志,则会发生相应的审核或报警事件。可以设置成功或失败中的一个或两个,但如果两个都未设置,则审核或报警ACE将无效。

The previously described processing applies to ACCESS operations even when they return NFS4_OK. For the purposes of AUDIT and ALARM, we consider an ACCESS operation to be a "failure" if it fails to return a bit that was requested and supported.

前面描述的处理适用于访问操作,即使它们返回NFS4_OK。出于审计和警报的目的,我们认为如果不能返回请求和支持的位,则访问操作将是“失败”。

ACE4_IDENTIFIER_GROUP Indicates that the "who" refers to a GROUP as defined under UNIX or a GROUP ACCOUNT as defined under Windows. Clients and servers MUST ignore the ACE4_IDENTIFIER_GROUP flag on ACEs with a who value equal to one of the special identifiers outlined in Section 6.2.1.5.

ACE4_IDENTIFIER_GROUP表示“谁”是指UNIX下定义的组或Windows下定义的组帐户。客户机和服务器必须忽略ACEs上的ACE4_标识符_组标志,其who值等于第6.2.1.5节中概述的特殊标识符之一。

6.2.1.5. ACE Who
6.2.1.5. 王牌谁

The who field of an ACE is an identifier that specifies the principal or principals to whom the ACE applies. It may refer to a user or a group, with the flag bit ACE4_IDENTIFIER_GROUP specifying which.

ACE的who字段是一个标识符,用于指定ACE应用到的一个或多个主体。它可能指的是用户或组,标志位ACE4_IDENTIFIER_group指定用户或组。

There are several special identifiers that need to be understood universally, rather than in the context of a particular DNS domain. 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, even if none of the access methods on the server understand the identifiers.

有几个特殊标识符需要普遍理解,而不是在特定DNS域的上下文中。其中一些标识符在NFS客户端访问服务器时无法理解,但在本地进程访问文件时具有意义。允许通过NFS显示和修改这些权限,即使服务器上的任何访问方法都不理解标识符。

   +---------------+---------------------------------------------------+
   | Who           | Description                                       |
   +---------------+---------------------------------------------------+
   | OWNER         | The owner of the file.                            |
   | GROUP         | The group associated with the file.               |
   | EVERYONE      | The world, including the owner and owning group.  |
   | 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.                     |
   +---------------+---------------------------------------------------+
        
   +---------------+---------------------------------------------------+
   | Who           | Description                                       |
   +---------------+---------------------------------------------------+
   | OWNER         | The owner of the file.                            |
   | GROUP         | The group associated with the file.               |
   | EVERYONE      | The world, including the owner and owning group.  |
   | 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.                     |
   +---------------+---------------------------------------------------+
        

Table 5: Special Identifiers

表5:特殊标识符

To avoid conflict, these special identifiers are distinguished by an appended "@" and should appear in the form "xxxx@" (with no domain name after the "@") -- for example, ANONYMOUS@.

为了避免冲突,这些特殊标识符通过附加的“@”加以区分,并应以“xxxx@”的形式出现(在“@”之后没有域名),例如,ANONYMOUS@.

The ACE4_IDENTIFIER_GROUP flag MUST be ignored on entries with these special identifiers. When encoding entries with these special identifiers, the ACE4_IDENTIFIER_GROUP flag SHOULD be set to zero.

对于具有这些特殊标识符的条目,必须忽略ACE4_标识符_组标志。使用这些特殊标识符对条目进行编码时,ACE4_IDENTIFIER_GROUP标志应设置为零。

6.2.1.5.1. Discussion of EVERYONE@
6.2.1.5.1. 大家讨论@

It is important to note that "EVERYONE@" is not equivalent to the UNIX "other" entity. This is because, by definition, UNIX "other" does not include the owner or owning group of a file. "EVERYONE@" means literally everyone, including the owner or owning group.

需要注意的是,“EVERYONE@”并不等同于UNIX“other”实体。这是因为,根据定义,UNIX“其他”不包括文件的所有者或所有者组。“EVERYONE@”字面上是指所有人,包括所有者或所有者团体。

6.2.2. Attribute 33: mode
6.2.2. 属性33:模式

The NFSv4.0 mode attribute is based on the UNIX mode bits. The following bits are defined:

NFSv4.0模式属性基于UNIX模式位。定义了以下位:

   const MODE4_SUID = 0x800;  /* set user id on execution */
   const MODE4_SGID = 0x400;  /* set group id on execution */
   const MODE4_SVTX = 0x200;  /* save text even after use */
   const MODE4_RUSR = 0x100;  /* read permission: owner */
   const MODE4_WUSR = 0x080;  /* write permission: owner */
   const MODE4_XUSR = 0x040;  /* execute permission: owner */
   const MODE4_RGRP = 0x020;  /* read permission: group */
   const MODE4_WGRP = 0x010;  /* write permission: group */
   const MODE4_XGRP = 0x008;  /* execute permission: group */
        
   const MODE4_SUID = 0x800;  /* set user id on execution */
   const MODE4_SGID = 0x400;  /* set group id on execution */
   const MODE4_SVTX = 0x200;  /* save text even after use */
   const MODE4_RUSR = 0x100;  /* read permission: owner */
   const MODE4_WUSR = 0x080;  /* write permission: owner */
   const MODE4_XUSR = 0x040;  /* execute permission: owner */
   const MODE4_RGRP = 0x020;  /* read permission: group */
   const MODE4_WGRP = 0x010;  /* write permission: group */
   const MODE4_XGRP = 0x008;  /* execute permission: group */
        
   const MODE4_ROTH = 0x004;  /* read permission: other */
   const MODE4_WOTH = 0x002;  /* write permission: other */
   const MODE4_XOTH = 0x001;  /* execute permission: other */
        
   const MODE4_ROTH = 0x004;  /* read permission: other */
   const MODE4_WOTH = 0x002;  /* write permission: other */
   const MODE4_XOTH = 0x001;  /* execute permission: other */
        

Bits MODE4_RUSR, MODE4_WUSR, and MODE4_XUSR apply to the principal identified in the owner attribute. Bits MODE4_RGRP, MODE4_WGRP, and MODE4_XGRP apply to principals identified in the owner_group attribute but who are not identified in the owner attribute. Bits MODE4_ROTH, MODE4_WOTH, and MODE4_XOTH apply to any principal that does not match that in the owner attribute and does not have a group matching that of the owner_group attribute.

位MODE4_RUSR、MODE4_WUSR和MODE4_XUSR应用于所有者属性中标识的主体。位MODE4_RGRP、MODE4_WGRP和MODE4_XGRP适用于在owner_group属性中标识但在owner属性中未标识的主体。位MODE4_ROTH、MODE4_WOTH和MODE4_XOTH适用于与owner属性中的主体不匹配且组与owner_group属性中的主体不匹配的任何主体。

Bits within the mode other than those specified above are not defined by this protocol. A server MUST NOT return bits other than those defined above in a GETATTR or READDIR operation, and it MUST return NFS4ERR_INVAL if bits other than those defined above are set in a SETATTR, CREATE, OPEN, VERIFY, or NVERIFY operation.

本协议未定义除上述规定之外的模式内的位。服务器不能返回除上面在GETATTR或READDIR操作中定义的位以外的位,如果在SETATTR、CREATE、OPEN、VERIFY或NVERIFY操作中设置了除上面定义的位以外的位,则必须返回NFS4ERR_INVAL。

6.3. Common Methods
6.3. 常用方法

The requirements in this section will be referred to in future sections, especially Section 6.4.

本节中的要求将在以后的章节中提及,特别是第6.4节。

6.3.1. Interpreting an ACL
6.3.1. 解释ACL
6.3.1.1. Server Considerations
6.3.1.1. 服务器注意事项

The server uses the algorithm described in Section 6.2.1 to determine whether an ACL allows access to an object. However, the ACL may not be the sole determiner of access. For example:

服务器使用第6.2.1节中描述的算法来确定ACL是否允许访问对象。但是,ACL可能不是访问的唯一决定因素。例如:

o In the case of a file system exported as read-only, the server may deny write permissions even though an object's ACL grants it.

o 对于以只读方式导出的文件系统,即使对象的ACL授予写入权限,服务器也可能会拒绝该权限。

o Server implementations MAY grant ACE4_WRITE_ACL and ACE4_READ_ACL permissions to prevent a situation from arising in which there is no valid way to ever modify the ACL.

o 服务器实现可能会授予ACE4_WRITE_ACL和ACE4_READ_ACL权限,以防止出现无法有效修改ACL的情况。

o All servers will allow a user the ability to read the data of the file when only the execute permission is granted (i.e., if the ACL denies the user ACE4_READ_DATA access and allows the user ACE4_EXECUTE, the server will allow the user to read the data of the file).

o 当仅授予执行权限时,所有服务器将允许用户读取文件数据(即,如果ACL拒绝用户ACE4_读取_数据访问并允许用户ACE4_执行,则服务器将允许用户读取文件数据)。

o Many servers have the notion of owner-override, in which the owner of the object is allowed to override accesses that are denied by the ACL. This may be helpful, for example, to allow users continued access to open files on which the permissions have changed.

o 许多服务器都有所有者覆盖的概念,其中允许对象的所有者覆盖ACL拒绝的访问。例如,这可能有助于允许用户继续访问权限已更改的打开文件。

o Many servers have the notion of a "superuser" that has privileges beyond an ordinary user. The superuser may be able to read or write data or metadata in ways that would not be permitted by the ACL.

o 许多服务器都有“超级用户”的概念,拥有普通用户以外的特权。超级用户可能能够以ACL不允许的方式读取或写入数据或元数据。

6.3.1.2. Client Considerations
6.3.1.2. 客户注意事项

Clients SHOULD NOT do their own access checks based on their interpretation of the ACL but rather use the OPEN and ACCESS operations to do access checks. This allows the client to act on the results of having the server determine whether or not access should be granted based on its interpretation of the ACL.

客户端不应该基于对ACL的解释来执行自己的访问检查,而应该使用OPEN和access操作来执行访问检查。这允许客户端根据服务器根据其对ACL的解释确定是否应授予访问权限的结果进行操作。

Clients must be aware of situations in which an object's ACL will define a certain access even though the server will not have adequate information to enforce it. For example, the server has no way of determining whether a particular OPEN reflects a user's open for read access or is done as part of executing the file in question. In such situations, the client needs to do its part in the enforcement of access as defined by the ACL. To do this, the client will send the appropriate ACCESS operation (or use a cached previous determination) prior to servicing the request of the user or application in order to determine whether the user or application should be granted the access requested. For examples in which the ACL may define accesses that the server does not enforce, see Section 6.3.1.1.

客户端必须知道对象的ACL将定义特定访问权限的情况,即使服务器没有足够的信息来强制执行该访问权限。例如,服务器无法确定特定的打开是否反映了用户对读取访问的打开,或者是否作为执行相关文件的一部分完成。在这种情况下,客户机需要按照ACL的定义执行访问。为此,客户端将在为用户或应用程序的请求提供服务之前发送适当的访问操作(或使用缓存的先前确定),以确定是否应向用户或应用程序授予请求的访问权限。有关ACL可能定义服务器不强制执行的访问的示例,请参见第6.3.1.1节。

6.3.2. Computing a mode Attribute from an ACL
6.3.2. 从ACL计算模式属性

The following method can be used to calculate the MODE4_R*, MODE4_W*, and MODE4_X* bits of a mode attribute, based upon an ACL.

以下方法可用于基于ACL计算模式属性的MODE4_R*、MODE4_W*和MODE4_X*位。

First, for each of the special identifiers OWNER@, GROUP@, and EVERYONE@, evaluate the ACL in order, considering only ALLOW and DENY ACEs for the identifier EVERYONE@ and for the identifier under consideration. The result of the evaluation will be an NFSv4 ACL mask showing exactly which bits are permitted to that identifier.

首先,对于每个特殊标识符OWNER@、GROUP@和EVERYONE@,依次评估ACL,考虑仅允许和拒绝标识符EVERYONE@和正在考虑的标识符的ACE。评估的结果将是一个NFSv4 ACL掩码,精确显示允许该标识符使用的位。

Then translate the calculated mask for OWNER@, GROUP@, and EVERYONE@ into mode bits for the user, group, and other, respectively, as follows:

然后将计算出的OWNER@、GROUP@和everybody@掩码分别转换为user、GROUP和other的模式位,如下所示:

1. Set the read bit (MODE4_RUSR, MODE4_RGRP, or MODE4_ROTH) if and only if ACE4_READ_DATA is set in the corresponding mask.

1. 当且仅当在相应掩码中设置了ACE4_读取数据时,设置读取位(MODE4_RUSR、MODE4_RGRP或MODE4_ROTH)。

2. Set the write bit (MODE4_WUSR, MODE4_WGRP, or MODE4_WOTH) if and only if ACE4_WRITE_DATA and ACE4_APPEND_DATA are both set in the corresponding mask.

2. 设置写入位(MODE4_WUSR、MODE4_WGRP或MODE4_WOTH),前提是且仅当ACE4_写入_数据和ACE4_附加_数据均在相应掩码中设置。

3. Set the execute bit (MODE4_XUSR, MODE4_XGRP, or MODE4_XOTH), if and only if ACE4_EXECUTE is set in the corresponding mask.

3. 设置执行位(MODE4_XUSR、MODE4_XGRP或MODE4_XOTH),前提是且仅当相应掩码中设置了ACE4_execute。

6.3.2.1. Discussion
6.3.2.1. 讨论

Some server implementations also add bits permitted to named users and groups to the group bits (MODE4_RGRP, MODE4_WGRP, and MODE4_XGRP).

一些服务器实现还将允许命名用户和组的位添加到组位(MODE4_RGRP、MODE4_WGRP和MODE4_XGRP)。

Implementations are discouraged from doing this, because it has been found to cause confusion for users who see members of a file's group denied access that the mode bits appear to allow. (The presence of DENY ACEs may also lead to such behavior, but DENY ACEs are expected to be more rarely used.)

不鼓励实现这样做,因为已经发现,如果用户看到模式位似乎允许的文件组成员被拒绝访问,则会导致混淆。(拒绝ACE的存在也可能导致此类行为,但拒绝ACE预计将很少使用。)

The same user confusion seen when fetching the mode also results if setting the mode does not effectively control permissions for the owner, group, and other users; this motivates some of the requirements that follow.

如果设置模式不能有效控制所有者、组和其他用户的权限,则在获取模式时也会出现相同的用户混淆;这激发了接下来的一些需求。

6.4. Requirements
6.4. 要求

The server that supports both mode and ACL must take care to synchronize the MODE4_*USR, MODE4_*GRP, and MODE4_*OTH bits with the ACEs that have respective who fields of "OWNER@", "GROUP@", and "EVERYONE@" so that the client can see that semantically equivalent access permissions exist whether the client asks for just the ACL or any of the owner, owner_group, and mode attributes.

同时支持mode和ACL的服务器必须注意将MODE4_*USR、MODE4_*GRP和MODE4_*OTH位与ACE同步,ACE具有各自的who字段“OWNER@”、“GROUP@”和“EVERYONE@”,以便客户端可以看到,无论客户端只请求ACL还是请求任何所有者,都存在语义等效的访问权限,所有者组和模式属性。

Many requirements refer to Section 6.3.2, but note that the methods have behaviors specified with "SHOULD". This is intentional, to avoid invalidating existing implementations that compute the mode according to the withdrawn POSIX ACL draft ([P1003.1e]), rather than by actual permissions on owner, group, and other.

许多要求参考第6.3.2节,但请注意,这些方法具有“应”指定的行为。这是有意的,以避免使根据撤销的POSIX ACL草案([P1003.1e])而不是所有者、组和其他用户的实际权限计算模式的现有实现无效。

6.4.1. Setting the mode and/or ACL Attributes
6.4.1. 设置模式和/或ACL属性
6.4.1.1. Setting mode and Not ACL
6.4.1.1. 设置模式而不是ACL

When any of the nine low-order mode bits are changed because the mode attribute was set, and no ACL attribute is explicitly set, the acl attribute must be modified in accordance with the updated value of those bits. This must happen even if the value of the low-order bits is the same after the mode is set as before.

如果由于设置了模式属性而更改了九个低阶模式位中的任何一个,并且没有显式设置ACL属性,则必须根据这些位的更新值修改ACL属性。即使低阶位的值在模式设置后与之前相同,也必须发生这种情况。

Note that any AUDIT or ALARM ACEs are unaffected by changes to the mode.

请注意,任何审核或报警ACE均不受模式更改的影响。

In cases in which the permissions bits are subject to change, the acl attribute MUST be modified such that the mode computed via the method described in Section 6.3.2 yields the low-order nine bits (MODE4_R*, MODE4_W*, MODE4_X*) of the mode attribute as modified by the change attribute. The ACL attributes SHOULD also be modified such that:

在权限位可能发生更改的情况下,必须修改acl属性,以便通过第6.3.2节中描述的方法计算的模式产生由更改属性修改的模式属性的低阶九位(MODE4_R*、MODE4_W*、MODE4_X*)。还应修改ACL属性,以便:

1. If MODE4_RGRP is not set, entities explicitly listed in the ACL other than OWNER@ and EVERYONE@ SHOULD NOT be granted ACE4_READ_DATA.

1. 如果未设置MODE4_RGRP,则ACL中明确列出的除OWNER@和EVERYONE@之外的实体不应被授予ACE4_读取_数据。

2. If MODE4_WGRP is not set, entities explicitly listed in the ACL other than OWNER@ and EVERYONE@ SHOULD NOT be granted ACE4_WRITE_DATA or ACE4_APPEND_DATA.

2. 如果未设置MODE4_WGRP,则在ACL中明确列出的除OWNER@和EVERYONE@以外的实体不应被授予ACE4_WRITE_数据或ACE4_APPEND_数据。

3. If MODE4_XGRP is not set, entities explicitly listed in the ACL other than OWNER@ and EVERYONE@ SHOULD NOT be granted ACE4_EXECUTE.

3. 如果未设置MODE4_XGRP,则不应授予ACL中明确列出的除OWNER@和EVERYONE@以外的实体ACE4_EXECUTE。

Access mask bits other than those listed above, appearing in ALLOW ACEs, MAY also be disabled.

除了上面列出的访问掩码位之外,出现在允许ACEs中的访问掩码位也可能被禁用。

Note that ACEs with the flag ACE4_INHERIT_ONLY_ACE set do not affect the permissions of the ACL itself, nor do ACEs of the types AUDIT and ALARM. As such, it is desirable to leave these ACEs unmodified when modifying the ACL attributes.

请注意,带有标志ACE4_INHERIT_ONLY_ACE set的ACE不会影响ACL本身的权限,也不会影响AUDIT和ALARM类型的ACE。因此,在修改ACL属性时,最好不要修改这些ACE。

Also note that the requirement may be met by discarding the acl in favor of an ACL that represents the mode and only the mode. This is permitted, but it is preferable for a server to preserve as much of the ACL as possible without violating the above requirements. Discarding the ACL makes it effectively impossible for a file created with a mode attribute to inherit an ACL (see Section 6.4.3).

还请注意,可以通过放弃acl而使用表示模式且仅表示模式的acl来满足该要求。这是允许的,但服务器最好在不违反上述要求的情况下保留尽可能多的ACL。丢弃ACL实际上使使用mode属性创建的文件无法继承ACL(请参阅第6.4.3节)。

6.4.1.2. Setting ACL and Not mode
6.4.1.2. 设置ACL和Not模式

When setting the acl and not setting the mode attribute, the permission bits of the mode need to be derived from the ACL. In this case, the ACL attribute SHOULD be set as given. The nine low-order bits of the mode attribute (MODE4_R*, MODE4_W*, MODE4_X*) MUST be modified to match the result of the method described in Section 6.3.2. The three high-order bits of the mode (MODE4_SUID, MODE4_SGID, MODE4_SVTX) SHOULD remain unchanged.

设置acl而不设置mode属性时,需要从acl派生模式的权限位。在这种情况下,ACL属性应按给定值设置。必须修改模式属性的九个低阶位(MODE4_R*、MODE4_W*、MODE4_X*),以匹配第6.3.2节所述方法的结果。模式的三个高阶位(MODE4_SUID、MODE4_SGID、MODE4_SVTX)应保持不变。

6.4.1.3. Setting Both ACL and mode
6.4.1.3. 设置ACL和模式

When setting both the mode and the acl attribute in the same operation, the attributes MUST be applied in this order: mode, then ACL. The mode-related attribute is set as given, then the ACL attribute is set as given, possibly changing the final mode, as described above in Section 6.4.1.2.

在同一操作中设置模式和acl属性时,必须按以下顺序应用属性:模式,然后是acl。模式相关属性设置为给定,然后ACL属性设置为给定,可能会更改最终模式,如上文第6.4.1.2节所述。

6.4.2. Retrieving the mode and/or ACL Attributes
6.4.2. 检索模式和/或ACL属性

This section applies only to servers that support both the mode and ACL attributes.

本节仅适用于同时支持模式和ACL属性的服务器。

Some server implementations may have a concept of "objects without ACLs", meaning that all permissions are granted and denied according to the mode attribute, and that no ACL attribute is stored for that object. If an ACL attribute is requested of such a server, the server SHOULD return an ACL that does not conflict with the mode; that is to say, the ACL returned SHOULD represent the nine low-order bits of the mode attribute (MODE4_R*, MODE4_W*, MODE4_X*) as described in Section 6.3.2.

一些服务器实现可能有“没有ACL的对象”的概念,这意味着根据mode属性授予和拒绝所有权限,并且没有为该对象存储ACL属性。如果请求此类服务器的ACL属性,则服务器应返回与模式不冲突的ACL;也就是说,返回的ACL应表示第6.3.2节中描述的模式属性(MODE4_R*、MODE4_W*、MODE4_X*)的九个低阶位。

For other server implementations, the ACL attribute is always present for every object. Such servers SHOULD store at least the three high-order bits of the mode attribute (MODE4_SUID, MODE4_SGID, MODE4_SVTX). The server SHOULD return a mode attribute if one is requested, and the low-order nine bits of the mode (MODE4_R*, MODE4_W*, MODE4_X*) MUST match the result of applying the method in Section 6.3.2 to the ACL attribute.

对于其他服务器实现,ACL属性始终存在于每个对象中。此类服务器应至少存储模式属性的三个高阶位(MODE4_SUID、MODE4_SGID、MODE4_SVTX)。如果请求模式属性,服务器应返回一个模式属性,模式的低阶九位(MODE4_R*、MODE4_W*、MODE4_X*)必须与将第6.3.2节中的方法应用于ACL属性的结果相匹配。

6.4.3. Creating New Objects
6.4.3. 创建新对象

If a server supports any ACL attributes, it may use the ACL attributes on the parent directory to compute an initial ACL attribute for a newly created object. This will be referred to as the inherited ACL within this section. The act of adding one or more

如果服务器支持任何ACL属性,它可以使用父目录上的ACL属性来计算新创建对象的初始ACL属性。这将在本节中称为继承的ACL。添加一个或多个的行为

ACEs to the inherited ACL that are based upon ACEs in the parent directory's ACL will be referred to as inheriting an ACE within this section.

基于父目录ACL中ACE的继承ACL的ACE在本节中称为继承ACE。

In the presence or absence of the mode and ACL attributes, the behavior of CREATE and OPEN SHOULD be:

在存在或不存在模式和ACL属性的情况下,CREATE和OPEN的行为应为:

1. If just the mode is given in the call:

1. 如果通话中仅给出了模式:

In this case, inheritance SHOULD take place, but the mode MUST be applied to the inherited ACL as described in Section 6.4.1.1, thereby modifying the ACL.

在这种情况下,应该进行继承,但必须按照第6.4.1.1节所述将该模式应用于继承的ACL,从而修改ACL。

2. If just the ACL is given in the call:

2. 如果调用中仅给出了ACL:

In this case, inheritance SHOULD NOT take place, and the ACL as defined in the CREATE or OPEN will be set without modification, and the mode modified as in Section 6.4.1.2.

在这种情况下,不应发生继承,并且在创建或打开中定义的ACL将在不进行修改的情况下进行设置,并且模式将按照第6.4.1.2节的规定进行修改。

3. If both mode and ACL are given in the call:

3. 如果调用中同时给出了mode和ACL:

In this case, inheritance SHOULD NOT take place, and both attributes will be set as described in Section 6.4.1.3.

在这种情况下,不应发生继承,两个属性都将按照第6.4.1.3节所述进行设置。

4. If neither mode nor ACL is given in the call:

4. 如果调用中未给出模式或ACL:

In the case where an object is being created without any initial attributes at all, e.g., an OPEN operation with an opentype4 of OPEN4_CREATE and a createmode4 of EXCLUSIVE4, inheritance SHOULD NOT take place. Instead, the server SHOULD set permissions to deny all access to the newly created object. It is expected that the appropriate client will set the desired attributes in a subsequent SETATTR operation, and the server SHOULD allow that operation to succeed, regardless of what permissions the object is created with. For example, an empty ACL denies all permissions, but the server should allow the owner's SETATTR to succeed even though WRITE_ACL is implicitly denied.

如果创建对象时根本没有任何初始属性,例如,opentype4为OPEN4_CREATE,createmode4为EXCLUSIVE4的开放操作,则不应发生继承。相反,服务器应该设置权限以拒绝对新创建的对象的所有访问。预期适当的客户端将在后续的SETATTR操作中设置所需的属性,并且服务器应允许该操作成功,而不管使用什么权限创建对象。例如,空ACL拒绝所有权限,但服务器应允许所有者的SETATTR成功,即使WRITE_ACL被隐式拒绝。

In other cases, inheritance SHOULD take place, and no modifications to the ACL will happen. The mode attribute, if supported, MUST be as computed via the method described in Section 6.3.2, with the MODE4_SUID, MODE4_SGID, and MODE4_SVTX bits clear. If no inheritable ACEs exist on the parent directory, the rules for creating acl attributes are implementation defined.

在其他情况下,应该进行继承,并且不会对ACL进行任何修改。如果支持模式属性,则必须通过第6.3.2节中描述的方法计算模式属性,并清除MODE4_SUID、MODE4_SGID和MODE4_SVTX位。如果父目录上不存在可继承的ACE,则创建acl属性的规则由实现定义。

6.4.3.1. The Inherited ACL
6.4.3.1. 继承的ACL

If the object being created is not a directory, the inherited ACL SHOULD NOT inherit ACEs from the parent directory ACL unless the ACE4_FILE_INHERIT_FLAG is set.

如果要创建的对象不是目录,则继承的ACL不应从父目录ACL继承ACE,除非设置了ACE4_FILE_inherit_标志。

If the object being created is a directory, the inherited ACL should inherit all inheritable ACEs from the parent directory, i.e., those that have the ACE4_FILE_INHERIT_ACE or ACE4_DIRECTORY_INHERIT_ACE flag set. If the inheritable ACE has ACE4_FILE_INHERIT_ACE set, but ACE4_DIRECTORY_INHERIT_ACE is clear, the inherited ACE on the newly created directory MUST have the ACE4_INHERIT_ONLY_ACE flag set to prevent the directory from being affected by ACEs meant for non-directories.

如果要创建的对象是目录,则继承的ACL应继承父目录中的所有可继承ACE,即设置了ACE4\u文件\u继承\u ACE或ACE4\u目录\u继承\u ACE标志的ACE。如果可继承ACE设置了ACE4\u文件\u继承\u ACE,但ACE4\u目录\u继承\u ACE是清除的,则新创建目录上的继承ACE必须设置ACE4\u仅继承\u ACE标志,以防止目录受到非目录的ACE的影响。

When a new directory is created, the server MAY split any inherited ACE that is both inheritable and effective (in other words, that has neither ACE4_INHERIT_ONLY_ACE nor ACE4_NO_PROPAGATE_INHERIT_ACE set) into two ACEs -- one with no inheritance flags, and one with ACE4_INHERIT_ONLY_ACE set. This makes it simpler to modify the effective permissions on the directory without modifying the ACE that is to be inherited to the new directory's children.

创建新目录时,服务器可能会将任何既可继承又有效的继承ACE(换句话说,既没有ACE4_INHERIT_ONLY_ACE也没有ACE4_NO_PROPAGATE_INHERIT_ACE集)拆分为两个ACE—一个没有继承标志,另一个只有ACE4_INHERIT_ACE集。这使得修改目录上的有效权限变得更简单,而无需修改要继承到新目录子目录的ACE。

7. NFS Server Namespace
7. NFS服务器命名空间
7.1. Server Exports
7.1. 服务器导出

On a UNIX server, the namespace describes all the files reachable by pathnames under the root directory or "/". On a Windows server, the namespace constitutes all the files on disks named by mapped disk letters. NFS server administrators rarely make the entire server's file system namespace available to NFS clients. More often, portions of the namespace are made available via an "export" feature. In previous versions of the NFS protocol, the root filehandle for each export is obtained through the MOUNT protocol; the client sends a string that identifies an object in the exported namespace, and the server returns the root filehandle for it. The MOUNT protocol supports an EXPORTS procedure that will enumerate the server's exports.

在UNIX服务器上,命名空间描述根目录或“/”下的路径名可访问的所有文件。在Windows服务器上,名称空间由磁盘上以映射的磁盘字母命名的所有文件组成。NFS服务器管理员很少使整个服务器的文件系统命名空间可供NFS客户端使用。更常见的情况是,命名空间的某些部分通过“导出”功能提供。在以前版本的NFS协议中,每次导出的根文件句柄都是通过MOUNT协议获得的;客户端发送一个字符串,标识导出命名空间中的对象,服务器返回该对象的根文件句柄。装载协议支持导出过程,该过程将枚举服务器的导出。

7.2. Browsing Exports
7.2. 浏览导出

The NFSv4 protocol provides a root filehandle that clients can use to obtain filehandles for these exports via a multi-component LOOKUP. A common user experience is to use a graphical user interface (perhaps a file "Open" dialog window) to find a file via progressive browsing

NFSv4协议提供了一个根文件句柄,客户端可以使用该根文件句柄通过多组件查找来获取这些导出的文件句柄。常见的用户体验是使用图形用户界面(可能是文件“打开”对话框窗口)通过渐进式浏览查找文件

through a directory tree. The client must be able to move from one export to another export via single-component, progressive LOOKUP operations.

通过目录树。客户端必须能够通过单个组件、渐进式查找操作从一个导出移动到另一个导出。

This style of browsing is not well supported by the NFSv2 and NFSv3 protocols. The client expects all LOOKUP operations to remain within a single-server file system. For example, the device attribute will not change. This prevents a client from taking namespace paths that span exports.

NFSv2和NFSv3协议不支持这种浏览方式。客户端希望所有查找操作都保留在单个服务器文件系统中。例如,设备属性不会更改。这将防止客户端采用跨越导出的命名空间路径。

An automounter on the client can obtain a snapshot of the server's namespace using the EXPORTS procedure of the MOUNT protocol. If it understands the server's pathname syntax, it can create an image of the server's namespace on the client. The parts of the namespace that are not exported by the server are filled in with a "pseudo-file system" that allows the user to browse from one mounted file system to another. There is a drawback to this representation of the server's namespace 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
7.3. 服务器伪文件系统

NFSv4 servers avoid this namespace inconsistency by presenting all the exports within the framework of a single-server namespace. An NFSv4 client uses LOOKUP and READDIR operations to browse seamlessly from one export to another. Portions of the server namespace 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.

NFSv4服务器通过在单个服务器名称空间的框架内呈现所有导出来避免这种名称空间不一致。NFSv4客户端使用查找和READDIR操作从一个导出无缝浏览到另一个导出。未导出的服务器命名空间部分通过“伪文件系统”桥接,该系统仅提供导出目录的视图。伪文件系统具有唯一的fsid,其行为类似于普通的只读文件系统。

Based on the construction of the server's namespace, it is possible that multiple pseudo-file systems may exist. For example:

根据服务器名称空间的构造,可能存在多个伪文件系统。例如:

     /a         pseudo-file system
     /a/b       real file system
     /a/b/c     pseudo-file system
     /a/b/c/d   real file system
        
     /a         pseudo-file system
     /a/b       real file system
     /a/b/c     pseudo-file system
     /a/b/c/d   real file system
        

Each of the pseudo-file systems are considered separate entities and therefore will have a unique fsid.

每个伪文件系统都被视为独立的实体,因此具有唯一的fsid。

7.4. Multiple Roots
7.4. 多根

The DOS and Windows operating environments are sometimes described as having "multiple roots". File systems are commonly represented as disk letters. MacOS represents file systems as top-level names. NFSv4 servers for these platforms can construct a pseudo-file system above these root names so that disk letters or volume names are simply directory names in the pseudo-root.

DOS和Windows操作环境有时被描述为具有“多个根”。文件系统通常表示为磁盘字母。MacOS将文件系统表示为顶级名称。这些平台的NFSv4服务器可以在这些根名称之上构造一个伪文件系统,以便磁盘字母或卷名称只是伪根中的目录名。

7.5. Filehandle Volatility
7.5. 文件句柄波动性

The nature of the server's pseudo-file system is that it is a logical representation of file system(s) available from the server. Therefore, the pseudo-file system is most likely constructed dynamically when the server is first instantiated. It is expected that the pseudo-file system may not have an on-disk counterpart from which persistent filehandles could be constructed. Even though it is preferable that the server provide persistent filehandles for the pseudo-file system, the NFS client should expect that pseudo-file system filehandles are volatile. This can be confirmed by checking the associated "fh_expire_type" attribute for those filehandles in question. If the filehandles are volatile, the NFS client must be prepared to recover a filehandle value (e.g., with a multi-component LOOKUP) when receiving an error of NFS4ERR_FHEXPIRED.

服务器伪文件系统的本质是,它是服务器上可用的文件系统的逻辑表示。因此,伪文件系统最有可能在服务器第一次实例化时动态构建。预计伪文件系统可能没有可用于构造持久化文件句柄的磁盘上副本。尽管服务器最好为伪文件系统提供持久的文件句柄,但NFS客户机应该认为伪文件系统文件句柄是易变的。这可以通过检查相关文件句柄的“fh\u expire\u type”属性来确认。如果文件句柄是易失性的,则NFS客户端必须准备在接收到NFS4ERR_错误时恢复文件句柄值(例如,使用多组件查找)。

7.6. Exported Root
7.6. 导出根

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)
     /a/b    disk3  (exported)
        
     /       disk1  (exported)
     /a      disk2  (not exported)
     /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.

由于未导出disk2,因此无法通过简单的查找访问disk3。服务器必须使用伪文件系统来弥补这一差距。

7.7. Mount Point Crossing
7.7. 挂载点交叉口

The server file system environment may be constructed in such a way that one file system contains a directory that is 'covered' or mounted upon by a second file system. For example:

服务器文件系统环境可以这样构造:一个文件系统包含一个被第二个文件系统“覆盖”或挂载的目录。例如:

     /a/b            (file system 1)
     /a/b/c/d        (file system 2)
        
     /a/b            (file system 1)
     /a/b/c/d        (file system 2)
        

The pseudo-file system for this server may be constructed to look like:

此服务器的伪文件系统的构造如下所示:

     /               (placeholder/not exported)
     /a/b            (file system 1)
     /a/b/c/d        (file system 2)
        
     /               (placeholder/not exported)
     /a/b            (file system 1)
     /a/b/c/d        (file system 2)
        

It is the server's responsibility to present the pseudo-file system that is complete to the client. If the client sends a LOOKUP request for the path "/a/b/c/d", the server's response is the filehandle of the file system "/a/b/c/d". In previous versions of the NFS protocol, the server would respond with the filehandle of directory "/a/b/c/d" within the file system "/a/b".

服务器负责向客户端呈现完整的伪文件系统。如果客户端发送路径“/a/b/c/d”的查找请求,则服务器的响应是文件系统“/a/b/c/d”的文件句柄。在以前版本的NFS协议中,服务器将在文件系统“/a/b”中使用目录“/a/b/c/d”的文件句柄进行响应。

The NFS client will be able to determine if it crosses a server mount point by a change in the value of the "fsid" attribute.

NFS客户端将能够通过更改“fsid”属性的值来确定它是否跨越服务器装载点。

7.8. Security Policy and Namespace Presentation
7.8. 安全策略和命名空间表示

Because NFSv4 clients possess the ability to change the security mechanisms used, after determining what is allowed, by using SECINFO the server SHOULD NOT present a different view of the namespace based on the security mechanism being used by a client. Instead, it should present a consistent view and return NFS4ERR_WRONGSEC if an attempt is made to access data with an inappropriate security mechanism.

由于NFSv4客户端具有更改所用安全机制的能力,因此在确定允许的安全机制后,通过使用SECINFO,服务器不应基于客户端使用的安全机制呈现命名空间的不同视图。相反,如果试图使用不适当的安全机制访问数据,它应该提供一致的视图并返回NFS4ERR_-errosec。

If security considerations make it necessary to hide the existence of a particular file system, as opposed to all of the data within it, the server can apply the security policy of a shared resource in the server's namespace to components of the resource's ancestors. For example:

如果出于安全考虑,需要隐藏特定文件系统的存在,而不是其中的所有数据,则服务器可以将服务器命名空间中共享资源的安全策略应用于资源祖先的组件。例如:

       /                       (placeholder/not exported)
       /a/b                    (file system 1)
       /a/b/MySecretProject    (file system 2)
        
       /                       (placeholder/not exported)
       /a/b                    (file system 1)
       /a/b/MySecretProject    (file system 2)
        

The /a/b/MySecretProject directory is a real file system and is the shared resource. Suppose the security policy for /a/b/ MySecretProject is Kerberos with integrity and it is desired to limit knowledge of the existence of this file system. In this case, the server should apply the same security policy to /a/b. This allows for knowledge of the existence of a file system to be secured when desirable.

/a/b/MySecretProject目录是一个真正的文件系统,是共享资源。假设/a/b/MySecretProject的安全策略是具有完整性的Kerberos,需要限制对该文件系统存在的了解。在这种情况下,服务器应该对/a/b应用相同的安全策略。这允许在需要时了解要保护的文件系统的存在。

For the case of the use of multiple, disjoint security mechanisms in the server's resources, applying that sort of policy would result in the higher-level file system not being accessible using any security

对于在服务器资源中使用多个不相交的安全机制的情况,应用这种策略将导致无法使用任何安全机制访问更高级别的文件系统

flavor. Therefore, that sort of configuration is not compatible with hiding the existence (as opposed to the contents) from clients using multiple disjoint sets of security flavors.

风味因此,这种配置与使用多个不相交的安全风格集向客户端隐藏存在(与内容相反)是不兼容的。

In other circumstances, a desirable policy is for the security of a particular object in the server's namespace to include the union of all security mechanisms of all direct descendants. A common and convenient practice, unless strong security requirements dictate otherwise, is to make the entire pseudo-file system accessible by all of the valid security mechanisms.

在其他情况下,理想的策略是服务器命名空间中特定对象的安全性,以包括所有直接子体的所有安全机制的联合。除非强烈的安全性要求另有规定,否则一种常见且方便的做法是让所有有效的安全机制都可以访问整个伪文件系统。

Where there is concern about the security of data on the network, clients should use strong security mechanisms to access the pseudo-file system in order to prevent man-in-the-middle attacks.

如果担心网络上数据的安全性,客户端应使用强大的安全机制访问伪文件系统,以防止中间人攻击。

8. Multi-Server Namespace
8. 多服务器名称空间

NFSv4 supports attributes that allow a namespace to extend beyond the boundaries of a single server. It is RECOMMENDED that clients and servers support construction of such multi-server namespaces. Use of such multi-server namespaces is optional, however, and for many purposes, single-server namespaces are perfectly acceptable. Use of multi-server namespaces can provide many advantages, however, by separating a file system's logical position in a namespace from the (possibly changing) logistical and administrative considerations that result in particular file systems being located on particular servers.

NFSv4支持允许命名空间扩展到单个服务器边界之外的属性。建议客户端和服务器支持这种多服务器名称空间的构造。但是,使用这样的多服务器名称空间是可选的,对于许多目的,单服务器名称空间是完全可以接受的。但是,通过将文件系统在名称空间中的逻辑位置与导致特定文件系统位于特定服务器上的(可能不断变化的)后勤和管理考虑因素分开,使用多服务器名称空间可以提供许多优势。

8.1. Location Attributes
8.1. 位置属性

NFSv4 contains RECOMMENDED attributes that allow file systems on one server to be associated with one or more instances of that file system on other servers. These attributes specify such file system instances by specifying a server address target (as either a DNS name representing one or more IP addresses, or a literal IP address), together with the path of that file system within the associated single-server namespace.

NFSv4包含建议的属性,允许一台服务器上的文件系统与其他服务器上该文件系统的一个或多个实例相关联。这些属性通过指定服务器地址目标(作为表示一个或多个IP地址的DNS名称或文字IP地址)以及相关单个服务器名称空间中该文件系统的路径来指定此类文件系统实例。

The fs_locations RECOMMENDED attribute allows specification of the file system locations where the data corresponding to a given file system may be found.

fs_locations RECOMMENDED属性允许指定文件系统位置,其中可以找到与给定文件系统对应的数据。

8.2. File System Presence or Absence
8.2. 文件系统存在或不存在

A given location in an NFSv4 namespace (typically but not necessarily a multi-server namespace) can have a number of file system instance locations associated with it via the fs_locations attribute. There may also be an actual current file system at that location,

NFSv4名称空间(通常但不一定是多服务器名称空间)中的给定位置可以通过fs_locations属性与多个文件系统实例位置关联。在该位置还可能存在实际的当前文件系统,

accessible via normal namespace operations (e.g., LOOKUP). In this case, the file system is said to be "present" at that position in the namespace, and clients will typically use it, reserving use of additional locations specified via the location-related attributes to situations in which the principal location is no longer available.

可通过正常名称空间操作(例如,查找)访问。在这种情况下,文件系统被称为在名称空间中的该位置“存在”,客户端通常会使用它,在主位置不再可用的情况下保留使用通过位置相关属性指定的其他位置。

When there is no actual file system at the namespace location in question, the file system is said to be "absent". An absent file system contains no files or directories other than the root. Any reference to it, except to access a small set of attributes useful in determining alternative locations, will result in an error, NFS4ERR_MOVED. Note that if the server ever returns the error NFS4ERR_MOVED, it MUST support the fs_locations attribute.

当所讨论的名称空间位置没有实际的文件系统时,文件系统被称为“缺席”。缺少的文件系统不包含根目录以外的文件或目录。对它的任何引用,除了访问在确定替代位置时有用的一小组属性外,都将导致错误NFS4ERR_MOVED。请注意,如果服务器返回错误NFS4ERR_MOVED,它必须支持fs_locations属性。

While the error name suggests that we have a case of a file system that once was present, and has only become absent later, this is only one possibility. A position in the namespace may be permanently absent with the set of file system(s) designated by the location attributes being the only realization. The name NFS4ERR_MOVED reflects an earlier, more limited conception of its function, but this error will be returned whenever the referenced file system is absent, whether it has moved or simply never existed.

虽然错误名称表明我们有一个文件系统的案例,它曾经存在,但后来才消失,但这只是一种可能性。名称空间中的位置可能永久不存在,位置属性指定的文件系统集是唯一的实现。名称NFS4ERR_MOVED反映了对其功能的更早、更有限的概念,但只要引用的文件系统不存在,无论它是否已移动,都会返回此错误。

Except in the case of GETATTR-type operations (to be discussed later), when the current filehandle at the start of an operation is within an absent file system, that operation is not performed and the error NFS4ERR_MOVED is returned, to indicate that the file system is absent on the current server.

除GETATTR类型的操作(稍后讨论)外,当操作开始时的当前文件句柄位于不存在的文件系统内时,不会执行该操作,并返回错误NFS4ERR_MOVED,以指示当前服务器上不存在该文件系统。

Because a GETFH cannot succeed if the current filehandle is within an absent file system, filehandles within an absent file system cannot be transferred to the client. When a client does have filehandles within an absent file system, it is the result of obtaining them when the file system was present, and having the file system become absent subsequently.

由于如果当前文件句柄位于缺少的文件系统中,则GETFH无法成功,因此无法将缺少的文件系统中的文件句柄传输到客户端。如果客户机在不存在的文件系统中确实具有文件句柄,则这是在文件系统存在时获取这些句柄,并使文件系统随后变得不存在的结果。

It should be noted that because the check for the current filehandle being within an absent file system happens at the start of every operation, operations that change the current filehandle so that it is within an absent file system will not result in an error. This allows such combinations as PUTFH-GETATTR and LOOKUP-GETATTR to be used to get attribute information, particularly location attribute information, as discussed below.

应该注意的是,由于检查当前文件句柄是否在缺少的文件系统中是在每次操作开始时进行的,因此更改当前文件句柄以使其位于缺少的文件系统中的操作不会导致错误。这允许使用PUTFH-GETATTR和LOOKUP-GETATTR等组合来获取属性信息,特别是位置属性信息,如下所述。

8.3. Getting Attributes for an Absent File System
8.3. 获取缺失文件系统的属性

When a file system is absent, most attributes are not available, but it is necessary to allow the client access to the small set of attributes that are available, and most particularly that which gives information about the correct current locations for this file system, fs_locations.

当文件系统不存在时,大多数属性都不可用,但必须允许客户端访问可用的一小部分属性,尤其是提供有关此文件系统的正确当前位置信息的属性,即fs_位置。

8.3.1. GETATTR within an Absent File System
8.3.1. 缺少文件系统中的GETATTR

As mentioned above, an exception is made for GETATTR in that attributes may be obtained for a filehandle within an absent file system. This exception only applies if the attribute mask contains at least the fs_locations attribute bit, which indicates that the client is interested in a result regarding an absent file system. If it is not requested, GETATTR will result in an NFS4ERR_MOVED error.

如上所述,GETATTR有一个例外,即可以为缺少的文件系统中的文件句柄获取属性。此异常仅适用于属性掩码至少包含fs_locations属性位的情况,该属性位表示客户端对缺少文件系统的结果感兴趣。如果未请求,GETATTR将导致NFS4ERR_移动错误。

When a GETATTR is done on an absent file system, the set of supported attributes is very limited. Many attributes, including those that are normally REQUIRED, will not be available on an absent file system. In addition to the fs_locations attribute, the following attributes SHOULD be available on absent file systems. In the case of RECOMMENDED attributes, they should be available at least to the same degree that they are available on present file systems.

在缺少文件系统的情况下执行GETATTR时,支持的属性集非常有限。许多属性(包括通常需要的属性)在缺少的文件系统上不可用。除了fs_locations属性外,以下属性在缺少的文件系统上也应该可用。对于推荐的属性,它们的可用程度应至少与当前文件系统上的可用程度相同。

fsid: This attribute should be provided so that the client can determine file system boundaries, including, in particular, the boundary between present and absent file systems. This value must be different from any other fsid on the current server and need have no particular relationship to fsids on any particular destination to which the client might be directed.

fsid:应提供此属性,以便客户端可以确定文件系统边界,特别是现有和不存在的文件系统之间的边界。此值必须不同于当前服务器上的任何其他fsid,并且不需要与客户端可能指向的任何特定目标上的fsid具有特定关系。

mounted_on_fileid: For objects at the top of an absent file system, this attribute needs to be available. Since the fileid is within the present parent file system, there should be no need to reference the absent file system to provide this information.

mounted_on_fileid:对于不存在的文件系统顶部的对象,此属性需要可用。由于fileid位于当前父文件系统中,因此不需要引用缺少的文件系统来提供此信息。

Other attributes SHOULD NOT be made available for absent file systems, even when it is possible to provide them. The server should not assume that more information is always better and should avoid gratuitously providing additional information.

对于缺少的文件系统,即使可以提供其他属性,也不应提供这些属性。服务器不应该认为信息越多越好,应该避免无偿提供额外信息。

When a GETATTR operation includes a bitmask for the attribute fs_locations, but where the bitmask includes attributes that are not supported, GETATTR will not return an error but will return the mask of the actual attributes supported with the results.

当GETATTR操作包含属性fs_位置的位掩码,但位掩码包含不受支持的属性时,GETATTR不会返回错误,而是返回结果支持的实际属性的掩码。

Handling of VERIFY/NVERIFY is similar to GETATTR in that if the attribute mask does not include fs_locations the error NFS4ERR_MOVED will result. It differs in that any appearance in the attribute mask of an attribute not supported for an absent file system (and note that this will include some normally REQUIRED attributes) will also cause an NFS4ERR_MOVED result.

VERIFY/NVERIFY的处理类似于GETATTR,因为如果属性掩码不包括fs_位置,则会导致错误NFS4ERR_MOVED。它的不同之处在于,属性掩码中不受缺少的文件系统支持的属性的任何外观(请注意,这将包括一些通常需要的属性)也将导致NFS4ERR_移动结果。

8.3.2. READDIR and Absent File Systems
8.3.2. READDIR和缺席文件系统

A READDIR performed when the current filehandle is within an absent file system will result in an NFS4ERR_MOVED error, since, unlike the case of GETATTR, no such exception is made for READDIR.

当当前文件句柄位于不存在的文件系统内时执行的READDIR将导致NFS4ERR_MOVED错误,因为与GETATTR的情况不同,READDIR没有此类异常。

Attributes for an absent file system may be fetched via a READDIR for a directory in a present file system, when that directory contains the root directories of one or more absent file systems. In this case, the handling is as follows:

当当前文件系统中的目录包含一个或多个缺席文件系统的根目录时,缺席文件系统的属性可以通过READDIR获取。在这种情况下,处理如下:

o If the attribute set requested includes fs_locations, then the fetching of attributes proceeds normally, and no NFS4ERR_MOVED indication is returned even when the rdattr_error attribute is requested.

o 如果请求的属性集包括fs_位置,则属性的获取正常进行,即使请求rdattr_错误属性,也不会返回NFS4ERR_移动指示。

o If the attribute set requested does not include fs_locations, then if the rdattr_error attribute is requested, each directory entry for the root of an absent file system will report NFS4ERR_MOVED as the value of the rdattr_error attribute.

o 如果请求的属性集不包括fs_位置,则如果请求rdattr_错误属性,则缺少文件系统的根目录的每个目录项都将报告NFS4ERR_MOVED作为rdattr_错误属性的值。

o If the attribute set requested does not include either of the attributes fs_locations or rdattr_error, then the occurrence of the root of an absent file system within the directory will result in the READDIR failing with an NFS4ERR_MOVED error.

o 如果请求的属性集不包括属性fs_locations或rdattr_error,则目录中不存在文件系统的根目录将导致READDIR失败,并出现NFS4ERR_MOVED错误。

o The unavailability of an attribute because of a file system's absence, even one that is ordinarily REQUIRED, does not result in any error indication. The set of attributes returned for the root directory of the absent file system in that case is simply restricted to those actually available.

o 由于文件系统不存在而导致属性不可用,即使是通常需要的属性,也不会导致任何错误指示。在这种情况下,为不存在的文件系统的根目录返回的属性集仅限于那些实际可用的属性。

8.4. Uses of Location Information
8.4. 位置信息的使用

The location-bearing attribute of fs_locations provides, together with the possibility of absent file systems, a number of important facilities in providing reliable, manageable, and scalable data access.

fs_locations的位置承载属性与缺少文件系统的可能性一起,提供了许多重要的功能,以提供可靠、可管理和可扩展的数据访问。

When a file system is present, these attributes can provide alternative locations, to be used to access the same data, in the event of server failures, communications problems, or other difficulties that make continued access to the current file system impossible or otherwise impractical. Under some circumstances, multiple alternative locations may be used simultaneously to provide higher-performance access to the file system in question. Provision of such alternative locations is referred to as "replication", although there are cases in which replicated sets of data are not in fact present and the replicas are instead different paths to the same data.

当存在文件系统时,这些属性可以提供备用位置,以便在出现服务器故障、通信问题或其他导致无法继续访问当前文件系统或无法继续访问当前文件系统的困难时,用于访问相同的数据。在某些情况下,可以同时使用多个备选位置,以提供对相关文件系统的更高性能访问。提供此类替代位置称为“复制”,尽管在某些情况下,复制的数据集实际上不存在,而副本是指向相同数据的不同路径。

When a file system is present and subsequently becomes absent, clients can be given the opportunity to have continued access to their data, at an alternative location. Transfer of the file system contents to the new location is referred to as "migration". See Section 8.4.2 for details.

当文件系统存在并且随后不存在时,客户机可以有机会在其他位置继续访问其数据。将文件系统内容传输到新位置称为“迁移”。详见第8.4.2节。

Alternative locations may be physical replicas of the file system data or alternative communication paths to the same server or, in the case of various forms of server clustering, another server providing access to the same physical file system. The client's responsibilities in dealing with this transition depend on the specific nature of the new access path as well as how and whether data was in fact migrated. These issues will be discussed in detail below.

替代位置可以是文件系统数据的物理副本或到同一服务器的替代通信路径,或者在各种形式的服务器集群的情况下,提供对同一物理文件系统的访问的另一服务器。客户在处理此转换时的责任取决于新访问路径的特定性质以及数据的实际迁移方式和是否迁移。下面将详细讨论这些问题。

Where a file system was not previously present, specification of file system location provides a means by which file systems located on one server can be associated with a namespace defined by another server, thus allowing a general multi-server namespace facility. A designation of such a location, in place of an absent file system, is called a "referral".

当文件系统以前不存在时,文件系统位置规范提供了一种方法,通过这种方法,位于一台服务器上的文件系统可以与另一台服务器定义的名称空间相关联,从而允许使用通用的多服务器名称空间功能。指定这样一个位置来代替缺少的文件系统,称为“参考”。

Because client support for location-related attributes is OPTIONAL, a server may (but is not required to) take action to hide migration and referral events from such clients, by acting as a proxy, for example.

由于客户机对位置相关属性的支持是可选的,因此服务器可以(但不需要)通过代理等方式对这些客户机隐藏迁移和引用事件。

8.4.1. File System Replication
8.4.1. 文件系统复制

The fs_locations attribute provides alternative locations, to be used to access data in place of, or in addition to, the current file system instance. On first access to a file system, the client should obtain the value of the set of alternative locations by interrogating the fs_locations attribute.

fs_locations属性提供了替代位置,用于代替或补充当前文件系统实例访问数据。在第一次访问文件系统时,客户机应通过询问fs_locations属性来获取备选位置集的值。

In the event that server failures, communications problems, or other difficulties make continued access to the current file system impossible or otherwise impractical, the client can use the alternative locations as a way to get continued access to its data. Multiple locations may be used simultaneously, to provide higher performance through the exploitation of multiple paths between client and target file system.

如果服务器故障、通信问题或其他困难导致无法继续访问当前文件系统或无法继续访问当前文件系统,客户机可以使用其他位置作为继续访问其数据的方式。可以同时使用多个位置,通过利用客户端和目标文件系统之间的多个路径来提供更高的性能。

Multiple server addresses, whether they are derived from a single entry with a DNS name representing a set of IP addresses or from multiple entries each with its own server address, may correspond to the same actual server.

多个服务器地址,无论是从一个具有代表一组IP地址的DNS名称的单个条目中派生出来的,还是从多个具有各自服务器地址的条目中派生出来的,都可能对应于同一个实际服务器。

8.4.2. File System Migration
8.4.2. 文件系统迁移

When a file system is present and becomes absent, clients can be given the opportunity to have continued access to their data, at an alternative location, as specified by the fs_locations attribute. Typically, a client will be accessing the file system in question, get an NFS4ERR_MOVED error, and then use the fs_locations attribute to determine the new location of the data.

当文件系统存在且不存在时,客户机可以在fs_locations属性指定的其他位置继续访问其数据。通常,客户机将访问有问题的文件系统,获取NFS4ERR_MOVED错误,然后使用fs_locations属性确定数据的新位置。

Such migration can be helpful in providing load balancing or general resource reallocation. The protocol does not specify how the file system will be moved between servers. It is anticipated that a number of different server-to-server transfer mechanisms might be used, with the choice left to the server implementer. The NFSv4 protocol specifies the method used to communicate the migration event between client and server.

这种迁移有助于提供负载平衡或一般资源重新分配。该协议未指定文件系统在服务器之间移动的方式。预计可能会使用许多不同的服务器到服务器传输机制,选择权留给服务器实现者。NFSv4协议指定用于在客户端和服务器之间传递迁移事件的方法。

When an alternative location is designated as the target for migration, it must designate the same data. Where file systems are writable, a change made on the original file system must be visible on all migration targets. Where a file system is not writable but represents a read-only copy (possibly periodically updated) of a writable file system, similar requirements apply to the propagation of updates. Any change visible in the original file system must already be effected on all migration targets, to avoid any possibility that a client, in effecting a transition to the migration target, will see any reversion in file system state.

当替代位置被指定为迁移目标时,它必须指定相同的数据。如果文件系统是可写的,则对原始文件系统所做的更改必须在所有迁移目标上可见。如果文件系统不可写,但表示可写文件系统的只读副本(可能定期更新),则类似的要求适用于更新的传播。在原始文件系统中可见的任何更改必须已经在所有迁移目标上生效,以避免客户端在执行到迁移目标的转换时看到文件系统状态的任何恢复。

8.4.3. Referrals
8.4.3. 转介

Referrals provide a way of placing a file system in a location within the namespace essentially without respect to its physical location on a given server. This allows a single server or a set of servers to present a multi-server namespace that encompasses file systems

引用提供了一种将文件系统放置在命名空间中某个位置的方法,基本上不考虑其在给定服务器上的物理位置。这允许单个服务器或一组服务器呈现包含文件系统的多服务器命名空间

located on multiple servers. Some likely uses of this include establishment of site-wide or organization-wide namespaces, or even knitting such together into a truly global namespace.

位于多个服务器上。它的一些可能用途包括建立站点范围或组织范围的名称空间,甚至将这些名称空间组合成一个真正的全局名称空间。

Referrals occur when a client determines, upon first referencing a position in the current namespace, that it is part of a new file system and that the file system is absent. When this occurs, typically by receiving the error NFS4ERR_MOVED, the actual location or locations of the file system can be determined by fetching the fs_locations attribute.

当客户机在第一次引用当前名称空间中的位置时,确定该位置是新文件系统的一部分并且该文件系统不存在时,就会发生引用。发生这种情况时,通常通过接收错误NFS4ERR_MOVED,可以通过获取fs_locations属性来确定文件系统的实际位置。

The location-related attribute may designate a single file system location or multiple file system locations, to be selected based on the needs of the client.

位置相关属性可以指定单个文件系统位置或多个文件系统位置,以根据客户机的需要进行选择。

Use of multi-server namespaces is enabled by NFSv4 but is not required. The use of multi-server namespaces and their scope will depend on the applications used and system administration preferences.

NFSv4支持使用多服务器名称空间,但不是必需的。多服务器名称空间的使用及其范围将取决于所使用的应用程序和系统管理首选项。

Multi-server namespaces can be established by a single server providing a large set of referrals to all of the included file systems. Alternatively, a single multi-server namespace may be administratively segmented with separate referral file systems (on separate servers) for each separately administered portion of the namespace. The top-level referral file system or any segment may use replicated referral file systems for higher availability.

多服务器名称空间可以由一台服务器建立,该服务器提供对所有包含的文件系统的大量引用。或者,单个多服务器名称空间可以使用单独的引用文件系统(在单独的服务器上)对名称空间的每个单独管理部分进行管理分段。顶级转诊文件系统或任何细分市场都可以使用复制的转诊文件系统以获得更高的可用性。

Generally, multi-server namespaces are for the most part uniform, in that the same data made available to one client at a given location in the namespace is made available to all clients at that location.

通常,多服务器名称空间在很大程度上是统一的,因为名称空间中给定位置的一个客户端可以使用的相同数据,在该位置的所有客户端都可以使用。

8.5. Location Entries and Server Identity
8.5. 位置条目和服务器标识

As mentioned above, a single location entry may have a server address target in the form of a DNS name that may represent multiple IP addresses, while multiple location entries may have their own server address targets that reference the same server.

如上所述,单个位置项可以具有DNS名称形式的服务器地址目标,该DNS名称可以表示多个IP地址,而多个位置项可以具有引用同一服务器的自己的服务器地址目标。

When multiple addresses for the same server exist, the client may assume that for each file system in the namespace of a given server network address, there exist file systems at corresponding namespace locations for each of the other server network addresses. It may do this even in the absence of explicit listing in fs_locations. Such corresponding file system locations can be used as alternative locations, just as those explicitly specified via the fs_locations attribute.

当同一服务器存在多个地址时,客户机可能会假定,对于给定服务器网络地址的命名空间中的每个文件系统,在其他每个服务器网络地址的相应命名空间位置都存在文件系统。即使在fs_位置中没有明确的列表,它也可以这样做。这些相应的文件系统位置可以用作替代位置,就像通过fs_locations属性显式指定的位置一样。

If a single location entry designates multiple server IP addresses, the client should choose a single one to use. When two server addresses are designated by a single location entry and they correspond to different servers, this normally indicates some sort of misconfiguration, and so the client should avoid using such location entries when alternatives are available. When they are not, clients should pick one of the IP addresses and use it, without using others that are not directed to the same server.

如果单个位置条目指定多个服务器IP地址,则客户端应选择一个要使用的IP地址。当两个服务器地址由一个位置条目指定,并且它们对应于不同的服务器时,这通常表示存在某种配置错误,因此当有其他选择时,客户端应避免使用此类位置条目。如果不是,客户端应该选择一个IP地址并使用它,而不使用其他不指向同一服务器的IP地址。

8.6. Additional Client-Side Considerations
8.6. 其他客户端注意事项

When clients make use of servers that implement referrals, replication, and migration, care should be taken that a user who mounts a given file system that includes a referral or a relocated file system continues to see a coherent picture of that user-side file system despite the fact that it contains a number of server-side file systems that may be on different servers.

当客户端使用实现转介、复制和迁移的服务器时,应注意,装载包含引用或重新定位文件系统的给定文件系统的用户继续看到该用户端文件系统的一致图片,尽管它包含许多可能位于不同服务器上的服务器端文件系统。

One important issue is upward navigation from the root of a server-side file system to its parent (specified as ".." in UNIX), in the case in which it transitions to that file system as a result of referral, migration, or a transition as a result of replication. When the client is at such a point, and it needs to ascend to the parent, it must go back to the parent as seen within the multi-server namespace rather than sending a LOOKUPP operation to the server, which would result in the parent within that server's single-server namespace. In order to do this, the client needs to remember the filehandles that represent such file system roots and use these instead of issuing a LOOKUPP operation to the current server. This will allow the client to present to applications a consistent namespace, where upward navigation and downward navigation are consistent.

一个重要问题是从服务器端文件系统的根目录向上导航到其父目录(在UNIX中指定为“.”),在这种情况下,由于引用、迁移或复制而转换到该文件系统。当客户端处于这样的位置,并且需要提升到父级时,它必须返回到多服务器名称空间中看到的父级,而不是向服务器发送LOOKUPP操作,这将导致该服务器的单服务器名称空间中的父级。为了做到这一点,客户机需要记住表示这些文件系统根的文件句柄,并使用它们,而不是向当前服务器发出LOOKUPP操作。这将允许客户端向应用程序提供一致的命名空间,其中向上导航和向下导航是一致的。

Another issue concerns refresh of referral locations. When referrals are used extensively, they may change as server configurations change. It is expected that clients will cache information related to traversing referrals so that future client-side requests are resolved locally without server communication. This is usually rooted in client-side name lookup caching. Clients should periodically purge this data for referral points in order to detect changes in location information.

另一个问题涉及转诊地点的更新。广泛使用转介时,它们可能会随着服务器配置的更改而更改。预期客户端将缓存与遍历引用相关的信息,以便将来的客户端请求在本地解析,而无需服务器通信。这通常源于客户端名称查找缓存。客户应定期清除转诊点的这些数据,以便检测位置信息的变化。

A potential problem exists if a client were to allow an open-owner to have state on multiple file systems on a server, in that it is unclear how the sequence numbers associated with open-owners are to be dealt with, in the event of transparent state migration. A client can avoid such a situation if it ensures that any use of an open-owner is confined to a single file system.

如果客户端允许开放所有者在服务器上的多个文件系统上拥有状态,则存在一个潜在问题,因为在透明状态迁移的情况下,不清楚如何处理与开放所有者关联的序列号。如果客户机确保开放所有者的任何使用仅限于单个文件系统,则可以避免这种情况。

A server MAY decline to migrate state associated with open-owners that span multiple file systems. In cases in which the server chooses not to migrate such state, the server MUST return NFS4ERR_BAD_STATEID when the client uses those stateids on the new server.

服务器可能会拒绝迁移与跨多个文件系统的开放所有者关联的状态。在服务器选择不迁移这种状态的情况下,当客户端在新服务器上使用这些STATEID时,服务器必须返回NFS4ERR_BAD_STATEID。

The server MUST return NFS4ERR_STALE_STATEID when the client uses those stateids on the old server, regardless of whether migration has occurred or not.

当客户端在旧服务器上使用NFS4ERR_STALE_STATEID时,服务器必须返回NFS4ERR_STALE_STATEID,无论是否发生迁移。

8.7. Effecting File System Referrals
8.7. 影响文件系统引用

Referrals are effected when an absent file system is encountered and one or more alternative locations are made available by the fs_locations attribute. The client will typically get an NFS4ERR_MOVED error, fetch the appropriate location information, and proceed to access the file system on a different server, even though it retains its logical position within the original namespace. Referrals differ from migration events in that they happen only when the client has not previously referenced the file system in question (so there is nothing to transition). Referrals can only come into effect when an absent file system is encountered at its root.

当遇到不存在的文件系统并且fs_locations属性提供了一个或多个替代位置时,将影响引用。客户机通常会收到NFS4ERR_MOVED错误,获取适当的位置信息,并继续访问不同服务器上的文件系统,即使它在原始命名空间中保留其逻辑位置。引用与迁移事件的不同之处在于,它们仅在客户端以前没有引用过相关的文件系统时发生(因此不需要转换)。只有在根目录中遇到缺少的文件系统时,引用才能生效。

The examples given in the sections below are somewhat artificial in that an actual client will not typically do a multi-component lookup but will have cached information regarding the upper levels of the name hierarchy. However, these example are chosen to make the required behavior clear and easy to put within the scope of a small number of requests, without getting unduly into details of how specific clients might choose to cache things.

下面几节中给出的示例有些人为,因为实际的客户机通常不会执行多组件查找,但会缓存有关名称层次结构上层的信息。然而,选择这些示例是为了使所需的行为清晰,并且易于放在少量请求的范围内,而不必过分详细地说明特定客户机可能如何选择缓存内容。

8.7.1. Referral Example (LOOKUP)
8.7.1. 推荐示例(查找)

Let us suppose that the following COMPOUND is sent in an environment in which /this/is/the/path is absent from the target server. This may be for a number of reasons. It may be the case that the file system has moved, or it may be the case that the target server is functioning mainly, or solely, to refer clients to the servers on which various file systems are located.

假设在目标服务器中不存在/this/is/the/path的环境中发送以下化合物。这可能有很多原因。可能是文件系统已移动,也可能是目标服务器主要或仅在将客户端引用到各种文件系统所在的服务器。

o PUTROOTFH

o PUTROOTFH

o LOOKUP "this"

o 查找“此”

o LOOKUP "is"

o 查找“是”

o LOOKUP "the"

o 查找“the”

o LOOKUP "path"

o 查找“路径”

o GETFH

o GETFH

o GETATTR(fsid, fileid, size, time_modify)

o GETATTR(fsid、fileid、大小、时间\u修改)

Under the given circumstances, the following will be the result:

在特定情况下,结果如下:

o PUTROOTFH --> NFS_OK. The current fh is now the root of the pseudo-fs.

o PUTROOTFH-->NFS\u正常。当前fh现在是伪fs的根。

o LOOKUP "this" --> NFS_OK. The current fh is for /this and is within the pseudo-fs.

o 查找“this”->NFS\u确定。当前fh适用于/且在伪fs范围内。

o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is within the pseudo-fs.

o 查找“是”-->NFS\u正常。当前fh为/this/is,且在伪fs范围内。

o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and is within the pseudo-fs.

o 查找“the”-->NFS\u确定。当前fh用于/this/is/The,并且在伪fs内。

o LOOKUP "path" --> NFS_OK. The current fh is for /this/is/the/path and is within a new, absent file system, but ... the client will never see the value of that fh.

o 查找“路径”-->NFS\u确定。当前fh用于/this/is/The/path,并且位于一个新的、缺少的文件系统中,但是。。。客户永远看不到fh的价值。

o GETFH --> NFS4ERR_MOVED. Fails, because the current fh is in an absent file system at the start of the operation and the specification makes no exception for GETFH.

o GETFH-->NFS4ERR\u已移动。失败,因为当前fh在操作开始时位于缺少的文件系统中,并且规范对GETFH也不例外。

o GETATTR(fsid, fileid, size, time_modify). Not executed, because the failure of the GETFH stops the processing of the COMPOUND.

o GETATTR(fsid、fileid、大小、时间和修改)。未执行,因为GETFH的故障停止了化合物的处理。

Given the failure of the GETFH, the client has the job of determining the root of the absent file system and where to find that file system, i.e., the server and path relative to that server's root fh. Note here that in this example, the client did not obtain filehandles and attribute information (e.g., fsid) for the intermediate directories, so that it would not be sure where the absent file system starts. It could be the case, for example, that /this/is/the is the root of the moved file system and that the reason that the lookup of "path" succeeded is that the file system was not absent on

考虑到GETFH的失败,客户端的任务是确定缺少的文件系统的根,以及在哪里找到该文件系统,即服务器和相对于该服务器的根fh的路径。请注意,在此示例中,客户机没有获取中间目录的文件句柄和属性信息(例如,fsid),因此无法确定缺少的文件系统从何处启动。例如,/this/is/the可能是已移动文件系统的根目录,查找“path”成功的原因可能是上没有缺少文件系统

that operation but was moved between the last LOOKUP and the GETFH (since COMPOUND is not atomic). Even if we had the fsids for all of the intermediate directories, we could have no way of knowing that /this/is/the/path was the root of a new file system, since we don't yet have its fsid.

但在最后一次查找和GETFH之间移动了该操作(因为化合物不是原子的)。即使我们拥有所有中间目录的fsid,我们也无法知道/this/is/the/path是新文件系统的根,因为我们还没有它的fsid。

In order to get the necessary information, let us re-send the chain of LOOKUPs with GETFHs and GETATTRs to at least get the fsids so we can be sure where the appropriate file system boundaries are. The client could choose to get fs_locations at the same time, but in most cases the client will have a good guess as to where the file system boundaries are (because of where NFS4ERR_MOVED was, and was not, received), making the fetching of fs_locations unnecessary.

为了获得必要的信息,让我们使用GETFHs和GETATTRs重新发送查找链,以至少获取fsid,这样我们就可以确定适当的文件系统边界在哪里。客户机可以选择同时获取fs_位置,但在大多数情况下,客户机都可以很好地猜测文件系统边界的位置(因为NFS4ERR_移动的位置和未接收的位置),因此不需要获取fs_位置。

   OP01:  PUTROOTFH --> NFS_OK
        
   OP01:  PUTROOTFH --> NFS_OK
        

- The current fh is at the root of the pseudo-fs.

- 当前fh位于伪fs的根。

   OP02:  GETATTR(fsid) --> NFS_OK
        
   OP02:  GETATTR(fsid) --> NFS_OK
        

- Just for completeness. Normally, clients will know the fsid of the pseudo-fs as soon as they establish communication with a server.

- 只是为了完整。通常,客户机在与服务器建立通信后就会知道伪fs的fsid。

   OP03:  LOOKUP "this" --> NFS_OK
        
   OP03:  LOOKUP "this" --> NFS_OK
        
   OP04:  GETATTR(fsid) --> NFS_OK
        
   OP04:  GETATTR(fsid) --> NFS_OK
        

- Get the current fsid to see where the file system boundaries are. The fsid will be that for the pseudo-fs in this example, so no boundary.

- 获取当前fsid以查看文件系统边界的位置。fsid将是本例中伪fs的fsid,因此没有边界。

   OP05:  GETFH --> NFS_OK
        
   OP05:  GETFH --> NFS_OK
        

- The current fh is for /this and is within the pseudo-fs.

- 当前fh适用于/且在伪fs范围内。

   OP06:  LOOKUP "is" --> NFS_OK
        
   OP06:  LOOKUP "is" --> NFS_OK
        

- The current fh is for /this/is and is within the pseudo-fs.

- 当前fh为/this/is,且在伪fs范围内。

   OP07:  GETATTR(fsid) --> NFS_OK
        
   OP07:  GETATTR(fsid) --> NFS_OK
        

- Get the current fsid to see where the file system boundaries are. The fsid will be that for the pseudo-fs in this example, so no boundary.

- 获取当前fsid以查看文件系统边界的位置。fsid将是本例中伪fs的fsid,因此没有边界。

   OP08:  GETFH --> NFS_OK
        
   OP08:  GETFH --> NFS_OK
        

- The current fh is for /this/is and is within the pseudo-fs.

- 当前fh为/this/is,且在伪fs范围内。

   OP09:  LOOKUP "the" --> NFS_OK
        
   OP09:  LOOKUP "the" --> NFS_OK
        

- The current fh is for /this/is/the and is within the pseudo-fs.

- 当前fh用于/this/is/The,并且在伪fs内。

   OP10:  GETATTR(fsid) --> NFS_OK
        
   OP10:  GETATTR(fsid) --> NFS_OK
        

- Get the current fsid to see where the file system boundaries are. The fsid will be that for the pseudo-fs in this example, so no boundary.

- 获取当前fsid以查看文件系统边界的位置。fsid将是本例中伪fs的fsid,因此没有边界。

   OP11:  GETFH --> NFS_OK
        
   OP11:  GETFH --> NFS_OK
        

- The current fh is for /this/is/the and is within the pseudo-fs.

- 当前fh用于/this/is/The,并且在伪fs内。

   OP12:  LOOKUP "path" --> NFS_OK
        
   OP12:  LOOKUP "path" --> NFS_OK
        

- The current fh is for /this/is/the/path and is within a new, absent file system, but ...

- 当前fh用于/this/is/The/path,并且位于一个新的、缺少的文件系统中,但是。。。

- The client will never see the value of that fh.

- 客户永远看不到fh的价值。

   OP13:  GETATTR(fsid, fs_locations) --> NFS_OK
        
   OP13:  GETATTR(fsid, fs_locations) --> NFS_OK
        

- We are getting the fsid to know where the file system boundaries are. In this operation, the fsid will be different than that of the parent directory (which in turn was retrieved in OP10). Note that the fsid we are given will not necessarily be preserved at the new location. That fsid might be different, and in fact the fsid we have for this file system might be a valid fsid of a different file system on that new server.

- 我们正在让fsid知道文件系统边界在哪里。在这个操作中,fsid将不同于父目录的fsid(父目录又在OP10中检索到)。请注意,我们获得的fsid不一定会保留在新位置。该fsid可能不同,事实上,我们为该文件系统提供的fsid可能是新服务器上不同文件系统的有效fsid。

- In this particular case, we are pretty sure anyway that what has moved is /this/is/the/path rather than /this/is/the since we have the fsid of the latter and it is that of the pseudo-fs, which presumably cannot move. However, in other examples, we might not have this kind of information to rely on (e.g., /this/is/the might be a non-pseudo-file system separate from /this/is/the/path), so we need to have other reliable source information on the boundary of the file system that is moved. If, for example, the file system /this/is had moved, we would have a case of migration rather than referral, and once the boundaries of the migrated file system were clear we could fetch fs_locations.

- 在这个特殊的例子中,我们非常确定已经移动的是/this/is/the/path而不是/this/is/the,因为我们有后者的fsid,它是伪fs的fsid,它可能无法移动。但是,在其他示例中,我们可能没有此类信息可依赖(例如,/this/is/the可能是与/this/is/the/path分离的非伪文件系统),因此我们需要在移动的文件系统边界上有其他可靠的源信息。例如,如果文件系统/this/is已移动,我们将遇到迁移而不是引用的情况,并且一旦迁移的文件系统的边界被清除,我们就可以获取fs_位置。

- We are fetching fs_locations because the fact that we got an NFS4ERR_MOVED at this point means that this is most likely a referral and we need the destination. Even if it is the case that /this/is/the is a file system that has migrated, we will still need the location information for that file system.

- 我们正在获取fs_位置,因为我们在此时移动了一个NFS4ERR_,这意味着这很可能是一个转介,我们需要目的地。即使/this/is/the是已迁移的文件系统,我们仍然需要该文件系统的位置信息。

   OP14:  GETFH --> NFS4ERR_MOVED
        
   OP14:  GETFH --> NFS4ERR_MOVED
        

- Fails because current fh is in an absent file system at the start of the operation, and the specification makes no exception for GETFH. Note that this means the server will never send the client a filehandle from within an absent file system.

- 失败,因为在操作开始时,当前fh位于缺少的文件系统中,并且规范对GETFH也不例外。请注意,这意味着服务器永远不会从缺少的文件系统中向客户端发送文件句柄。

Given the above, the client knows where the root of the absent file system is (/this/is/the/path) by noting where the change of fsid occurred (between "the" and "path"). The fs_locations attribute also gives the client the actual location of the absent file system so that the referral can proceed. The server gives the client the bare minimum of information about the absent file system so that there will be very little scope for problems of conflict between information sent by the referring server and information of the file system's home. No filehandles and very few attributes are present on the referring server, and the client can treat those it receives as transient information with the function of enabling the referral.

鉴于上述情况,客户机通过注意fsid的更改发生在何处(在“the”和“path”之间),知道缺少的文件系统的根在何处(/this/is/the/path)。fs_locations属性还为客户端提供缺少的文件系统的实际位置,以便可以继续引用。服务器向客户机提供关于缺少的文件系统的最低限度的信息,这样,在引用服务器发送的信息与文件系统的主信息之间发生冲突的问题的范围将非常小。引用服务器上没有文件句柄,属性也很少,客户端可以使用启用引用的功能将接收到的文件句柄和属性视为临时信息。

8.7.2. Referral Example (READDIR)
8.7.2. 参考示例(READDIR)

Another context in which a client may encounter referrals is when it does a READDIR on a directory in which some of the subdirectories are the roots of absent file systems.

客户机可能遇到引用的另一个上下文是,当它在一个目录上执行READDIR时,其中一些子目录是不存在的文件系统的根。

Suppose such a directory is read as follows:

假设这样一个目录如下所示:

o PUTROOTFH

o PUTROOTFH

o LOOKUP "this"

o 查找“此”

o LOOKUP "is"

o 查找“是”

o LOOKUP "the"

o 查找“the”

o READDIR(fsid, size, time_modify, mounted_on_fileid)

o READDIR(fsid、大小、时间、修改、在文件ID上挂载)

In this case, because rdattr_error is not requested, fs_locations is not requested, and some of the attributes cannot be provided, the result will be an NFS4ERR_MOVED error on the READDIR, with the detailed results as follows:

在这种情况下,由于未请求rdattr_错误,未请求fs_位置,并且无法提供某些属性,因此结果将是READDIR上的NFS4ERR_移动错误,详细结果如下:

o PUTROOTFH --> NFS_OK. The current fh is at the root of the pseudo-fs.

o PUTROOTFH-->NFS\u正常。当前fh位于伪fs的根。

o LOOKUP "this" --> NFS_OK. The current fh is for /this and is within the pseudo-fs.

o 查找“this”->NFS\u确定。当前fh适用于/且在伪fs范围内。

o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is within the pseudo-fs.

o 查找“是”-->NFS\u正常。当前fh为/this/is,且在伪fs范围内。

o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and is within the pseudo-fs.

o 查找“the”-->NFS\u确定。当前fh用于/this/is/The,并且在伪fs内。

o READDIR(fsid, size, time_modify, mounted_on_fileid) --> NFS4ERR_MOVED. Note that the same error would have been returned if /this/is/the had migrated, but it is returned because the directory contains the root of an absent file system.

o READDIR(fsid、大小、时间、修改、在文件ID上挂载)-->NFS4ERR\u已移动。请注意,如果/this/is/the已迁移,则会返回相同的错误,但返回该错误是因为该目录包含缺少的文件系统的根。

So now suppose that we re-send with rdattr_error:

现在假设我们用rdattr_错误重新发送:

o PUTROOTFH

o PUTROOTFH

o LOOKUP "this"

o 查找“此”

o LOOKUP "is"

o 查找“是”

o LOOKUP "the"

o 查找“the”

o READDIR(rdattr_error, fsid, size, time_modify, mounted_on_fileid)

o READDIR(rdattr错误、fsid、大小、时间、修改、在文件ID上挂载)

The results will be:

结果将是:

o PUTROOTFH --> NFS_OK. The current fh is at the root of the pseudo-fs.

o PUTROOTFH-->NFS\u正常。当前fh位于伪fs的根。

o LOOKUP "this" --> NFS_OK. The current fh is for /this and is within the pseudo-fs.

o 查找“this”->NFS\u确定。当前fh适用于/且在伪fs范围内。

o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is within the pseudo-fs.

o 查找“是”-->NFS\u正常。当前fh为/this/is,且在伪fs范围内。

o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and is within the pseudo-fs.

o 查找“the”-->NFS\u确定。当前fh用于/this/is/The,并且在伪fs内。

o READDIR(rdattr_error, fsid, size, time_modify, mounted_on_fileid) --> NFS_OK. The attributes for the directory entry with the component named "path" will only contain rdattr_error with the value NFS4ERR_MOVED, together with an fsid value and a value for mounted_on_fileid.

o READDIR(rdattr\u错误、fsid、大小、时间\u修改、在\u文件ID上装载)->NFS\u正常。名为“path”的组件的目录项的属性将仅包含值为NFS4ERR_MOVED的rdattr_error,以及fsid值和fileid上mounted_的值。

So suppose we do another READDIR to get fs_locations (although we could have used a GETATTR directly, as in Section 8.7.1):

因此,假设我们执行另一个READDIR来获取fs_位置(尽管我们可以直接使用GETATTR,如第8.7.1节所述):

o PUTROOTFH

o PUTROOTFH

o LOOKUP "this"

o 查找“此”

o LOOKUP "is"

o 查找“是”

o LOOKUP "the"

o 查找“the”

o READDIR(rdattr_error, fs_locations, mounted_on_fileid, fsid, size, time_modify)

o READDIR(rdattr\u错误、fs\u位置、文件ID上的挂载\u、fsid、大小、时间\u修改)

The results would be:

结果将是:

o PUTROOTFH --> NFS_OK. The current fh is at the root of the pseudo-fs.

o PUTROOTFH-->NFS\u正常。当前fh位于伪fs的根。

o LOOKUP "this" --> NFS_OK. The current fh is for /this and is within the pseudo-fs.

o 查找“this”->NFS\u确定。当前fh适用于/且在伪fs范围内。

o LOOKUP "is" --> NFS_OK. The current fh is for /this/is and is within the pseudo-fs.

o 查找“是”-->NFS\u正常。当前fh为/this/is,且在伪fs范围内。

o LOOKUP "the" --> NFS_OK. The current fh is for /this/is/the and is within the pseudo-fs.

o 查找“the”-->NFS\u确定。当前fh用于/this/is/The,并且在伪fs内。

o READDIR(rdattr_error, fs_locations, mounted_on_fileid, fsid, size, time_modify) --> NFS_OK. The attributes will be as shown below.

o READDIR(rdattr\u错误、fs\u位置、文件ID上的挂载、fsid、大小、时间\u修改)->NFS\u正常。属性如下所示。

The attributes for the directory entry with the component named "path" will only contain:

组件名为“path”的目录项的属性将仅包含:

o rdattr_error (value: NFS_OK)

o rdattr_错误(值:NFS_OK)

o fs_locations

o 财政司司长办公室地点

o mounted_on_fileid (value: unique fileid within referring file system)

o 在文件ID上装入文件(值:引用文件系统中的唯一文件ID)

o fsid (value: unique value within referring server)

o fsid(值:引用服务器中的唯一值)

The attributes for entry "path" will not contain size or time_modify, because these attributes are not available within an absent file system.

条目“path”的属性将不包含size或time\u modify,因为这些属性在缺少的文件系统中不可用。

8.8. The Attribute fs_locations
8.8. 属性fs_位置

The fs_locations attribute is defined by both fs_location4 (Section 2.2.6) and fs_locations4 (Section 2.2.7). It is used to represent the location of a file system by providing a server name and the path to the root of the file system within that server's namespace. When a set of servers have corresponding file systems at the same path within their namespaces, an array of server names may be provided. An entry in the server array is a UTF-8 string and represents one of a traditional DNS host name, IPv4 address, IPv6 address, or a zero-length string. A zero-length string SHOULD be used to indicate the current address being used for the RPC. It is not a requirement that all servers that share the same rootpath be listed in one fs_location4 instance. The array of server names is provided for convenience. Servers that share the same rootpath may also be listed in separate fs_location4 entries in the fs_locations attribute.

fs_位置属性由fs_位置4(第2.2.6节)和fs_位置4(第2.2.7节)定义。它通过提供服务器名称和文件系统根目录在服务器名称空间中的路径来表示文件系统的位置。当一组服务器在其名称空间内的同一路径上具有相应的文件系统时,可以提供服务器名称数组。服务器阵列中的条目是UTF-8字符串,表示传统DNS主机名、IPv4地址、IPv6地址或零长度字符串之一。长度为零的字符串应用于指示RPC使用的当前地址。不要求共享同一根路径的所有服务器都列在一个fs_location4实例中。为方便起见,提供了服务器名称数组。共享同一根路径的服务器也可能列在fs_locations属性的单独fs_location4条目中。

The fs_locations4 data type and fs_locations attribute contain an array of such locations. Since the namespace of each server may be constructed differently, the fs_root field is provided. The path represented by the fs_root represents the location of the file system in the current server's namespace, i.e., that of the server from which the fs_locations attribute was obtained. The fs_root path is meant to aid the client by clearly referencing the root of the file system whose locations are being reported, no matter what object within the current file system the current filehandle designates. The fs_root is simply the pathname the client used to reach the object on the current server (i.e., the object to which the fs_locations attribute applies).

fs_locations4数据类型和fs_locations属性包含此类位置的数组。由于每个服务器的名称空间的构造可能不同,因此提供了fs_root字段。由fs_根表示的路径表示文件系统在当前服务器名称空间中的位置,即获取fs_locations属性的服务器的位置。fs_根路径旨在通过明确引用正在报告其位置的文件系统的根来帮助客户端,无论当前文件句柄指定当前文件系统中的哪个对象。fs_根只是客户端用来访问当前服务器上的对象(即fs_locations属性所应用的对象)的路径名。

When the fs_locations attribute is interrogated and there are no alternative file system locations, the server SHOULD return a zero-length array of fs_location4 structures, together with a valid fs_root.

当查询fs_locations属性且没有其他文件系统位置时,服务器应返回fs_location4结构的零长度数组以及有效的fs_根。

   As an example, suppose 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.
   If the client were to obtain the fs_locations value for the directory
   at /a/b/c/d, it might not necessarily know that the file system's
   root is located in servA's namespace 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 represented by the path /x/y/z/d
        
   As an example, suppose 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.
   If the client were to obtain the fs_locations value for the directory
   at /a/b/c/d, it might not necessarily know that the file system's
   root is located in servA's namespace 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 represented by the path /x/y/z/d
        

on servB. To facilitate this, the fs_locations attribute provided by servA would have an fs_root value of /a/b/c and two entries in fs_locations. One entry in fs_locations will be for itself (servA), and the other will be for servB with a path of /x/y/z. With this information, the client is able to substitute /x/y/z for /a/b/c at the beginning of its access path and construct /x/y/z/d to use for the new server.

在servB上。为了便于实现这一点,servA提供的fs_locations属性的fs_根值为/a/b/c,在fs_位置中有两个条目。fs_位置中的一个条目将用于自身(servA),另一个条目将用于路径为/x/y/z的servB。有了这些信息,客户端可以在其访问路径的开始处用/x/y/z替换/a/b/c,并构造/x/y/z/d以用于新服务器。

Note that there is no requirement that the number of components in each rootpath be the same; there is no relation between the number of components in the rootpath or fs_root, and none of the components in each rootpath and fs_root have to be the same. In the above example, we could have had a third element in the locations array, with server equal to "servC" and rootpath equal to "/I/II", and a fourth element in the locations array, with server equal to "servD" and rootpath equal to "/aleph/beth/gimel/daleth/he".

注意,没有要求每个根路径中的组件数量相同;根路径或fs_根中的组件数量之间没有关系,每个根路径和fs_根中的组件都不必相同。在上面的示例中,我们可以在locations数组中有第三个元素,其中server等于“servC”,rootpath等于“/I/II”;在locations数组中有第四个元素,server等于“servD”,rootpath等于“/aleph/beth/gimel/daleth/he”。

The relationship between an fs_root and a rootpath is that the client replaces the pathname indicated in the fs_root for the current server for the substitute indicated in the rootpath for the new server.

fs_根目录和根路径之间的关系是,客户端将当前服务器的fs_根目录中指示的路径名替换为新服务器的根路径中指示的替换项。

For an example of a referred or migrated file system, suppose there is a file system located at serv1. At serv1, the file system is located at /az/buky/vedi/glagoli. The client finds that the object at glagoli has migrated (or is a referral). The client gets the fs_locations attribute, which contains an fs_root of /az/buky/vedi/ glagoli, and one element in the locations array, with server equal to serv2, and rootpath equal to /izhitsa/fita. The client replaces /az/buky/vedi/glagoli with /izhitsa/fita and uses the latter pathname on serv2.

对于引用或迁移的文件系统示例,假设有一个文件系统位于serv1。在serv1中,文件系统位于/az/buky/vedi/glagoli。客户端发现glagoli的对象已迁移(或是引用)。客户端获取fs_locations属性,该属性包含/az/buky/vedi/glagoli的fs_根,以及locations数组中的一个元素,其中server等于serv2,rootpath等于/izhitsa/fita。客户端将/az/buky/vedi/glagoli替换为/izhitsa/fita,并在serv2上使用后者的路径名。

Thus, the server MUST return an fs_root that is equal to the path the client used to reach the object to which the fs_locations attribute applies. Otherwise, the client cannot determine the new path to use on the new server.

因此,服务器必须返回一个fs_根,该根等于客户端用来到达应用fs_locations属性的对象的路径。否则,客户端无法确定要在新服务器上使用的新路径。

9. File Locking and Share Reservations
9. 文件锁定和共享保留

Integrating locking into the NFS protocol necessarily causes it to be stateful. With the inclusion of share reservations, the protocol becomes substantially more dependent on state than the traditional combination of NFS and NLM (Network Lock Manager) [xnfs]. There are three components to making this state manageable:

将锁定集成到NFS协议中必然会导致它是有状态的。由于包含了共享保留,协议比NFS和NLM(网络锁管理器)[xnfs]的传统组合更依赖于状态。要使此状态易于管理,有三个组件:

o clear division between client and server

o 清除客户端和服务器之间的划分

o ability to reliably detect inconsistency in state between client and server

o 能够可靠地检测客户端和服务器之间状态的不一致性

o simple and robust recovery mechanisms

o 简单而稳健的恢复机制

In this model, the server owns the state information. The client requests changes in locks, and the server responds with the changes made. Non-client-initiated changes in locking state are infrequent. The client receives prompt notification of such changes and can adjust its view of the locking state to reflect the server's changes.

在此模型中,服务器拥有状态信息。客户机请求更改锁,服务器响应所做的更改。锁定状态中非客户端启动的更改很少。客户机收到此类更改的提示通知,并可以调整其锁定状态视图以反映服务器的更改。

Individual pieces of state created by the server and passed to the client at its request are represented by 128-bit stateids. These stateids may represent a particular open file, a set of byte-range locks held by a particular owner, or a recallable delegation of privileges to access a file in particular ways or at a particular location.

由服务器创建并在客户机请求时传递给客户机的各个状态段由128位StateID表示。这些stateID可以表示特定打开的文件、特定所有者持有的一组字节范围锁,或者以特定方式或在特定位置访问文件的可重新分配的权限。

In all cases, there is a transition from the most general information that represents a client as a whole to the eventual lightweight stateid used for most client and server locking interactions. The details of this transition will vary with the type of object, but it always starts with a client ID.

在所有情况下,都会从代表整个客户机的最一般信息过渡到用于大多数客户机和服务器锁定交互的最终轻量级stateid。此转换的详细信息将随对象的类型而变化,但它总是以客户机ID开始。

To support Win32 share reservations, it is necessary to atomically OPEN or CREATE files and apply the appropriate locks in the same operation. 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 NFSv4 protocol has an OPEN operation that subsumes the NFSv3 methodology of LOOKUP, CREATE, and ACCESS. However, because many operations require a filehandle, the traditional LOOKUP is preserved to map a filename to a 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.

要支持Win32共享保留,必须在同一操作中以原子方式打开或创建文件并应用适当的锁。使用单独的共享/取消共享操作将不允许Win32 OpenFile API的正确实现。为了正确实现共享语义,需要替换以前在打开或创建文件(查找、创建、访问)时使用的NFS协议机制。NFSv4协议有一个开放操作,包含了查找、创建和访问的NFSv3方法。但是,由于许多操作需要文件句柄,因此保留了传统的查找方法,以便将文件名映射到文件句柄,而无需在服务器上建立状态。授予访问权限或修改文件的策略由服务器根据客户端的状态进行管理。这些机制可以实现从仅建议锁定到完全强制锁定的策略。

9.1. Opens and Byte-Range Locks
9.1. 打开和关闭字节范围锁

It is assumed that manipulating a byte-range lock is rare when compared to READ and WRITE operations. It is also assumed that server restarts 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 byte-range lock request contains the heavyweight information required to establish a lock and uniquely define the owner of the lock.

与读写操作相比,假设操纵字节范围锁的情况很少。还假定服务器重启和网络分区相对较少。因此,读写操作必须有一个轻量级的机制来指示它们是否拥有持有的锁。字节范围锁请求包含建立锁和唯一定义锁所有者所需的重量级信息。

The following sections describe the transition from the heavyweight information to the eventual stateid used for most client and server locking and lease interactions.

以下各节描述了从重量级信息到用于大多数客户端和服务器锁定和租赁交互的最终stateid的转换。

9.1.1. Client ID
9.1.1. 客户端ID

For each LOCK request, the client must identify itself to the server. This is done in such a way as to allow for correct lock identification and crash recovery. A sequence of a SETCLIENTID operation followed by a SETCLIENTID_CONFIRM operation is required to establish the identification onto the server. Establishment of identification by a new incarnation of the client also has the effect of immediately breaking any leased state that a previous incarnation of the client might have had on the server, as opposed to forcing the new client incarnation to wait for the leases to expire. Breaking the lease state amounts to the server removing all lock, share reservation, and, where the server is not supporting the CLAIM_DELEGATE_PREV claim type, all delegation state associated with the same client with the same identity. For a discussion of delegation state recovery, see Section 10.2.1.

对于每个锁请求,客户端必须向服务器标识自己。这是以允许正确识别锁和碰撞恢复的方式进行的。要在服务器上建立标识,需要先执行SETCLIENTID操作,然后执行SETCLIENTID_确认操作。通过客户机的新版本建立标识还具有立即中断客户机的前一版本可能在服务器上具有的任何租用状态的效果,而不是强制新客户机版本等待租用到期。破坏租约状态相当于服务器删除所有锁、共享保留,如果服务器不支持CLAIM_DELEGATE_PREV CLAIM类型,则删除与具有相同标识的同一客户端关联的所有委派状态。有关授权状态恢复的讨论,请参见第10.2.1节。

Owners of opens and owners of byte-range locks are separate entities and remain separate even if the same opaque arrays are used to designate owners of each. The protocol distinguishes between open-owners (represented by open_owner4 structures) and lock-owners (represented by lock_owner4 structures).

opens的所有者和byte range锁的所有者是独立的实体,即使使用相同的不透明数组指定每个锁的所有者,它们仍然保持独立。该协议区分开放所有者(由open_owner4结构表示)和锁所有者(由lock_owner4结构表示)。

Both sorts of owners consist of a clientid and an opaque owner string. For each client, the set of distinct owner values used with that client constitutes the set of owners of that type, for the given client.

这两种所有者都由clientid和不透明的所有者字符串组成。对于每个客户机,与该客户机一起使用的一组不同的所有者值构成了给定客户机的该类型的所有者集。

Each open is associated with a specific open-owner, while each byte-range lock is associated with a lock-owner and an open-owner, the latter being the open-owner associated with the open file under which the LOCK operation was done.

每个打开与特定的打开所有者关联,而每个字节范围锁与一个锁所有者和一个打开所有者关联,后者是与执行锁定操作的打开文件关联的打开所有者。

Client identification is encapsulated in the following structure:

客户标识封装在以下结构中:

   struct nfs_client_id4 {
           verifier4       verifier;
           opaque          id<NFS4_OPAQUE_LIMIT>;
   };
        
   struct nfs_client_id4 {
           verifier4       verifier;
           opaque          id<NFS4_OPAQUE_LIMIT>;
   };
        

The first field, verifier, is a client incarnation verifier that is used to detect client reboots. Only if the verifier is different from that which the server has previously recorded for the client (as identified by the second field of the structure, id) does the server start the process of canceling the client's leased state.

第一个字段verifier是用于检测客户端重新启动的客户端化身验证器。只有当验证器不同于服务器先前为客户机记录的验证器(由结构的第二个字段标识,id)时,服务器才会启动取消客户机租用状态的过程。

The second field, id, is a variable-length string that uniquely defines the client.

第二个字段id是唯一定义客户机的可变长度字符串。

There are several considerations for how the client generates the id string:

对于客户端如何生成id字符串,有几个注意事项:

o The string should be unique so that multiple clients do not present the same string. The consequences of two clients presenting the same string range from one client getting an error to one client having its leased state abruptly and unexpectedly canceled.

o 该字符串应该是唯一的,以便多个客户端不显示相同的字符串。两个客户端呈现相同字符串的后果从一个客户端出错到一个客户端的租用状态突然意外取消。

o The string should be selected so the subsequent incarnations (e.g., reboots) of the same client cause the client to present the same string. The implementer is cautioned against an approach that requires the string to be recorded in a local file because this precludes the use of the implementation in an environment where there is no local disk and all file access is from an NFSv4 server.

o 应选择该字符串,以便同一客户端的后续化身(例如,重新启动)使客户端呈现相同的字符串。提醒实现者不要使用要求将字符串记录在本地文件中的方法,因为这会妨碍在没有本地磁盘且所有文件访问都来自NFSv4服务器的环境中使用实现。

o The string should be different for each server network address that the client accesses, rather than common to all server network addresses. The reason is that it may not be possible for the client to tell if the same server is listening on multiple network addresses. If the client issues SETCLIENTID with the same id string to each network address of such a server, the server will think it is the same client, and each successive SETCLIENTID will cause the server to begin the process of removing the client's previous leased state.

o 对于客户端访问的每个服务器网络地址,字符串应该是不同的,而不是所有服务器网络地址的公共字符串。原因是客户端可能无法判断同一服务器是否正在侦听多个网络地址。如果客户机向此类服务器的每个网络地址发出具有相同id字符串的SETCLIENTID,则服务器将认为它是同一个客户机,并且每个连续的SETCLIENTID将导致服务器开始删除客户机以前的租用状态。

o The algorithm for generating the string should not assume that the client's network address won't change. This includes changes between client incarnations and even changes while the client is still running in its current incarnation. This means that if the client includes just the client's and server's network address in

o 生成字符串的算法不应假定客户端的网络地址不会改变。这包括客户端化身之间的更改,甚至在客户端仍在当前化身中运行时的更改。这意味着,如果客户端仅包括客户端和服务器的网络地址

the id string, there is a real risk, after the client gives up the network address, that another client, using a similar algorithm for generating the id string, will generate a conflicting id string.

id字符串,在客户端放弃网络地址后,另一个客户端使用类似的算法生成id字符串,将生成冲突的id字符串,这是一个真正的风险。

Given the above considerations, an example of a well-generated id string is one that includes:

鉴于上述考虑,生成良好的id字符串示例包括:

o The server's network address.

o 服务器的网络地址。

o The client's network address.

o 客户端的网络地址。

o For a user-level NFSv4 client, it should contain additional information to distinguish the client from other user-level clients running on the same host, such as a universally unique identifier (UUID).

o 对于用户级NFSv4客户机,它应该包含其他信息,以便将客户机与运行在同一主机上的其他用户级客户机区分开来,例如通用唯一标识符(UUID)。

o Additional information that tends to be unique, such as one or more of:

o 倾向于唯一的附加信息,例如一个或多个:

* The client machine's serial number (for privacy reasons, it is best to perform some one-way function on the serial number).

* 客户端计算机的序列号(出于隐私原因,最好对序列号执行一些单向功能)。

* A MAC address (for privacy reasons, it is best to perform some one-way function on the MAC address).

* MAC地址(出于隐私考虑,最好在MAC地址上执行一些单向功能)。

* The timestamp of when the NFSv4 software was first installed on the client (though this is subject to the previously mentioned caution about using information that is stored in a file, because the file might only be accessible over NFSv4).

* NFSv4软件首次安装到客户端时的时间戳(尽管这取决于前面提到的关于使用存储在文件中的信息的注意事项,因为该文件可能只能通过NFSv4访问)。

* A true random number. However, since this number ought to be the same between client incarnations, this shares the same problem as that of using the timestamp of the software installation.

* 真随机数。然而,由于此数字在客户端化身之间应该是相同的,因此这与使用软件安装的时间戳的问题相同。

As a security measure, the server MUST NOT cancel a client's leased state if the principal that established the state for a given id string is not the same as the principal issuing the SETCLIENTID.

作为安全措施,如果为给定id字符串建立状态的主体与发出SETCLIENTID的主体不同,则服务器不得取消客户端的租用状态。

Note that SETCLIENTID (Section 16.33) and SETCLIENTID_CONFIRM (Section 16.34) have a secondary purpose of establishing the information the server needs to make callbacks to the client for the purpose of supporting delegations. It is permitted to change this information via SETCLIENTID and SETCLIENTID_CONFIRM within the same incarnation of the client without removing the client's leased state.

请注意,SETCLIENTID(第16.33节)和SETCLIENTID_CONFIRM(第16.34节)的第二个目的是建立服务器回调客户端以支持委托所需的信息。允许在客户端的同一版本中通过SETCLIENTID和SETCLIENTID_CONFIRM更改此信息,而无需删除客户端的已租用状态。

Once a SETCLIENTID and SETCLIENTID_CONFIRM sequence has successfully completed, the client uses the shorthand client identifier, of type clientid4, instead of the longer and less compact nfs_client_id4 structure. This shorthand client identifier (a client ID) is assigned by the server and should be chosen so that it will not conflict with a client ID previously assigned by the server. This applies across server restarts or reboots. When a client ID is presented to a server and that client ID is not recognized, as would happen after a server reboot, the server will reject the request with the error NFS4ERR_STALE_CLIENTID. When this happens, the client must obtain a new client ID by use of the SETCLIENTID operation and then proceed to any other necessary recovery for the server reboot case (see Section 9.6.2).

成功完成SETCLIENTID和SETCLIENTID_确认序列后,客户端将使用ClientD4类型的速记客户端标识符,而不是较长且不太紧凑的nfs_client_id4结构。此速记客户端标识符(客户端ID)由服务器分配,应进行选择,以使其不会与服务器先前分配的客户端ID冲突。这适用于服务器重新启动或重新启动。当客户机ID显示给服务器,而该客户机ID无法识别时(服务器重新启动后会发生这种情况),服务器将拒绝请求,错误为NFS4ERR\u STALE\u CLIENTID。发生这种情况时,客户端必须通过使用SETCLIENTID操作获得新的客户端ID,然后进行服务器重新启动情况下的任何其他必要恢复(请参阅第9.6.2节)。

The client must also employ the SETCLIENTID operation when it receives an NFS4ERR_STALE_STATEID error using a stateid derived from its current client ID, since this also indicates a server reboot, which has invalidated the existing client ID (see Section 9.6.2 for details).

当客户端使用从其当前客户端ID派生的STATEID接收到NFS4ERR_STALE_STATEID错误时,还必须使用SETCLIENTID操作,因为这也表示服务器重新启动,导致现有客户端ID无效(有关详细信息,请参阅第9.6.2节)。

See the detailed descriptions of SETCLIENTID (Section 16.33.4) and SETCLIENTID_CONFIRM (Section 16.34.4) for a complete specification of the operations.

有关操作的完整规范,请参见SETCLIENTID(第16.33.4节)和SETCLIENTID_CONFIRM(第16.34.4节)的详细说明。

9.1.2. Server Release of Client ID
9.1.2. 客户端ID的服务器版本

If the server determines that the client holds no associated state for its client ID, the server may choose to release the client ID. 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 that 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 client ID 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 client ID unless there had been no activity from that client for many minutes.

如果服务器确定客户机没有其客户机ID的关联状态,则服务器可以选择释放客户机ID。服务器可以对非活动客户机进行此选择,以便这些间歇性活动的客户机不会占用资源。如果客户机在此版本后联系服务器,服务器必须确保客户机收到适当的错误,以便使用SETCLIENTID/SETCLIENTID_确认序列来建立新标识。应该清楚的是,服务器在释放客户机ID时一定会非常犹豫,因为在客户机上从此类事件中恢复的结果工作将与服务器发生故障并重新启动时的负担相同。通常,服务器不会释放客户机ID,除非该客户机在几分钟内没有任何活动。

Note that if the id string in a SETCLIENTID request is properly constructed, and if the client takes care to use the same principal for each successive use of SETCLIENTID, then, barring an active denial-of-service attack, NFS4ERR_CLID_INUSE should never be returned.

请注意,如果SETCLIENTID请求中的id字符串构造正确,并且如果客户端注意在每次连续使用SETCLIENTID时使用相同的主体,则除非发生主动拒绝服务攻击,否则不应返回NFS4ERR_CLID_INUSE。

However, client bugs, server bugs, or perhaps a deliberate change of the principal owner of the id string (such as the case of a client that changes security flavors, and under the new flavor there is no mapping to the previous owner) will in rare cases result in NFS4ERR_CLID_INUSE.

但是,客户端错误、服务器错误,或者故意更改id字符串的主要所有者(例如更改安全风格的客户端,在新风格下没有映射到以前的所有者)在极少数情况下会导致NFS4ERR_CLID_使用。

In that event, when the server gets a SETCLIENTID for a client ID that currently has no state, or it has state but the lease has expired, rather than returning NFS4ERR_CLID_INUSE, the server MUST allow the SETCLIENTID and confirm the new client ID if followed by the appropriate SETCLIENTID_CONFIRM.

在这种情况下,当服务器获取当前没有状态的客户端ID的SETCLIENTID,或者它有状态但租约已过期,而不是返回NFS4ERR_CLID_INUSE时,服务器必须允许SETCLIENTID并确认新的客户端ID(如果后跟相应的SETCLIENTID_confirm)。

9.1.3. Use of Seqids
9.1.3. Seqids的使用

In several contexts, 32-bit sequence values called "seqids" are used as part of managing locking state. Such values are used:

在一些上下文中,称为“seqid”的32位序列值用作管理锁定状态的一部分。使用以下值:

o To provide an ordering of locking-related operations associated with a particular lock-owner or open-owner. See Section 9.1.7 for a detailed explanation.

o 提供与特定锁所有者或打开所有者相关的锁相关操作的顺序。详细说明见第9.1.7节。

o To define an ordered set of instances of a set of locks sharing a particular set of ownership characteristics. See Section 9.1.4.2 for a detailed explanation.

o 定义共享一组特定所有权特征的一组锁的有序实例集。详细说明见第9.1.4.2节。

Successive seqid values for the same object are normally arrived at by incrementing the current value by one. This pattern continues until the seqid is incremented past NFS4_UINT32_MAX, in which case one (rather than zero) is to be the next seqid value.

同一对象的连续seqid值通常是通过将当前值增加1来获得的。此模式持续,直到seqid增加超过NFS4_UINT32_MAX,在这种情况下,一个(而不是零)将成为下一个seqid值。

When two seqid values are to be compared to determine which of the two is later, the possibility of wraparound needs to be considered. In many cases, the values are such that simple numeric comparisons can be used. For example, if the seqid values to be compared are both less than one million, the higher value can be considered the later. On the other hand, if one of the values is at or near NFS_UINT32_MAX and the other is less than one million, then implementations can reasonably decide that the lower value has had one more wraparound and is thus, while numerically lower, actually later.

当比较两个seqid值以确定哪一个更晚时,需要考虑环绕的可能性。在许多情况下,这些值可以使用简单的数字比较。例如,如果要比较的seqid值都小于一百万,则可以认为较高的值较低。另一方面,如果其中一个值等于或接近NFS_UINT32_MAX,而另一个值小于一百万,则实现可以合理地确定较低的值多了一个概括值,因此,虽然数值较低,但实际上是在以后。

Implementations can compare seqids in the presence of potential wraparound by adopting the reasonable assumption that the chain of increments from one to the other is shorter than 2**31. So, if the difference between the two seqids is less than 2**31, then the lower seqid is to be treated as earlier. If, however, the difference

通过采用从一个到另一个的增量链小于2**31的合理假设,实现可以在存在潜在概括的情况下比较SeqID。因此,如果两个seqid之间的差值小于2**31,则较低的seqid将被视为较早的值。但是,如果差异

between the two seqids is greater than or equal to 2**31, then it can be assumed that the lower seqid has encountered one more wraparound and can be treated as later.

如果两个seqid之间的值大于或等于2**31,则可以假设较低的seqid遇到了一个以上的环绕,并且可以稍后处理。

9.1.4. Stateid Definition
9.1.4. Stateid定义

When the server grants a lock of any type (including opens, byte-range locks, and delegations), it responds with a unique stateid that represents a set of locks (often a single lock) for the same file, of the same type, and sharing the same ownership characteristics. Thus, opens of the same file by different open-owners each have an identifying stateid. Similarly, each set of byte-range locks on a file owned by a specific lock-owner has its own identifying stateid. Delegations also have associated stateids by which they may be referenced. The stateid is used as a shorthand reference to a lock or set of locks, and given a stateid, the server can determine the associated state-owner or state-owners (in the case of an open-owner/lock-owner pair) and the associated filehandle. When stateids are used, the current filehandle must be the one associated with that stateid.

当服务器授予任何类型的锁(包括打开、字节范围锁和委派)时,它将使用唯一的stateid进行响应,该stateid表示同一文件、同一类型和共享相同所有权特征的一组锁(通常是单个锁)。因此,由不同的打开所有者打开的同一个文件都有一个标识stateid。类似地,特定锁所有者拥有的文件上的每一组字节范围锁都有自己的标识stateid。代表团还具有相关的StateID,可通过该ID引用代表团。stateid用作一个锁或一组锁的简写引用,并且给定stateid,服务器可以确定关联的一个或多个状态所有者(在打开所有者/锁所有者对的情况下)和关联的文件句柄。使用stateid时,当前文件句柄必须是与该stateid关联的文件句柄。

All stateids associated with a given client ID are associated with a common lease that represents the claim of those stateids and the objects they represent to be maintained by the server. See Section 9.5 for a discussion of the lease.

与给定客户机ID关联的所有StateID都与一个公共租约关联,该租约表示这些StateID及其表示的要由服务器维护的对象的声明。有关租赁的讨论,请参见第9.5节。

Each stateid must be unique to the server. Many operations take a stateid as an argument but not a clientid, so the server must be able to infer the client from the stateid.

每个stateid对于服务器都必须是唯一的。许多操作将stateid作为参数,而不是clientid,因此服务器必须能够从stateid推断客户机。

9.1.4.1. Stateid Types
9.1.4.1. Stateid类型

With the exception of special stateids (see Section 9.1.4.3), each stateid represents locking objects of one of a set of types defined by the NFSv4 protocol. Note that in all these cases, where we speak of a guarantee, it is understood there are situations such as a client restart, or lock revocation, that allow the guarantee to be voided.

除特殊stateid(见第9.1.4.3节)外,每个stateid表示NFSv4协议定义的一组类型之一的锁定对象。请注意,在所有这些情况下,当我们谈到担保时,可以理解存在允许担保无效的情况,例如客户端重新启动或锁撤销。

o Stateids may represent opens of files.

o StateID可以表示打开的文件。

Each stateid in this case represents the OPEN state for a given client ID/open-owner/filehandle triple. Such stateids are subject to change (with consequent incrementing of the stateid's seqid) in response to OPENs that result in upgrade and OPEN_DOWNGRADE operations.

本例中的每个stateid表示给定客户机ID/开放所有者/filehandle三元组的开放状态。此类stateid可能会随着导致升级和OPEN\u降级操作的打开而更改(随后stateid的seqid会增加)。

o Stateids may represent sets of byte-range locks.

o StateID可以表示字节范围锁的集合。

All locks held on a particular file by a particular owner and all gotten under the aegis of a particular open file are associated with a single stateid, with the seqid being incremented whenever LOCK and LOCKU operations affect that set of locks.

特定所有者持有的特定文件上的所有锁以及在特定打开文件的保护下获得的所有锁都与单个stateid关联,只要锁和LOCKU操作影响到该组锁,seqid就会增加。

o Stateids may represent file delegations, which are recallable guarantees by the server to the client that other clients will not reference, or will not modify, a particular file until the delegation is returned.

o StateID可以表示文件委托,这是服务器向客户机提供的可收回保证,在委托返回之前,其他客户机不会引用或修改特定文件。

A stateid represents a single delegation held by a client for a particular filehandle.

stateid表示客户端为特定文件句柄持有的单个委托。

9.1.4.2. Stateid Structure
9.1.4.2. 状态结构

Stateids are divided into two fields: a 96-bit "other" field identifying the specific set of locks and a 32-bit "seqid" sequence value. Except in the case of special stateids (see Section 9.1.4.3), a particular value of the "other" field denotes a set of locks of the same type (for example, byte-range locks, opens, or delegations), for a specific file or directory, and sharing the same ownership characteristics. The seqid designates a specific instance of such a set of locks, and is incremented to indicate changes in such a set of locks, by either the addition or deletion of locks from the set, a change in the byte-range they apply to, or an upgrade or downgrade in the type of one or more locks.

StateID分为两个字段:一个96位的“other”字段标识特定的锁集,另一个32位的“seqid”序列值。除特殊StateID(见第9.1.4.3节)外,“其他”字段的特定值表示一组相同类型的锁(例如,字节范围锁、打开或委托),用于特定文件或目录,并共享相同的所有权特征。seqid指定此类锁集合的特定实例,并通过从集合中添加或删除锁、更改其应用的字节范围或升级或降级一个或多个锁的类型来递增以指示此类锁集合中的更改。

When such a set of locks is first created, the server returns a stateid with a seqid value of one. On subsequent operations that modify the set of locks, the server is required to advance the seqid field by one whenever it returns a stateid for the same state-owner/file/type combination and the operation is one that might make some change in the set of locks actually designated. In this case, the server will return a stateid with an "other" field the same as previously used for that state-owner/file/type combination, with an incremented seqid field.

当第一次创建这样一组锁时,服务器返回一个seqid值为1的stateid。在修改锁集的后续操作中,每当服务器返回同一状态所有者/文件/类型组合的stateid时,服务器都需要将seqid字段提前1,并且该操作可能会对实际指定的锁集进行一些更改。在这种情况下,服务器将返回一个stateid,其中包含一个“other”字段,该字段与之前用于该状态所有者/文件/类型组合的字段相同,并包含一个递增的seqid字段。

Seqids will be compared, by both the client and the server. The client uses such comparisons to determine the order of operations, while the server uses them to determine whether the NFS4ERR_OLD_STATEID error is to be returned. In all cases, the possibility of seqid wraparound needs to be taken into account, as discussed in Section 9.1.3.

SeqID将由客户端和服务器进行比较。客户端使用这种比较来确定操作顺序,而服务器使用它们来确定是否返回NFS4ERR_OLD_STATEID错误。在所有情况下,如第9.1.3节所述,需要考虑seqid环绕的可能性。

9.1.4.3. Special Stateids
9.1.4.3. 特殊州

Stateid values whose "other" field is either all zeros or all ones are reserved. They MUST NOT be assigned by the server but have special meanings defined by the protocol. The particular meaning depends on whether the "other" field is all zeros or all ones and the specific value of the seqid field.

“其他”字段为全零或全1的Stateid值被保留。它们不能由服务器分配,但具有协议定义的特殊含义。具体含义取决于“其他”字段是全零还是全1以及seqid字段的具体值。

The following combinations of "other" and seqid are defined in NFSv4:

NFSv4中定义了以下“其他”和seqid的组合:

Anonymous Stateid: When "other" and seqid are both zero, the stateid is treated as a special anonymous stateid, which can be used in READ, WRITE, and SETATTR requests to indicate the absence of any open state associated with the request. When an anonymous stateid value is used, and an existing open denies the form of access requested, then access will be denied to the request.

Anonymous Stateid:当“other”和seqid均为零时,Stateid被视为一个特殊的匿名Stateid,可在读、写和SETATTR请求中使用,以指示不存在与请求相关的任何打开状态。当使用匿名stateid值,并且现有的open拒绝请求的访问形式时,将拒绝对请求的访问。

READ Bypass Stateid: When "other" and seqid are both all ones, the stateid is a special READ bypass stateid. When this value is used in WRITE or SETATTR, it is treated like the anonymous value. When used in READ, the server MAY grant access, even if access would normally be denied to READ requests.

读取旁路Stateid:当“other”和seqid都是1时,Stateid是一个特殊的读取旁路Stateid。在WRITE或SETATTR中使用此值时,它将被视为匿名值。在读取中使用时,服务器可能会授予访问权限,即使对读取请求的访问通常会被拒绝。

If a stateid value is used that has all zeros or all ones in the "other" field but does not match one of the cases above, the server MUST return the error NFS4ERR_BAD_STATEID.

如果使用的stateid值在“other”字段中为全零或全一,但与上述情况之一不匹配,则服务器必须返回错误NFS4ERR_BAD_stateid。

Special stateids, unlike other stateids, are not associated with individual client IDs or filehandles and can be used with all valid client IDs and filehandles.

与其他StateID不同,特殊StateID与单个客户端ID或文件句柄不关联,可以与所有有效的客户端ID和文件句柄一起使用。

9.1.4.4. Stateid Lifetime and Validation
9.1.4.4. Stateid生存期和验证

Stateids must remain valid until either a client restart or a server restart, or until the client returns all of the locks associated with the stateid by means of an operation such as CLOSE or DELEGRETURN. If the locks are lost due to revocation, as long as the client ID is valid, the stateid remains a valid designation of that revoked state. Stateids associated with byte-range locks are an exception. They remain valid even if a LOCKU frees all remaining locks, so long as the open file with which they are associated remains open.

stateid必须保持有效,直到客户端重新启动或服务器重新启动,或者直到客户端通过关闭或删除返回与stateid关联的所有锁。如果锁因吊销而丢失,只要客户端ID有效,stateid仍然是该吊销状态的有效指定。与字节范围锁关联的StateID是一个例外。即使锁释放了所有剩余的锁,只要与它们关联的打开文件保持打开状态,它们仍然有效。

It should be noted that there are situations in which the client's locks become invalid, without the client requesting they be returned. These include lease expiration and a number of forms of lock revocation within the lease period. It is important to note that in these situations, the stateid remains valid and the client can use it to determine the disposition of the associated lost locks.

应该注意的是,在某些情况下,客户机的锁变得无效,而客户机没有请求返回这些锁。这些措施包括租赁到期和租赁期内多种形式的锁撤销。需要注意的是,在这些情况下,stateid仍然有效,客户端可以使用它来确定相关丢失锁的处置。

An "other" value must never be reused for a different purpose (i.e., different filehandle, owner, or type of locks) within the context of a single client ID. A server may retain the "other" value for the same purpose beyond the point where it may otherwise be freed, but if it does so, it must maintain seqid continuity with previous values.

在单个客户端ID的上下文中,“其他”值决不能用于不同的目的(即不同的文件句柄、所有者或锁类型)。服务器可能会出于相同的目的保留“其他”值,但如果这样做,则必须与以前的值保持seqid连续性。

One mechanism that may be used to satisfy the requirement that the server recognize invalid and out-of-date stateids is for the server to divide the "other" field of the stateid into two fields:

可用于满足服务器识别无效和过期stateid要求的一种机制是,服务器将stateid的“其他”字段分为两个字段:

o An index into a table of locking-state structures.

o 锁定状态结构表的索引。

o A generation number that is incremented on each allocation of a table entry for a particular use.

o 一种生成编号,在为特定用途分配表项时递增。

And then store the following in each table entry:

然后在每个表条目中存储以下内容:

o The client ID with which the stateid is associated.

o 与stateid关联的客户端ID。

o The current generation number for the (at most one) valid stateid sharing this index value.

o 共享此索引值的有效stateid(最多一个)的当前生成号。

o The filehandle of the file on which the locks are taken.

o 对其进行锁定的文件的filehandle。

o An indication of the type of stateid (open, byte-range lock, file delegation).

o stateid类型的指示(打开、字节范围锁定、文件委派)。

o The last seqid value returned corresponding to the current "other" value.

o 返回的最后一个seqid值与当前“其他”值相对应。

o An indication of the current status of the locks associated with this stateid -- in particular, whether these have been revoked and, if so, for what reason.

o 指示与此stateid关联的锁的当前状态,特别是这些锁是否已被撤销,如果已撤销,原因是什么。

With this information, an incoming stateid can be validated and the appropriate error returned when necessary. Special and non-special stateids are handled separately. (See Section 9.1.4.3 for a discussion of special stateids.)

有了这些信息,可以验证传入的stateid,并在必要时返回相应的错误。特殊和非特殊stateID分别处理。(有关特殊状态ID的讨论,请参见第9.1.4.3节。)

When a stateid is being tested, and the "other" field is all zeros or all ones, a check that the "other" and seqid fields match a defined combination for a special stateid is done and the results determined as follows:

当测试stateid时,“其他”字段为全零或全1,检查“其他”和seqid字段是否与特殊stateid的定义组合匹配,结果确定如下:

o If the "other" and seqid fields do not match a defined combination associated with a special stateid, the error NFS4ERR_BAD_STATEID is returned.

o 如果“other”和seqid字段不匹配与特殊stateid关联的已定义组合,则返回错误NFS4ERR_BAD_stateid。

o If the combination is valid in general but is not appropriate to the context in which the stateid is used (e.g., an all-zero stateid is used when an open stateid is required in a LOCK operation), the error NFS4ERR_BAD_STATEID is also returned.

o 如果组合通常有效,但不适用于使用stateid的上下文(例如,当锁操作中需要打开stateid时使用全零stateid),则还将返回错误NFS4ERR_BAD_stateid。

o Otherwise, the check is completed and the special stateid is accepted as valid.

o 否则,检查将完成,并且特殊stateid将被接受为有效。

When a stateid is being tested, and the "other" field is neither all zeros nor all ones, the following procedure could be used to validate an incoming stateid and return an appropriate error, when necessary, assuming that the "other" field would be divided into a table index and an entry generation. Note that the terms "earlier" and "later" used in connection with seqid comparison are to be understood as explained in Section 9.1.3.

当测试stateid时,“other”字段既不是全零也不是全1,可以使用以下过程验证传入的stateid并在必要时返回适当的错误,假设“other”字段将被划分为表索引和条目生成。请注意,与seqid比较相关的术语“较早”和“较晚”应理解为第9.1.3节中的解释。

o If the table index field is outside the range of the associated table, return NFS4ERR_BAD_STATEID.

o 如果表索引字段不在关联表的范围内,则返回NFS4ERR\u BAD\u STATEID。

o If the selected table entry is of a different generation than that specified in the incoming stateid, return NFS4ERR_BAD_STATEID.

o 如果所选表项的生成与传入stateid中指定的不同,则返回NFS4ERR\u BAD\u stateid。

o If the selected table entry does not match the current filehandle, return NFS4ERR_BAD_STATEID.

o 如果所选表项与当前文件句柄不匹配,则返回NFS4ERR\U BAD\U STATEID。

o If the stateid represents revoked state or state lost as a result of lease expiration, then return NFS4ERR_EXPIRED, NFS4ERR_BAD_STATEID, or NFS4ERR_ADMIN_REVOKED, as appropriate.

o 如果stateid表示吊销状态或由于租约到期而丢失的状态,则根据需要返回NFS4ERR_EXPIRED、NFS4ERR_BAD_stateid或NFS4ERR_ADMIN_reversed。

o If the stateid type is not valid for the context in which the stateid appears, return NFS4ERR_BAD_STATEID. Note that a stateid may be valid in general but invalid for a particular operation, as, for example, when a stateid that doesn't represent byte-range locks is passed to the non-from_open case of LOCK or to LOCKU, or when a stateid that does not represent an open is passed to CLOSE or OPEN_DOWNGRADE. In such cases, the server MUST return NFS4ERR_BAD_STATEID.

o 如果stateid类型对于stateid出现的上下文无效,则返回NFS4ERR\u BAD\u stateid。请注意,stateid通常有效,但对于特定操作无效,例如,当不表示字节范围锁的stateid传递给非from\u open LOCK或to LOCKU时,或者当不表示open的stateid传递给CLOSE或open\u降级时。在这种情况下,服务器必须返回NFS4ERR_BAD_STATEID。

o If the seqid field is not zero and it is later than the current sequence value corresponding to the current "other" field, return NFS4ERR_BAD_STATEID.

o 如果seqid字段不为零且晚于当前“其他”字段对应的当前序列值,则返回NFS4ERR_BAD_STATEID。

o If the seqid field is earlier than the current sequence value corresponding to the current "other" field, return NFS4ERR_OLD_STATEID.

o 如果seqid字段早于当前“其他”字段对应的当前序列值,则返回NFS4ERR_OLD_STATEID。

o Otherwise, the stateid is valid, and the table entry should contain any additional information about the type of stateid and information associated with that particular type of stateid, such as the associated set of locks (e.g., open-owner and lock-owner information), as well as information on the specific locks themselves, such as open modes and byte ranges.

o 否则,stateid是有效的,并且表条目应该包含关于stateid类型的任何附加信息以及与特定类型的stateid关联的信息,例如关联的锁集(例如,打开的所有者和锁所有者信息),以及关于特定锁本身的信息,例如打开模式和字节范围。

9.1.4.5. Stateid Use for I/O Operations
9.1.4.5. Stateid用于I/O操作

Clients performing Input/Output (I/O) operations need to select an appropriate stateid based on the locks (including opens and delegations) held by the client and the various types of state-owners sending the I/O requests. SETATTR operations that change the file size are treated like I/O operations in this regard.

执行输入/输出(I/O)操作的客户端需要根据客户端持有的锁(包括打开和委托)以及发送I/O请求的各种类型的状态所有者选择适当的stateid。在这方面,更改文件大小的SETATTR操作被视为I/O操作。

The following rules, applied in order of decreasing priority, govern the selection of the appropriate stateid. In following these rules, the client will only consider locks of which it has actually received notification by an appropriate operation response or callback.

以下规则按优先级降低的顺序应用,用于管理适当stateid的选择。在遵循这些规则时,客户端只考虑通过实际操作响应或回调实际接收到通知的锁。

o If the client holds a delegation for the file in question, the delegation stateid SHOULD be used.

o 如果客户机持有相关文件的委托,则应使用委托stateid。

o Otherwise, if the entity corresponding to the lock-owner (e.g., a process) sending the I/O has a byte-range lock stateid for the associated open file, then the byte-range lock stateid for that lock-owner and open file SHOULD be used.

o 否则,如果与发送I/O的锁所有者(例如,进程)对应的实体具有关联打开文件的字节范围lock stateid,则应使用该锁所有者和打开文件的字节范围lock stateid。

o If there is no byte-range lock stateid, then the OPEN stateid for the current open-owner, i.e., the OPEN stateid for the open file in question, SHOULD be used.

o 如果没有字节范围锁定stateid,则应使用当前打开所有者的打开stateid,即相关打开文件的打开stateid。

o Finally, if none of the above apply, then a special stateid SHOULD be used.

o 最后,如果上述任何一项都不适用,那么应该使用一个特殊的stateid。

Ignoring these rules may result in situations in which the server does not have information necessary to properly process the request. For example, when mandatory byte-range locks are in effect, if the stateid does not indicate the proper lock-owner, via a lock stateid, a request might be avoidably rejected.

忽略这些规则可能会导致服务器没有正确处理请求所需的信息。例如,当强制字节范围锁生效时,如果stateid没有通过lock stateid指示正确的锁所有者,则请求可能会被拒绝。

The server, however, should not try to enforce these ordering rules and should use whatever information is available to properly process I/O requests. In particular, when a client has a delegation for a given file, it SHOULD take note of this fact in processing a request, even if it is sent with a special stateid.

但是,服务器不应尝试强制执行这些排序规则,而应使用任何可用信息来正确处理I/O请求。特别是,当客户机对给定文件具有委托时,它应该在处理请求时注意这一事实,即使请求是使用特殊的stateid发送的。

9.1.4.6. Stateid Use for SETATTR Operations
9.1.4.6. Stateid用于SETATTR操作

In the case of SETATTR operations, a stateid is present. In cases other than those that set the file size, the client may send either a special stateid or, when a delegation is held for the file in question, a delegation stateid. While the server SHOULD validate the stateid and may use the stateid to optimize the determination as to whether a delegation is held, it SHOULD note the presence of a delegation even when a special stateid is sent, and MUST accept a valid delegation stateid when sent.

在SETATTR操作的情况下,存在stateid。在设置文件大小的情况之外的情况下,客户机可以发送特殊的stateid,或者在为相关文件保留委托时,发送委托stateid。虽然服务器应验证stateid,并可使用stateid优化是否保留委派的确定,但即使发送了特殊stateid,也应注意委派的存在,并且在发送时必须接受有效的委派stateid。

9.1.5. Lock-Owner
9.1.5. 船主

When requesting a lock, the client must present to the server the client ID and an identifier for the owner of the requested lock. These two fields comprise the lock-owner and are defined as follows:

请求锁时,客户端必须向服务器提供客户端ID和请求锁所有者的标识符。这两个字段构成锁所有者,定义如下:

o A client ID returned by the server as part of the client's use of the SETCLIENTID operation.

o 作为客户端使用SETCLIENTID操作的一部分,服务器返回的客户端ID。

o A variable-length opaque array used to uniquely define the owner of a lock managed by the client.

o 可变长度不透明数组,用于唯一定义由客户端管理的锁的所有者。

This may be a thread id, process id, or other unique value.

这可能是线程id、进程id或其他唯一值。

When the server grants the lock, it responds with a unique stateid. The stateid is used as a shorthand reference to the lock-owner, since the server will be maintaining the correspondence between them.

当服务器授予锁时,它将使用唯一的stateid进行响应。stateid用作锁所有者的简写引用,因为服务器将维护它们之间的通信。

9.1.6. Use of the Stateid and Locking
9.1.6. Stateid和锁定的使用

All READ, WRITE, and SETATTR operations contain a stateid. For the purposes of this section, SETATTR operations that 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. The stateid passed to one of these operations must be one that represents an OPEN (e.g., via the open-owner), a set of byte-range locks, or a delegation, or it may be a special stateid representing anonymous access or the READ bypass stateid.

所有读、写和SETATTR操作都包含stateid。在本节中,更改文件大小属性的SETATTR操作被视为写入新旧大小之间的区域(即通过SETATTR截断或添加到文件中的范围),即使文本中未明确提及SETATTR。传递给这些操作之一的stateid必须是表示打开(例如,通过打开的所有者)、一组字节范围锁或委派的stateid,也可以是表示匿名访问或读取旁路stateid的特殊stateid。

If the state-owner performs a READ or WRITE in a situation in which it has established a lock or share reservation on the server (any OPEN constitutes a share reservation), the stateid (previously returned by the server) must be used to indicate what locks, including both byte-range locks and share reservations, are held by the state-owner. If no state is established by the client -- either

如果状态所有者在其已在服务器上建立锁或共享保留的情况下执行读或写操作(任何打开都构成共享保留),则必须使用stateid(服务器先前返回的)来指示状态所有者持有哪些锁,包括字节范围锁和共享保留。如果客户端未建立任何状态,则

byte-range lock or share reservation -- the anonymous stateid is used. Regardless of whether an anonymous stateid or a stateid returned by the server is used, if there is a conflicting share reservation or mandatory byte-range lock held on the file, the server MUST refuse to service the READ or WRITE operation.

字节范围锁定或共享保留--使用匿名stateid。无论使用匿名stateid还是服务器返回的stateid,如果文件上存在冲突的共享保留或强制字节范围锁,服务器必须拒绝为读或写操作提供服务。

Share reservations 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. Byte-range locks may be implemented by the server as either mandatory or advisory, or the choice of mandatory or advisory behavior may be determined by the server on the basis of the file being accessed (for example, some UNIX-based servers support a "mandatory lock bit" on the mode attribute such that if set, byte-range locks are required on the file before I/O is possible). When byte-range locks are advisory, they only prevent the granting of conflicting lock requests and have no effect on READs or WRITEs. Mandatory byte-range locks, however, prevent conflicting I/O operations. When they are attempted, they are rejected with NFS4ERR_LOCKED. When the client gets NFS4ERR_LOCKED on a file it knows it has the proper share reservation for, it will need to issue a LOCK request on the region of the file that includes the region the I/O was to be performed on, with an appropriate locktype (i.e., READ*_LT for a READ operation, WRITE*_LT for a WRITE operation).

共享保留是由开放操作建立的,其性质是强制性的,因为当开放操作拒绝读或写操作时,该拒绝会导致此类操作被拒绝,并出现错误NFS4ERR_LOCKED。字节范围锁可由服务器实现为强制或建议,或者强制或建议行为的选择可由服务器根据所访问的文件确定(例如,一些基于UNIX的服务器支持“强制锁位”在mode属性上,如果设置了,则需要在文件上设置字节范围锁,然后才能进行I/O)。当字节范围锁是建议性的时,它们只会阻止授予冲突的锁请求,对读或写没有影响。但是,强制字节范围锁可防止I/O操作冲突。尝试这些操作时,会被拒绝并锁定NFS4ERR_。当客户端在其知道其具有适当的共享保留的文件上锁定NFS4ERR_时,它将需要在文件的区域上发出锁定请求,该区域包括要执行I/O的区域,并具有适当的锁定类型(即,读操作为READ*_LT,写操作为WRITE*_LT)。

With NFSv3, there was no notion of a stateid, so there was no way to tell if the application process of the client sending the READ or WRITE operation had also acquired the appropriate byte-range lock on the file. Thus, there was no way to implement mandatory locking. With the stateid construct, this barrier has been removed.

对于NFSv3,没有stateid的概念,因此无法判断发送读或写操作的客户端的应用程序进程是否也在文件上获得了适当的字节范围锁。因此,无法实现强制锁定。通过stateid构造,该障碍已被移除。

Note that for UNIX environments that support mandatory file locking, the distinction between advisory and mandatory locking is subtle. In fact, advisory and mandatory byte-range locks are exactly the same insofar as the APIs and requirements on implementation are concerned. If the mandatory lock attribute is set on the file, the server checks to see if the lock-owner has an appropriate shared (read) or exclusive (write) byte-range lock on the region it wishes to read or write to. If there is no appropriate lock, the server checks if there is a conflicting lock (which can be done by attempting to acquire the conflicting lock on behalf of the lock-owner and, if successful, release the lock after the READ or WRITE is done), and if there is, the server returns NFS4ERR_LOCKED.

请注意,对于支持强制文件锁定的UNIX环境,建议锁定和强制锁定之间的区别很微妙。事实上,就API和实现要求而言,建议和强制字节范围锁是完全相同的。如果在文件上设置了强制锁定属性,服务器将检查锁定所有者在其希望读取或写入的区域上是否具有适当的共享(读取)或独占(写入)字节范围锁定。如果没有合适的锁,服务器将检查是否存在冲突的锁(这可以通过代表锁所有者尝试获取冲突的锁来实现,如果成功,则在读取或写入完成后释放锁),如果存在,服务器将返回NFS4ERR_LOCKED。

For Windows environments, there are no advisory byte-range locks, so the server always checks for byte-range locks during I/O requests.

对于Windows环境,没有建议的字节范围锁,因此服务器在I/O请求期间始终检查字节范围锁。

Thus, the NFSv4 LOCK operation does not need to distinguish between advisory and mandatory byte-range locks. It is the NFSv4 server's processing of the READ and WRITE operations that introduces the distinction.

因此,NFSv4锁操作不需要区分建议锁和强制字节范围锁。正是NFSv4服务器对读写操作的处理引入了区别。

Every stateid other than the special stateid values noted in this section, 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 that began the stateid sequence, and as modified by subsequent OPENs and OPEN_DOWNGRADEs within that stateid sequence. When a READ, WRITE, or SETATTR that 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.

除本节中注明的特殊stateid值外的每个stateid,无论是由开放式操作(即OPEN、OPEN_降级)还是由锁式操作(即LOCK或LOCKU)返回,都定义了由开始stateid序列的原始OPEN建立的文件访问模式(即读、写或读写),并在该stateid序列中通过后续OPEN和OPEN_降级进行修改。当完成指定大小属性的读、写或SETATTR时,该操作将根据访问模式进行检查,以验证该操作是否适合与该操作关联的打开项。

In the case of WRITE-type operations (i.e., WRITEs and SETATTRs that 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 READs are allowed in these circumstances, the server MUST still check for locks that conflict with the READ (e.g., another open specifying denial of READs). Note that a server that does enforce the access mode check on READs need not explicitly check for conflicting share reservations since the existence of OPEN for read access guarantees that no conflicting share reservation can exist.

对于写入类型操作(即设置大小的写入和设置属性),服务器必须验证访问模式是否允许写入,如果不允许,则返回NFS4ERR_OPENMODE错误。在读取的情况下,服务器可以对访问模式执行相应的检查,或者它可以选择允许仅为写而打开的读操作,以容纳其写实现可能不可避免地进行读取的客户端(例如,由于缓冲区缓存约束)。但是,即使在这些情况下允许读取,服务器仍必须检查与读取冲突的锁(例如,另一个open指定拒绝读取)。请注意,对读取执行访问模式检查的服务器不需要显式检查冲突的共享保留,因为开放式读取访问的存在保证不存在冲突的共享保留。

A READ bypass stateid MAY allow READ operations to bypass locking checks at the server. However, WRITE operations with a READ bypass stateid MUST NOT bypass locking checks and are treated exactly the same as if an anonymous stateid were used.

READ bypass stateid允许读取操作绕过服务器上的锁定检查。但是,具有读取旁路stateid的写入操作不能绕过锁定检查,并且被视为与使用匿名stateid时完全相同。

A lock may not be granted while a READ or WRITE operation using one of the special stateids is being performed and the range of the lock request conflicts with the range of the READ or WRITE operation. For the purposes of this paragraph, a conflict occurs when a shared lock is requested and a WRITE operation is being performed, or an exclusive lock is requested and either a READ or a WRITE operation is being performed. A SETATTR that sets size is treated similarly to a WRITE as discussed above.

在执行使用一个特殊StateID的读或写操作时,可能不会授予锁,并且锁请求的范围与读或写操作的范围冲突。在本段中,当请求共享锁并执行写入操作时,或请求独占锁并执行读取或写入操作时,会发生冲突。设置大小的SETATTR与上面讨论的写入类似。

9.1.7. Sequencing of Lock Requests
9.1.7. 锁请求的排序

Locking is different than most NFS operations as it requires "at-most-one" semantics that are not provided by ONC RPC. ONC RPC over a 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 integer. Different state-owners have different sequences. The server maintains the last sequence number (L) received and the response that was returned. The server SHOULD assign a seqid value of one for the first request issued for any given state-owner. Subsequent values are arrived at by incrementing the seqid value, subject to wraparound as described in Section 9.1.3.

锁定与大多数NFS操作不同,因为它需要ONC RPC未提供的“最多一个”语义。可靠传输上的ONC RPC是不够的,因为一系列锁定请求可能跨越多个TCP连接。在面临重新传输或重新排序时,锁定或解锁请求必须具有定义良好且一致的行为。为了实现这一点,每个锁请求都包含一个连续递增的整数序列号。不同的国家所有者有不同的顺序。服务器维护接收到的最后一个序列号(L)和返回的响应。服务器应该为任何给定状态所有者发出的第一个请求分配一个seqid值1。后续值通过增加seqid值得出,并按照第9.1.3节所述进行概括。

Note that for requests that contain a sequence number, for each state-owner, there should be no more than one outstanding request.

请注意,对于包含序列号的请求,对于每个状态所有者,不应该有多个未完成的请求。

When a request is received, its sequence number (r) is compared to that of the last one received (L). Only if it has the correct next sequence, normally L + 1, is the request processed beyond the point of seqid checking. 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 the sequence value received is any other value, it is rejected with the return of error NFS4ERR_BAD_SEQID. Sequence history is reinitialized whenever the SETCLIENTID/ SETCLIENTID_CONFIRM sequence changes the client verifier.

当接收到一个请求时,将其序列号(r)与上次接收的序列号(L)进行比较。只有当它具有正确的下一个序列(通常为L+1)时,请求才会在seqid检查点之外被处理。如果客户端功能正常,则必须在发送最后一个请求(L)之前收到对(r)的响应。如果接收到上一个请求(r==L)的副本,则返回存储的响应。如果接收到的序列值是任何其他值,则拒绝该序列值,并返回错误NFS4ERR_BAD_SEQID。每当SETCLIENTID/SETCLIENTID\u确认序列更改客户端验证器时,序列历史将重新初始化。

It is critical that the server maintain the last response sent to the client to provide a more reliable cache of duplicate non-idempotent requests than that of the traditional cache described in [Chet]. The traditional duplicate request cache uses a least recently used algorithm for removing unneeded requests. However, the last lock request and response on a given state-owner must be cached as long as the lock state exists on the server.

与[Chet]中所述的传统缓存相比,服务器必须维护发送给客户端的最后一个响应,以便为重复的非幂等请求提供更可靠的缓存。传统的重复请求缓存使用最近最少使用的算法来删除不需要的请求。但是,只要服务器上存在锁状态,就必须缓存给定状态所有者上的最后一个锁请求和响应。

The client MUST advance the sequence number for the CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE operations. This is true even in the event that the previous operation that used the sequence number received an error. The only exception to this rule is if the previous operation received one of the following errors: NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID, NFS4ERR_BADXDR, NFS4ERR_RESOURCE, NFS4ERR_NOFILEHANDLE, or NFS4ERR_MOVED.

客户必须提前输入关闭、锁定、锁定、打开、打开确认和打开降级操作的序列号。即使在使用序列号的前一个操作收到错误的情况下也是如此。此规则的唯一例外是,如果上一个操作收到以下错误之一:NFS4ERR_STALE_CLIENTID、NFS4ERR_STALE_STATEID、NFS4ERR_BAD_STATEID、NFS4ERR_BAD_SEQID、NFS4ERR_BADXDR、NFS4ERR_RESOURCE、NFS4ERR_NOFILEHANDLE或NFS4ERR_MOVED。

9.1.8. Recovery from Replayed Requests
9.1.8. 从重播请求中恢复

As described above, the sequence number is per state-owner. 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 (state-owner, 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 state-owner state.

LOCK、LOCKU、OPEN、OPEN_降级和CLOSE每个都包含一个序列号,因此,在服务器保持状态所有者状态时,这些操作的重播导致不期望的效果的风险是不存在的。

9.1.9. Interactions of Multiple Sequence Values
9.1.9. 多序列值的相互作用

Some operations may have multiple sources of data for request sequence checking and retransmission determination. Some operations have multiple sequence values associated with multiple types of state-owners. In addition, such operations may also have a stateid with its own seqid value, that will be checked for validity.

一些操作可能有多个数据源用于请求序列检查和重传确定。某些操作具有多个与多种类型的状态所有者关联的序列值。此外,此类操作还可能有一个stateid及其自身的seqid值,将对其有效性进行检查。

As noted above, there may be multiple sequence values to check. The following rules should be followed by the server in processing these multiple sequence values within a single operation.

如上所述,可能需要检查多个序列值。服务器在单个操作中处理这些多个序列值时应遵循以下规则。

o When a sequence value associated with a state-owner is unavailable for checking because the state-owner is unknown to the server, it takes no part in the comparison.

o 当与状态所有者关联的序列值因服务器未知而无法进行检查时,它将不参与比较。

o When any of the state-owner sequence values are invalid, NFS4ERR_BAD_SEQID is returned. When a stateid sequence is checked, NFS4ERR_BAD_STATEID or NFS4ERR_OLD_STATEID is returned as appropriate, but NFS4ERR_BAD_SEQID has priority.

o 当任何状态所有者序列值无效时,将返回NFS4ERR_BAD_SEQID。检查stateid序列时,会根据需要返回NFS4ERR_BAD_stateid或NFS4ERR_OLD_stateid,但NFS4ERR_BAD_SEQID具有优先级。

o When any one of the sequence values matches a previous request, for a state-owner, it is treated as a retransmission and not re-executed. When the type of the operation does not match that originally used, NFS4ERR_BAD_SEQID is returned. When the server can determine that the request differs from the original, it may return NFS4ERR_BAD_SEQID.

o 当序列值中的任何一个与前一个请求匹配时,对于状态所有者,它将被视为重传,而不是重新执行。当操作类型与最初使用的不匹配时,将返回NFS4ERR_BAD_SEQID。当服务器可以确定请求与原始请求不同时,它可能会返回NFS4ERR_BAD_SEQID。

o When multiple sequence values match previous operations but the operations are not the same, NFS4ERR_BAD_SEQID is returned.

o 当多个序列值与以前的操作匹配但操作不相同时,将返回NFS4ERR_BAD_SEQID。

o When there are no sequence values available for comparison and the operation is an OPEN, the server indicates to the client that an OPEN_CONFIRM is required, unless it can conclusively determine that confirmation is not required (e.g., by knowing that no open-owner state has ever been released for the current clientid).

o 当没有可用于比较的序列值且操作是开放的时,服务器向客户端指示需要开放的确认,除非它能够最终确定不需要确认(例如,通过知道当前clientid从未发布开放的所有者状态)。

9.1.10. Releasing State-Owner State
9.1.10. 释放状态所有者状态

When a particular state-owner no longer holds open or file locking state at the server, the server may choose to release the sequence number state associated with the state-owner. The server may make this choice based on lease expiration, the reclamation of server memory, or other implementation-specific details. Note that when this is done, a retransmitted request, normally identified by a matching state-owner sequence, may not be correctly recognized, so that the client will not receive the original response that it would have if the state-owner state was not released.

当特定状态所有者不再在服务器上保持打开或文件锁定状态时,服务器可以选择释放与状态所有者关联的序列号状态。服务器可以根据租约到期、服务器内存回收或其他特定于实现的详细信息进行选择。请注意,当完成此操作时,通常由匹配的状态所有者序列标识的重新传输请求可能无法正确识别,因此客户端将不会接收到在状态所有者状态未释放时将具有的原始响应。

If the server were able to be sure that a given state-owner would never again be used by a client, such an issue could not arise. Even when the state-owner state is released and the client subsequently uses that state-owner, retransmitted requests will be detected as invalid and the request not executed, although the client may have a recovery path that is more complicated than simply getting the original response back transparently.

如果服务器能够确保给定的状态所有者不再被客户端使用,那么就不会出现这样的问题。即使当状态所有者状态被释放并且客户端随后使用该状态所有者时,重新传输的请求也将被检测为无效且请求未执行,尽管客户端可能具有比简单透明地获取原始响应更复杂的恢复路径。

In any event, the server is able to safely release state-owner state (in the sense that retransmitted requests will not be erroneously acted upon) when the state-owner is not currently being utilized by the client (i.e., there are no open files associated with an open-owner and no lock stateids associated with a lock-owner). The server may choose to hold the state-owner state in order to simplify the recovery path, in the case in which retransmissions of currently active requests are received. However, the period for which it chooses to hold this state is implementation specific.

在任何情况下,当客户端当前未使用状态所有者时(即,没有与打开的所有者相关联的打开的文件,也没有与锁所有者相关联的锁stateids),服务器都能够安全地释放状态所有者状态(在某种意义上,不会错误地处理重新传输的请求)。在接收到当前活动请求的重传的情况下,服务器可以选择保持状态所有者状态以简化恢复路径。然而,它选择保持这种状态的期限是具体实施的。

In the case that a LOCK, LOCKU, OPEN_DOWNGRADE, or CLOSE is retransmitted after the server has previously released the state-owner state, the server will find that the state-owner has no files open and an error will be returned to the client. If the state-owner does have a file open, the stateid will not match and again an error is returned to the client.

如果在服务器先前释放状态所有者状态后重新传输锁定、锁定、打开降级或关闭,服务器将发现状态所有者没有打开的文件,并将向客户端返回错误。如果状态所有者确实打开了一个文件,则stateid将不匹配,并再次向客户端返回一个错误。

9.1.11. Use of Open Confirmation
9.1.11. 公开确认的使用

In the case that an OPEN is retransmitted and the open-owner is being used for the first time or the open-owner state has been previously released by the server, the use of the OPEN_CONFIRM operation will prevent incorrect behavior. When the server observes the use of the open-owner 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 open-owner and associated sequence number. Since the OPEN_CONFIRM sequence connects a new open-owner on the server with an existing open-owner on a client, the sequence number may have any valid (i.e., non-zero) value. The OPEN_CONFIRM step assures the server that the value received is the correct one. (See Section 16.18 for further details.)

如果重新传输打开的文件,并且打开的所有者第一次被使用,或者服务器先前已释放打开的所有者状态,则使用打开确认操作将防止错误行为。当服务器第一次观察到OpenOwner的使用时,它将指示客户端对相应的OpenOwner执行OpenU确认。该序列确定了开放所有者和相关序列号的使用。由于OPEN_CONFIRM序列将服务器上的新开放所有者与客户端上的现有开放所有者连接起来,因此序列号可能具有任何有效(即非零)值。打开确认步骤可确保服务器收到的值是正确的。(详见第16.18节。)

There are a number of situations in which the requirement to confirm an OPEN would pose difficulties for the client and server, in that they would be prevented from acting in a timely fashion on information received, because that information would be provisional, subject to deletion upon non-confirmation. Fortunately, these are situations in which the server can avoid the need for confirmation when responding to open requests. The two constraints are:

在许多情况下,确认开放的要求会给客户机和服务器带来困难,因为它们无法及时处理收到的信息,因为这些信息是临时性的,在未确认时会被删除。幸运的是,在这些情况下,服务器可以避免在响应打开的请求时进行确认。这两个限制是:

o The server must not bestow a delegation for any open that would require confirmation.

o 服务器不得为任何需要确认的打开授予委派。

o The server MUST NOT require confirmation on a reclaim-type open (i.e., one specifying claim type CLAIM_PREVIOUS or CLAIM_DELEGATE_PREV).

o 服务器不得要求确认打开的回收类型(即指定索赔类型claim_PREVIOUS或claim_DELEGATE_PREV的类型)。

These constraints are related in that reclaim-type opens are the only ones in which the server may be required to send a delegation. For CLAIM_NULL, sending the delegation is optional, while for CLAIM_DELEGATE_CUR, no delegation is sent.

这些约束是相关的,因为回收类型是服务器可能需要发送委派的唯一约束。对于CLAIM_NULL,发送委派是可选的,而对于CLAIM_DELEGATE_CUR,不发送委派。

Delegations being sent with an open requiring confirmation are troublesome because recovering from non-confirmation adds undue complexity to the protocol, while requiring confirmation on reclaim-type opens poses difficulties in that the inability to resolve the status of the reclaim until lease expiration may make it difficult to have timely determination of the set of locks being reclaimed (since the grace period may expire).

发出要求确认的开放式授权的代表团很麻烦,因为从未确认中恢复会给协议增加不必要的复杂性,虽然要求确认回收类型打开会带来困难,因为在租约到期之前无法解决回收状态可能会导致难以及时确定要回收的锁集(因为宽限期可能到期)。

Requiring open confirmation on reclaim-type opens is avoidable because of the nature of the environments in which such opens are done. For CLAIM_PREVIOUS opens, this is immediately after server reboot, so there should be no time for open-owners to be created, found to be unused, and recycled. For CLAIM_DELEGATE_PREV opens,

由于执行此类打开的环境的性质,可以避免要求对回收类型打开进行打开确认。对于之前打开的声明,这是在服务器重新启动后立即打开的,因此应该没有时间创建、发现未使用和回收打开的所有者。对于索赔(委托)(上一页),,

we are dealing with either a client reboot situation or a network partition resulting in deletion of lease state (and returning NFS4ERR_EXPIRED). A server that supports delegations can be sure that no open-owners for that client have been recycled since client initialization or deletion of lease state and thus can be confident that confirmation will not be required.

我们正在处理导致租约状态删除(并返回NFS4ERR_EXPIRED)的客户端重新启动情况或网络分区。支持委托的服务器可以确保在客户端初始化或删除租约状态后,该客户端的开放所有者没有被回收,因此可以确信不需要确认。

9.2. Lock Ranges
9.2. 锁定范围

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.

该协议允许锁所有者请求具有字节范围的锁,然后升级或解锁初始锁的子范围。预计这将是一种不常见的请求类型。在任何情况下,服务器或服务器文件系统都可能无法支持子范围锁语义。如果服务器接收到表示锁所有者当前锁定状态子范围的锁定请求,则允许服务器返回错误NFS4ERR_lock_range,以表示它不支持子范围锁定操作。因此,客户机应该准备好接收此错误,并在适当的情况下向请求的应用程序报告此错误。

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 Section 9.6.2 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.

由于服务器可能不支持子范围请求,并且由于与服务器故障时恢复文件锁定状态有关的原因,不鼓励客户端将碰巧相邻的多个独立锁定范围合并到单个请求中。如下文第9.6.2节所述,服务器可能在恢复期间采用某些优化,这些优化只有在锁定恢复期间的客户端行为与服务器故障之前的客户端锁定行为类似时才能有效工作。

9.3. Upgrading and Downgrading Locks
9.3. 升级和降级锁

If a client has a write lock on a record, it can request an atomic downgrade of the lock to a read lock via the LOCK request, by setting the type to READ_LT. If the server supports atomic downgrade, the request will succeed. If not, it will return NFS4ERR_LOCK_NOTSUPP. The client should be prepared to receive this error and, if appropriate, report the error to the requesting application.

如果客户机在记录上有写锁,它可以通过锁请求请求将锁的原子降级为读锁,方法是将类型设置为read\LT。如果服务器支持原子降级,则请求将成功。否则,它将返回NFS4ERR\u LOCK\u NOTSUPP。客户端应准备好接收此错误,并在适当的情况下向请求的应用程序报告此错误。

If a client has a read lock on a record, it can request an atomic upgrade of the lock to a write lock via the LOCK request by setting the type to WRITE_LT or WRITEW_LT. If the server does not support atomic upgrade, it will return NFS4ERR_LOCK_NOTSUPP. If the upgrade can be achieved without an existing conflict, the request will succeed. Otherwise, the server will return either NFS4ERR_DENIED or NFS4ERR_DEADLOCK. The error NFS4ERR_DEADLOCK is returned if the client issued the LOCK request with the type set to WRITEW_LT and the

如果客户机对记录具有读锁,则可以通过将类型设置为write_LT或WRITEW_LT,通过锁请求将锁的原子升级为写锁。如果服务器不支持原子升级,它将返回NFS4ERR_lock_NOTSUPP。如果可以在不存在冲突的情况下实现升级,则请求将成功。否则,服务器将返回NFS4ERR_DENIED或NFS4ERR_DEADLOCK。如果客户端发出类型设置为WRITEW_LT的锁请求,并且

server has detected a deadlock. The client should be prepared to receive such errors and, if appropriate, report them to the requesting application.

服务器检测到死锁。客户应做好接收此类错误的准备,并在适当情况下向请求的应用程序报告这些错误。

9.4. Blocking Locks
9.4. 闭锁

Some clients require the support of blocking locks. The NFSv4 protocol must not rely on a callback mechanism and therefore is unable to notify a client when a previously denied lock has been 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 required to maintain a list of pending blocked locks, as it is not used to provide correct operation but only to increase fairness. Because of the unordered nature of crash recovery, storing of lock state to stable storage would be required to guarantee ordered granting of blocking locks.

有些客户机需要阻塞锁的支持。NFSv4协议不能依赖回调机制,因此无法在授予先前被拒绝的锁时通知客户端。客户端别无选择,只能不断轮询锁。这是一个公平问题。添加了两种新的锁类型READW和WRITEW,用于向服务器指示客户端正在请求阻塞锁。服务器应该维护挂起的阻塞锁的有序列表。当冲突锁被释放时,服务器可能会等待租约期,等待第一个等待的客户端重新请求锁。租赁期到期后,允许下一个等待的客户端请求锁定。客户端需要以足够小的间隔进行轮询,以便能够及时获取锁。服务器不需要维护挂起的阻塞锁列表,因为它不用于提供正确的操作,而仅用于提高公平性。由于崩溃恢复的无序性,需要将锁状态存储到稳定存储,以保证阻塞锁的有序授予。

Servers may also note the lock types and delay returning denial of the request to allow extra time for a conflicting lock to be released, allowing a successful return. In this way, clients can avoid the burden of needlessly frequent polling for blocking locks. The server should take care with the length of delay in the event that the client retransmits the request.

服务器还可能会注意到锁的类型,并延迟请求的返回拒绝,以允许释放冲突锁的额外时间,从而允许成功返回。这样,客户机就可以避免不必要的频繁轮询阻塞锁的负担。在客户端重新传输请求时,服务器应注意延迟的长度。

If a server receives a blocking lock request, denies it, and then later receives a non-blocking request for the same lock, which is also denied, then it should remove the lock in question from its list of pending blocking locks. Clients should use such a non-blocking request to indicate to the server that this is the last time they intend to poll for the lock, as may happen when the process requesting the lock is interrupted. This is a courtesy to the server, to prevent it from unnecessarily waiting a lease period before granting other lock requests. However, clients are not required to perform this courtesy, and servers must not depend on them doing so. Also, clients must be prepared for the possibility that this final locking request will be accepted.

如果服务器收到一个阻塞锁请求并拒绝它,然后又收到一个针对同一个锁的非阻塞请求(该请求也被拒绝),那么它应该将该锁从其挂起的阻塞锁列表中移除。客户端应该使用这样一个非阻塞请求来向服务器指示这是他们最后一次打算轮询锁,当请求锁的进程中断时可能会发生这种情况。这是对服务器的一种礼貌,以防止它在授予其他锁请求之前不必要地等待租用期。但是,客户机不需要执行这种礼节,服务器也不能依赖客户机这样做。此外,客户必须准备好接受最终锁定请求的可能性。

9.5. Lease Renewal
9.5. 续租

The purpose of a lease is to allow a server to remove stale locks that are held by a client that has crashed or is otherwise unreachable. It is not a mechanism for cache consistency, and lease renewals may not be denied if the lease interval has not expired.

租约的目的是允许服务器删除已崩溃或无法访问的客户端持有的过时锁。它不是缓存一致性的机制,如果租约间隔未过期,则租约续订可能不会被拒绝。

The client can implicitly provide a positive indication that it is still active and that the associated state held at the server, for the client, is still valid. Any operation made with a valid clientid (DELEGPURGE, LOCK, LOCKT, OPEN, RELEASE_LOCKOWNER, or RENEW) or a valid stateid (CLOSE, DELEGRETURN, LOCK, LOCKU, OPEN, OPEN_CONFIRM, OPEN_DOWNGRADE, READ, SETATTR, or WRITE) informs the server to renew all of the leases for that client (i.e., all those sharing a given client ID). In the latter case, the stateid must not be one of the special stateids (anonymous stateid or READ bypass stateid).

客户端可以隐式地提供一个积极的指示,表明它仍然处于活动状态,并且服务器上为客户端保留的关联状态仍然有效。使用有效的clientid(DELEGPURGE、LOCK、LOCKT、OPEN、RELEASE\u LOCKOWNER或RENEW)或有效的stateid(CLOSE、DELEGRETURN、LOCK、LOCKU、OPEN、OPEN\u CONFIRM、OPEN\u Degrade、READ、SETATTR或WRITE)执行的任何操作都会通知服务器续订该客户端的所有租约(即,所有共享给定客户端ID的人)。在后一种情况下,stateid不能是特殊stateid(匿名stateid或读取旁路stateid)之一。

Note that if the client had restarted or rebooted, the client would not be making these requests without issuing the SETCLIENTID/ SETCLIENTID_CONFIRM sequence. The use of the SETCLIENTID/ SETCLIENTID_CONFIRM sequence (one that changes the client verifier) notifies the server to drop the locking state associated with the client. SETCLIENTID/SETCLIENTID_CONFIRM never renews a lease.

请注意,如果客户端已重新启动或重新启动,则在未发出SETCLIENTID/SETCLIENTID_确认序列的情况下,客户端不会发出这些请求。使用SETCLIENTID/SETCLIENTID_确认序列(更改客户端验证器的序列)通知服务器放弃与客户端关联的锁定状态。SETCLIENTID/SETCLIENTID\u确认从不续订租约。

If the server has rebooted, the stateids (NFS4ERR_STALE_STATEID error) or the client ID (NFS4ERR_STALE_CLIENTID error) will not be valid, hence preventing spurious renewals.

如果服务器已重新启动,STATEID(NFS4ERR\u STALE\u STATEID错误)或客户端ID(NFS4ERR\u STALE\u CLIENTID错误)将无效,从而防止虚假续订。

This approach allows for low-overhead lease renewal, which scales well. In the typical case, no extra RPCs 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.

这种方法允许低管理费用的租赁续期,这可以很好地扩展。在典型情况下,续租不需要额外的RPC,在最坏的情况下,每个租赁期需要一个RPC(即续租操作)。客户端持有的锁的数量不是一个因素,因为客户端的所有状态都与租约续订操作有关。

Since all operations that create a new lease also renew existing leases, the server must maintain a common lease expiration time for all valid leases for a given client. This lease time can then be easily updated upon implicit lease renewal actions.

由于创建新租约的所有操作也会续订现有租约,因此服务器必须为给定客户端的所有有效租约维护一个公共租约到期时间。然后,可以根据隐式租约续订操作轻松更新此租约时间。

9.6. Crash Recovery
9.6. 事故恢复

The important requirement in crash recovery is that both the client and the server know when the other has failed. Additionally, it is required that a client sees a consistent view of data across server restarts or reboots. All READ and WRITE operations that may have been queued within the client or network buffers must wait until the client has successfully recovered the locks protecting the READ and WRITE operations.

崩溃恢复的重要要求是,客户端和服务器都知道另一方何时出现故障。此外,要求客户端在服务器重新启动或重新启动时看到一致的数据视图。在客户端或网络缓冲区内排队的所有读写操作必须等待,直到客户端成功恢复保护读写操作的锁。

9.6.1. Client Failure and Recovery
9.6.1. 客户端故障和恢复

In the event that a client fails, the server may recover the client's 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, open and 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 client ID as a result of the SETCLIENTID operation. The client then confirms the use of the client ID with SETCLIENTID_CONFIRM. The client ID in combination with an opaque owner field is then used by the client to identify the open-owner for OPEN. This chain of associations is then used to identify all locks for a particular client.

为了最小化重启时的客户端延迟,打开和锁定请求由客户端提供的验证器与客户端实例相关联。此验证器是客户端进行的初始SETCLIENTID调用的一部分。服务器返回一个客户端ID作为SETCLIENTID操作的结果。然后,客户机使用SETCLIENTID\u CONFIRM确认客户机ID的使用。然后,客户机使用客户机ID和不透明所有者字段来标识open的open所有者。然后,该关联链用于标识特定客户端的所有锁。

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 all locks held that are associated with the old client ID that was derived from the old verifier.

由于客户端在每次初始化时都会更改验证器,因此服务器可以将新的验证器与与当前持有的锁关联的验证器进行比较,并确定它们不匹配。这表示客户端的新实例化和随后的锁定状态丢失。因此,服务器可以自由地释放与从旧验证器派生的旧客户端ID关联的所有锁。

Note that the verifier must have the same uniqueness properties of the verifier for the COMMIT operation.

请注意,对于提交操作,验证器必须具有与验证器相同的唯一性属性。

9.6.2. Server Failure and Recovery
9.6.2. 服务器故障和恢复

If the server loses locking state (usually as a result of a restart or reboot), it must allow clients time to discover this fact and re-establish the lost locking state. The client must be able to re-establish the locking state without having the server deny valid requests because the server has granted conflicting access to another client. Likewise, if there is the possibility that clients have

如果服务器失去锁定状态(通常是由于重新启动或重新启动),它必须让客户端有时间发现这一事实并重新建立失去的锁定状态。客户端必须能够重新建立锁定状态,而无需服务器拒绝有效请求,因为服务器已授予另一客户端冲突的访问权限。同样,如果客户有可能

not yet re-established their locking state for a file, the server must disallow READ and WRITE operations for that file. The duration of this recovery period is equal to the duration of the lease period.

尚未重新建立文件的锁定状态,服务器必须禁止该文件的读写操作。此恢复期的持续时间等于租赁期的持续时间。

A client can determine that server failure (and thus loss of locking state) has occurred, when it receives one of two errors. The NFS4ERR_STALE_STATEID error indicates a stateid invalidated by a reboot or restart. The NFS4ERR_STALE_CLIENTID error indicates a client ID invalidated by reboot or restart. When either of these is received, the client must establish a new client ID (see Section 9.1.1) and re-establish the locking state as discussed below.

当客户端收到两个错误中的一个错误时,它可以确定服务器发生故障(从而失去锁定状态)。NFS4ERR\u STALE\u STATEID错误表示STATEID因重新启动或重新启动而无效。NFS4ERR_STALE_CLIENTID错误表示客户端ID因重新启动或重新启动而无效。当收到其中任何一个时,客户机必须建立一个新的客户机ID(见第9.1.1节),并重新建立锁定状态,如下所述。

The period of special handling of locking and READs and WRITEs, equal in duration to the lease period, is referred to as the "grace period". During the grace period, clients recover locks and the associated state by reclaim-type locking requests (i.e., LOCK requests with reclaim set to TRUE and OPEN operations with a claim type of either CLAIM_PREVIOUS or CLAIM_DELEGATE_PREV). 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.

锁定和读写的特殊处理期限与租赁期限相等,称为“宽限期”。在宽限期内,客户端通过回收类型锁定请求(即,将回收设置为TRUE的锁定请求和索赔类型为claim_PREVIOUS或claim_DELEGATE_PREV的打开操作)恢复锁和关联状态。在宽限期内,服务器必须拒绝读写操作和非回收锁定请求(即其他锁定和打开操作),错误为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 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.

如果服务器能够可靠地确定授予非回收请求不会与其他客户端的锁回收冲突,则不必返回NFS4ERR_GRACE错误,并且可以为非回收客户端请求提供服务。为了使服务器能够在宽限期内为读写操作提供服务,它必须再次能够保证即将到来的回收锁定请求与读写操作之间不会出现任何可能的冲突。如果服务器无法提供该保证,则必须将NFS4ERR_GRACE错误返回给客户端。

For a server to provide simple, valid handling during the grace 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.

对于要在宽限期内提供简单有效的处理的服务器,最简单的方法是通过返回NFS4ERR_宽限期错误,简单地拒绝所有非回收锁定请求和读写操作。但是,服务器可能会在稳定的存储中保留有关已授予锁的信息。有了这些信息,服务器可以确定是否可以安全地处理常规锁定或读写操作。

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 may be processed. This way, the server can ensure that non-reclaim locking requests will not conflict with potential reclaim requests. With respect to I/O requests, if the server is able to

例如,如果给定文件上的锁数量在稳定存储中可用,则服务器可以跟踪该文件的回收锁,并且在处理完所有回收后,可以处理非回收锁定请求。这样,服务器可以确保非回收锁定请求不会与潜在的回收请求冲突。对于I/O请求,如果服务器能够

determine that there are no outstanding reclaim requests for a file by information from stable storage or another similar mechanism, the processing of I/O requests could proceed normally for the file.

如果通过稳定存储或其他类似机制中的信息确定没有未完成的文件回收请求,则文件的I/O请求处理可以正常进行。

To reiterate, for a server that allows non-reclaim lock and I/O requests to be processed during the grace period, it MUST determine that no lock subsequently reclaimed will be rejected and that no lock subsequently reclaimed would have prevented any I/O operation processed during the grace period.

重申一下,对于允许在宽限期内处理非回收锁和I/O请求的服务器,必须确定随后回收的锁不会被拒绝,并且随后回收的锁不会阻止宽限期内处理的任何I/O操作。

Clients should be prepared for the return of NFS4ERR_GRACE errors for non-reclaim lock and I/O requests. In this case, the client should employ a retry mechanism for the request. A delay (on the order of several seconds) between retries should be used to avoid overwhelming the server. Further discussion of the general issue is included in [Floyd]. The client must account for the server that is able to perform I/O and non-reclaim locking requests within the grace period as well as those that cannot do so.

客户端应准备好返回非回收锁和I/O请求的NFS4ERR_GRACE错误。在这种情况下,客户端应该对请求采用重试机制。重试之间应使用延迟(大约几秒钟),以避免服务器无法正常工作。关于一般性问题的进一步讨论载于[Floyd]。客户机必须说明能够在宽限期内执行I/O和非回收锁定请求的服务器以及不能执行这些请求的服务器。

A reclaim-type locking request outside the server's grace period can only succeed if the server can guarantee that no conflicting lock or I/O request has been granted since reboot or restart.

只有在服务器能够保证自重新启动或重新启动后未授予任何冲突的锁定或I/O请求的情况下,服务器宽限期之外的回收类型锁定请求才能成功。

A server may, upon restart, establish a new value for the lease period. Therefore, clients should, once a new client ID is established, refetch the lease_time attribute and use it as the basis for lease renewal for the lease associated with that server. However, the server must establish, for this restart event, a grace period at least as long as the lease period for the previous server instantiation. This allows the client state obtained during the previous server instance to be reliably re-established.

服务器可以在重新启动时为租赁期建立新值。因此,一旦建立了新的客户机ID,客户机应重新蚀刻lease_time属性,并将其用作与该服务器关联的租约的租约续订基础。但是,对于此重新启动事件,服务器必须建立一个宽限期,该宽限期至少与上一个服务器实例化的租用期一样长。这允许可靠地重新建立在上一个服务器实例期间获得的客户端状态。

9.6.3. Network Partitions and Recovery
9.6.3. 网络分区和恢复

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 cancel the lease and 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, the client will suitably notify the application that held the lock.

如果网络分区的持续时间大于服务器提供的租约期限,则服务器将不会从客户端收到租约续订。如果发生这种情况,服务器可能会取消租约并释放为客户端保留的所有锁。因此,客户端持有的所有StateID都将变得无效或过时。一旦客户机能够在这样一个网络分区之后到达服务器,客户机提交的所有I/O以及现在无效的StateID都将失败,服务器返回错误NFS4ERR_EXPIRED。一旦收到此错误,客户端将适当地通知持有锁的应用程序。

9.6.3.1. Courtesy Locks
9.6.3.1. 门控锁

As a courtesy to the client or as an optimization, the server may continue to hold locks, including delegations, on behalf of a client for which recent communication has extended beyond the lease period, delaying the cancellation of the lease. If the server receives a lock or I/O request that conflicts with one of these courtesy locks or if it runs out of resources, the server MAY cause lease cancellation to occur at that time and henceforth return NFS4ERR_EXPIRED when any of the stateids associated with the freed locks is used. If lease cancellation has not occurred and the server receives a lock or I/O request that conflicts with one of the courtesy locks, the requirements are as follows:

作为对客户机的礼貌或作为优化,服务器可以代表最近的通信已经延长到租赁期之外的客户机继续持有锁,包括委托,从而延迟租赁的取消。如果服务器接收到与这些礼貌锁之一冲突的锁或I/O请求,或者如果资源耗尽,则服务器可能会导致此时发生租约取消,并在使用与释放的锁关联的任何StateID时返回NFS4ERR_EXPIRED。如果租赁取消未发生,且服务器收到与其中一个门控锁冲突的锁或I/O请求,则要求如下:

o In the case of a courtesy lock that is not a delegation, it MUST free the courtesy lock and grant the new request.

o 如果门控锁不是委托,则必须释放门控锁并批准新请求。

o In the case of a lock or an I/O request that conflicts with a delegation that is being held as a courtesy lock, the server MAY delay resolution of the request but MUST NOT reject the request and MUST free the delegation and grant the new request eventually.

o 如果锁或I/O请求与作为礼节锁持有的委托冲突,服务器可能会延迟请求的解决,但不得拒绝请求,并且必须释放委托并最终授予新请求。

o In the case of a request for a delegation that conflicts with a delegation that is being held as a courtesy lock, the server MAY grant the new request or not as it chooses, but if it grants the conflicting request, the delegation held as a courtesy lock MUST be freed.

o 如果委托请求与作为礼节锁保留的委托冲突,服务器可以根据选择授予或不授予新请求,但如果授予冲突请求,则必须释放作为礼节锁保留的委托。

If the server does not reboot or cancel the lease before the network partition is healed, when the original client tries to access a courtesy lock that was freed, the server SHOULD send back an NFS4ERR_BAD_STATEID to the client. If the client tries to access a courtesy lock that was not freed, then the server SHOULD mark all of the courtesy locks as implicitly being renewed.

如果服务器在网络分区修复之前未重新启动或取消租约,则当原始客户端尝试访问已释放的门控锁时,服务器应向客户端发回NFS4ERR_BAD_STATEID。如果客户端试图访问未释放的门控锁,则服务器应将所有门控锁标记为隐式续订。

9.6.3.2. Lease Cancellation
9.6.3.2. 取消租约

As a result of lease expiration, leases may be canceled, either immediately upon expiration or subsequently, depending on the occurrence of a conflicting lock or extension of the period of partition beyond what the server will tolerate.

租约到期后,租约可能会立即取消,也可能会在到期后取消,具体取决于发生冲突的锁或分区期限的延长超出服务器所能容忍的范围。

When a lease is canceled, all locking state associated with it is freed, and the use of any of the associated stateids will result in NFS4ERR_EXPIRED being returned. Similarly, the use of the associated clientid will result in NFS4ERR_EXPIRED being returned.

当租约被取消时,与之关联的所有锁定状态将被释放,并且使用任何关联的StateID都将导致返回NFS4ERR_EXPIRED。类似地,使用关联的clientid将导致返回NFS4ERR_EXPIRED。

The client should recover from this situation by using SETCLIENTID followed by SETCLIENTID_CONFIRM, in order to establish a new clientid. Once a lock is obtained using this clientid, a lease will be established.

客户端应使用SETCLIENTID,然后使用SETCLIENTID_CONFIRM从这种情况中恢复,以便建立新的clientid。使用此clientid获得锁后,将建立租约。

9.6.3.3. Client's Reaction to a Freed Lock
9.6.3.3. 客户端对释放的锁的反应

There is no way for a client to predetermine how a given server is going to behave during a network partition. When the partition heals, the client still has either all of its locks, some of its locks, or none of them. The client will be able to examine the various error return values to determine its response.

客户端无法预先确定给定服务器在网络分区期间的行为。当分区恢复时,客户机仍然拥有它的所有锁、一些锁或没有锁。客户端将能够检查各种错误返回值以确定其响应。

NFS4ERR_EXPIRED:

NFS4ERR_已过期:

All locks have been freed as a result of a lease cancellation that occurred during the partition. The client should use a SETCLIENTID to recover.

由于分区期间发生的租约取消,所有锁都已释放。客户端应使用SETCLIENTID进行恢复。

NFS4ERR_ADMIN_REVOKED:

NFS4ERR_ADMIN_已撤销:

The current lock has been revoked before, during, or after the partition. The client SHOULD handle this error as it normally would.

当前锁已在分区之前、期间或之后撤销。客户端应该像平常一样处理这个错误。

NFS4ERR_BAD_STATEID:

NFS4ERR_BAD_STATEID:

The current lock has been revoked/released during the partition, and the server did not reboot. Other locks MAY still be renewed. The client need not do a SETCLIENTID and instead SHOULD probe via a RENEW call.

当前锁已在分区期间被撤销/释放,服务器未重新启动。其他锁仍可能更新。客户端不需要执行SETCLIENTID,而是应该通过续订呼叫进行探测。

NFS4ERR_RECLAIM_BAD:

NFS4ERR_receive_BAD:

The current lock has been revoked during the partition, and the server rebooted. The server might have no information on the other locks. They may still be renewable.

当前锁已在分区期间被撤销,服务器已重新启动。服务器可能没有关于其他锁的信息。它们可能仍然是可再生的。

NFS4ERR_NO_GRACE:

NFS4ERR_NO_GRACE:

The client's locks have been revoked during the partition, and the server rebooted. None of the client's locks will be renewable.

在分区期间,客户端的锁已被撤销,服务器已重新启动。客户端的锁都不可更新。

NFS4ERR_OLD_STATEID:

NFS4ERR_OLD_STATEID:

The server has not rebooted. The client SHOULD handle this error as it normally would.

服务器尚未重新启动。客户端应该像平常一样处理这个错误。

9.6.3.4. Edge Conditions
9.6.3.4. 边缘条件

When a network partition is combined with a server reboot, then both the server and client have responsibilities to ensure that the client does not reclaim a lock that it should no longer be able to access. Briefly, those are:

当网络分区与服务器重新启动相结合时,服务器和客户机都有责任确保客户机不会回收其不再能够访问的锁。简而言之,这些是:

o Client's responsibility: A client MUST NOT attempt to reclaim any locks that it did not hold at the end of its most recent successfully established client lease.

o 客户的责任:客户不得试图收回其在最近成功建立的客户租约结束时未持有的任何锁。

o Server's responsibility: A server MUST NOT allow a client to reclaim a lock unless it knows that it could not have since granted a conflicting lock. However, in deciding whether a conflicting lock could have been granted, it is permitted to assume that its clients are responsible, as above.

o 服务器的责任:服务器不得允许客户机回收锁,除非它知道此后不可能授予冲突的锁。但是,在决定是否可以授予冲突锁时,允许假定其客户机负责,如上所述。

A server may consider a client's lease "successfully established" once it has received an OPEN operation from that client.

一旦客户端从该客户端接收到打开的操作,服务器可以考虑“成功建立”租约。

The above are directed to CLAIM_PREVIOUS reclaims and not to CLAIM_DELEGATE_PREV reclaims, which generally do not involve a server reboot. However, when a server persistently stores delegation information to support CLAIM_DELEGATE_PREV across a period in which both client and server are down at the same time, similar strictures apply.

上述内容旨在声明_先前的回收,而不是声明_委托_先前的回收,这通常不涉及服务器重新启动。但是,当服务器在客户端和服务器同时停机的期间内持续存储委托信息以支持CLAIM_DELEGATE_PREV时,也会应用类似的限制。

The next sections give examples showing what can go wrong if these responsibilities are neglected and also provide examples of server implementation strategies that could meet a server's responsibilities.

接下来的部分给出了一些示例,说明了如果忽略这些责任,可能会出现什么问题,并提供了可以满足服务器责任的服务器实现策略的示例。

9.6.3.4.1. First Server Edge Condition
9.6.3.4.1. 第一服务器边缘条件

The first edge condition has the following scenario:

第一条边条件具有以下情况:

1. Client A acquires a lock.

1. 客户端A获得一个锁。

2. Client A and the server experience mutual network partition, such that client A is unable to renew its lease.

2. 客户端A和服务器经历相互的网络分区,因此客户端A无法续订其租约。

3. Client A's lease expires, so the server releases the lock.

3. 客户端A的租约到期,因此服务器将释放锁。

4. Client B acquires a lock that would have conflicted with that of client A.

4. 客户端B获取的锁可能与客户端a的锁冲突。

5. Client B releases the lock.

5. 客户端B释放锁。

6. The server reboots.

6. 服务器重新启动。

7. The network partition between client A and the server heals.

7. 客户端A和服务器之间的网络分区将修复。

8. Client A issues a RENEW operation and gets back an NFS4ERR_STALE_CLIENTID.

8. 客户端A发出续订操作并获取NFS4ERR\u STALE\u CLIENTID。

9. Client A reclaims its lock within the server's grace period.

9. 客户端A在服务器的宽限期内收回其锁。

Thus, at the final step, the server has erroneously granted client A's lock reclaim. If client B modified the object the lock was protecting, client A will experience object corruption.

因此,在最后一步,服务器错误地授予客户端A的锁回收。如果客户端B修改了锁所保护的对象,客户端A将经历对象损坏。

9.6.3.4.2. Second Server Edge Condition
9.6.3.4.2. 第二服务器边缘条件

The second known edge condition follows:

第二个已知边条件如下所示:

1. Client A acquires a lock.

1. 客户端A获得一个锁。

2. The server reboots.

2. 服务器重新启动。

3. Client A and the server experience mutual network partition, such that client A is unable to reclaim its lock within the grace period.

3. 客户端A和服务器经历相互的网络分区,因此客户端A无法在宽限期内收回其锁。

4. The server's reclaim grace period ends. Client A has no locks recorded on the server.

4. 服务器的回收宽限期结束。客户端A在服务器上没有记录锁。

5. Client B acquires a lock that would have conflicted with that of client A.

5. 客户端B获取的锁可能与客户端a的锁冲突。

6. Client B releases the lock.

6. 客户端B释放锁。

7. The server reboots a second time.

7. 服务器将再次重新启动。

8. The network partition between client A and the server heals.

8. 客户端A和服务器之间的网络分区将修复。

9. Client A issues a RENEW operation and gets back an NFS4ERR_STALE_CLIENTID.

9. 客户端A发出续订操作并获取NFS4ERR\u STALE\u CLIENTID。

10. Client A reclaims its lock within the server's grace period.

10. 客户端A在服务器的宽限期内收回其锁。

As with the first edge condition, the final step of the scenario of the second edge condition has the server erroneously granting client A's lock reclaim.

与第一个边缘条件一样,第二个边缘条件场景的最后一步是服务器错误地授予客户端A的锁回收。

9.6.3.4.3. Handling Server Edge Conditions
9.6.3.4.3. 处理服务器边缘条件

In both of the above examples, the client attempts reclaim of a lock that it held at the end of its most recent successfully established lease; thus, it has fulfilled its responsibility.

在上述两个示例中,客户机尝试收回其在最近成功建立的租约结束时持有的锁;因此,它履行了自己的责任。

The server, however, has failed, by granting a reclaim, despite having granted a conflicting lock since the reclaimed lock was last held.

然而,尽管自上次持有回收的锁以来已授予冲突的锁,但服务器已通过授予回收而失败。

Solving these edge conditions requires that the server either (1) assume after it reboots that an edge condition occurs, and thus return NFS4ERR_NO_GRACE for all reclaim attempts, or (2) record some information in stable storage. The amount of information the server records in stable storage is in inverse proportion to how harsh the server wants to be whenever the edge conditions occur. The server that is completely tolerant of all edge conditions will record in stable storage every lock that is acquired, removing the lock record from stable storage only when the lock is unlocked by the client and the lock's owner advances the sequence number such that the lock release is not the last stateful event for the owner's sequence. For the two aforementioned edge conditions, the harshest a server can be, and still support a grace period for reclaims, requires that the server record in stable storage some minimal information. For example, a server implementation could, for each client, save in stable storage a record containing:

解决这些边缘条件要求服务器(1)在重新启动后假设出现边缘条件,从而为所有回收尝试返回NFS4ERR_NO_GRACE,或者(2)在稳定存储中记录一些信息。服务器在稳定存储中记录的信息量与每当出现边缘条件时服务器希望达到的苛刻程度成反比。完全容忍所有边缘条件的服务器将在稳定存储中记录获取的每个锁,只有当客户端解锁锁并且锁的所有者提前输入序列号,从而使锁释放不是所有者序列的最后一个有状态事件时,才会从稳定存储中删除锁记录。对于上述两种边缘条件,服务器可能是最苛刻的,并且仍然支持回收的宽限期,要求服务器在稳定存储中记录一些最小的信息。例如,服务器实现可以为每个客户机在稳定存储中保存一条记录,其中包含:

o the client's id string.

o 客户端的id字符串。

o a boolean that indicates if the client's lease expired or if there was administrative intervention (see Section 9.8) to revoke a byte-range lock, share reservation, or delegation.

o 一个布尔值,指示客户端的租约是否过期,或者是否有管理干预(参见第9.8节)来撤销字节范围锁、共享保留或委派。

o a timestamp that is updated the first time after a server boot or reboot the client acquires byte-range locking, share reservation, or delegation state on the server. The timestamp need not be updated on subsequent lock requests until the server reboots.

o 服务器启动或重新启动后,客户端在服务器上获取字节范围锁定、共享保留或委派状态时第一次更新的时间戳。在服务器重新启动之前,不需要在后续锁定请求中更新时间戳。

The server implementation would also record in stable storage the timestamps from the two most recent server reboots.

服务器实现还将在稳定存储器中记录最近两次服务器重新启动的时间戳。

Assuming the above record keeping, for the first edge condition, after the server reboots, the record that client A's lease expired means that another client could have acquired a conflicting record lock, share reservation, or delegation. Hence, the server must reject a reclaim from client A with the error NFS4ERR_NO_GRACE or NFS4ERR_RECLAIM_BAD.

假设上述记录保留,对于第一个边缘条件,在服务器重新启动后,客户机A的租约过期的记录意味着另一个客户机可能获得了冲突的记录锁、共享保留或委派。因此,服务器必须拒绝来自客户端a的回收,错误为NFS4ERR_NO_GRACE或NFS4ERR_reclain_BAD。

For the second edge condition, after the server reboots for a second time, the record that the client had an unexpired record lock, share reservation, or delegation established before the server's previous incarnation means that the server must reject a reclaim from client A with the error NFS4ERR_NO_GRACE or NFS4ERR_RECLAIM_BAD.

对于第二个边缘条件,在服务器第二次重新启动后,在服务器上一次运行之前,客户端已建立了未过期的记录锁定、共享保留或委派,这意味着服务器必须拒绝客户端a的回收,错误为NFS4ERR_NO_GRACE或NFS4ERR_reclain_BAD。

Regardless of the level and approach to record keeping, the server MUST implement one of the following strategies (which apply to reclaims of share reservations, byte-range locks, and delegations):

无论记录保留的级别和方法如何,服务器都必须实施以下策略之一(适用于回收共享保留、字节范围锁和委派):

1. Reject all reclaims with NFS4ERR_NO_GRACE. This is extremely harsh but is necessary if the server does not want to record lock state in stable storage.

1. 使用NFS4ERR_NO_GRACE拒绝所有回收。这非常苛刻,但如果服务器不想在稳定存储中记录锁定状态,则必须这样做。

2. Record sufficient state in stable storage to meet its responsibilities. In doubt, the server should err on the side of being harsh.

2. 在稳定的存储中记录足够的状态,以满足其职责。毫无疑问,服务器的错误在于过于苛刻。

In the event that, after a server reboot, the server determines that there is unrecoverable damage or corruption to stable storage, then for all clients and/or locks affected, the server MUST return NFS4ERR_NO_GRACE.

如果服务器重新启动后,服务器确定稳定存储存在无法恢复的损坏或损坏,则对于所有受影响的客户端和/或锁,服务器必须返回NFS4ERR_NO_GRACE。

9.6.3.4.4. Client Edge Condition
9.6.3.4.4. 客户端边缘条件

A third edge condition affects the client and not the server. If the server reboots in the middle of the client reclaiming some locks and then a network partition is established, the client might be in the situation of having reclaimed some, but not all, locks. In that case, a conservative client would assume that the non-reclaimed locks were revoked.

第三个边缘条件影响客户端而不是服务器。如果服务器重新启动在客户端的中间,回收一些锁,然后建立一个网络分区,客户端可能处于回收一些但不是全部锁的情况。在这种情况下,保守的客户端会假定未回收的锁已被撤销。

The third known edge condition follows:

第三个已知边条件如下所示:

1. Client A acquires a lock 1.

1. 客户端A获得锁1。

2. Client A acquires a lock 2.

2. 客户端A获得锁2。

3. The server reboots.

3. 服务器重新启动。

4. Client A issues a RENEW operation and gets back an NFS4ERR_STALE_CLIENTID.

4. 客户端A发出续订操作并获取NFS4ERR\u STALE\u CLIENTID。

5. Client A reclaims its lock 1 within the server's grace period.

5. 客户端A在服务器的宽限期内回收其锁1。

6. Client A and the server experience mutual network partition, such that client A is unable to reclaim its remaining locks within the grace period.

6. 客户端A和服务器经历相互的网络分区,因此客户端A无法在宽限期内回收其剩余的锁。

7. The server's reclaim grace period ends.

7. 服务器的回收宽限期结束。

8. Client B acquires a lock that would have conflicted with client A's lock 2.

8. 客户端B获取的锁可能与客户端a的锁2冲突。

9. Client B releases the lock.

9. 客户端B释放锁。

10. The server reboots a second time.

10. 服务器将再次重新启动。

11. The network partition between client A and the server heals.

11. 客户端A和服务器之间的网络分区将修复。

12. Client A issues a RENEW operation and gets back an NFS4ERR_STALE_CLIENTID.

12. 客户端A发出续订操作并获取NFS4ERR\u STALE\u CLIENTID。

13. Client A reclaims both lock 1 and lock 2 within the server's grace period.

13. 客户端A在服务器的宽限期内回收锁1和锁2。

At the last step, the client reclaims lock 2 as if it had held that lock continuously, when in fact a conflicting lock was granted to client B.

在最后一步中,客户机回收锁2,就好像它一直持有该锁一样,而实际上一个冲突的锁被授予了客户机B。

This occurs because the client failed its responsibility, by attempting to reclaim lock 2 even though it had not held that lock at the end of the lease that was established by the SETCLIENTID after the first server reboot. (The client did hold lock 2 on a previous lease, but it is only the most recent lease that matters.)

发生这种情况的原因是,客户机未能履行其职责,尝试回收锁2,即使它在第一次服务器重新启动后由SETCLIENTID建立的租约结束时未持有该锁。(客户确实在以前的租约中持有锁2,但这只是最新的租约。)

A server could avoid this situation by rejecting the reclaim of lock 2. However, to do so accurately, it would have to ensure that additional information about individual locks held survives a reboot. Server implementations are not required to do that, so the client must not assume that the server will.

服务器可以通过拒绝回收锁2来避免这种情况。但是,为了准确地执行此操作,它必须确保有关持有的各个锁的附加信息在重新启动后仍然有效。服务器实现不需要这样做,因此客户端不能假设服务器会这样做。

Instead, a client MUST reclaim only those locks that it successfully acquired from the previous server instance, omitting any that it failed to reclaim before a new reboot. Thus, in the last step above, client A should reclaim only lock 1.

相反,客户机必须只回收它从以前的服务器实例成功获取的锁,而忽略它在重新启动之前未能回收的任何锁。因此,在上面的最后一步中,客户端A应该只回收锁1。

9.6.3.4.5. Client's Handling of Reclaim Errors
9.6.3.4.5. 客户对回收错误的处理

A mandate for the client's handling of the NFS4ERR_NO_GRACE and NFS4ERR_RECLAIM_BAD errors is outside the scope of this specification, since the strategies for such handling are very dependent on the client's operating environment. However, one potential approach is described below.

客户处理NFS4ERR_NO_GRACE和NFS4ERR_Receive_错误的授权不在本规范的范围内,因为此类处理策略非常依赖于客户的操作环境。然而,下文描述了一种可能的方法。

When the client's reclaim fails, it could examine the change attribute of the objects the client is trying to reclaim state for, and use that to determine whether to re-establish the state via normal OPEN or LOCK requests. This is acceptable, provided the client's operating environment allows it. In other words, the client implementer is advised to document the behavior for his users. The client could also inform the application that its byte-range lock or share reservations (whether they were delegated or not) have been lost, such as via a UNIX signal, a GUI pop-up window, etc. See Section 10.5 for a discussion of what the client should do for dealing with unreclaimed delegations on client state.

当客户机的回收失败时,它可以检查客户机试图回收状态的对象的change属性,并使用该属性确定是否通过正常的OPEN或LOCK请求重新建立状态。只要客户的操作环境允许,这是可以接受的。换句话说,建议客户机实现者为其用户记录行为。客户端还可以通知应用程序其字节范围锁或共享保留(无论它们是否被委派)已丢失,例如通过UNIX信号、GUI弹出窗口等。有关客户端应如何处理客户端状态下未委派的委派的讨论,请参阅第10.5节。

For further discussion of revocation of locks, see Section 9.8.

有关撤销锁的进一步讨论,请参见第9.8节。

9.7. Recovery from a Lock Request Timeout or Abort
9.7. 从锁定请求超时或中止中恢复

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 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 resynchronize state with the server before it attempts any other operation that takes a seqid and/or a stateid with the same state-owner. This is straightforward to do without a special resynchronize operation.

如果锁定请求超时,客户端可能会决定不重试该请求。当为其发出请求的进程终止时(例如,在UNIX中,由于信号),客户端也可能中止请求。不过,服务器有可能接收到请求并对其执行操作。这将在客户端不知道更改的情况下更改服务器上的状态。最重要的是,客户机在尝试使用seqid和/或具有相同状态所有者的stateid的任何其他操作之前,必须与服务器重新同步状态。不需要特殊的重新同步操作,这是很简单的。

Since the server maintains the last lock request and response received on the state-owner, for each state-owner, 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 state-owner, 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 server will return the cached result or, if it never saw the request, perform it. 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 state-owner will resynchronize, and in turn the lock state will resynchronize.

由于服务器维护在状态所有者上接收的最后一个锁请求和响应,因此对于每个状态所有者,客户端应该缓存它发送的最后一个锁请求,以便锁请求不会收到响应。因此,下次客户端为状态所有者执行锁定操作时,它可以发送缓存的请求(如果有),并且如果请求是建立状态的请求(例如,锁定或打开操作),服务器将返回缓存的结果,或者,如果它从未看到请求,则执行该请求。客户端可以通过请求来删除状态(例如,锁定或关闭操作)。使用这种方法,客户机和服务器上给定状态所有者的序列和stateid信息将重新同步,而锁状态将重新同步。

9.8. Server Revocation of Locks
9.8. 服务器撤销锁

At any point, the server can revoke locks held by a client and the client must be prepared for this event. When the client detects that its locks have been or may have been revoked, the client is responsible for validating the state information between itself and the server. Validating locking state for the client means that it must verify or reclaim state for each lock currently held.

在任何时候,服务器都可以撤销客户机持有的锁,客户机必须为此事件做好准备。当客户端检测到其锁已被或可能已被撤销时,客户端负责验证自身和服务器之间的状态信息。验证客户端的锁定状态意味着它必须验证或回收当前持有的每个锁的状态。

The first instance of lock revocation is upon server reboot or re-initialization. In this instance, the client will receive an error (NFS4ERR_STALE_STATEID or NFS4ERR_STALE_CLIENTID) and the client will proceed with normal crash recovery as described in the previous section.

锁撤销的第一个实例是在服务器重新启动或重新初始化时。在这种情况下,客户端将收到一个错误(NFS4ERR_STALE_STATEID或NFS4ERR_STALE_CLIENTID),客户端将按照上一节中所述继续进行正常崩溃恢复。

The second lock revocation event is the inability to renew the lease before expiration. While this is considered a rare or unusual event, the client must be prepared to recover. Both the server and client will be able to detect the failure to renew the lease and are capable of recovering without data corruption. For the server, it tracks the last renewal event serviced for the client and knows when the lease will expire. Similarly, the client must track operations that will renew the lease period. Using the time that each such request was sent and the time that the corresponding reply was received, the client should bound the time that the corresponding renewal could 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_ADMIN_REVOKED. In this instance, the client may assume that only the state-owner's locks have been lost. The client notifies the lock holder appropriately. The client cannot assume that the lease period has been renewed as a result of a failed operation.

第三个锁撤销事件可能是由于租赁期内的管理干预而发生的。虽然这被认为是罕见的事件,但服务器管理员可能已决定释放或撤销客户端持有的特定锁。撤销后,客户端将收到NFS4ERR_ADMIN_reversed错误。在这种情况下,客户端可能会假定只有状态所有者的锁丢失。客户端会适当地通知锁持有者。客户不能假定由于操作失败而续订了租赁期。

When the client determines the lease period may have expired, the 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 Section 9.6, 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; if there is no relevant I/O pending, a zero-length read specifying the stateid associated with the lock in question can be synthesized to trigger the renewal. If the response to the request is success, the client has validated all of the locks governed by that stateid and re-established the appropriate state between itself and the server.

当客户确定租赁期可能已到期时,客户必须将为相关租赁持有的所有锁标记为“未验证”。这意味着客户端无法与服务器重新建立或确认适当的锁定状态。如第9.6节所述,在某些情况下,服务器可能会在客户机的租赁期到期后授予冲突锁。当租赁期可能已过期时,客户端必须验证当前持有的每个锁,以确保未授予冲突的锁。客户端可以通过发出I/O请求来完成此任务;如果没有相关的I/O挂起,则可以合成一个零长度读取,指定与所讨论的锁关联的stateid,以触发续订。如果对请求的响应是成功的,则客户端已经验证了由该stateid管理的所有锁,并在其自身和服务器之间重新建立了适当的状态。

If the I/O request is not successful, then one or more of the locks associated with the stateid were revoked by the server, and the client must notify the owner.

如果I/O请求未成功,则服务器将撤销与stateid关联的一个或多个锁,客户端必须通知所有者。

9.9. Share Reservations
9.9. 共享预订

A share reservation is a mechanism to control access to a file. It is a separate and independent mechanism from byte-range locking. When a client opens a file, it issues an OPEN operation to the server specifying the type of access required (READ, WRITE, or BOTH) and the type of access to deny others (OPEN4_SHARE_DENY_NONE, OPEN4_SHARE_DENY_READ, OPEN4_SHARE_DENY_WRITE, or OPEN4_SHARE_DENY_BOTH). If the OPEN fails, the client will fail the application's open request.

共享保留是一种控制文件访问的机制。它是一种独立于字节范围锁定的机制。当客户端打开一个文件时,它会向服务器发出一个打开操作,指定所需的访问类型(读、写或两者)和拒绝其他人访问的类型(OPEN4_共享\u拒绝\u无、OPEN4_共享\u拒绝\u读、OPEN4_共享\u拒绝\u写或OPEN4_共享\u拒绝\u两者)。如果打开失败,客户端将使应用程序的打开请求失败。

Pseudo-code definition of the semantics:

语义的伪代码定义:

if (request.access == 0) return (NFS4ERR_INVAL) else if ((request.access & file_state.deny) || (request.deny & file_state.access)) return (NFS4ERR_DENIED)

if(request.access==0)返回(NFS4ERR_INVAL)else if((request.access&file_state.deny)| |(request.deny&file_state.access))返回(NFS4ERR_DENIED)

This checking of share reservations on OPEN is done with no exception for an existing OPEN for the same open-owner.

对于同一开放所有者的现有开放,在开放时对共享保留进行检查,没有例外。

The constants used for the OPEN and OPEN_DOWNGRADE operations for the access and deny fields are as follows:

access和deny字段的OPEN和OPEN_降级操作使用的常量如下:

   const OPEN4_SHARE_ACCESS_READ   = 0x00000001;
   const OPEN4_SHARE_ACCESS_WRITE  = 0x00000002;
   const OPEN4_SHARE_ACCESS_BOTH   = 0x00000003;
        
   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;
        
   const OPEN4_SHARE_DENY_NONE     = 0x00000000;
   const OPEN4_SHARE_DENY_READ     = 0x00000001;
   const OPEN4_SHARE_DENY_WRITE    = 0x00000002;
   const OPEN4_SHARE_DENY_BOTH     = 0x00000003;
        
9.10. OPEN/CLOSE Operations
9.10. 打开/关闭操作

To provide correct share semantics, a client MUST use the OPEN operation to obtain the initial filehandle and indicate the desired access and what access, if any, to deny. Even if the client intends to use one of the special stateids (anonymous stateid or READ bypass stateid), it must still obtain the filehandle for the regular file with the OPEN operation so the appropriate share semantics can be

为了提供正确的共享语义,客户端必须使用OPEN操作来获取初始文件句柄,并指示所需的访问以及要拒绝的访问(如果有)。即使客户机打算使用一个特殊的stateid(匿名stateid或READ-bypass-stateid),它仍然必须通过OPEN操作获得常规文件的filehandle,以便可以使用适当的共享语义

applied. Clients that do not have a deny mode built into their programming interfaces for opening a file should request a deny mode of OPEN4_SHARE_DENY_NONE.

应用如果客户端的编程接口中没有内置用于打开文件的拒绝模式,则应请求OPEN4_SHARE_deny_NONE的拒绝模式。

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.

带有CREATE标志的OPEN操作还包含NFS协议早期版本中使用的常规文件的CREATE操作。这允许以原子方式创建共享。

The CLOSE operation removes all share reservations held by the open-owner on that file. If byte-range 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 byte-range locks held. The server MUST return failure, NFS4ERR_LOCKS_HELD, if any locks would exist after the CLOSE.

关闭操作将删除打开的所有者对该文件持有的所有共享保留。如果持有字节范围锁,客户端应在发出关闭之前释放所有锁。服务器可能会在关闭时释放所有未完成的锁,但某些服务器可能不支持关闭仍保留字节范围锁的文件。如果关闭后存在任何锁,服务器必须返回failure,NFS4ERR_LOCKS_hold。

The LOOKUP operation will return a filehandle without establishing any lock state on the server. Without a valid stateid, the server will assume that the client has the least access. For example, if one client opened a file with OPEN4_SHARE_DENY_BOTH and another client accesses the file via a filehandle obtained through LOOKUP, the second client could only read the file using the special READ bypass stateid. The second client could not WRITE the file at all because it would not have a valid stateid from OPEN and the special anonymous stateid would not be allowed access.

查找操作将返回文件句柄,而不会在服务器上建立任何锁定状态。如果没有有效的stateid,服务器将假定客户端具有最少的访问权限。例如,如果一个客户机同时使用OPEN4_SHARE_DENY_打开一个文件,而另一个客户机通过通过查找获得的文件句柄访问该文件,则第二个客户机只能使用特殊的读取旁路stateid读取该文件。第二个客户端根本无法写入该文件,因为它没有来自OPEN的有效stateid,并且不允许访问特殊的匿名stateid。

9.10.1. Close and Retention of State Information
9.10.1. 关闭和保留状态信息

Since a CLOSE operation requests deallocation of a stateid, dealing with retransmission of the CLOSE may pose special difficulties, since the state information, which normally would be used to determine the state of the open file being designated, might be deallocated, resulting in an NFS4ERR_BAD_STATEID error.

由于关闭操作请求释放stateid,因此处理关闭的重新传输可能会带来特殊困难,因为通常用于确定指定的打开文件的状态的状态信息可能会被释放,从而导致NFS4ERR_BAD_stateid错误。

Servers may deal with this problem in a number of ways. To provide the greatest degree of assurance that the protocol is being used properly, a server should, rather than deallocate the stateid, mark it as close-pending, and retain the stateid with this status, until later deallocation. In this way, a retransmitted CLOSE can be recognized since the stateid points to state information with this distinctive status, so that it can be handled without error.

服务器可以通过多种方式处理此问题。为了最大程度地保证协议被正确使用,服务器应该将stateid标记为close pending,而不是解除分配,并将stateid保留为此状态,直到以后解除分配。通过这种方式,可以识别重新传输的关闭,因为stateid指向具有此独特状态的状态信息,因此可以无误地处理它。

When adopting this strategy, a server should retain the state information until the earliest of:

采用此策略时,服务器应保留状态信息,直到以下时间最早:

o Another validly sequenced request for the same open-owner, that is not a retransmission.

o 对同一开放所有者的另一个有效排序的请求,这不是重传。

o The time that an open-owner is freed by the server due to period with no activity.

o 由于没有活动的时间段,服务器释放打开的所有者的时间。

o All locks for the client are freed as a result of a SETCLIENTID.

o 由于SETCLIENTID,客户端的所有锁都被释放。

Servers may avoid this complexity, at the cost of less complete protocol error checking, by simply responding NFS4_OK in the event of a CLOSE for a deallocated stateid, on the assumption that this case must be caused by a retransmitted close. When adopting this approach, it is desirable to at least log an error when returning a no-error indication in this situation. If the server maintains a reply-cache mechanism, it can verify that the CLOSE is indeed a retransmission and avoid error logging in most cases.

服务器可以避免这种复杂性,但代价是协议错误检查不太完整,只要在释放的stateid关闭时响应NFS4_OK即可,前提是这种情况必须由重新传输的关闭引起。当采用这种方法时,希望在这种情况下返回无错误指示时至少记录错误。如果服务器维护应答缓存机制,它可以验证关闭是否确实是重新传输,并在大多数情况下避免错误日志记录。

9.11. Open Upgrade and Downgrade
9.11. 开放式升级和降级

When an OPEN is done for a file and the open-owner for which the open is being done already has the file open, the result is to upgrade the open file status maintained on the server to include the access and deny bits specified by the new OPEN as well as those for the existing OPEN. The result is that there is one open file, as far as the protocol is concerned, and it includes the union of the access and deny bits for all of the OPEN requests completed. Only a single CLOSE will be done to reset the effects of both OPENs. Note that the client, when issuing the OPEN, may not know that the same file is in fact being opened. The above only applies if both OPENs result in the OPENed object being designated by the same filehandle.

当对某个文件执行打开操作,并且正在执行打开操作的打开所有者已打开该文件时,结果是升级服务器上维护的打开文件状态,以包括新打开指定的访问和拒绝位以及现有打开指定的访问和拒绝位。结果是,就协议而言,有一个打开的文件,它包括所有已完成的打开请求的访问位和拒绝位的联合。只有一次关闭才能重置两次打开的效果。请注意,客户端在发出OPEN命令时,可能不知道实际上正在打开同一个文件。仅当两次打开都导致打开的对象由同一个filehandle指定时,上述内容才适用。

When the server chooses to export multiple filehandles corresponding to the same file object and returns different filehandles on two different OPENs 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 OPENs with separate stateids and will require separate CLOSEs to free them.

当服务器选择导出对应于同一文件对象的多个文件句柄,并在同一文件对象的两个不同打开上返回不同的文件句柄时,服务器不得将访问和拒绝位“或”组合在一起,并合并两个打开的文件。相反,服务器必须使用单独的stateID维护单独的打开,并且需要单独的关闭来释放它们。

When multiple open files on the client are merged into a single open file object on the server, the close of one of the open files (on the 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 opens may be smaller (i.e., a proper subset) than previously. The OPEN_DOWNGRADE operation is used to make the necessary change, and the client should use it to update the

当客户端上的多个打开的文件合并到服务器上的单个打开的文件对象中时,关闭其中一个打开的文件(客户端上)可能需要更改服务器上打开的文件的访问和拒绝状态。这是因为剩余打开的访问位和拒绝位的联合可能比以前更小(即,适当的子集)。OPEN_降级操作用于进行必要的更改,客户端应使用它更新

server so that share reservation requests by other clients are handled properly. The stateid returned has the same "other" field as that passed to the server. The seqid value in the returned stateid MUST be incremented (Section 9.1.4), even in situations in which there has been no change to the access and deny bits for the file.

服务器,以便正确处理其他客户端的共享保留请求。返回的stateid与传递给服务器的stateid具有相同的“other”字段。即使在文件的访问位和拒绝位没有更改的情况下,返回的stateid中的seqid值也必须增加(第9.1.4节)。

9.12. Short and Long Leases
9.12. 短期和长期租赁

When determining the time period for the server lease, the usual lease trade-offs 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 servers trying to handle very large numbers of clients. The number of RENEW requests drops in proportion to the lease time. The disadvantages of long leases are slower recovery after server failure (the server must wait for the leases to expire and the grace period to elapse before granting new lock requests) and increased file contention (if the client fails to transmit an unlock request, then the server must wait for lease expiration before granting new locks).

在确定服务器租用的时间段时,通常的租用权衡适用。短租约有利于快速服务器恢复,但代价是续订或读取(长度为零)请求增加。对于试图处理大量客户机的服务器来说,较长的租赁期当然更友好、更温和。续订请求的数量与租赁时间成比例下降。长租约的缺点是服务器故障后恢复较慢(服务器必须等待租约到期,宽限期过后才能授予新锁请求)和文件争用加剧(如果客户端无法传输解锁请求,则服务器必须等待租约到期后再授予新锁)。

Long leases are usable if the server is able to store lease state in non-volatile memory. Upon recovery, the server can reconstruct the lease state from its non-volatile memory and continue operation with its clients, and therefore long leases would not be an issue.

如果服务器能够在非易失性内存中存储租约状态,则长租约是可用的。恢复后,服务器可以从其非易失性内存重建租约状态,并继续与客户端一起操作,因此长租约不会成为问题。

9.13. Clocks, Propagation Delay, and Calculating Lease Expiration
9.13. 时钟、传播延迟和计算租约到期

To avoid the need for synchronized clocks, lease times are granted by the server as a time delta. However, there is a requirement that the client and server clocks do not drift excessively over the duration of the lock. There is also the issue of propagation delay across the network -- which could easily be several hundred milliseconds -- as well as the possibility that requests will be lost and need to be 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.

为了将传播延迟考虑在内,客户机应将其从租约时间中减去(例如,如果客户机估计单向传播延迟为200毫秒,则可以假设在获得租约时,租约已经存在200毫秒)。此外,还需要200毫秒才能将响应返回到服务器。因此,客户端必须在租约到期前400毫秒向服务器发送锁续订或写回数据。

The server's lease period configuration should take into account the network distance of the clients that will be accessing the server's resources. It is expected that the lease period will take into account the network propagation delays and other network delay

服务器的租用期配置应考虑将要访问服务器资源的客户端的网络距离。预计租赁期将考虑网络传播延迟和其他网络延迟

factors for the client population. Since the protocol does not allow for an automatic method to determine an appropriate lease period, the server's administrator may have to tune the lease period.

客户群体的因素。由于协议不允许使用自动方法来确定适当的租赁期,服务器管理员可能必须调整租赁期。

9.14. Migration, Replication, and State
9.14. 迁移、复制和状态

When responsibility for handling a given file system is transferred to a new server (migration) or the client chooses to use an alternative 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, stateids, and client IDs) is as described below. The handling differs between migration and replication. For a related discussion of file server state and recovery of same, see the subsections of Section 9.6.

当处理给定文件系统的责任转移到新服务器(迁移)或客户端选择在文件系统复制上下文中使用替代服务器(例如,响应服务器无响应)时,客户端和服务器之间共享的状态的适当处理(即锁、租约、状态ID和客户端ID)如下所述。迁移和复制的处理方式不同。有关文件服务器状态和恢复的相关讨论,请参阅第9.6节的小节。

In cases in which one server is expected to accept opaque values from the client that originated from another server, the servers SHOULD encode the opaque values in big-endian byte order. If this is done, the new server will be able to parse values like stateids, directory cookies, filehandles, etc. even if their native byte order is different from that of other servers cooperating in the replication and migration of the file system.

如果期望一台服务器接受来自另一台服务器的客户端的不透明值,则服务器应以大端字节顺序对不透明值进行编码。如果这样做,新服务器将能够解析stateID、目录cookie、文件句柄等值,即使它们的本机字节顺序与在文件系统的复制和迁移中协作的其他服务器的本机字节顺序不同。

9.14.1. Migration and State
9.14.1. 移民与国家

In the case of migration, the servers involved in the migration of a file system SHOULD transfer all server state from the original server to the new server. This must be done in a way that is transparent to the client. This state transfer will ease the client's transition when a file system migration occurs. If the servers are successful in transferring all state, the client will continue to use stateids assigned by the original server. Therefore, the new server must recognize these stateids as valid. This holds true for the client ID as well. Since responsibility for an entire file system is transferred with a migration event, there is no possibility that conflicts will arise on the new server as a result of the transfer of locks.

在迁移的情况下,参与文件系统迁移的服务器应将所有服务器状态从原始服务器传输到新服务器。这必须以对客户端透明的方式完成。当发生文件系统迁移时,此状态传输将简化客户端的转换。如果服务器成功传输所有状态,客户端将继续使用原始服务器分配的StateID。因此,新服务器必须将这些stateID识别为有效。对于客户端ID也是如此。由于整个文件系统的责任是通过迁移事件转移的,因此不可能由于锁的转移而在新服务器上产生冲突。

As part of the transfer of information between servers, leases would be transferred as well. The leases being transferred to the new server will typically have a different expiration time from those for the same client, previously on the old server. To maintain the property that all leases on a given server for a given client expire at the same time, the server should advance the expiration time to the later of the leases being transferred or the leases already present. This allows the client to maintain lease renewal of both classes without special effort.

作为服务器间信息传输的一部分,租约也将进行传输。传输到新服务器的租约的到期时间通常与以前在旧服务器上传输到同一客户机的租约的到期时间不同。要维护给定客户端的给定服务器上的所有租约同时到期的属性,服务器应将到期时间提前到正在传输的租约或已存在的租约中的较晚者。这允许客户无需特别努力即可维持这两个类别的租赁续期。

The servers may choose not to transfer the state information upon migration. However, this choice is discouraged. In this case, when the client presents state information from the original server (e.g., in a RENEW operation or a READ operation of zero length), the 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.

服务器可以选择在迁移时不传输状态信息。然而,这种选择是不可取的。在这种情况下,当客户端显示来自原始服务器的状态信息时(例如,在续订操作或长度为零的读取操作中),客户端必须准备从新服务器接收NFS4ERR_STALE_CLIENTID或NFS4ERR_STALE_STATEID。然后,客户机应恢复其状态信息,这与正常情况下响应服务器故障时一样。新服务器必须注意恢复状态信息,就像服务器重新启动时一样。

A client SHOULD re-establish new callback information with the new server as soon as possible, according to sequences described in Sections 16.33 and 16.34. This ensures that server operations are not blocked by the inability to recall delegations.

客户机应根据第16.33节和第16.34节中描述的顺序,尽快与新服务器重新建立新的回调信息。这可确保服务器操作不会因无法调用委派而受阻。

9.14.2. Replication and State
9.14.2. 复制和状态

Since client switch-over in the case of replication is not under server control, the handling of state is different. In this case, leases, stateids, and client IDs 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 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 file systems, 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 its original lock had been revoked.

由于复制情况下的客户端切换不受服务器控制,因此状态的处理是不同的。在这种情况下,租约、StateID和客户端ID在从一台服务器到另一台服务器的转换过程中不具有有效性。客户端必须在新服务器上重新建立其锁。这可以与服务器重新启动后通过回收类型请求重新建立锁进行比较。不同之处在于,服务器没有规定区分请求回收锁和请求获得新锁或延迟后者。因此,在新服务器上重新建立锁的客户端(通过锁或打开请求)可能会由于锁冲突而拒绝请求。由于复制旨在以只读方式使用文件系统,因此这种拒绝锁定在实践中不会造成很大困难。当在新服务器上重新建立锁的尝试被拒绝时,客户端应将此情况视为其原始锁已被撤销。

9.14.3. Notification of Migrated Lease
9.14.3. 迁移租约的通知

In the case of lease renewal, the client may not be submitting requests for a file system that has been migrated to another server. This can occur because of the implicit lease renewal mechanism. The client renews leases for all file systems when submitting a request to any one file system at the server.

在租约续订的情况下,客户端可能不会提交已迁移到另一台服务器的文件系统的请求。这可能是由于隐式租约续订机制造成的。当向服务器上的任何一个文件系统提交请求时,客户端将续订所有文件系统的租约。

In order for the client to schedule renewal of leases that may have been relocated to the new server, the client must find out about lease relocation before those leases expire. To accomplish this, all operations that implicitly renew leases for a client (such as OPEN, CLOSE, READ, WRITE, RENEW, LOCK, and others) will return the error NFS4ERR_LEASE_MOVED if responsibility for any of the leases to be

为了让客户端计划可能已重新定位到新服务器的租约的续订,客户端必须在这些租约到期之前了解租约重新定位。为了实现这一点,所有隐式续订客户机租约的操作(如打开、关闭、读取、写入、续订、锁定和其他操作)都将返回错误NFS4ERR_LEASE_MOVED,前提是要删除对任何租约的责任

renewed has been transferred to a new server. This condition will continue until the client receives an NFS4ERR_MOVED error and the server receives the subsequent GETATTR(fs_locations) for an access to each file system for which a lease has been moved to a new server. By convention, the compound including the GETATTR(fs_locations) SHOULD append a RENEW operation to permit the server to identify the client doing the access.

续订的已传输到新服务器。此情况将持续,直到客户端收到NFS4ERR_MOVED错误,并且服务器收到后续GETATTR(fs_位置)以访问已将租约移动到新服务器的每个文件系统。按照惯例,包括GETATTR(fs_位置)的复合应该附加一个续订操作,以允许服务器识别进行访问的客户端。

Upon receiving the NFS4ERR_LEASE_MOVED error, a client that supports file system migration MUST probe all file systems from that server on which it holds open state. Once the client has successfully probed all those file systems that are migrated, the server MUST resume normal handling of stateful requests from that client.

接收到NFS4ERR_LEASE_MOVED错误后,支持文件系统迁移的客户端必须从其保持打开状态的服务器探测所有文件系统。一旦客户机成功探测到所有迁移的文件系统,服务器必须恢复对来自该客户机的有状态请求的正常处理。

In order to support legacy clients that do not handle the NFS4ERR_LEASE_MOVED error correctly, the server SHOULD time out after a wait of at least two lease periods, at which time it will resume normal handling of stateful requests from all clients. If a client attempts to access the migrated files, the server MUST reply with NFS4ERR_MOVED.

为了支持未正确处理NFS4ERR_LEASE_MOVED错误的旧客户端,服务器应在至少两个租用期等待后超时,此时将恢复正常处理来自所有客户端的有状态请求。如果客户端试图访问迁移的文件,服务器必须使用NFS4ERR_MOVED进行回复。

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, the client will receive either NFS4ERR_STALE_CLIENTID or NFS4ERR_STALE_STATEID from the new server, as described above. The client can then recover state information as it does in the event of server failure.

当客户端接收到NFS4ERR_MOVED错误时,客户端可以按照正常过程获取新服务器信息(通过fs_locations属性),并在新服务器上执行这些租约的续订。如果服务器尚未将状态透明地传输给它,则客户端将从新服务器接收NFS4ERR_STALE_CLIENTID或NFS4ERR_STALE_STATEID,如上所述。然后,客户端可以像在服务器发生故障时一样恢复状态信息。

9.14.4. Migration and the lease_time Attribute
9.14.4. 迁移和租赁时间属性

In order that the client may appropriately manage its leases in the case of migration, the destination server must establish proper values for the lease_time attribute.

为了在迁移的情况下客户端可以适当地管理其租约,目标服务器必须为租约时间属性建立适当的值。

When state is transferred transparently, that state should include the correct value of the lease_time attribute. The lease_time attribute on the destination server must never be less than that on the source since this would result in premature expiration of leases granted by the source server. Upon migration, in which state is transferred transparently, the client is under no obligation to refetch the lease_time attribute and may continue to use the value previously fetched (on the source server).

当状态以透明方式传输时,该状态应包含lease_time属性的正确值。目标服务器上的租约时间属性不得小于源服务器上的租约时间属性,因为这将导致源服务器授予的租约提前到期。在迁移时,状态是透明传输的,客户端没有义务重新蚀刻lease_time属性,并且可以继续使用以前获取的值(在源服务器上)。

If state has not been transferred transparently (i.e., the client sees a real or simulated server reboot), the client should fetch the value of lease_time on the new (i.e., destination) server and use it

如果状态没有被透明地传输(即,客户端看到真实或模拟的服务器重新启动),客户端应该获取新(即,目标)服务器上的租约时间值并使用它

for subsequent locking requests. However, the server must respect a grace period at least as long as the lease_time on the source server, in order to ensure that clients have ample time to reclaim their locks before potentially conflicting non-reclaimed locks are granted. The means by which the new server obtains the value of lease_time on the old server is left to the server implementations. It is not specified by the NFSv4 protocol.

用于后续锁定请求。但是,服务器必须遵守至少与源服务器上的租约时间一样长的宽限期,以确保在授予潜在冲突的未回收锁之前,客户端有足够的时间回收其锁。新服务器获取旧服务器上的租赁时间值的方法留给服务器实现。NFSv4协议没有指定它。

10. Client-Side Caching
10. 客户端缓存

Client-side caching of data, file attributes, and filenames 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 specifications, and it is often unclear what is valid or invalid client behavior.

数据、文件属性和文件名的客户端缓存对于使用NFS协议提供良好性能至关重要。提供分布式缓存一致性是一个难题,以前版本的NFS协议没有尝试过。相反,使用了几种NFS客户端实现技术来减少缺乏一致性给用户带来的问题。这些技术在早期的协议规范中没有明确定义,并且通常不清楚什么是有效的或无效的客户端行为。

The NFSv4 protocol uses many techniques similar to those that have been used in previous protocol versions. The NFSv4 protocol does not provide distributed cache coherence. However, it defines a more limited set of caching guarantees to allow locks and share reservations to be used without destructive interference from client-side caching.

NFSv4协议使用了许多与以前协议版本中使用的技术类似的技术。NFSv4协议不提供分布式缓存一致性。但是,它定义了一组更有限的缓存保证,以允许在不受客户端缓存破坏性干扰的情况下使用锁和共享保留。

In addition, the NFSv4 protocol introduces a delegation mechanism that allows many decisions normally made by the server to be made locally by clients. This mechanism provides efficient support of the common cases where sharing is infrequent or where sharing is read-only.

此外,NFSv4协议引入了一种委托机制,允许客户端在本地做出通常由服务器做出的许多决策。此机制为共享不频繁或共享为只读的常见情况提供了有效支持。

10.1. Performance Challenges for Client-Side Caching
10.1. 客户端缓存的性能挑战

Caching techniques used in previous versions of the NFS protocol have been successful in providing good performance. However, several scalability challenges can arise when those techniques are used with very large numbers of clients. This is particularly true when clients are geographically distributed, which classically increases the latency for cache revalidation requests.

NFS协议早期版本中使用的缓存技术已经成功地提供了良好的性能。然而,当这些技术用于大量客户机时,可能会出现一些可伸缩性挑战。当客户端分布在不同的地理位置时尤其如此,这通常会增加缓存重新验证请求的延迟。

The previous versions of the NFS protocol repeat their file data cache validation requests at the time the file is opened. This behavior can have serious performance drawbacks. A common case is one in which a file is only accessed by a single client. Therefore, sharing is infrequent.

NFS协议的早期版本在打开文件时重复其文件数据缓存验证请求。这种行为可能有严重的性能缺陷。一种常见的情况是,一个文件只能由一个客户端访问。因此,共享很少。

In this case, repeated reference to the server to find that no conflicts exist is expensive. A better option with regards to 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 Section 10.3.2) can severely limit performance. When locking is used to provide protection against infrequent conflicts, a large penalty is incurred. This penalty may discourage the use of file locking by applications.

在文件锁定方面也会出现类似的情况。向服务器发送文件锁定和解锁请求以及使数据缓存与锁定语义一致所需的读写请求(参见第10.3.2节)会严重限制性能。如果使用锁定来防止不经常发生的冲突,则会产生很大的损失。此惩罚可能会阻止应用程序使用文件锁定。

The NFSv4 protocol provides more aggressive caching strategies with the following design goals:

NFSv4协议提供了更积极的缓存策略,具有以下设计目标:

o Compatibility with a large range of server semantics.

o 与大量服务器语义的兼容性。

o Providing the same caching benefits as previous versions of the NFS protocol when unable to provide the more aggressive model.

o 在无法提供更具攻击性的模型时,提供与以前版本的NFS协议相同的缓存好处。

o Organizing requirements for aggressive caching so that a large portion of the benefit can be obtained even when not all of the requirements can be met.

o 组织主动缓存的需求,以便即使不能满足所有需求,也能获得大部分好处。

The appropriate requirements for the server are discussed in later sections, in which specific forms of caching are covered (see Section 10.4).

服务器的适当要求将在后面的章节中讨论,其中介绍了缓存的具体形式(参见第10.4节)。

10.2. Delegation and Callbacks
10.2. 委托和回调

Recallable delegation of server responsibilities for a file to a client improves performance by avoiding repeated requests to the server in the absence of inter-client conflict. With the use of a "callback" RPC from server to client, a server recalls delegated responsibilities when another client engages in the sharing of a delegated file.

在没有客户端间冲突的情况下,通过避免向服务器重复请求,将文件的服务器责任可重新分配给客户端,从而提高了性能。通过使用从服务器到客户端的“回调”RPC,当另一个客户端参与共享委托文件时,服务器会调用委托的职责。

A delegation is passed from the server to the client, specifying the object of the delegation and the type of delegation. There are different types of delegations, but each type contains a stateid to be used to represent the delegation when performing operations that depend on the delegation. This stateid is similar to those associated with locks and share reservations but differs in that the stateid for a delegation is associated with a client ID and may be

委托从服务器传递到客户端,指定委托对象和委托类型。有不同类型的委托,但每种类型都包含一个stateid,用于在执行依赖于委托的操作时表示委托。此stateid类似于与锁和共享保留相关联的stateid,但不同之处在于委托的stateid与客户端ID相关联,并且可能是

used on behalf of all the open-owners for the given client. A delegation is made to the client as a whole and not to any specific process or thread of control within it.

代表给定客户端的所有开放所有者使用。委托是作为一个整体委托给客户机的,而不是委托给客户机中的任何特定进程或控制线程。

Because callback RPCs may not work in all environments (due to firewalls, for example), correct protocol operation does not depend 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 delegations being granted.

由于回调RPC可能无法在所有环境中工作(例如,由于防火墙),因此正确的协议操作并不依赖于它们。通过CB_NULL过程对回调功能进行初步测试,确定是否支持回调。CB_NULL过程检查回调路径的连续性。服务器对给定客户端的回调可用性进行初步评估,并在确定回调受支持之前避免委派责任。由于授予委托始终以不存在冲突访问为条件,因此客户端不得假设将授予委托,并且必须始终准备好在未授予任何委托的情况下进行处理。

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.

与锁不同,第二个客户端对委托文件的操作将导致服务器通过回调调用委托。

On recall, the client holding the delegation must flush modified state (such as modified data) to the server and return the delegation. The conflicting request will not be acted on until the recall is complete. The recall is considered complete when the client returns the delegation or the server times out its wait for the delegation to be returned and revokes the delegation as a result of the timeout. In the interim, the server will either delay responding to conflicting requests or respond to them with NFS4ERR_DELAY. Following the resolution of the recall, the server has the information necessary to grant or deny the second client's request.

调用时,持有委托的客户端必须将修改状态(如修改的数据)刷新到服务器并返回委托。在召回完成之前,不会对冲突请求采取行动。当客户端返回委派或服务器超时等待委派返回并由于超时而撤消委派时,调用被视为完成。在此期间,服务器将延迟响应冲突请求,或使用NFS4ERR_延迟响应冲突请求。在解决召回问题后,服务器具有批准或拒绝第二个客户端请求所需的信息。

At the time the client receives a delegation recall, it may have substantial state that needs to be flushed to the server. Therefore, the server should allow sufficient time for the delegation to be returned since it may involve numerous RPCs to the server. If the server is able to determine that the client is diligently flushing state to the server as a result of the recall, the server MAY extend the usual time allowed for a recall. However, the time allowed for recall completion should not be unbounded.

在客户机接收到委派回调时,它可能具有需要刷新到服务器的实质性状态。因此,服务器应该为委托返回留出足够的时间,因为它可能涉及到服务器的多个RPC。如果服务器能够确定客户机由于调用而正在向服务器刷新状态,则服务器可以延长允许调用的通常时间。然而,召回完成所允许的时间不应该是无界的。

An example of this is when responsibility to mediate opens on a given file is delegated to a client (see Section 10.4). The server will not know what opens are in effect on the client. Without this knowledge, the server will be unable to determine if the access and deny state for the file allows any particular open until the delegation for the file has been returned.

这方面的一个例子是,将对给定文件进行调解的责任委托给客户(见第10.4节)。服务器将不知道在客户端上打开的是什么。如果不知道这一点,服务器将无法确定文件的访问和拒绝状态是否允许任何特定的打开,直到返回文件的委派。

A client failure or a network partition can result in failure to respond to a recall callback. In this case, the server will revoke the delegation; this in turn will render useless any modified state still on the client.

客户端故障或网络分区可能导致无法响应回调。在这种情况下,服务器将撤销委托;这反过来会使客户端上的任何修改状态变得无用。

Clients need to be aware that server implementers may enforce practical limitations on the number of delegations issued. Further, as there is no way to determine which delegations to revoke, the server is allowed to revoke any. If the server is implemented to revoke another delegation held by that client, then the client may be able to determine that a limit has been reached because each new delegation request results in a revoke. The client could then determine which delegations it may not need and preemptively release them.

客户机需要知道,服务器实现者可能会对发出的委托数量实施实际限制。此外,由于无法确定要撤销哪些委托,因此允许服务器撤销任何委托。如果服务器被实现为撤销该客户机持有的另一个委托,那么客户机可能能够确定已达到限制,因为每个新的委托请求都会导致撤销。然后,客户可以确定它可能不需要哪些委托,并先发制人地释放它们。

10.2.1. Delegation Recovery
10.2.1. 授权恢复

There are three situations that delegation recovery must deal with:

授权恢复必须处理三种情况:

o Client reboot or restart

o 客户端重新启动或重新启动

o Server reboot or restart (see Section 9.6.3.1)

o 服务器重新启动或重新启动(见第9.6.3.1节)

o Network partition (full or callback-only)

o 网络分区(完全或仅回调)

In the event that the client reboots or restarts, the confirmation of a SETCLIENTID done with an nfs_client_id4 with a new verifier4 value will result in the release of byte-range locks and share reservations. Delegations, however, may be treated a bit differently.

在客户端重新启动或重新启动的情况下,使用新的verifier4值确认nfs_客户端_id4完成的SETCLIENTID将导致释放字节范围锁和共享保留。然而,代表团的待遇可能有所不同。

There will be situations in which delegations will need to be re-established 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 re-establish the appropriate file state on the server.

在某些情况下,客户机重新启动或重新启动后,需要重新建立委托关系。原因是客户机可能在本地存储了文件数据,并且该数据与以前持有的委托相关。客户端需要在服务器上重新建立适当的文件状态。

To allow for this type of client recovery, the server MAY allow delegations to be retained after other sorts of locks are released. This implies that requests from other clients that conflict with these delegations will need to wait. Because the normal recall

为了允许这种类型的客户端恢复,服务器可以允许在释放其他类型的锁后保留委派。这意味着与这些委托冲突的其他客户机的请求将需要等待。因为正常的回忆

process may require significant time for the client to flush changed state to the server, other clients need to be prepared for delays that occur because of a conflicting delegation. In order to give clients a chance to get through the reboot process -- during which leases will not be renewed -- the server MAY extend the period for delegation recovery beyond the typical lease expiration period. For open delegations, such delegations that are not released are reclaimed using OPEN with a claim type of CLAIM_DELEGATE_PREV. (See Sections 10.5 and 16.16 for discussions of open delegation and the details of OPEN, respectively.)

该过程可能需要很长的时间,以便客户端将更改的状态刷新到服务器,其他客户端需要为由于委托冲突而发生的延迟做好准备。为了让客户端有机会完成重新启动过程(在此过程中,租约将不被续订),服务器可以将委派恢复时间延长到典型租约到期时间之外。对于开放式委托,使用索赔类型为claim_DELEGATE_PREV的open回收未释放的此类委托。(关于公开授权的讨论和公开授权的详细信息,分别参见第10.5节和第16.16节。)

A server MAY support a claim type of CLAIM_DELEGATE_PREV, but if it does, it MUST NOT remove delegations upon SETCLIENTID_CONFIRM and instead MUST make them available for client reclaim using CLAIM_DELEGATE_PREV. The server MUST NOT remove the delegations until either the client does a DELEGPURGE or one lease period has elapsed from the time -- whichever is later -- of the SETCLIENTID_CONFIRM or the last successful CLAIM_DELEGATE_PREV reclaim.

服务器可能支持claim_DELEGATE_PREV的声明类型,但如果支持,则在SETCLIENTID_CONFIRM时不能删除委托,而是必须使用claim_DELEGATE_PREV使委托可用于客户端回收。在客户端执行DELEGPURGE或从SETCLIENTID\u CONFIRM或上一次成功的CLAIM\u DELEGATE\u PREV Reclain开始(以较晚者为准)经过一个租用期之前,服务器不得删除委托。

Note that the requirement stated above is not meant to imply that, when the server is no longer obliged, as required above, to retain delegation information, it should necessarily dispose of it. Some specific cases are:

请注意,上述要求并不意味着,当服务器不再有义务(如上所述)保留委派信息时,它必须将其处理掉。一些具体情况如下:

o When the period is terminated by the occurrence of DELEGPURGE, deletion of unreclaimed delegations is appropriate and desirable.

o 当该期限因发生授权终止时,删除未申报的授权是适当和可取的。

o When the period is terminated by a lease period elapsing without a successful CLAIM_DELEGATE_PREV reclaim, and that situation appears to be the result of a network partition (i.e., lease expiration has occurred), a server's lease expiration approach, possibly including the use of courtesy locks, would normally provide for the retention of unreclaimed delegations. Even in the event that lease cancellation occurs, such delegation should be reclaimed using CLAIM_DELEGATE_PREV as part of network partition recovery.

o 当租期在未成功索赔_DELEGATE _prevreclain的情况下终止,并且这种情况似乎是网络分区的结果(即发生了租期到期),服务器的租期到期方法,可能包括使用门控锁,通常将规定保留未申报的代表团。即使在发生租约取消的情况下,也应使用CLAIM_DELEGATE_PREV作为网络分区恢复的一部分回收此类委派。

o When the period of non-communicating is followed by a client reboot, unreclaimed delegations should also be reclaimable by use of CLAIM_DELEGATE_PREV as part of client reboot recovery.

o 当非通信期间之后是客户端重新启动时,作为客户端重新启动恢复的一部分,还应使用CLAIM_DELEGATE_PREV回收未回收的委派。

o When the period is terminated by a lease period elapsing without a successful CLAIM_DELEGATE_PREV reclaim, and lease renewal is occurring, the server may well conclude that unreclaimed delegations have been abandoned and consider the situation as one in which an implied DELEGPURGE should be assumed.

o 当一个租赁期结束时,如果没有一个成功的CalimaPraveTyPrv回收和租赁续期正在发生,服务器可以很好地断定未收回的代表团已经被放弃,并认为这种情况是一个隐含的委托清洗应该被假定的情况。

A server that supports a claim type of CLAIM_DELEGATE_PREV MUST support the DELEGPURGE operation, and similarly, a server that supports DELEGPURGE MUST support CLAIM_DELEGATE_PREV. A server that does not support CLAIM_DELEGATE_PREV MUST return NFS4ERR_NOTSUPP if the client attempts to use that feature or performs a DELEGPURGE operation.

支持claim_DELEGATE_PREV的声明类型的服务器必须支持delegpuse操作,同样,支持delegpuse的服务器必须支持claim_DELEGATE_PREV。如果客户端尝试使用该功能或执行delegpuke操作,则不支持CLAIM_DELEGATE_PREV的服务器必须返回NFS4ERR_NOTSUPP。

Support for a claim type of CLAIM_DELEGATE_PREV is often referred to as providing for "client-persistent delegations" in that they allow the use of persistent storage on the client to store data written by the client, even across a client restart. It should be noted that, with the optional exception noted below, this feature requires persistent storage to be used on the client and does not add to persistent storage requirements on the server.

对claim_DELEGATE_PREV的声明类型的支持通常被称为提供“客户端持久性委托”,因为它们允许在客户端上使用持久性存储来存储客户端写入的数据,即使在客户端重新启动时也是如此。应该注意的是,除了下面提到的可选例外情况外,此功能要求在客户端上使用持久性存储,而不会增加服务器上的持久性存储要求。

One good way to think about client-persistent delegations is that for the most part, they function like "courtesy locks", with special semantic adjustments to allow them to be retained across a client restart, which cause all other sorts of locks to be freed. Such locks are generally not retained across a server restart. The one exception is the case of simultaneous failure of the client and server and is discussed below.

考虑客户端持久性委托的一个好方法是,在大多数情况下,它们的功能类似于“礼貌锁”,并进行特殊的语义调整,以允许它们在客户端重新启动时保留,从而释放所有其他类型的锁。这种锁通常不会在服务器重启期间保留。一个例外是客户端和服务器同时发生故障的情况,将在下面讨论。

When the server indicates support of CLAIM_DELEGATE_PREV (implicitly) by returning NFS_OK to DELEGPURGE, a client with a write delegation can use write-back caching for data to be written to the server, deferring the write-back until such time as the delegation is recalled, possibly after intervening client restarts. Similarly, when the server indicates support of CLAIM_DELEGATE_PREV, a client with a read delegation and an open-for-write subordinate to that delegation may be sure of the integrity of its persistently cached copy of the file after a client restart without specific verification of the change attribute.

当服务器通过将NFS_OK返回给DELEGPURGE来表示支持CLAIM_DELEGATE_PREV(隐式)时,具有写委派的客户端可以对要写入服务器的数据使用写回缓存,将写回延迟到调用委派的时间,可能是在干预客户端重新启动之后。类似地,当服务器指示支持CLAIM_DELEGATE_PREV时,具有读委托和从属于该委托的open for write的客户端可以确保在客户端重新启动后其持久缓存的文件副本的完整性,而无需具体验证更改属性。

When the server reboots or restarts, delegations are reclaimed (using the OPEN operation with CLAIM_PREVIOUS) in a similar fashion to byte-range locks and share reservations. However, there is a slight semantic difference. In the normal case, if the server decides that a delegation should not be granted, it performs the requested action (e.g., OPEN) without granting any delegation. For reclaim, the server grants the delegation, but a special designation is applied so that the client treats the delegation as having been granted but recalled by the server. Because of this, the client has the duty to

当服务器重新启动或重新启动时,将以与字节范围锁和共享保留类似的方式回收委派(使用CLAIM_PREVIOUS的OPEN操作)。然而,有一点语义上的差异。在正常情况下,如果服务器决定不应授予委派,它将执行请求的操作(例如,打开),而不授予任何委派。对于回收,服务器授予委托,但应用了一个特殊的指定,以便客户端将委托视为已被授予但被服务器调用。因此,客户有义务

write all modified state to the server and then return the delegation. This process of handling delegation reclaim reconciles three principles of the NFSv4 protocol:

将所有修改的状态写入服务器,然后返回委派。处理委托回收的过程符合NFSv4协议的三个原则:

o Upon reclaim, a client claiming resources assigned to it by an earlier server instance must be granted those resources.

o 回收时,必须向声称由早期服务器实例分配给它的资源的客户机授予这些资源。

o The server has unquestionable authority to determine whether delegations are to be granted and, once granted, whether they are to be continued.

o 服务器无疑有权决定是否授予委托,一旦授予,是否继续。

o The use of callbacks is not to be depended upon until the client has proven its ability to receive them.

o 在客户机证明其有能力接收回调之前,不能依赖回调的使用。

When a client has more than a single open associated with a delegation, state for those additional opens can be established using OPEN operations of type CLAIM_DELEGATE_CUR. When these are used to establish opens associated with reclaimed delegations, the server MUST allow them when made within the grace period.

当客户端有多个与委托关联的打开时,可以使用CLAIM\u DELEGATE\u CUR类型的打开操作来建立这些额外打开的状态。当这些用于建立与回收的委派关联的打开时,服务器必须在宽限期内允许这些打开。

Situations in which there is a series of client and server restarts where there is no restart of both at the same time are dealt with via a combination of CLAIM_DELEGATE_PREV and CLAIM_PREVIOUS reclaim cycles. Persistent storage is needed only on the client. For each server failure, a CLAIM_PREVIOUS reclaim cycle is done, while for each client restart, a CLAIM_DELEGATE_PREV reclaim cycle is done.

通过CLAIM_DELEGATE_PREV和CLAIM_PREVIOUS回收周期的组合来处理一系列客户端和服务器重启的情况,其中客户端和服务器没有同时重启。仅在客户端上需要持久存储。对于每一个服务器故障,都会执行一个CLAIM_上一个回收周期,而对于每一个客户端重新启动,都会执行一个CLAIM_DELEGATE_上一个回收周期。

To deal with the possibility of simultaneous failure of client and server (e.g., a data center power outage), the server MAY persistently store delegation information so that it can respond to a CLAIM_DELEGATE_PREV reclaim request that it receives from a restarting client. This is the one case in which persistent delegation state can be retained across a server restart. A server is not required to store this information, but if it does do so, it should do so for write delegations and for read delegations, during the pendency of which (across multiple client and/or server instances), some open-for-write was done as part of delegation. When the space to persistently record such information is limited, the server should recall delegations in this class in preference to keeping them active without persistent storage recording.

为了处理客户端和服务器同时发生故障的可能性(例如,数据中心断电),服务器可以持续存储委派信息,以便能够响应从重新启动的客户端接收到的CLAIM_DELEGATE_PREV Reclain请求。这是一种可以在服务器重启期间保留持久委派状态的情况。服务器不需要存储此信息,但如果它这样做,则它应该为写委派和读委派存储此信息,在挂起期间(跨多个客户端和/或服务器实例),一些开放供写的操作是作为委派的一部分完成的。当持久记录此类信息的空间有限时,服务器应该调用此类中的委派,而不是在不进行持久存储记录的情况下使委派保持活动状态。

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, and as for locks and share reservations, it may be modified by support for "courtesy locks" in which locks are not freed in the absence of a conflicting lock request. Whereas for locks and share reservations the freeing of locks will occur immediately upon the appearance of a conflicting

当发生网络分区时,当租约续订期到期时,服务器将释放委派。这类似于锁和共享保留的行为,对于锁和共享保留,可以通过支持“礼貌锁”进行修改,在这种情况下,在没有冲突的锁请求的情况下不会释放锁。而对于锁和共享保留,一旦出现冲突,锁将立即释放

request, for delegations, the server MAY institute a period during which conflicting 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 a later network configuration change) will have a similar effect in that it can also result in revocation of a delegation. 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 one of the errors NFS4ERR_EXPIRED, NFS4ERR_BAD_STATEID, or NFS4ERR_ADMIN_REVOKED (NFS4ERR_EXPIRED indicates that all lock state associated with the client has been lost). It also may find out about delegation revocation after a client reboot when it attempts to reclaim a delegation and receives NFS4ERR_EXPIRED. Note that in the case of a revoked OPEN_DELEGATE_WRITE delegation, there are issues because data may have been modified by the client whose delegation is revoked and, separately, by other clients. See Section 10.5.1 for a discussion of such issues. Note also that when delegations are revoked, information about the revoked delegation will be written by the server to stable storage (as described in Section 9.6). This is done to deal with the case in which a server reboots after revoking a delegation but before the client holding the revoked delegation is notified about the revocation.

当客户端使用与委派关联的stateid并收到以下错误之一时,通常会发现委派的吊销(NFS4ERR_EXPIRED、NFS4ERR_BAD_stateid或NFS4ERR_ADMIN_Revered)(NFS4ERR_EXPIRED表示与客户端关联的所有锁状态都已丢失)。它还可以在客户端重新启动后,当它尝试回收委派并收到NFS4ERR_过期时,发现有关委派吊销的信息。请注意,如果是已撤销的OPEN_DELEGATE_WRITE委派,则会出现问题,因为数据可能已被其委派已撤销的客户端修改,也可能被其他客户端单独修改。有关此类问题的讨论,请参见第10.5.1节。还请注意,当委托被撤销时,服务器将把有关被撤销委托的信息写入稳定存储器(如第9.6节所述)。这样做是为了处理这样的情况,即服务器在撤销委派之后,但在持有已撤销委派的客户端收到有关撤销的通知之前重新启动。

Note that when there is a loss of a delegation, due to a network partition in which all locks associated with the lease are lost, the client will also receive the error NFS4ERR_EXPIRED. This case can be distinguished from other situations in which delegations are revoked by seeing that the associated clientid becomes invalid so that NFS4ERR_STALE_CLIENTID is returned when it is used.

请注意,当由于网络分区丢失与租约相关的所有锁而导致委托丢失时,客户端还将收到错误NFS4ERR_EXPIRED。通过查看关联的clientid变为无效,从而在使用时返回NFS4ERR_STALE_clientid,可以将这种情况与撤销委托的其他情况区分开来。

When NFS4ERR_EXPIRED is returned, the server MAY retain information about the delegations held by the client, deleting those that are invalidated by a conflicting request. Retaining such information will allow the client to recover all non-invalidated delegations using the claim type CLAIM_DELEGATE_PREV, once the SETCLIENTID_CONFIRM is done to recover. Attempted recovery of a delegation that the client has no record of, typically because they were invalidated by conflicting requests, will result in the error NFS4ERR_BAD_RECLAIM. Once a reclaim is attempted for all delegations that the client held, it SHOULD do a DELEGPURGE to allow any remaining server delegation information to be freed.

当返回NFS4ERR_EXPIRED时,服务器可能会保留有关客户端持有的委托的信息,删除那些因冲突请求而无效的委托。保留此类信息将允许客户端在完成SETCLIENTID_CONFIRM恢复后,使用索赔类型claim_DELEGATE_PREV恢复所有未失效的委托。尝试恢复客户端没有记录的委派(通常是因为它们被冲突的请求无效)将导致错误NFS4ERR_BAD_receive。一旦尝试对客户端持有的所有委派进行回收,它应该执行DELEGPURGE以允许释放任何剩余的服务器委派信息。

10.3. Data Caching
10.3. 数据缓存

When applications share access to a set of files, they need to be implemented so as to take account of the possibility of conflicting access by another application. This is true whether the applications in question execute on different clients or reside on the same client.

当应用程序共享对一组文件的访问时,需要实现它们,以便考虑到另一个应用程序访问冲突的可能性。无论所讨论的应用程序是在不同的客户机上执行还是驻留在同一客户机上,都是如此。

Share reservations and byte-range locks are the facilities the NFSv4 protocol provides to allow applications to coordinate access by providing mutual exclusion facilities. The NFSv4 protocol's data caching must be implemented such that it does not invalidate the assumptions that those using these facilities depend upon.

共享保留和字节范围锁是NFSv4协议提供的功能,允许应用程序通过提供互斥功能来协调访问。NFSv4协议的数据缓存的实现必须确保不会使使用这些设施的人所依赖的假设失效。

10.3.1. Data Caching and OPENs
10.3.1. 数据缓存并打开

In order to avoid invalidating the sharing assumptions that applications rely on, NFSv4 clients should not provide cached 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.

为了避免应用程序所依赖的共享假设失效,当通过读或写操作获取或修改相同数据无效时,NFSv4客户端不应向应用程序提供缓存数据或代表应用程序修改缓存数据。

Furthermore, in the absence of open delegation (see Section 10.4), two additional rules apply. Note that these rules are obeyed in practice by many NFSv2 and NFSv3 clients.

此外,在没有公开授权的情况下(见第10.4节),适用另外两条规则。请注意,许多NFSv2和NFSv3客户端在实践中都遵守这些规则。

o First, cached data present on a client must be revalidated after doing an OPEN. Revalidating means that the client fetches the change attribute from the server, compares it with the cached change attribute, and, if different, declares the cached data (as well as the cached attributes) as invalid. 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 (such as at OPENs specifying DENY=NONE) to parallel the NFSv3 protocol's practice for the benefit of users assuming this degree of cache revalidation.

o 首先,客户端上存在的缓存数据必须在执行打开后重新验证。重新验证意味着客户端从服务器获取更改属性,将其与缓存的更改属性进行比较,如果不同,则将缓存数据(以及缓存的属性)声明为无效。这是为了确保已打开文件的数据仍然正确地反映在客户端缓存中。至少当客户端的打开操作包括DENY=WRITE或两者时,必须执行此验证,从而终止其他客户端可能有机会使用写访问权限打开文件的时间段。客户机可以选择更频繁地进行重新验证(例如,在指定DENY=NONE的打开处),以并行NFSv3协议的实践,从而使用户能够假定这种缓存重新验证的程度。

Since the change attribute is updated for data and metadata modifications, some client implementers may be tempted to use the time_modify attribute and not the change attribute to validate cached data, so that metadata changes do not spuriously invalidate clean data. The implementer is cautioned against this approach. The change attribute is guaranteed to change for each update to the file, whereas time_modify is guaranteed to change only at the

由于更改属性是为数据和元数据修改而更新的,因此一些客户机实现人员可能会尝试使用time_modify属性而不是change属性来验证缓存的数据,以便元数据更改不会错误地使干净的数据无效。要提醒实施者不要使用这种方法。对于文件的每次更新,change属性都保证更改,而time\u modify只保证在更新时更改

granularity of the time_delta attribute. Use by the client's data cache validation logic of time_modify and not the change attribute runs the risk of the client incorrectly marking stale data as valid.

时间增量属性的粒度。客户机的数据缓存验证逻辑使用time_modify而不是change属性会导致客户机错误地将过时数据标记为有效数据的风险。

o Second, modified data must be flushed to the server before closing a file OPENed for write. This is complementary to the first rule. If the data is not flushed at CLOSE, the revalidation done after the client OPENs a file is unable to achieve its purpose. The other aspect to flushing the data before close is that the data must be committed to stable storage, at the server, before the CLOSE operation is requested by the client. In the case of a server reboot or restart and a CLOSEd file, it may not be possible to retransmit the data to be written to the file -- hence, this requirement.

o 其次,在关闭为写入而打开的文件之前,必须将修改后的数据刷新到服务器。这是对第一条规则的补充。如果关闭时未刷新数据,则在客户端打开文件后进行的重新验证无法达到其目的。关闭前刷新数据的另一个方面是,在客户端请求关闭操作之前,必须将数据提交到服务器上的稳定存储中。在服务器重新启动或重新启动以及文件关闭的情况下,可能无法重新传输要写入文件的数据——因此,这是一个要求。

10.3.2. Data Caching and File Locking
10.3.2. 数据缓存和文件锁定

For those applications that choose to use file locking instead of share reservations to exclude inconsistent file access, there is an analogous set of constraints that apply to client-side data caching. These rules are effective only if the file locking is used in a way that matches in an equivalent way the actual READ and WRITE operations executed. This is as opposed to file locking that is based on pure convention. For example, it is possible to manipulate a two-megabyte file by dividing the file into two one-megabyte regions and protecting access to the two regions by file locks on bytes zero and one. A lock for write on byte zero of the file would represent the right to do READ and WRITE operations on the first region. A lock for write on byte one of the file would represent the right to do READ and WRITE operations on the second region. As long as all applications manipulating the file obey this convention, they will work on a local file system. However, they may not work with the NFSv4 protocol unless clients refrain from data caching.

对于那些选择使用文件锁定而不是共享保留来排除不一致的文件访问的应用程序,有一组类似的约束适用于客户端数据缓存。这些规则只有在文件锁定的使用方式与实际执行的读写操作相匹配时才有效。这与基于纯约定的文件锁定相反。例如,可以通过将文件划分为两个1兆字节的区域,并通过对字节0和字节1的文件锁定来保护对这两个区域的访问,从而操纵一个2兆字节的文件。文件字节0上的写锁定表示对第一个区域执行读写操作的权限。文件字节1上的写锁定表示对第二个区域执行读写操作的权限。只要操作文件的所有应用程序都遵守此约定,它们就可以在本地文件系统上工作。但是,除非客户端避免数据缓存,否则它们可能无法与NFSv4协议一起工作。

The rules for data caching in the file locking environment are:

文件锁定环境中的数据缓存规则包括:

o First, when a client obtains a file lock for a particular region, the data cache corresponding to that region (if any cached 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 the 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.

o 首先,当客户端获得特定区域的文件锁时,必须重新验证与该区域对应的数据缓存(如果存在任何缓存数据)。如果change属性指示文件可能在获取缓存数据后已更新,则客户端必须刷新或使新锁定区域的缓存数据无效。客户机可能会选择使文件中所有未修改的缓存数据无效,但正确操作的唯一要求是使新锁定区域中的所有数据无效。

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.

o 其次,在释放区域的写锁之前,必须将该区域的所有修改数据刷新到服务器。修改后的数据还必须写入稳定的存储器。

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 unlocked may cause invalid modification to the region outside the unlocked area. This, in turn, may be part of a region locked by another client. Clients can avoid this situation by synchronously performing portions of WRITE operations that overlap that portion (initial or final) that is not a full block. Similarly, invalidating a locked area that is not an integral number of full buffer blocks would require the client to read one or two partial blocks from the server if the revalidation procedure shows that the data that the client possesses may not be valid.

请注意,将数据刷新到服务器和缓存数据的失效必须反映锁定或解锁的实际字节范围。如果不小心,向上或向下舍入这些值以反映客户端缓存块边界将导致问题。例如,当修改后的块只有一半在解锁区域内时写入该块可能会导致对解锁区域外区域的无效修改。反过来,这可能是另一个客户端锁定的区域的一部分。客户端可以通过同步执行与非完整块部分(初始或最终)重叠的写入操作部分来避免这种情况。类似地,如果重新验证过程表明客户机拥有的数据可能无效,则使非整数个完整缓冲区块的锁定区域无效将需要客户机从服务器读取一个或两个部分块。

The data that is written to the server as a prerequisite to the unlocking of a region must be written, at the server, to stable storage. The client may accomplish this either with synchronous writes or by following asynchronous writes with a COMMIT operation. This is required because retransmission of the modified data after a server reboot might conflict with a lock held by another client.

作为解锁区域的先决条件写入服务器的数据必须在服务器上写入稳定存储。客户机可以通过同步写入或使用提交操作跟踪异步写入来完成这一点。这是必需的,因为在服务器重新启动后重新传输修改后的数据可能会与另一个客户端持有的锁冲突。

A client implementation may choose to accommodate applications that use byte-range locking in non-standard ways (e.g., using a byte-range lock as a global semaphore) by flushing to the server more data upon a LOCKU than is covered by the locked range. This may include modified data within files other than the one for which the unlocks are being done. In such cases, the client must not interfere with applications whose READs and WRITEs are being done only within the bounds of record locks that the application holds. For example, an application locks a single byte of a file and proceeds to write that single byte. A client that chose to handle a LOCKU by flushing all modified data to the server could validly write that single byte in response to an unrelated unlock. However, it would not be valid to write the entire block in which that single written byte was located since it includes an area that is not locked and might be locked by another client. Client implementations can avoid this problem by dividing files with modified data into those for which all modifications are done to areas covered by an appropriate byte-range lock and those for which there are modifications not covered by a byte-range lock. Any writes done for the former class of files must not include areas not locked and thus not modified on the client.

客户机实现可以通过向服务器刷新锁上超过锁定范围覆盖的更多数据来选择以非标准方式(例如,使用字节范围锁作为全局信号量)使用字节范围锁定的应用程序。这可能包括文件中的修改数据,而不是正在进行解锁的文件。在这种情况下,客户机不得干扰仅在应用程序持有的记录锁的范围内进行读写的应用程序。例如,应用程序锁定文件的一个字节并继续写入该字节。选择通过将所有修改的数据刷新到服务器来处理锁定的客户端可以有效地写入该单个字节以响应不相关的解锁。但是,写入单个写入字节所在的整个块是无效的,因为它包含一个未锁定的区域,并且可能被另一个客户端锁定。客户端实现可以通过将具有修改数据的文件划分为对适当字节范围锁覆盖的区域进行所有修改的文件和未被字节范围锁覆盖的文件来避免此问题。为前一类文件执行的任何写入操作都不得包括未锁定的区域,因此也不得在客户端上修改这些区域。

10.3.3. Data Caching and Mandatory File Locking
10.3.3. 数据缓存和强制文件锁定

Client-side data caching needs to respect mandatory file locking when it is in effect. The presence of mandatory file locking for a given file is indicated when the client gets back NFS4ERR_LOCKED from a READ or WRITE on a file it has an appropriate share reservation for. When mandatory locking is in effect for a file, the client must check 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 be subdivided into multiple pieces with each region (locked or not) treated appropriately.

客户端数据缓存在生效时需要遵守强制文件锁定。当客户端从其具有适当共享保留的文件的读或写操作中恢复NFS4ERR_LOCKED时,将指示给定文件是否存在强制文件锁定。当强制锁定对文件生效时,客户端必须为正在读取或写入的数据检查适当的文件锁定。如果正在读取或写入的范围存在锁,则客户端可以使用客户端的已验证缓存满足请求。如果没有为读或写的范围保留适当的文件锁,则客户端缓存不能满足读或写请求,并且必须将请求发送到服务器进行处理。当读或写请求与锁定区域部分重叠时,应将请求细分为多个部分,并适当处理每个区域(锁定或未锁定)。

10.3.4. Data Caching and File Identity
10.3.4. 数据缓存和文件标识

When clients cache data, the file data needs to be organized according to the file system object to which the data belongs. For NFSv3 clients, the typical practice has been to assume for the purpose of caching that distinct filehandles represent distinct file system objects. The client then has the choice to organize and maintain the data cache on this basis.

当客户端缓存数据时,需要根据数据所属的文件系统对象组织文件数据。对于NFSv3客户机,典型的做法是为了缓存,假定不同的文件句柄表示不同的文件系统对象。然后,客户机可以在此基础上选择组织和维护数据缓存。

In the NFSv4 protocol, there is now the possibility of having significant deviations from a "one filehandle per object" model, because a filehandle may be constructed on the basis of the object's pathname. Therefore, clients need a reliable method to determine if two filehandles designate the same file system object. If clients were simply to assume that all distinct filehandles denote distinct objects and proceed to do data caching on this basis, caching inconsistencies would arise between the distinct client-side objects that mapped to the same server-side object.

在NFSv4协议中,现在可能与“每个对象一个文件句柄”模型存在重大偏差,因为文件句柄可以基于对象的路径名构建。因此,客户端需要一种可靠的方法来确定两个文件句柄是否指定相同的文件系统对象。如果客户端只是假设所有不同的文件句柄都表示不同的对象,并在此基础上继续进行数据缓存,那么映射到同一服务器端对象的不同客户端对象之间就会出现缓存不一致的情况。

By providing a method to differentiate filehandles, the NFSv4 protocol alleviates a potential functional regression in comparison with the NFSv3 protocol. Without this method, caching inconsistencies within the same client could occur, and this has not been present in previous versions of the NFS protocol. Note that it is possible to have such inconsistencies with applications executing on multiple clients, but that is not the issue being addressed here.

通过提供一种区分文件句柄的方法,与NFSv3协议相比,NFSv4协议减轻了潜在的功能回归。如果没有此方法,可能会在同一客户机中发生缓存不一致,这在以前版本的NFS协议中是不存在的。请注意,在多个客户端上执行的应用程序可能存在这种不一致,但这不是本文要解决的问题。

For the purposes of data caching, the following steps allow an NFSv4 client to determine whether two distinct filehandles denote the same server-side object:

出于数据缓存的目的,以下步骤允许NFSv4客户端确定两个不同的文件句柄是否表示相同的服务器端对象:

o If GETATTR directed to two filehandles returns different values of the fsid attribute, then the filehandles represent distinct objects.

o 如果指向两个filehandles的GETATTR返回不同的fsid属性值,则filehandles表示不同的对象。

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 distinct.

o 如果fsid与两个文件句柄的fsid相匹配的任何文件的GETATTR返回一个值为TRUE的唯一_handles属性,则这两个对象是不同的。

o If GETATTR directed to the two filehandles does not return the fileid attribute for both of the handles, then it cannot be determined whether the two objects are the same. Therefore, operations that depend on that knowledge (e.g., client-side data caching) cannot be done reliably. Note that if GETATTR does not return the fileid attribute for both filehandles, it will return it for neither of the filehandles, since the fsid for both filehandles is the same.

o 如果指向两个FileHandle的GETATTR没有为这两个句柄返回fileid属性,则无法确定这两个对象是否相同。因此,依赖于该知识的操作(例如,客户端数据缓存)无法可靠地完成。请注意,如果GETATTR没有为两个filehandles返回fileid属性,那么它将为两个filehandles都返回该属性,因为两个filehandles的fsid相同。

o If GETATTR directed to the two filehandles returns different values for the fileid attribute, then they are distinct objects.

o 如果指向两个FileHandle的GETATTR为fileid属性返回不同的值,则它们是不同的对象。

o Otherwise, they are the same object.

o 否则,它们是相同的对象。

10.4. Open Delegation
10.4. 公开授权

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 delegation is recallable, since the circumstances that allowed for the delegation are subject to change. In particular, the server may receive a conflicting OPEN from another client; the server must recall the delegation before deciding whether the OPEN from the other client may be granted. Making a delegation is up to the server, and clients should not assume that any particular OPEN either will or will not result in an open delegation. The following is a typical set of conditions that servers might use in deciding whether OPEN should be delegated:

打开文件时,服务器可以将该文件的打开和关闭的进一步处理委托给打开的客户端。任何此类授权都是可撤销的,因为允许授权的情况可能会发生变化。具体地,服务器可以从另一客户端接收冲突的OPEN;服务器必须在决定是否可以授予从其他客户端打开的权限之前调用委托。委托由服务器决定,客户机不应认为任何特定的开放式委托会或不会导致开放式委托。以下是服务器在决定是否委派OPEN时可能使用的一组典型条件:

o The client must be able to respond to the server's callback requests. The server will use the CB_NULL procedure for a test of callback ability.

o 客户端必须能够响应服务器的回调请求。服务器将使用CB_NULL过程来测试回调能力。

o The client must have responded properly to previous recalls.

o 客户必须对之前的召回做出正确响应。

o There must be no current open conflicting with the requested delegation.

o 必须没有与请求的委派冲突的当前打开。

o There should be no current delegation that conflicts with the delegation being requested.

o 当前不应存在与所请求的授权冲突的授权。

o The probability of future conflicting open requests should be low, based on the recent history of the file.

o 根据文件最近的历史记录,未来发生冲突的开放请求的概率应该很低。

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).

o 存在任何特定于服务器的打开/关闭语义,这将使所需的处理与委托客户端将应用的指定处理不兼容(见下文)。

There are two types of open delegations: OPEN_DELEGATE_READ and OPEN_DELEGATE_WRITE. An OPEN_DELEGATE_READ delegation allows a client to handle, on its own, requests to open a file for reading that do not deny read access to others. It MUST, however, continue to send all requests to open a file for writing to the server. Multiple OPEN_DELEGATE_READ delegations may be outstanding simultaneously and do not conflict. An OPEN_DELEGATE_WRITE delegation allows the client to handle, on its own, all opens. Only one OPEN_DELEGATE_WRITE delegation may exist for a given file at a given time, and it is inconsistent with any OPEN_DELEGATE_READ delegations.

开放式委托有两种类型:开放式委托读取和开放式委托写入。OPEN_DELEGATE_READ delegation允许客户端自行处理打开文件进行读取的请求,而不拒绝其他客户端的读取访问。但是,它必须继续发送打开文件以写入服务器的所有请求。多个开放式委托书可以同时未完成且不冲突。OPEN_DELEGATE_WRITE委托允许客户端自行处理所有打开的文件。给定文件在给定时间只能存在一个OPEN_DELEGATE_WRITE委托,它与任何OPEN_DELEGATE_READ委托不一致。

When a single client holds an OPEN_DELEGATE_READ delegation, it is assured that no other client may modify the contents or attributes of the file. If more than one client holds an OPEN_DELEGATE_READ delegation, then the contents and attributes of that file are not allowed to change. When a client has an OPEN_DELEGATE_WRITE delegation, it may modify the file data since no other client will be accessing the file's data. The client holding an OPEN_DELEGATE_WRITE delegation may only affect file attributes that are intimately connected with the file data: size, time_modify, and change.

当单个客户机持有OPEN_DELEGATE_READ委托时,可以确保没有其他客户机可以修改文件的内容或属性。如果有多个客户端持有OPEN_DELEGATE_READ委派,则不允许更改该文件的内容和属性。当一个客户端有一个OPEN_DELEGATE_WRITE委托时,它可能会修改文件数据,因为没有其他客户端会访问该文件的数据。持有OPEN_DELEGATE_WRITE delegation的客户端可能只影响与文件数据密切相关的文件属性:大小、时间、修改和更改。

When a client has an open delegation, it does not send OPENs or CLOSEs to the server but updates the appropriate status internally. For an OPEN_DELEGATE_READ delegation, opens that cannot be handled locally (opens for write or that deny read access) must be sent to the server.

当客户机具有打开的委派时,它不会向服务器发送打开或关闭,而是在内部更新相应的状态。对于OPEN_DELEGATE_READ delegation,必须将无法在本地处理的打开(打开以进行写入或拒绝读取访问)发送到服务器。

When an open delegation is made, the response to the OPEN contains an open delegation structure that specifies the following:

进行开放式委派时,对开放式委派的响应包含一个开放式委派结构,该结构指定以下内容:

o the type of delegation (read or write)

o 委托的类型(读或写)

o space limitation information to control flushing of data on close (OPEN_DELEGATE_WRITE delegation only; see Section 10.4.1)

o 用于控制关闭时数据刷新的空间限制信息(仅开放\u委托\u写入委托;参见第10.4.1节)

o an nfsace4 specifying read and write permissions

o 指定读写权限的nfsace4

o a stateid to represent the delegation for READ and WRITE

o 表示读写委托的stateid

The delegation stateid is separate and distinct from the stateid for the OPEN proper. The standard stateid, unlike the delegation stateid, is associated with a particular open-owner and will continue to be valid after the delegation is recalled and the file remains open.

委托stateid是独立的,并且与开放数据库的stateid不同。与委托stateid不同,标准stateid与特定的打开所有者相关联,并且在调用委托并且文件保持打开状态后将继续有效。

When a request internal to the client is made to open a file and open delegation is in effect, it will be accepted or rejected solely on the basis of the following conditions. Any requirement for other checks to be made by the delegate should result in open delegation 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 Section 9.9.

o 请求和文件的访问和拒绝位,如第9.9节所述。

o The read and write permissions, as determined below.

o 读取和写入权限,如下所示。

The nfsace4 passed with delegation can be used to avoid frequent ACCESS calls. The permission check should be as follows:

通过委派传递的nfsace4可用于避免频繁的访问调用。权限检查应如下所示:

o If the nfsace4 indicates that the open may be done, then it should be granted without reference to the server.

o 如果nfsace4指示可以完成打开,则应在不参考服务器的情况下授予打开。

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.

o 如果nfsace4指示可能无法打开,则必须向服务器发送访问请求以获得最终答案。

The server may return an nfsace4 that is more restrictive than the actual ACL of the file. This includes an nfsace4 that specifies denial of all access. Note that some common practices, such as mapping the traditional user "root" to the user "nobody", may make it incorrect to return the actual ACL of the file in the delegation response.

服务器可能返回比文件的实际ACL更严格的nfsace4。这包括指定拒绝所有访问的nfsace4。请注意,一些常见做法(如将传统用户“root”映射到用户“nobody”)可能会导致在委派响应中返回文件的实际ACL不正确。

The use of delegation, together with various other forms of caching, creates the possibility that no server authentication will ever be performed for a given user since all of the user's requests might be satisfied locally. Where the client is depending on the server for authentication, the client should be sure authentication occurs for each user by use of the ACCESS operation. This should be the case even if an ACCESS operation would not be required otherwise. As mentioned before, the server may enforce frequent authentication by returning an nfsace4 denying all access with every open delegation.

委托的使用,加上各种其他形式的缓存,使得不会对给定用户执行服务器身份验证,因为用户的所有请求都可能在本地得到满足。当客户端依赖服务器进行身份验证时,客户端应确保通过使用访问操作为每个用户进行身份验证。即使不需要访问操作,也应如此。如前所述,服务器可以通过返回一个nfsace4来强制执行频繁身份验证,该nfsace4拒绝每个打开的委托的所有访问。

10.4.1. Open Delegation and Data Caching
10.4.1. 开放委托和数据缓存

OPEN delegation allows much of the message overhead associated with the opening and closing files to be eliminated. An open when an open delegation is in effect does not require that a validation message be sent to the server unless there exists a potential for conflict with the requested share mode. The continued endurance of the "OPEN_DELEGATE_READ delegation" provides a guarantee that no OPEN for write and thus no write has occurred that did not originate from this client. Similarly, when closing a file opened for write and if OPEN_DELEGATE_WRITE delegation is in effect, the data written does not have to be flushed to the server until the open delegation is recalled. The continued endurance of the open delegation provides a guarantee that no open and thus no read or write has been done by another client.

开放式委派允许消除和打开和关闭文件相关的大部分消息开销。开放式委派生效时的开放式委派不要求向服务器发送验证消息,除非与请求的共享模式存在潜在冲突。“开放式委托-读取委托”的持续持久性保证了不会出现开放式写操作,因此不会发生非源于此客户端的写操作。类似地,在关闭为写入而打开的文件时,如果“打开的委托”或“写入的委托”生效,则在调用“打开的委托”之前,写入的数据不必刷新到服务器。开放委托的持续持久性保证了另一个客户机没有进行开放操作,因此也没有进行读写操作。

For the purposes of open delegation, READs and WRITEs done without an OPEN (anonymous and READ bypass stateids) are treated as the functional equivalents of a corresponding type of OPEN. READs and WRITEs done with an anonymous stateid done by another client will force the server to recall an OPEN_DELEGATE_WRITE delegation. A WRITE with an anonymous stateid done by another client will force a recall of OPEN_DELEGATE_READ delegations. The handling of a READ bypass stateid is identical, except that a READ done with a READ bypass stateid will not force a recall of an OPEN_DELEGATE_READ delegation.

出于开放式委托的目的,在没有open(匿名和读绕过stateID)的情况下进行的读写操作被视为相应类型的open的功能等价物。由另一个客户端使用匿名stateid执行的读写操作将强制服务器调用OPEN_DELEGATE_WRITE委派。由另一个客户端使用匿名stateid进行的写入将强制调用OPEN_DELEGATE_READ委托。读取旁路stateid的处理是相同的,除了使用读取旁路stateid完成的读取不会强制调用打开的\u委托\u读取委托。

With delegations, a client is able to avoid writing data to the server when the CLOSE of a file is serviced. The file close system call is the usual point at which the client is notified of a lack of stable storage for the modified file data generated by the application. At 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., the server returns NFS4ERR_NOSPC or NFS4ERR_DQUOT). This accounting includes quotas. The introduction of delegations requires that an alternative method be in place for the same type of communication to occur between client and server.

通过委托,客户机可以避免在文件关闭时向服务器写入数据。文件关闭系统调用是一个通常的点,在这个点上,客户端会被通知缺少用于应用程序生成的修改文件数据的稳定存储。在结束时,文件数据被写入服务器,通过正常记帐,服务器能够确定是否超出了数据的可用文件系统空间(即,服务器返回NFS4ERR_NOSPC或NFS4ERR_DQUOT)。这种核算包括配额。委托的引入要求为客户机和服务器之间发生相同类型的通信提供一种替代方法。

In the delegation response, the server provides either the limit of the size of the file or the number of modified blocks and associated block size. The server must ensure that the client will be able to flush to the server data of a size equal to that provided in the original delegation. The server must make this assurance for all outstanding delegations. Therefore, the server must be careful in its management of available space for new or modified data, taking into account available file system space and any applicable quotas. The server can recall delegations as a result of managing the

在委托响应中,服务器提供文件大小的限制或修改的块数和关联的块大小。服务器必须确保客户端能够刷新到服务器上的数据,其大小等于原始委托中提供的数据大小。服务器必须为所有未完成的委派做出此保证。因此,服务器在管理新数据或修改数据的可用空间时必须谨慎,同时考虑可用文件系统空间和任何适用的配额。服务器可以通过管理

available file system space. The client should abide by the server's state space limits for delegations. If the client exceeds the stated limits for the delegation, the server's behavior is undefined.

可用的文件系统空间。客户机应该遵守服务器的状态空间限制。如果客户端超过了指定的委托限制,则服务器的行为未定义。

Based on server conditions, quotas, or available file system space, the server may grant OPEN_DELEGATE_WRITE delegations with very restrictive space limitations. The limitations may be defined in a way that will always force modified data to be flushed to the server on close.

根据服务器条件、配额或可用的文件系统空间,服务器可以授予具有非常严格的空间限制的OPEN_DELEGATE_WRITE委派。这些限制的定义方式可能总是强制在关闭时将修改后的数据刷新到服务器。

With respect to authentication, flushing modified data to the server after a CLOSE has occurred may be problematic. For example, the user of the application may have logged off the client, and unexpired authentication credentials may not be present. In this case, the client may need to take special care to ensure that local unexpired credentials will in fact be available. One way that this may be accomplished is by tracking the expiration time of credentials and flushing data well in advance of their expiration.

关于身份验证,在关闭后将修改的数据刷新到服务器可能会有问题。例如,应用程序的用户可能已注销客户端,并且未过期的身份验证凭据可能不存在。在这种情况下,客户端可能需要特别小心,以确保本地未过期的凭据实际上可用。实现这一点的一种方法是跟踪凭据的过期时间,并在其过期之前刷新数据。

10.4.2. Open Delegation and File Locks
10.4.2. 打开委托和文件锁

When a client holds an OPEN_DELEGATE_WRITE delegation, lock operations may be performed locally. This includes those required for mandatory file 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.

当客户端持有OPEN_DELEGATE_WRITE委派时,可以在本地执行锁定操作。这包括强制文件锁定所需的文件。这是可以做到的,因为委托意味着不可能有冲突的锁。类似地,通常与获取锁相关的所有重新验证以及与释放锁相关的数据刷新都不需要完成。

When a client holds an OPEN_DELEGATE_READ delegation, lock operations are not performed locally. All lock operations, including those requesting non-exclusive locks, are sent to the server for resolution.

当客户端持有OPEN_DELEGATE_READ委派时,不会在本地执行锁定操作。所有锁操作(包括请求非独占锁的操作)都将发送到服务器进行解析。

10.4.3. Handling of CB_GETATTR
10.4.3. CB_GETATTR的处理

The server needs to employ special handling for a GETATTR where the target is a file that has an OPEN_DELEGATE_WRITE delegation in effect. The reason for this is that the client holding the OPEN_DELEGATE_WRITE delegation may have modified the data, and the server needs to reflect this change to the second client that submitted the GETATTR. Therefore, the client holding the OPEN_DELEGATE_WRITE delegation needs to be interrogated. The server will use the CB_GETATTR operation. The only attributes that the server can reliably query via CB_GETATTR are size and change.

服务器需要对GETATTR进行特殊处理,其中目标是一个有效的OPEN_DELEGATE_WRITE委托的文件。这是因为持有OPEN_DELEGATE_WRITE委托的客户端可能修改了数据,服务器需要将此更改反映到提交GETATTR的第二个客户端。因此,需要询问持有OPEN_DELEGATE_WRITE委托的客户机。服务器将使用CB_GETATTR操作。服务器可以通过CB_GETATTR可靠查询的唯一属性是大小和更改。

Since CB_GETATTR is being used to satisfy another client's GETATTR request, the server only needs to know if the client holding the delegation has a modified version of the file. If the client's copy of the delegated file is not modified (data or size), the server can satisfy the second client's GETATTR request from the attributes stored locally at the server. If the file is modified, the server only needs to know about this modified state. If the server determines that the file is currently modified, it will respond to the second client's GETATTR as if the file had been modified locally at the server.

由于CB_GETATTR用于满足另一个客户机的GETATTR请求,因此服务器只需要知道持有委托的客户机是否具有文件的修改版本。如果委托文件的客户端副本未被修改(数据或大小),则服务器可以从服务器本地存储的属性满足第二个客户端的GETATTR请求。如果文件被修改,服务器只需要知道此修改状态。如果服务器确定该文件当前已修改,它将响应第二个客户端的GETATTR,就像该文件已在服务器本地修改一样。

Since the form of the change attribute is determined by the server and is opaque to the client, the client and server need to agree on a method of communicating the modified state of the file. For the size attribute, the client will report its current view of the file size. For the change attribute, the handling is more involved.

由于更改属性的形式由服务器决定,并且对客户机来说是不透明的,因此客户机和服务器需要就传递文件修改状态的方法达成一致。对于“大小”属性,客户端将报告其文件大小的当前视图。对于change属性,处理更为复杂。

For the client, the following steps will be taken when receiving an OPEN_DELEGATE_WRITE delegation:

对于客户端,在接收OPEN_DELEGATE_WRITE委派时,将采取以下步骤:

o The value of the change attribute will be obtained from the server and cached. Let this value be represented by c.

o 更改属性的值将从服务器获取并缓存。让这个值用c表示。

o The client will create a value greater than c that will be used for communicating that modified data is held at the client. Let this value be represented by d.

o 客户端将创建一个大于c的值,该值将用于通信客户端保存的修改数据。让这个值用d表示。

o When the client is queried via CB_GETATTR for the change attribute, it checks to see if it holds modified data. If the file is modified, the value d is returned for the change attribute value. If this file is not currently modified, the client returns the value c for the change attribute.

o 当通过CB_GETATTR查询客户机的change属性时,它会检查客户机是否保存修改后的数据。如果文件被修改,则会为更改属性值返回值d。如果当前未修改此文件,则客户端将返回change属性的值c。

For simplicity of implementation, the client MAY for each CB_GETATTR return the same value d. This is true even if, between successive CB_GETATTR operations, the client again modifies in the file's data or metadata in its cache. The client can return the same value because the only requirement is that the client be able to indicate to the server that the client holds modified data. Therefore, the value of d may always be c + 1.

为简化实现,客户机可能会为每个CB_GETATTR返回相同的值d。即使在连续的CB_GETATTR操作之间,客户端再次修改其缓存中文件的数据或元数据,这也是正确的。客户机可以返回相同的值,因为唯一的要求是客户机能够向服务器指示客户机持有修改后的数据。因此,d的值可能总是c+1。

While the change attribute is opaque to the client in the sense that it has no idea what units of time, if any, the server is counting change with, it is not opaque in that the client has to treat it as an unsigned integer, and the server has to be able to see the results of the client's changes to that integer. Therefore, the server MUST encode the change attribute in network byte order when sending it to the client. The client MUST decode it from network byte order to its

虽然change属性对客户端来说是不透明的,因为它不知道服务器使用什么时间单位(如果有的话)计算更改,但它不是不透明的,因为客户端必须将其视为无符号整数,服务器必须能够看到客户端对该整数所做更改的结果。因此,服务器在将更改属性发送到客户端时,必须按网络字节顺序对其进行编码。客户端必须将其从网络字节顺序解码为

native order when receiving it, and the client MUST encode it in network byte order when sending it to the server. For this reason, the change attribute is defined as an unsigned integer rather than an opaque array of bytes.

接收时按本机顺序,客户端发送到服务器时必须按网络字节顺序对其进行编码。因此,change属性被定义为无符号整数,而不是不透明的字节数组。

For the server, the following steps will be taken when providing an OPEN_DELEGATE_WRITE delegation:

对于服务器,在提供OPEN_DELEGATE_WRITE委派时将采取以下步骤:

o Upon providing an OPEN_DELEGATE_WRITE delegation, the server will cache a copy of the change attribute in the data structure it uses to record the delegation. Let this value be represented by sc.

o 在提供OPEN_DELEGATE_WRITE委派后,服务器将在用于记录委派的数据结构中缓存change属性的副本。让这个值用sc表示。

o When a second client sends a GETATTR operation on the same file to the server, the server obtains the change attribute from the first client. Let this value be cc.

o 当第二个客户机向服务器发送同一文件上的GETATTR操作时,服务器从第一个客户机获取change属性。将此值设为cc。

o If the value cc is equal to sc, the file is not modified and the server returns the current values for change, time_metadata, and time_modify (for example) to the second client.

o 如果值cc等于sc,则不会修改文件,服务器会将更改、时间\元数据和时间\修改(例如)的当前值返回给第二个客户端。

o If the value cc is NOT equal to sc, the file is currently modified at the first client and most likely will be modified at the server at a future time. The server then uses its current time to construct attribute values for time_metadata and time_modify. A new value of sc, which we will call nsc, is computed by the server, such that nsc >= sc + 1. The server then returns the constructed time_metadata, time_modify, and nsc values to the requester. The server replaces sc in the delegation record with nsc. To prevent the possibility of time_modify, time_metadata, and change from appearing to go backward (which would happen if the client holding the delegation fails to write its modified data to the server before the delegation is revoked or returned), the server SHOULD update the file's metadata record with the constructed attribute values. For reasons of reasonable performance, committing the constructed attribute values to stable storage is OPTIONAL.

o 如果值cc不等于sc,则文件当前在第一个客户端修改,并且很可能在将来在服务器上修改。然后,服务器使用其当前时间为time\u元数据和time\u modify构造属性值。服务器会计算一个新的sc值,我们称之为nsc,这样nsc>=sc+1。然后,服务器将构造的time_元数据、time_modify和nsc值返回给请求者。服务器用nsc替换委派记录中的sc。为了防止时间\修改、时间\元数据和更改出现倒退的可能性(如果持有委托的客户端在撤销或返回委托之前未能将其修改的数据写入服务器,则会发生这种情况),服务器应使用构造的属性值更新文件的元数据记录。出于合理性能的考虑,将构造的属性值提交到稳定存储是可选的。

As discussed earlier in this section, the client MAY return the same cc value on subsequent CB_GETATTR calls, even if the file was modified in the client's cache yet again between successive CB_GETATTR calls. Therefore, the server must assume that the file has been modified yet again and MUST take care to ensure that the new nsc it constructs and returns is greater than the previous nsc it returned. An example implementation's delegation record would satisfy this mandate by including a boolean field (let us call it "modified") that is set to FALSE when the delegation is granted, and an sc value set at the time of grant to the change attribute value. The modified field would be set to TRUE the first time cc != sc and

如本节前面所述,客户机可能会在后续CB_GETATTR调用中返回相同的cc值,即使在连续CB_GETATTR调用之间再次在客户机缓存中修改了文件。因此,服务器必须假设文件已再次修改,并且必须注意确保它构造和返回的新nsc大于它返回的前一个nsc。一个示例实现的委托记录将通过包含一个布尔字段(我们称之为“修改”)来满足这一要求,该布尔字段在授予委托时设置为FALSE,以及在授予更改属性值时设置的sc值。修改后的字段将在第一次抄送时设置为TRUE!=理学士及

would stay TRUE until the delegation is returned or revoked. The processing for constructing nsc, time_modify, and time_metadata would use this pseudo-code:

将保持为TRUE,直到委托被返回或撤销。用于构造nsc、time\u modify和time\u元数据的处理将使用以下伪代码:

       if (!modified) {
           do CB_GETATTR for change and size;
        
       if (!modified) {
           do CB_GETATTR for change and size;
        
           if (cc != sc)
               modified = TRUE;
       } else {
           do CB_GETATTR for size;
       }
        
           if (cc != sc)
               modified = TRUE;
       } else {
           do CB_GETATTR for size;
       }
        
       if (modified) {
           sc = sc + 1;
           time_modify = time_metadata = current_time;
           update sc, time_modify, time_metadata into file's metadata;
       }
        
       if (modified) {
           sc = sc + 1;
           time_modify = time_metadata = current_time;
           update sc, time_modify, time_metadata into file's metadata;
       }
        

This would return to the client (that sent GETATTR) the attributes it requested but would make sure that size comes from what CB_GETATTR returned. The server would not update the file's metadata with the client's modified size.

这将向客户端(发送GETATTR的客户端)返回它请求的属性,但会确保大小来自CB_GETATTR返回的属性。服务器不会使用客户端修改的大小更新文件的元数据。

In the case that the file attribute size is different than the server's current value, the server treats this as a modification regardless of the value of the change attribute retrieved via CB_GETATTR and responds to the second client as in the last step.

如果文件属性大小不同于服务器的当前值,则服务器将此视为修改,而不管通过CB_GETATTR检索的更改属性的值如何,并像上一步一样响应第二个客户端。

This methodology resolves issues of clock differences between client and server and other scenarios where the use of CB_GETATTR breaks down.

这种方法解决了客户机和服务器之间的时钟差异问题,以及使用CB_GETATTR出现故障的其他场景。

It should be noted that the server is under no obligation to use CB_GETATTR; therefore, the server MAY simply recall the delegation to avoid its use.

需要注意的是,服务器没有义务使用CB_GETATTR;因此,服务器可以简单地调用委派以避免使用委派。

10.4.4. Recall of Open Delegation
10.4.4. 召回公开代表团

The following events necessitate the recall of an open delegation:

以下事件需要召回一个公开的代表团:

o Potentially conflicting OPEN request (or READ/WRITE done with "special" stateid)

o 潜在冲突的开放请求(或使用“特殊”stateid完成读/写操作)

o SETATTR issued by another client

o 由另一个客户端发出的SETATTR

o REMOVE request for the file

o 删除对该文件的请求

o RENAME request for the file as either source or target of the RENAME

o 将文件重命名为重命名的源或目标的请求

Whether a RENAME of a directory in the path leading to the file results in the recall of an open delegation depends on the semantics of the server file system. If that file system denies such RENAMEs when a file is open, the recall must be performed to determine whether the file in question is, in fact, open.

对指向文件的路径中的目录进行重命名是否会导致调用打开的委托,这取决于服务器文件系统的语义。如果文件系统在文件打开时拒绝此类重命名,则必须执行回调以确定所涉及的文件实际上是否已打开。

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 a recall.

除上述情况外,如果资源限制允许,服务器可以随时选择召回开放的委托。客户应随时做好召回的准备。

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.

o 如果与委派关联的文件不再打开,并且以前的关闭操作未发送到服务器,则必须向服务器发送关闭操作。

o If a file has other open references at the client, then OPEN operations must be sent to the server. The appropriate stateids will be provided by the server for subsequent use by the client since the delegation stateid will not longer be valid. These 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 Section 16.16 for details.)

o 如果文件在客户端具有其他打开引用,则必须将打开操作发送到服务器。服务器将提供适当的stateid供客户端后续使用,因为委托stateid将不再有效。这些打开的请求使用claim_DELEGATE_CUR的claim类型完成。这将允许呈现委托stateid,以便客户机可以建立适当的权限来执行OPEN。(详见第16.16节。)

o If there are granted file locks, the corresponding LOCK operations need to be performed. This applies to the OPEN_DELEGATE_WRITE delegation case only.

o 如果已授予文件锁,则需要执行相应的锁操作。这仅适用于OPEN_DELEGATE_WRITE委派案例。

o For an OPEN_DELEGATE_WRITE delegation, if at the time of the 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 对于OPEN_DELEGATE_WRITE delegation,如果在回调时文件未打开进行写入,则必须将文件的所有修改数据刷新到服务器。如果委托不存在,客户机将在关闭操作之前完成此数据刷新。

o For an OPEN_DELEGATE_WRITE delegation, when a file is still open at the time of the recall, any modified data for the file needs to be flushed to the server.

o 对于OPEN_DELEGATE_WRITE delegation,当调用时文件仍处于打开状态时,需要将文件的任何修改数据刷新到服务器。

o With the OPEN_DELEGATE_WRITE 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 UNCHECKED4 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.

o 在OPEN_DELEGATE_WRITE委派就绪的情况下,文件可能在委派期间被截断。例如,截断可能是由于大小属性值为零的未选中打开的4导致的。因此,如果发生了文件截断,并且此操作尚未传播到服务器,则必须在将任何修改的数据写入服务器之前进行截断。

In the case of an OPEN_DELEGATE_WRITE delegation, file locking imposes some additional requirements. To precisely maintain the associated invariant, it is required to flush any modified data in any region for which a write lock was released while the OPEN_DELEGATE_WRITE delegation was in effect. However, because the OPEN_DELEGATE_WRITE 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 OPEN_DELEGATE_WRITE delegation was in effect.

在开放委托和写委托的情况下,文件锁定带来了一些额外的要求。为了精确地维护关联的不变量,需要刷新在OPEN_DELEGATE_write delegation有效时为其释放写锁的任何区域中的任何修改数据。但是,由于OPEN_DELEGATE_WRITE delegation并不意味着其他客户端进行其他锁定,因此更简单的实现是,如果在OPEN_DELEGATE_WRITE delegation有效时释放了任何写锁,则刷新文件的所有修改数据(如上所述)。

An implementation need not wait until delegation recall (or deciding to voluntarily return a delegation) to perform any of the above actions, if implementation considerations (e.g., resource availability constraints) make that desirable. Generally, however, the fact that the actual open state of the file may continue to change makes it not worthwhile to send information about opens and closes to the server, except as part of delegation return. Only in the case of closing the open that resulted in obtaining the delegation would clients be likely to do this early, since, in that case, the close once done will not be undone. Regardless of the client's choices on scheduling these actions, all must be performed before the delegation is returned, including (when applicable) the close that corresponds to the open that resulted in the delegation. These actions can be performed either in previous requests or in previous operations in the same COMPOUND request.

如果实现考虑(例如,资源可用性约束)使执行上述任何操作成为可取的,则实现无需等到委托召回(或决定自愿返回委托)后再执行。但是,通常情况下,文件的实际打开状态可能会继续更改,因此不值得向服务器发送有关打开和关闭的信息,除非作为委托返回的一部分。只有在关闭导致获得委托的未结项的情况下,客户才可能提前这样做,因为在这种情况下,一旦完成,关闭将不会撤消。无论客户选择如何安排这些操作,都必须在返回委派之前执行所有操作,包括(如果适用)与导致委派的打开对应的关闭。这些操作可以在以前的请求中执行,也可以在同一复合请求中的以前操作中执行。

10.4.5. OPEN Delegation Race with CB_RECALL
10.4.5. 与CB_召回的公开代表团竞赛

The server informs the client of a recall via a CB_RECALL. A race case that may develop is when the delegation is immediately recalled before the COMPOUND that established the delegation is returned to the client. As the CB_RECALL provides both a stateid and a filehandle for which the client has no mapping, it cannot honor the recall attempt. At this point, the client has two choices: either do not respond or respond with NFS4ERR_BADHANDLE. If it does not respond, then it runs the risk of the server deciding to not grant it further delegations.

服务器通过CB_回调通知客户端回调。可能发生的种族案件是,在建立委托关系的化合物返回给客户之前,立即召回委托关系。由于CB_回调同时提供stateid和filehandle,客户端没有映射,因此它不能接受回调尝试。此时,客户端有两个选择:要么不响应,要么使用NFS4ERR_BADHANDLE响应。如果它没有响应,那么它将面临服务器决定不授予它进一步授权的风险。

If instead it does reply with NFS4ERR_BADHANDLE, then both the client and the server might be able to detect that a race condition is occurring. The client can keep a list of pending delegations. When it receives a CB_RECALL for an unknown delegation, it can cache the stateid and filehandle on a list of pending recalls. When it is provided with a delegation, it would only use it if it was not on the pending recall list. Upon the next CB_RECALL, it could immediately return the delegation.

相反,如果它使用NFS4ERR_BADHANDLE进行应答,那么客户端和服务器都可能能够检测到正在发生竞争情况。客户可以保留一份待处理委托的列表。当它收到未知委托的CB_回调时,它可以在挂起的回调列表上缓存stateid和filehandle。当向其提供委托时,只有在其不在待召回名单上时,才会使用该委托。在下一次CB_召回时,它可以立即返回代表团。

In turn, the server can keep track of when it issues a delegation and assume that if a client responds to the CB_RECALL with an NFS4ERR_BADHANDLE, then the client has yet to receive the delegation. The server SHOULD give the client a reasonable time both to get this delegation and to return it before revoking the delegation. Unlike a failed callback path, the server should periodically probe the client with CB_RECALL to see if it has received the delegation and is ready to return it.

反过来,服务器可以跟踪何时发出委托,并假设如果客户机使用NFS4ERR_BADHANDLE响应CB_调用,则客户机尚未收到委托。服务器应该给客户端一段合理的时间来获取此委派,并在撤消委派之前返回委派。与失败的回调路径不同,服务器应该定期使用CB_RECALL探测客户机,以查看它是否已收到委托并准备返回委托。

When the server finally determines that enough time has elapsed, it SHOULD revoke the delegation and it SHOULD NOT revoke the lease. During this extended recall process, the server SHOULD be renewing the client lease. The intent here is that the client not pay too onerous a burden for a condition caused by the server.

当服务器最终确定已经过了足够的时间时,它应该撤销委托,而不应该撤销租约。在此扩展召回过程中,服务器应续订客户端租约。这里的目的是,客户机不必为服务器造成的状况支付太沉重的负担。

10.4.6. Clients That Fail to Honor Delegation Recalls
10.4.6. 未能履行委托关系的客户召回

A client may fail to respond to a recall for various reasons, such as a failure of the callback path from the server to the client. The client may be unaware of a failure in the callback path. This lack of awareness could result in the client finding out long after the failure that its delegation has been revoked, and another client has modified the data for which the client had a delegation. This is especially a problem for the client that held an OPEN_DELEGATE_WRITE delegation.

客户端可能由于各种原因无法响应回调,例如从服务器到客户端的回调路径失败。客户端可能不知道回调路径中有故障。这种缺乏意识的情况可能会导致客户机在失败很久之后发现其委托已被撤销,而另一个客户机已修改了该客户机具有委托的数据。这对于持有开放式委托的客户机来说尤其是一个问题。

The server also has a dilemma in that the client that fails to respond to the recall might also be sending other NFS requests, including those that renew the lease before the lease expires. Without returning an error for those lease-renewing operations, the server leads the client to believe that the delegation it has is in force.

服务器还面临一个难题,即未能响应召回的客户端可能还发送其他NFS请求,包括那些在租约到期之前续订租约的请求。在不为这些租约续订操作返回错误的情况下,服务器会引导客户机相信它所拥有的委托已生效。

This difficulty is solved by the following rules:

此困难可通过以下规则解决:

o When the callback path is down, the server MUST NOT revoke the delegation if one of the following occurs:

o 当回调路径关闭时,如果发生以下情况之一,服务器不得撤消委派:

* The client has issued a RENEW operation, and the server has returned an NFS4ERR_CB_PATH_DOWN error. The server MUST renew the lease for any byte-range locks and share reservations the client has that the server has known about (as opposed to those locks and share reservations the client has established but not yet sent to the server, due to the delegation). The server SHOULD give the client a reasonable time to return its delegations to the server before revoking the client's delegations.

* 客户端已发出续订操作,服务器已返回NFS4ERR\u CB\u PATH\u DOWN错误。服务器必须为客户端已知的任何字节范围锁和共享保留续订租约(与客户端已建立但由于委派尚未发送到服务器的锁和共享保留相反)。在撤销客户机的委托之前,服务器应该给客户机一段合理的时间将其委托返回给服务器。

* The client has not issued a RENEW operation for some period of time after the server attempted to recall the delegation. This period of time MUST NOT be less than the value of the lease_time attribute.

* 在服务器尝试调用委派后,客户端有一段时间未发出续订操作。此时间段不得小于lease_time属性的值。

o When the client holds a delegation, it cannot rely on operations, except for RENEW, that take a stateid, to renew delegation leases across callback path failures. The client that wants to keep delegations in force across callback path failures must use RENEW to do so.

o 当客户机持有委派时,它不能依赖操作(RENEW除外)跨回调路径故障续订委派租约,该操作采用stateid。希望在回调路径失败时保持委托有效的客户端必须使用“续订”来执行此操作。

10.4.7. Delegation Revocation
10.4.7. 委托撤销

At the point a delegation is revoked, if there are associated opens on the client, the applications holding these opens need to be notified. This notification usually occurs by returning errors for READ/WRITE operations or when a close is attempted for the open file.

在委托被撤销时,如果客户端上存在关联的打开,则需要通知持有这些打开的应用程序。此通知通常在读/写操作返回错误或试图关闭打开的文件时发生。

If no opens exist for the file at the point the delegation is revoked, then notification of the revocation is unnecessary. However, if there is modified data present at the client for the file, the user of the application should be notified. Unfortunately, it may not be possible to notify the user since active applications may not be present at the client. See Section 10.5.1 for additional details.

如果在撤销委派时不存在文件的打开,则不需要通知撤销。但是,如果文件的客户端存在修改的数据,则应通知应用程序的用户。不幸的是,由于客户端可能不存在活动应用程序,因此可能无法通知用户。更多详情见第10.5.1节。

10.5. Data Caching and Revocation
10.5. 数据缓存和撤销

When locks and delegations are revoked, the assumptions upon which successful caching depend are no longer guaranteed. For any locks or share reservations that have been revoked, the corresponding owner needs to be notified. This notification includes applications with a file open that has a corresponding delegation that has been revoked.

当锁和委托被撤销时,成功缓存所依赖的假设将不再得到保证。对于任何已撤销的锁或共享保留,需要通知相应的所有者。此通知包括打开文件的应用程序,该文件具有已撤销的相应委派。

Cached 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 application what has occurred to the file in the case of revocation.

必须从客户端删除与吊销关联的缓存数据。如果客户端缓存中存在已修改的数据,则必须在不将数据写入服务器的情况下从客户端删除该数据。如前所述,当锁或委托被撤销时,客户端所做的假设不再有效。例如,在第一个客户端撤销锁后,另一个客户端可能已被授予冲突锁。因此,锁定范围内的数据可能已被其他客户端修改。显然,第一个客户端无法向应用程序保证在撤销文件的情况下该文件发生了什么。

Notification to a lock-owner will in many cases consist of simply returning an error on the next and all subsequent READs/WRITEs to the open file or on the close. Where the methods available to a client make such notification impossible because errors for certain operations may not be returned, more drastic action, such as signals or process termination, may be appropriate. The justification for this is that an invariant on which an application depends may be violated. Depending on how errors are typically treated for the client operating environment, further levels of notification, including logging, console messages, and GUI pop-ups, may be appropriate.

在许多情况下,对锁所有者的通知只包括在下一次和所有后续读/写打开的文件或关闭时返回错误。如果由于某些操作的错误可能不会被返回,客户机可用的方法使得此类通知无法进行,则更激烈的操作(如信号或进程终止)可能是合适的。这样做的理由是可能会违反应用程序所依赖的不变量。根据客户端操作环境通常如何处理错误,进一步的通知级别(包括日志记录、控制台消息和GUI弹出窗口)可能是合适的。

10.5.1. Revocation Recovery for Write Open Delegation
10.5.1. 写开放委派的吊销恢复

Revocation recovery for an OPEN_DELEGATE_WRITE delegation poses the special issue of modified data in the client cache while the file is not open. In this situation, any client that does not flush modified data to the server on each close must ensure that the user receives appropriate notification of the failure as a result of the revocation. Since such situations may require human action to correct problems, notification schemes in which the appropriate user or administrator is notified may be necessary. Logging and console messages are typical examples.

打开的_委托_写入委托的吊销恢复会在文件未打开时引起客户端缓存中修改数据的特殊问题。在这种情况下,每次关闭时未将修改后的数据刷新到服务器的任何客户端都必须确保用户收到由于撤销而导致的故障的适当通知。由于此类情况可能需要人为措施来纠正问题,因此可能需要通知相应用户或管理员的通知方案。日志和控制台消息是典型的例子。

If there is modified data on the client, it must not be flushed normally to the server. A client may attempt to provide a copy of the file data as modified during the delegation under a different name in the file system namespace to ease recovery. Note that when the client can determine that the file has not been modified by any other client, or when the client has a complete cached copy of the file in question, such a saved copy of the client's view of the file may be of particular value for recovery. In other cases, recovery using a copy of the file, based partially on the client's cached data and partially on the server copy as modified by other clients, will be anything but straightforward, so clients may avoid saving file contents in these situations or mark the results specially to warn users of possible problems.

如果客户端上有修改过的数据,则不能将其正常刷新到服务器。客户机可能会尝试以文件系统命名空间中的不同名称提供在委派期间修改的文件数据副本,以便于恢复。请注意,当客户机可以确定文件未被任何其他客户机修改时,或者当客户机具有所讨论文件的完整缓存副本时,这种保存的客户机文件视图副本对于恢复可能具有特定价值。在其他情况下,使用文件副本(部分基于客户端的缓存数据,部分基于由其他客户端修改的服务器副本)进行恢复并不简单,因此客户端可能会避免在这些情况下保存文件内容,或专门标记结果以警告用户可能出现的问题。

The saving of such modified data in delegation revocation situations may be limited to files of a certain size or might be used only when sufficient disk space is available within the target file system. Such saving may also be restricted to situations when the client has sufficient buffering resources to keep the cached copy available until it is properly stored to the target file system.

在委托撤销情况下保存此类修改后的数据可能仅限于特定大小的文件,或者可能仅在目标文件系统中有足够的可用磁盘空间时使用。这种保存也可能被限制在客户端有足够的缓冲资源来保持缓存副本可用,直到它正确存储到目标文件系统的情况下。

10.6. Attribute Caching
10.6. 属性缓存

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 regular 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.

本节中讨论的属性不包括命名属性。单个命名属性类似于文件,需要处理这些属性的数据缓存,就像处理常规文件的数据缓存一样。类似地,来自OPENATTR目录的查找结果将与任何其他路径名一样进行缓存,对于目录内容也是如此。

Clients may cache file attributes obtained from the server and use them to avoid subsequent GETATTR requests. This cache is write through caching in that any modifications to the file attributes are always done by means of requests to the server, which means the modifications should not be done locally and should not be cached. Exceptions 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 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_GETATTR call.

客户端可以缓存从服务器获得的文件属性,并使用它们来避免后续的GETATTR请求。此缓存是直写缓存,因为对文件属性的任何修改都始终通过向服务器发出请求来完成,这意味着不应在本地进行修改,也不应缓存这些修改。例外情况是修改与数据缓存密切相关的属性。因此,通过将数据写入本地数据缓存来扩展文件会立即反映在客户机上看到的大小中,而不会立即反映在服务器上。通常,此类更改不会直接传播到服务器,但当修改的数据刷新到服务器时,会在服务器上进行类似的属性更改。当开放委派生效时,修改的属性可能会在响应CB_GETATTR调用时返回给服务器。

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.

属性的本地缓存的结果是,在单个客户端上维护的属性缓存将不一致。在服务器上按一个顺序所做的更改可能在一个客户端上以不同的顺序显示,在另一个客户端上以第三个顺序显示。

The typical file system application programming interfaces do not provide means to atomically modify or interrogate attributes for multiple files at the same time. The following rules provide an environment where the potential incoherency mentioned above can be reasonably managed. These rules are derived from the practice of previous NFS protocols.

典型的文件系统应用程序编程接口不提供同时原子地修改或查询多个文件属性的方法。以下规则提供了一个可以合理管理上述潜在不一致性的环境。这些规则源自以前NFS协议的实践。

o All attributes for a given file (per-fsid attributes excepted) are cached as a unit at the client so that no non-serializability can arise within the context of a single file.

o 给定文件的所有属性(每个fsid属性除外)都作为一个单元缓存在客户机上,因此在单个文件的上下文中不会出现非序列化。

o An upper time boundary is maintained on how long a client cache entry can be kept without being refreshed from the server.

o 对于客户端缓存项在不从服务器刷新的情况下可以保留多长时间,将保留一个时间上限。

o When operations are performed that modify attributes at the 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.

o 在服务器上执行修改属性的操作时,更新的属性集作为包含RPC的一部分被请求。这包括间接更新属性的目录操作。这是通过使用GETATTR操作执行修改操作,然后使用GETATTR的结果更新客户端的缓存属性来实现的。

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.

请注意,如果READDIR请求要缓存的完整属性集,则客户机可以按照与通过GETATTR获得的属性相同的基础来缓存结果。

A client may validate its cached version of attributes for a file by only fetching both the change and time_access attributes and assuming that if the change attribute has the same value as it did when the attributes were cached, then no attributes other than time_access have changed. The time_access attribute is also fetched because many servers operate in environments where the operation that updates change does not update time_access. For example, POSIX file semantics do not update access time when a file is modified by the write system call. Therefore, the client that wants a current time_access value should fetch it with change during the attribute cache validation processing and update its cached time_access.

客户端可以通过仅获取更改和时间访问属性,并假设如果更改属性具有与缓存属性时相同的值,则除了时间访问之外,没有其他属性发生更改,从而验证文件属性的缓存版本。由于许多服务器在更新更改的操作不更新时间访问的环境中运行,因此也会获取时间访问属性。例如,当写入系统调用修改文件时,POSIX文件语义不会更新访问时间。因此,需要当前时间访问值的客户端应在属性缓存验证处理期间获取该值,并更新其缓存的时间访问。

The client may maintain a cache of modified attributes for those attributes intimately connected with data of modified regular files (size, time_modify, and change). Other than those three attributes, the client MUST NOT maintain a cache of modified attributes. Instead, attribute changes are immediately sent to the server.

客户端可以为那些与修改的常规文件(大小、修改时间和更改)的数据密切相关的属性维护修改属性的缓存。除这三个属性外,客户端不得维护已修改属性的缓存。相反,属性更改会立即发送到服务器。

In some operating environments, the equivalent to time_access is expected to be implicitly updated by each read of the content of the file object. If an NFS client is caching the content of a file object, whether it is a regular file, directory, or symbolic link, the client SHOULD NOT update the time_access attribute (via SETATTR or a small READ or READDIR request) on the server with each read that is satisfied from cache. The reason is that this can defeat the performance benefits of caching content, especially since an explicit SETATTR of time_access may alter the change attribute on the server. If the change attribute changes, clients that are caching the content will think the content has changed and will re-read unmodified data from the server. Nor is the client encouraged to maintain a modified version of time_access in its cache, since this would mean that the client either will eventually have to write the access time to the server with bad performance effects or would never update the server's time_access, thereby resulting in a situation where an

在某些操作环境中,每次读取文件对象的内容时,都会隐式地更新相当于time_访问的值。如果NFS客户端正在缓存文件对象的内容(无论是常规文件、目录还是符号链接),则客户端不应使用缓存满足的每次读取更新服务器上的time_access属性(通过SETATTR或小型读取或READDIR请求)。原因是,这可能会破坏缓存内容的性能优势,特别是因为时间访问的显式SETATTR可能会改变服务器上的change属性。如果更改属性更改,缓存内容的客户端将认为内容已更改,并将从服务器重新读取未修改的数据。也不鼓励客户机在其缓存中维护修改后的time_访问版本,因为这意味着客户机最终将不得不将访问时间写入服务器,从而产生不良性能影响,或者永远不会更新服务器的time_访问,从而导致

application that caches access time between a close and open of the same file observes the access time oscillating between the past and present. The time_access attribute always means the time of last access to a file by a READ that was satisfied by the server. This way, clients will tend to see only time_access changes that go forward in time.

在同一文件的关闭和打开之间缓存访问时间的应用程序会观察访问时间在过去和现在之间的振荡。time_access属性始终表示服务器满足的读取上次访问文件的时间。通过这种方式,客户端将倾向于只看到随时间推移的时间访问更改。

10.7. Data and Metadata Caching and Memory-Mapped Files
10.7. 数据和元数据缓存以及内存映射文件

Some operating environments include the capability for an application to map a file's content into the application's address space. Each time the application accesses a memory location that corresponds to a block that has not been loaded into the address space, a page fault occurs and the file is read (or if the block does not exist in the file, the block is allocated and then instantiated in the application's address space).

一些操作环境包括应用程序将文件内容映射到应用程序地址空间的功能。每次应用程序访问与未加载到地址空间的块相对应的内存位置时,都会发生页面错误并读取文件(或者,如果文件中不存在该块,则分配该块,然后在应用程序的地址空间中实例化)。

As long as each memory-mapped access to the file requires a page fault, the relevant attributes of the file that are used to detect access and modification (time_access, time_metadata, time_modify, and change) will be updated. However, in many operating environments, when page faults are not required, these attributes will not be updated on reads or updates to the file via memory access (regardless of whether the file is a local file or is being accessed remotely). A client or server MAY fail to update attributes of a file that is being accessed via memory-mapped I/O. This has several implications:

只要对文件的每个内存映射访问都需要一个页面错误,用于检测访问和修改的文件的相关属性(时间访问、时间元数据、时间修改和更改)就会更新。但是,在许多操作环境中,当不需要页面错误时,这些属性不会在读取或通过内存访问更新文件时更新(无论文件是本地文件还是远程访问)。客户机或服务器可能无法更新通过内存映射I/O访问的文件的属性。这有几个含义:

o If there is an application on the server that has memory mapped a file that a client is also accessing, the client may not be able to get a consistent value of the change attribute to determine whether its cache is stale or not. A server that knows that the file is memory mapped could always pessimistically return updated values for change so as to force the application to always get the most up-to-date data and metadata for the file. However, due to the negative performance implications of this, such behavior is OPTIONAL.

o 如果服务器上的应用程序内存映射了客户端也正在访问的文件,则客户端可能无法获取更改属性的一致值以确定其缓存是否过时。知道文件是内存映射的服务器可能总是悲观地返回更新的值以进行更改,从而强制应用程序始终获取文件的最新数据和元数据。但是,由于这会对性能产生负面影响,此类行为是可选的。

o If the memory-mapped file is not being modified on the server and instead is just being read by an application via the memory-mapped interface, the client will not see an updated time_access attribute. However, in many operating environments, neither will any process running on the server. Thus, NFS clients are at no disadvantage with respect to local processes.

o 如果服务器上没有修改内存映射文件,而只是由应用程序通过内存映射接口读取,则客户端将看不到更新的时间访问属性。但是,在许多操作环境中,服务器上运行的任何进程都不会。因此,NFS客户端在本地进程方面并不处于劣势。

o If there is another client that is memory mapping the file and if that client is holding an OPEN_DELEGATE_WRITE delegation, the same set of issues as discussed in the previous two bullet items apply. So, when a server does a CB_GETATTR to a file that the client has

o 如果有另一个客户机正在映射文件,并且该客户机持有OPEN_DELEGATE_WRITE委托,则适用前两个项目符号中讨论的相同问题集。因此,当服务器对客户端拥有的文件执行CB_GETATTR时

modified in its cache, the response from CB_GETATTR will not necessarily be accurate. As discussed earlier, the client's obligation is to report that the file has been modified since the delegation was granted, not whether it has been modified again between successive CB_GETATTR calls, and the server MUST assume that any file the client has modified in cache has been modified again between successive CB_GETATTR calls. Depending on the nature of the client's memory management system, this weak obligation may not be possible. A client MAY return stale information in CB_GETATTR whenever the file is memory mapped.

在缓存中修改后,来自CB_GETATTR的响应不一定准确。如前所述,客户机的义务是报告自授予委派以来文件已被修改,而不是在连续的CB_GETATTR调用之间是否再次修改,并且服务器必须假设客户机在缓存中修改的任何文件在连续的CB_GETATTR调用之间再次被修改。根据客户机内存管理系统的性质,这种弱义务可能是不可能的。每当文件被内存映射时,客户端可能会在CB_GETATTR中返回过时信息。

o The mixture of memory mapping and file locking on the same file is problematic. Consider the following scenario, where the page size on each client is 8192 bytes.

o 在同一个文件上混合使用内存映射和文件锁定是有问题的。考虑下面的场景,其中每个客户机上的页面大小是8192字节。

* Client A memory maps first page (8192 bytes) of file X.

* 客户端A内存映射文件X的第一页(8192字节)。

* Client B memory maps first page (8192 bytes) of file X.

* 客户端B内存映射文件X的第一页(8192字节)。

* Client A write locks first 4096 bytes.

* 客户端A写锁定前4096个字节。

* Client B write locks second 4096 bytes.

* 客户端B写锁定第二个4096字节。

* Client A, via a STORE instruction, modifies part of its locked region.

* 客户端A通过存储指令修改其锁定区域的一部分。

* Simultaneous to client A, client B issues a STORE on part of its locked region.

* 与客户端A同时,客户端B在其锁定区域的一部分上发布存储。

Here, the challenge is for each client to resynchronize to get a correct view of the first page. In many operating environments, the virtual memory management systems on each client only know a page is modified, not that a subset of the page corresponding to the respective lock regions has been modified. So it is not possible for each client to do the right thing, which is to only write to the server that portion of the page that is locked. For example, if client A simply writes out the page, and then client B writes out the page, client A's data is lost.

在这里,挑战在于每个客户端都要重新同步以获得第一页的正确视图。在许多操作环境中,每个客户机上的虚拟内存管理系统只知道修改了一个页面,而不知道修改了对应于各个锁定区域的页面子集。因此,不可能每个客户机都做正确的事情,也就是只向服务器写入页面中被锁定的部分。例如,如果客户机A只是写出页面,然后客户机B写出页面,则客户机A的数据将丢失。

Moreover, if mandatory locking is enabled on the file, then we have a different problem. When clients A and B issue the STORE instructions, the resulting page faults require a byte-range lock on the entire page. Each client then tries to extend their locked range to the entire page, which results in a deadlock.

此外,如果对文件启用了强制锁定,则会出现另一个问题。当客户端A和B发出存储指令时,产生的页面错误需要在整个页面上锁定字节范围。然后,每个客户机尝试将其锁定范围扩展到整个页面,从而导致死锁。

Communicating the NFS4ERR_DEADLOCK error to a STORE instruction is difficult at best.

将NFS4ERR_死锁错误传送到存储指令充其量是困难的。

If a client is locking the entire memory-mapped file, there is no problem with advisory or mandatory byte-range locking, at least until the client unlocks a region in the middle of the file.

如果客户端锁定整个内存映射文件,则至少在客户端解锁文件中间的区域之前,没有咨询或强制字节范围锁定的问题。

Given the above issues, the following are permitted:

鉴于上述问题,允许以下情况:

o Clients and servers MAY deny memory mapping a file they know there are byte-range locks for.

o 客户端和服务器可能会拒绝内存映射他们知道有字节范围锁的文件。

o Clients and servers MAY deny a byte-range lock on a file they know is memory mapped.

o 客户端和服务器可能会拒绝他们知道是内存映射的文件上的字节范围锁。

o A client MAY deny memory mapping a file that it knows requires mandatory locking for I/O. If mandatory locking is enabled after the file is opened and mapped, the client MAY deny the application further access to its mapped file.

o 客户端可能会拒绝内存映射它知道需要强制锁定I/O的文件。如果在打开和映射文件后启用强制锁定,客户端可能会拒绝应用程序对其映射文件的进一步访问。

10.8. Name Caching
10.8. 名称高速缓存

The results of LOOKUP and READDIR operations may be cached to avoid the cost of subsequent LOOKUP operations. Just as in the case of attribute caching, inconsistencies may arise among the various client caches. To mitigate the effects of these inconsistencies and given the context of typical file system APIs, an upper time boundary is maintained on how long a client name cache entry can be kept without verifying that the entry has not been made invalid by a directory change operation performed by another client.

查找和READDIR操作的结果可以缓存,以避免后续查找操作的开销。与属性缓存一样,不同的客户端缓存之间可能会出现不一致。为了减轻这些不一致性的影响,并考虑到典型文件系统API的上下文,在不验证另一个客户端执行的目录更改操作是否使该项无效的情况下,对客户端名称缓存项可以保留的时间上限进行了维护。

When a client is not making changes to a directory for which there exist name cache entries, the client needs to periodically fetch attributes for that directory to ensure that it is not being modified. After determining that no modification has occurred, the expiration time for the associated name cache entries may be updated to be the current time plus the name cache staleness bound.

当客户端不更改存在名称缓存项的目录时,客户端需要定期获取该目录的属性,以确保该目录未被修改。在确定未发生任何修改后,关联名称缓存项的过期时间可能会更新为当前时间加上名称缓存过时界限。

When a client is making changes to a given directory, it needs to determine whether there have been changes made to the directory by other clients. It does this by using the change attribute as reported before and after the directory operation in the associated change_info4 value returned for the operation. The server is able to communicate to the client whether the change_info4 data is provided atomically with respect to the directory operation. If the change values are provided atomically, the client is then able to compare the pre-operation change value with the change value in the client's name cache. If the comparison indicates that the directory was updated by another client, the name cache associated with the modified directory is purged from the client. If the comparison indicates no modification, the name cache can be updated on the

当客户端对给定目录进行更改时,它需要确定是否有其他客户端对该目录进行了更改。它通过使用为操作返回的关联change_info4值中目录操作前后报告的change属性来完成此操作。服务器能够与客户机通信,以确定是否以原子方式提供了与目录操作相关的更改信息4数据。如果以原子方式提供更改值,则客户端可以将操作前更改值与客户端名称缓存中的更改值进行比较。如果比较表明目录已由另一个客户端更新,则与修改后的目录关联的名称缓存将从客户端中清除。如果比较结果表明没有修改,则可以在服务器上更新名称缓存

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 directories when the contents of the corresponding directory are 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.

如上面的场景所示,名称缓存要求客户端通过在缓存名称缓存项时检查目录的change属性来重新验证名称缓存数据。这要求服务器在修改相应目录的内容时更新目录的change属性。为了让客户端正确地使用change_info4信息,服务器必须以原子方式报告操作前和操作后的change属性值。当服务器无法原子地报告与目录操作相关的before和after值时,服务器必须在change_info4返回值中指出这一事实。当信息未按原子方式报告时,客户端不应假定其他客户端未更改目录。

10.9. Directory Caching
10.9. 目录缓存

The results of READDIR operations may be used to avoid subsequent READDIR operations. Just as in the cases of attribute and name caching, inconsistencies may arise among the various client caches. To mitigate the effects of these inconsistencies, and given the context of typical file system APIs, the following rules should be followed:

READDIR操作的结果可用于避免后续的READDIR操作。与属性和名称缓存的情况一样,不同的客户端缓存之间可能会出现不一致。为了减轻这些不一致的影响,并考虑到典型文件系统API的上下文,应遵循以下规则:

o Cached READDIR information for a directory that is not obtained in a single READDIR operation must always be a consistent snapshot of directory contents. This is determined by using a GETATTR before the first READDIR and after the last READDIR that contributes to the cache.

o 未在单个READDIR操作中获得的目录的缓存READDIR信息必须始终是目录内容的一致快照。这是通过在第一个READDIR之前和最后一个参与缓存的READDIR之后使用GETATTR来确定的。

o An upper time boundary is maintained to indicate the length of time a directory cache entry is considered valid before the client must revalidate the cached information.

o 维护时间上限,以指示在客户端必须重新验证缓存信息之前,目录缓存项被视为有效的时间长度。

The revalidation technique parallels that discussed in the case of name caching. When the client is not changing the directory in question, checking the change attribute of the directory with GETATTR is adequate. The lifetime of the cache entry can be extended at these checkpoints. When a client is modifying the directory, the client needs to use the change_info4 data to determine whether there are other clients modifying the directory. If it is determined that no other client modifications are occurring, the client may update its directory cache to reflect its own changes.

重新验证技术与在名称缓存中讨论的技术类似。当客户机没有更改有问题的目录时,用GETATTR检查目录的change属性就足够了。可以在这些检查点延长缓存项的生存期。当客户端修改目录时,客户端需要使用change_info4数据来确定是否有其他客户端修改目录。如果确定没有发生其他客户端修改,则客户端可以更新其目录缓存以反映其自身的更改。

As demonstrated previously, directory caching requires that the client revalidate directory cache data by inspecting the change attribute of a directory at the point when the directory was cached. This requires that the server update the change attribute for directories when the contents of the corresponding directory are 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 ch