github.com/cockroachdb/pebble@v1.1.2/vfs/testdata/memfs_lock (about)

     1  mkfs A B
     2  ----
     3  OK
     4  
     5  #
     6  # Locking a path with parents that don't exist should error.
     7  #
     8  
     9  lock fs=A path=a/b/c handle=fsApathABC
    10  ----
    11  open a/b/c: file does not exist
    12  
    13  #
    14  # If we create the parents, it should succeed.
    15  #
    16  
    17  mkdirall fs=A path=a/b
    18  ----
    19  OK
    20  
    21  lock fs=A path=a/b/c handle=fsApathABC
    22  ----
    23  OK
    24  
    25  #
    26  # Locking the same path on the same filesystem should fail with EAGAIN.
    27  #
    28  
    29  lock fs=A path=a/b/c handle=bogus
    30  ----
    31  resource temporarily unavailable
    32  
    33  #
    34  # Locking the same path on a DIFFERENT filesystem should succeed.
    35  #
    36  
    37  mkdirall fs=B path=a/b
    38  ----
    39  OK
    40  
    41  lock fs=B path=a/b/c handle=fsBpathABC
    42  ----
    43  OK
    44  
    45  #
    46  # Releasing the lock on fs A should allow us to reacquire it.
    47  #
    48  
    49  close handle=fsApathABC
    50  ----
    51  OK
    52  
    53  lock fs=A path=a/b/c handle=fsApathABC
    54  ----
    55  OK