Alexander Aring, from Red Hat, who is responsible for the IEEE 802.15.4, DLM, and flock/fcntl subsystems in the Linux kernel, has introduced a specialized file system called DLMPFS in the kernel developers' mailing list. The proposed file system provides a layer for distributed file locking implemented based on DLM (Distributed Lock Manager) and ramfs. The implementation of DLMPFS is available as a set of patches for Linux kernel 6.19.
DLMPFS allows working with a shared file hierarchy across multiple hosts, creating and deleting files and directories, and applying or removing locks on files using standard flock() and fcntl() functions. However, DLMPFS does not permit reading or writing data to files, limiting itself to locking operations. An additional limitation is that the state of a lock can only be determined if the full file path to the locked file is known (DLM requires the resource name to identify the lock).
With DLMPFS, existing applications tied to lock management through the flock/fcntl API can be easily adapted to use distributed locks that span multiple hosts in a cluster without the need for specialized distributed file systems for data storage.
DLMPFS differs from the existing similar file system DLMFS by using the flock/fcntl API instead of the API specific to the OCFS2 file system. Future plans include adding distributed locks marked in the POSIX specification and the ability to connect different backends for integration not only with DLM but also other distributed lock managers such as NFS lockd.
Example of usage (on the second node, the lock on the file /mnt/lock will be released after 20 seconds): Node 1: mount -t dlmpfs -o clname=$CLUSTERNAME none /mnt touch /mnt/lock flock /mnt/lock -c "echo 'acquired'; sleep 20; echo 'released'" Node 2: mount -t dlmpfs -o clname=$CLUSTERNAME none /mnt touch /mnt/lock flock /mnt/lock -c "echo 'acquired'; sleep 20; echo 'released'"
Allikas: opennet.ru
