]> git.proxmox.com Git - pve-storage.git/commitdiff
cephfs: tell systemd that mount mount requires network
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 27 Nov 2018 11:02:01 +0000 (12:02 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 27 Nov 2018 11:10:36 +0000 (12:10 +0100)
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@proxmox.com>
PVE/Storage/CephFSPlugin.pm

index de1499c84c24ca9a34238a3594765c6cf3551a9b..1bfdd01954373870c48a753879c2ba5a483b7ace 100644 (file)
@@ -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};