[systemd-devel] Masking mount units
Lennart Poettering
lennart at poettering.net
Thu Oct 24 07:45:49 UTC 2024
On Mi, 23.10.24 14:32, Phillip Susi (phill at thesusis.net) wrote:
> A few years ago you mentioned that gparted should not be masking mount
> units and should instead take a bsd lock:
>
> https://lists.freedesktop.org/archives/systemd-devel/2020-January/043924.html
>
> I brought this issue back up recently. It seems like taking a bsd lock
> would allow gparted to make sure that partition probing and auto
> mounting does not happen say, between the time the partition is created,
> and the time mkfs is run on it, but apparently that is not the real
> issue why gparted masks all mount units.
>
> Simply having libparted *read* the partition table from the disk
> triggers change events on all of the partitions, causing them to be auto
> mounted. This is because libparted issues a BLKFLUSH ioctl to all of
> the partition devices, I believe, as a workaround for the fact that
> Linux does not unify the block cache for the partition and the whole
> disk, so the partition is flushed to make sure that any recent mkfs is
> visible when libparted tries to probe the filesystem type by reading the
> raw disk block device.
>
> Can you think of any other way to prevent this unwanted auto mounting
> besides masking the mount units?
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.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list