On Mon, Oct 27, 2014 at 02:10:47PM -0700, Chris Leech wrote:
> Hi, I was hoping someone could help me make sure I'm not overlooking
> something with trying to manage mounts on iSCSI disks.
> 
> I have an iscsi.service which starts and stops sessions to iSCSI
> targets.  It's set with Before=remote-fs-pre.target and
> Wants=remote-fs-pre.target to ensure that remote fs ordering is enabled.
> Unfortunately mount points only get configured as remote if there is a
> record in /etc/fstab at the time fstab-generator is run.
> 
> At boot fstab-generator is picking up on the _netdev option in fstab,
> and the generated mount units are ordered against remote-fs properly.
> If I leave a filesystem mounted at shutdown, it will be unmounted before
> the iSCSI session is destroyed or the network is shut down and
> everything works as expected.
> 
> But there are two cases that are problematic, adding entries to fstab at
> runtime and manually mounting without adding to fstab (while still using
> the _netdev option, some hint is needed).  The first case actually ends
> up being the second, with the possible work-around of always remembering
> to run a daemon-reload after editing fstab to run fstab-generator again.
> 
> If there's no matching mount unit from fstab-generator, one gets created
> dynamically when the fs is mounted by monitoring /proc/self/mountinfo.
Actually, it is more correct to say that a unit *always* get created based
on /proc/self/mountinfo. If there was a unit previously, it is replaced
by the new one, but inherits the dependencies. In effect it leads to
the behaviour you described.

> So for any mounts to remote block devices (unlike remote file system
> protocols which are detected by the fs name), unless there is an fstab
> entry at the time fstab-generator is run they get treated like local fs
> mounts and connectivity to the storage target may be disrupted before
> unmounting (possibly resulting in file system errors).
Yes, that seems right. It seems reasonable to change the code which
generates units based on /p/s/mounintinfo to behave as if _netdev option
was specified, for the known network filesystem types.

> I'm currently at a loss for how to handle this, other than to claim that
> if filesystems are going to be left mounted they should be added to
> fstab and a daemon-reload is required.
That is always an option, but I think that in this case a simple patch
will be nicer.

Zbyszek
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to