# Exclusive access
Takes an exclusive lease on the directory (`db.lock`) and holds it for as
long as the returned handle — or anything that outlives it, such as a
replication server or client — is alive. A second open of the same
directory returns [`DbError::Locked`], whether it comes from another
process or from another live handle in this one: two engines over one
shard set would run independent in-memory indexes and silently drop each
other's writes.
The kernel releases the lease when the handle is dropped, including on
`SIGKILL`, panic or OOM, so there is no stale lock file to clean up. To
reopen in the same process, drop every handle first — shadowing a
binding (`let tree = ...`) does not drop it.
On NFS `flock` is emulated with POSIX locks: cross-process exclusion
still works, but the same-process rejection is lost.