github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/lisafs/lisafs.go (about)

     1  // Copyright 2021 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Package lisafs (LInux SAndbox FileSystem) defines the protocol for
    16  // filesystem RPCs between an untrusted Sandbox (client) and a trusted
    17  // filesystem server.
    18  //
    19  // Lock ordering:
    20  //
    21  //	Server.renameMu
    22  //	  Node.opMu
    23  //	    Node.childrenMu
    24  //	      Node.controlFDsMu
    25  //
    26  // Locking rules:
    27  //   - Node.childrenMu can be simultaneously held on multiple nodes, ancestors
    28  //     before descendants.
    29  //   - Node.opMu can be simultaneously held on multiple nodes, ancestors before
    30  //     descendants.
    31  //   - Node.opMu can be simultaneously held on two nodes that do not have an
    32  //     ancestor-descendant relationship. One node must be an internal (directory)
    33  //     node and the other a leaf (non-directory) node. Directory must be locked
    34  //     before non-directories.
    35  //   - "Ancestors before descendants" requires that Server.renameMu is locked to
    36  //     ensure that this ordering remains satisfied.
    37  package lisafs