diff --git a/qa/tasks/cephfs/test_misc.py b/qa/tasks/cephfs/test_misc.py index 3201425e09f..2e5387aecf7 100644 --- a/qa/tasks/cephfs/test_misc.py +++ b/qa/tasks/cephfs/test_misc.py @@ -4,6 +4,7 @@ from tasks.cephfs.fuse_mount import FuseMount from tasks.cephfs.cephfs_test_case import CephFSTestCase from teuthology.exceptions import CommandFailedError import errno +import platform import time import json import logging @@ -30,6 +31,9 @@ class TestMisc(CephFSTestCase): p.wait() def test_fuse_mount_on_already_mounted_path(self): + if platform.system() != "Linux": + self.skipTest("Require Linux platform") + if not isinstance(self.mount_a, FuseMount): self.skipTest("Require FUSE client") diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index e060ac88087..ee81752721c 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -23,10 +23,13 @@ #include #include #include + +#if defined(__linux__) #include #include #include #include +#endif // ceph #include "common/errno.h" @@ -57,11 +60,13 @@ #define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) #define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) +#if defined(__linux__) #ifndef FUSE_SUPER_MAGIC #define FUSE_SUPER_MAGIC 0x65735546 #endif #define _CEPH_CLIENT_ID "ceph.client_id" +#endif using namespace std; @@ -173,6 +178,7 @@ public: struct fuse_args args; }; +#if defined(__linux__) static int already_fuse_mounted(const char *path, bool &already_mounted) { struct statx path_statx; @@ -242,6 +248,13 @@ static int already_fuse_mounted(const char *path, bool &already_mounted) return err; } +#else // non-linux platforms +static int already_fuse_mounted(const char *path, bool &already_mounted) +{ + already_mounted = false; + return 0; +} +#endif static int getgroups(fuse_req_t req, gid_t **sgids) { diff --git a/src/mount.fuse.ceph b/src/mount.fuse.ceph index 5f115d8efc3..59a296d964f 100755 --- a/src/mount.fuse.ceph +++ b/src/mount.fuse.ceph @@ -28,6 +28,7 @@ id=myuser,conf=/etc/ceph/foo.conf /mnt/ceph fuse.ceph defaults 0 0 import sys import argparse import errno +import platform from subprocess import Popen def ceph_options(mntops): @@ -74,7 +75,10 @@ def main(arguments): mount_cmd.communicate() if (mount_cmd.returncode != 0): - if (mount_cmd.returncode != errno.EBUSY): + if (platform.system() == "Linux"): + if (mount_cmd.returncode != errno.EBUSY): + print("Mount failed with status code: {}".format(mount_cmd.returncode)) + else: print("Mount failed with status code: {}".format(mount_cmd.returncode)) if __name__ == '__main__':