z/OS UNIX System Services File System Interface Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


LFS-PFS control block serialization

z/OS UNIX System Services File System Interface Reference
SA23-2285-00

The LFS serializes use of the vnode-inode pair for each vnode operation. Writing of file data is done under an exclusive latch. Reading of file data is also done under an exclusive latch, unless shared read support has been indicated by the PFS for the file, and the read is via vn_rdwr or vn_readwritev. Shared read can be indicated in the OSI by the PFS upon return from vn_open, vn_close, vn_rdwr, vn_readwritev, vn_setattr, and vn_trunc.

Other read operations, such as vn_readdir, are done under a shared latch.

In particular, to optimize the performance of pathname resolution, only a shared latch is held on the directory that is involved in a vn_lookup operation.

Recommendation: Read operations that are done under a shared latch may require the PFS to update some structures; for example, to mark the access time of a file for update. The PFS is responsible for any additional serialization that is required to maintain integrity of its structures when functions are called with a shared or an exclusive latch. Often the compare and swap instruction is sufficient for this additional serialization. In order to avoid contention problems, the cross-memory local lock (CML) should not be used.

For the operations that refer to more than one vnode (vn_remove, vn_rmdir, vn_link, and vn_rename), exclusive latches are held on all the vnodes that are involved in the operation. This includes vnodes that are not explicitly passed on the interface, such as the file that is being unlinked on vn_remove.

When the PFS enters a signal-enabled wait, or when the WAITX option has been used to drop serialization around the wait, all vnode and file system latches are released before the wait and re-obtained after it. This means that other operations may be invoked from another thread for a given vnode during an exclusive operation that enters a signal-enabled wait, although there would not be two operations running at the same time, because the blocked thread re-obtains exclusive access when it wakes up.
Note: While any operation is active, the PFS never receives a vn_inactive call for that vnode, even if the latches are released. In cases of vn_open or vn_close processing, the LFS does not allow a close against the last active file descriptor while another thread has any operation in progress against it.

Refer to the individual operations for the level of serialization that is provided for each call.

The serialization that is provided can be changed by the PFS when the osi_getvnode service is called to create a vnode. The PFS can specify that no LFS latching be performed. If no LFS latching is specified, all discussions in this topic about latches held on vnodes do not apply. Other LFS latches are unaffected; sigwait and waitx should still be used to drop other latches, where necessary.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014