On Tue, 15.01.13 15:41, John Lane (syst...@jelmail.com) wrote: > > On 04/01/13 02:56, Peeters Simon wrote: > > > >I think one of the only usecase for this kind of overmounting is to bind > >mount > >a subdir of a mountpoint on top of that mountpoint: (as in Johns original > >post) > >mount /dev/somedev /images > >mount --bind /images/1354 /images > > > >so it might be a solution to add a BindSubdir= option to the unit file > >like this: > >[Mount] > >What=/dev/somedev > >Where=/images > >BindSubdir=1354 > > > >So that multiple mount units for the same mount point are not needed. > >I think this is a quiet clean solution, but anyhow just my 2c. > > > > > >Simon > > > > I would agree with Simon's suggestion. Such a 'BindSubdir' option > would satisfy my use case. I can try and write a patch to implement > a Bind option if this solution would be acceptable ?
I am a bit afraid of the atomicity implications this have. If you do two mounts to set up a specific mount point, then apps listening for that will get two events, and if they end up being too quick they might see the mount point at an "invalid" time. That's a real problem actually, as gvfs/nautilus actively watch all mounts as they are created. And gvfs/nautilus are hardly the only ones. Creating mount points should be atomic, there should be no time window where a mount point contains stuff that is not supposed to be visible, and there should be a single notification event be generated for it. Ultimately this means this should be fixed in the kernel, i.e. the kernel should provide a mount option or so how one can mount a file system's subdirectory only instead of the file system itself. It's the only clean way... Also, I am pretty sure systemd should not expose more here than mount(8) does, so if we work around a missing feature of the kernel in userspace, then this should at least live in mount(8) so that it is available from all mount commands, not just those configured via systemd. This all is very similar actually to the discussion of read-only bind mounts. Right now you need two mount commands to set them up, and they can hence not be created atomically either. THis really is something to fix in the kernel, as it creates and will continue to create all kinds of weird userspace problems. Sorry if that's disappointing... Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel