HomeFreeBSD

Eliminate snaplk / bufwait LOR when creating UFS snapshots

Description

Eliminate snaplk / bufwait LOR when creating UFS snapshots

Each vnode has an embedded lock that controls access to its contents.
However vnodes describing a UFS snapshot all share a single snapshot
lock to coordinate their access and update. As part of creating a
new UFS snapshot, it has to have its individual vnode lock replaced
with the filesystem's snapshot lock.

The lock order for regular vnodes with respect to buffer locks is that
they must first acquire the vnode lock, then a buffer lock. The order
for the snapshot lock is reversed: a buffer lock must be acquired before
the snapshot lock.

When creating a new snapshot, the snapshot file must retain its vnode
lock until it has allocated all the blocks that it needs before
switching to the snapshot lock. This update moves one final piece of
the initial snapshot block allocation so that it is done before the
newly created snapshot is switched to use the snapshot lock.

Reported by: Witness code
MFC after: 1 week
Sponsored by: Netflix

Details

Provenance
mckusickAuthored on Sep 18 2021, 11:51 PM
Parents
rGad6dc3652023: nfscl: Use vfs.nfs.maxalloclen to limit Deallocate RPC RTT
Branches
Unknown
Tags
Unknown