[systemd-devel] Masking mount units
Lennart Poettering
lennart at poettering.net
Fri Oct 25 08:30:15 UTC 2024
On Do, 24.10.24 15:43, Phillip Susi (phill at thesusis.net) wrote:
> Lennart Poettering <lennart at poettering.net> writes:
>
> > systemd is downstream to udev. If udev doesn't process a block device
> > because of the taken BSD file lock on the main block device, then
> > systemd (and other downstreams of udev) won't get such notificaitons
> > either. And thus won't automount.
>
> The BSD lock does not prevent the udev processing, it only delays it
> until after the lock is released doesn't it?
It prevents it fully. However, udev installs an inotify watch on all
relevant block devices, which watches for IN_CLOSE_WRITE events, and
then triggers the device again. IN_CLOSE_WRITE is the event that is
generated when an inode is closed after it was open for writing. For
block devices this means that when tools such as fdisk open the device
for writing and then close it, the devices will be fully automatically
reprobed afterwards (unless a BSD file lock is still in place then, by
somebody else).
IN_CLOSE_WRITE is strictly speaking not the event we *actually* want
to watch for retriggering the device (that would be an event triggered
by the release of the file lock, but linux does not support generating
a lock then), but it's really close, because "close-after-write" and
"release lock" typically coincide, or are even the very same
operation.
This is all pretty well documented btw, I'd recommend having a look:
https://systemd.io/BLOCK_DEVICE_LOCKING
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list