[pve-devel] applied: [PATCH storage 2/3] cephfs: mount fuse through systemd with correct order dependencies
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jan 29 19:58:23 CET 2020
This fixes a potential races where fuse get's unmouted to late in the
shutdown process, i.e., at a time where network was down and it could
not talk to any MDS or monitor anymore.
We could fix it the same way we did once with the kernel based mount,
i.e., adding _netdev, but doing so would require to switch over from
"ceph-fuse" to "mount.fuse.ceph" which has better compatibility with
the common mount tool API.
As that helper exists we can reuse the newer systemd_netmount
ephemeral unit generator, only some options differ in name between
fuse and kernel variant.
So besides solving a potential issue we get a more unified handling
of those two cases.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
PVE/Storage/CephFSPlugin.pm | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/PVE/Storage/CephFSPlugin.pm b/PVE/Storage/CephFSPlugin.pm
index bc1ca3e..843af88 100644
--- a/PVE/Storage/CephFSPlugin.pm
+++ b/PVE/Storage/CephFSPlugin.pm
@@ -94,7 +94,6 @@ EOF
sub cephfs_mount {
my ($scfg, $storeid) = @_;
- my $cmd;
my $mountpoint = $scfg->{path};
my $subdir = $scfg->{subdir} // '/';
@@ -102,31 +101,23 @@ sub cephfs_mount {
my $configfile = $cmd_option->{ceph_conf};
my $secretfile = $cmd_option->{keyring};
my $server = $cmd_option->{mon_host} // PVE::CephConfig::get_monaddr_list($configfile);
+ my $type = 'ceph';
- # fuse -> client-enforced quotas (kernel doesn't), updates w/ ceph-fuse pkg
- # kernel -> better performance, less frequent updates
+ my @opts = ();
if ($scfg->{fuse}) {
- # FIXME: ceph-fuse client complains about missing ceph.conf or keyring if
- # not provided on its default locations but still connects. Fix upstream??
- $cmd = ['/usr/bin/ceph-fuse', '-n', "client.$cmd_option->{userid}", '-m', $server];
- push @$cmd, '--keyfile', $secretfile if defined($secretfile);
- push @$cmd, '-r', $subdir if !($subdir =~ m|^/$|);
- push @$cmd, $mountpoint;
- push @$cmd, '--conf', $configfile if defined($configfile);
-
- if ($scfg->{options}) {
- push @$cmd, '-o', $scfg->{options};
- }
-
- run_command($cmd, errmsg => "mount error");
+ $type = 'fuse.ceph';
+ push @opts, "ceph.id=$cmd_option->{userid}";
+ push @opts, "ceph.keyfile=$secretfile" if defined($secretfile);
+ push @opts, "ceph.conf=$configfile" if defined($configfile);
} else {
- my $source = "$server:$subdir";
- my @opts = ( "name=$cmd_option->{userid}" );
+ push @opts, "name=$cmd_option->{userid}";
push @opts, "secretfile=$secretfile" if defined($secretfile);
- push @opts, $scfg->{options} if $scfg->{options};
-
- systemd_netmount($mountpoint, 'ceph', $source, join(',', @opts));
+ push @opts, "conf=$configfile" if defined($configfile);
}
+
+ push @opts, $scfg->{options} if $scfg->{options};
+
+ systemd_netmount($mountpoint, $type, "$server:$subdir", join(',', @opts));
}
# Configuration
--
2.20.1
More information about the pve-devel
mailing list