mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
Merge pull request #45549 from nmshelke/fuse-linux-only
ceph-fuse: restrict already_fuse_mounted function only for linux Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
commit
b4ea90ad82
@ -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")
|
||||
|
||||
|
@ -23,10 +23,13 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <libgen.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <linux/magic.h>
|
||||
#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)
|
||||
{
|
||||
|
@ -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__':
|
||||
|
Loading…
Reference in New Issue
Block a user