summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-09 10:51:20 +0200
committerGitHub <noreply@github.com>2020-06-09 10:51:20 +0200
commited66590d15487b22da28d2f1b6608e9acc3449c1 (patch)
tree671b2cc6134b4e025d779f86d7b3c7d55837dd05
parentbf760801804e55b045aed54bf9b1d0b0131be3f2 (diff)
parentc15ab81ed9fa9437fdc31b6761ad331f6fd52400 (diff)
downloadsystemd-ed66590d15487b22da28d2f1b6608e9acc3449c1.tar.gz
Merge pull request #16080 from YmrDtnJu/9p
9p is a network filesystem
-rw-r--r--src/basic/mountpoint-util.c10
-rw-r--r--src/basic/mountpoint-util.h1
-rw-r--r--src/mount/mount-tool.c4
3 files changed, 13 insertions, 2 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index 0b3587ff55..d4a621c7ae 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -338,6 +338,16 @@ bool fstype_is_api_vfs(const char *fstype) {
"tracefs");
}
+bool fstype_is_blockdev_backed(const char *fstype) {
+ const char *x;
+
+ x = startswith(fstype, "fuse.");
+ if (x)
+ fstype = x;
+
+ return !streq(fstype, "9p") && !fstype_is_network(fstype) && !fstype_is_api_vfs(fstype);
+}
+
bool fstype_is_ro(const char *fstype) {
/* All Linux file systems that are necessarily read-only */
return STR_IN_SET(fstype,
diff --git a/src/basic/mountpoint-util.h b/src/basic/mountpoint-util.h
index 5398836fed..ab4ed19394 100644
--- a/src/basic/mountpoint-util.h
+++ b/src/basic/mountpoint-util.h
@@ -14,6 +14,7 @@ int path_is_mount_point(const char *path, const char *root, int flags);
bool fstype_is_network(const char *fstype);
bool fstype_is_api_vfs(const char *fstype);
+bool fstype_is_blockdev_backed(const char *fstype);
bool fstype_is_ro(const char *fsype);
bool fstype_can_discard(const char *fstype);
bool fstype_can_uid_gid(const char *fstype);
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 469c14271c..ea86a6e06a 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -364,7 +364,7 @@ static int parse_argv(int argc, char *argv[]) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"At most two arguments required.");
- if (arg_mount_type && (fstype_is_api_vfs(arg_mount_type) || fstype_is_network(arg_mount_type))) {
+ if (arg_mount_type && !fstype_is_blockdev_backed(arg_mount_type)) {
arg_mount_what = strdup(argv[optind]);
if (!arg_mount_what)
return log_oom();
@@ -1463,7 +1463,7 @@ static int run(int argc, char* argv[]) {
if (arg_action == ACTION_UMOUNT)
return action_umount(bus, argc, argv);
- if ((!arg_mount_type || !fstype_is_network(arg_mount_type))
+ if ((!arg_mount_type || fstype_is_blockdev_backed(arg_mount_type))
&& !path_is_normalized(arg_mount_what)) {
log_error("Path contains non-normalized components: %s", arg_mount_what);
return -EINVAL;