[pve-devel] applied: [PATCH storage] cephfs: tell systemd that mount mount requires network

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Nov 27 12:13:24 CET 2018


applied

On Tue, Nov 27, 2018 at 12:02:01PM +0100, Thomas Lamprecht wrote:
> As we mount this manually and thus systemd doesn't know about any
> dependency for cephFS mounts, this got umounted only at the last
> stage of shutdown, where network wasn't active anymore.
> 
> But, CephFS needs to be connected to an active MDS for a clean
> unmount so without network this mount would delay shutdown for quite
> a bit, until after some minutes systemd gave up and forced unmount.
> 
> So tell systemd that this mount requires network, which can be done
> with the '_netdev'[0] mount option, that lucky for us can be also
> passed to a mount call and isn't only available for fstab.
> 
> with this a mount gets, among others:
> > Wants=network-online.target
> > Before=umount.target remote-fs.target
> > After=remote-fs-pre.target system.slice network.target network-online.target -.mount
> 
> Which does the trick for us.
> 
> [0]: https://www.freedesktop.org/software/systemd/man/systemd.mount.html#_netdev
> 
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  PVE/Storage/CephFSPlugin.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/PVE/Storage/CephFSPlugin.pm b/PVE/Storage/CephFSPlugin.pm
> index de1499c..1bfdd01 100644
> --- a/PVE/Storage/CephFSPlugin.pm
> +++ b/PVE/Storage/CephFSPlugin.pm
> @@ -66,6 +66,10 @@ sub cephfs_mount {
>  	$cmd = ['/bin/mount', '-t', 'ceph', $source, $mountpoint, '-o', "name=$cmd_option->{userid}"];
>  	push @$cmd, '-o', "secretfile=$secretfile" if defined($secretfile);
>      }
> +    # tell systemd that we're network dependent, else it umounts us to late on
> +    # shutdown, when we couldn't connect to the active MDS and thus unmount
> +    # hangs and delays shutdown/reboot (man systemd.mount)
> +    push @$cmd, '-o', '_netdev';
>  
>      if ($scfg->{options}) {
>  	push @$cmd, '-o', $scfg->{options};
> -- 
> 2.19.2




More information about the pve-devel mailing list