Re: mount race prevention

Mouse <[email protected]> Tue, 18 Nov 2025 12:25:56 -0500 (EST)
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
> Is there a way to prevent two processes to mount something to the
> same mount point?  I.e., is there a way to call mount(2) in a way
> that it fails if would mount on top of anonther mount?

Are you trying to deal with races, or are you trying to prevent two
things mounted at the same point of the tree?  Those aren't really the
same thing; you can sequentially mount two things on the same point
just fine:

	# mount /dev/sd1a /mnt
	# mount /dev/sd2a /mnt

Indeed, with some filesystem types this is useful - and, for some (eg,
union) it borders on necessary for them to be useful.  I assume you're
looking for something optional.

So, my first question would be, what precisely is it you're trying to
prevent?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		[email protected]
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B