[systemd-devel] systemd-fstab-generator and multiple mounts to same mount point

John Lane systemd at jelmail.com
Thu Jan 3 08:16:06 PST 2013


On 02/01/13 20:21, John Lane wrote:
> On 02/01/13 14:25, Zbigniew Jędrzejewski-Szmek wrote:
>> On Wed, Jan 02, 2013 at 12:44:10PM +0000, John Lane wrote:
>>> On 02/01/13 12:15, Andrey Borzenkov wrote:
>>>> В Wed, 02 Jan 2013 12:01:41 +0000
>>>> John Lane <systemd at jelmail.com> пишет:
>>>>
>>>>> Hello,
>>>>>
>>>>> I have a configuration where a filesystem is mounted on /images.
>>>>>
>>>>> Then a subdirectory of that filesystem, say /images/1, is bind 
>>>>> mounted
>>>>> on top as /images.
>>> I think the problem is how systemd names the generated mount units.
>>> If there is a clash, could it not
>>> use a modified name for the unit (e.g if
>>> /run/systemd/generator/images.mount exists it would create
>>> /run/systemd/generator/images-1.mount or something like that) ?
>> Hi,
>>
>> it's on the TODO list ("* properly handle .mount unit state tracking
>> when two mount points are stacked one on top of another on the exact
>> same mount point.") Patches welcome :)
>>
>> Zbyszek
>>
> Good to know, thanks. I'll take a look and see if I'll provide a patch 
> if I can.
> But I have never looked inside systemd so I may need some pointers to 
> find my way around it.
>
> @tom: good point about not including a "-" in any variant filename.

Hello. Here is a patch to allow systemd to handle overmounts defined in 
/etc/fstab.

https://raw.github.com/johnlane/archlinux-systemd/master/fstab-overmount.patch

It works against the latest git version. It amends two files :

* src/fstab-generator/fstab-generator.c
* src/core/mount.c

It appends a suffix (an underscore followed by a number) to a mount unit 
file name when one already
exists. This allows the mount unit file to be generated. The mount 
routine is modified to consider the
suffix when checking that the mount point and unit file names match.

Tested on Arch Linux. I have a pkgbuild for it: 
https://github.com/johnlane/archlinux-systemd

If I should submit this in some other way please let me know. Sorry I am 
not more familiar with your process.

I hope this is useful.

Kind regards,
John






More information about the systemd-devel mailing list