[systemd-devel] help: unmounting iscsi xfs filesystem without using netdev in /etc/fstab

Andrei Borzenkov arvidjaar at gmail.com
Tue Aug 27 18:06:25 UTC 2019


27.08.2019 18:55, Tony Rodriguez пишет:
> Interesting that you mentioned the following. I actually added logic to
> do something like this early yesterday.   Will discuss with my team to
> see if this is good enough.  I'd rather not bypass _netdev either. Feels
> like I am re-eventing the wheel. I think the main issue regarding using
> _netdev is the amount of time it takes to check/mount iscsi devices. 
> Believe it waits up to 90 seconds to timeout for an iscsi
> device/filesystem and I am not sure this can be bypassed.  Is it
> possible to limit the amount of time _netdev will take?

You seem to seriously misinterpret what you see. _netdev does not "do"
anything. It only affects which After/Before/Wants directives are added
to mount unit definition - nothing more. If you see 90 seconds timeout,
most likely one of units that mount is ordered After fails to start -
and my educated guess is that it is related to network-online.


>  I tried setting
> x-systemd.device-timeout and x-systemd.mount-timeout with _netdev in
> /etc/fstab but it didn't seem to work.  It also didn't propagate to
> /run/systemd/generators/remote-fs-target.requires   I believe the
> systemd document mentioned such settings are ignored.
> 
> "I haven't been following your earlier threads too closely, but if you're
> stuck with stupid fstab requirements why not just bypass them with
> altogether with drop-in:
> 
>     # path-to-mountpoint.mount.d/20-Options.conf
>     [Mount]
>     Options=_netdev"
> 
> 
> 
> On 8/27/19 2:33 AM, Michael Chapman wrote:
>> On Tue, 27 Aug 2019, Tony Rodriguez wrote:
>>> Managed to detect/mount iscsi devices without using _netdev keyword in
>>> /etc/fstab.  Made changes within
>>> src/fstab-generator/ftstab-generator.c and it
>>> seems to work.  The only problem is during shutdown/reboot, my iscsi xfs
>>> filesystem does not unmount cleanly before the network/iscs
>>> service/system is
>>> shutdown.  When this happens I receive a xfs error/warning.
>>>
>>> However this doesn't happen when _netdev is specified in /etc/fstab
>>> for my
>>> iscsi device.  Seems _netdev handles management of mounts/unmounts
>>> before
>>> killing things off.  How exactly does _netdev manage unmounting
>>> filesystems
>>> during a shutdown/reboot?
>> One of the "default dependencies" for a mount unit that systemd thinks is
>> a network filesystem is After=network.target. During shutdown, this
>> ensures the filesystem is unmounted before networking is brought down:
>>
>>     
>> https://github.com/systemd/systemd/blob/fef40ceb5dfbb76d4733e579846a380a224efd55/src/core/mount.c#L455-L482
>>
>>
>> If you're not using the _netdev keyword, and systemd does not otherwise
>> think this is a remote filesystem, you will need to add this dependency
>> manually. You'll probably also want:
>>
>>      Wants=network-online.target
>>      After=network-online.target
>>
>> to match the code linked above.
>>
>>>    I would like to invoke that same netdev unmount
>>> code/logic myself from within systemd source but without using the
>>> _netdev
>>> keyword. Unfortunately it is a requirement to not use _netdev within
>>> /etc/fstab for iscsi.  Seems _netdev takes a long time to timeout and
>>> continue
>>> when unable to mount.
>> I haven't been following your earlier threads too closely, but if you're
>> stuck with stupid fstab requirements why not just bypass them with
>> altogether with drop-in:
>>
>>      # path-to-mountpoint.mount.d/20-Options.conf
>>      [Mount]
>>      Options=_netdev
>>
>> Plus any other options you may need, of course; this directive is not
>> "list-valued", so you can't use it to add just one option.
>>
>>> Checked src/core/mount.c and src/core/unmount.c but not sure what to
>>> do to
>>> duplicate how _netdev manages unmounting before the system is
>>> shutdown or
>>> rebooted.  Do I need a special before and after keyword in /etc/fstab
>>> so my
>>> xfs filesystems is unmounted before shutting down the iscsi
>>> service/network/system?  If so, will such keywords also propagate to
>>> /run/systemd/generator/remote-fs-target.requires?
>>>
>>>
>>> Thanks,
>>> Tony
>>> _______________________________________________
>>> systemd-devel mailing list
>>> systemd-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>>
>>> _______________________________________________
>>> systemd-devel mailing list
>>> systemd-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list