get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2231578/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2231578,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2231578/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/177758363694.1314717.18298115158990525436.stgit@frogsfrogsfrogs/",
    "project": {
        "id": 8,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/8/?format=api",
        "name": "Linux ext4 filesystem development",
        "link_name": "linux-ext4",
        "list_id": "linux-ext4.vger.kernel.org",
        "list_email": "linux-ext4@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<177758363694.1314717.18298115158990525436.stgit@frogsfrogsfrogs>",
    "date": "2026-04-30T21:17:22",
    "name": "[09/13] mount.fuse3: integrate systemd service startup",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9eebef6abd7bfd1bfa64e8f8ed096e9d72c04a58",
    "submitter": {
        "id": 77032,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/77032/?format=api",
        "name": "Darrick J. Wong",
        "email": "djwong@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/177758363694.1314717.18298115158990525436.stgit@frogsfrogsfrogs/mbox/",
    "series": [
        {
            "id": 502386,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/502386/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=502386",
            "date": "2026-04-30T21:15:17",
            "name": "[01/13] Refactor mount code / move common functions to mount_util.c",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502386/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2231578/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2231578/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <SRS0=pBCo=C5=vger.kernel.org=linux-ext4+bounces-16261-patchwork-incoming=ozlabs.org@ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-ext4@vger.kernel.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "patchwork-incoming@ozlabs.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=ZxCsw/Jp;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=pbco=c5=vger.kernel.org=linux-ext4+bounces-16261-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.105.105.114 arc.chain=subspace.kernel.org",
            "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org",
            "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=ZxCsw/Jp;\n\tdkim-atps=neutral",
            "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16261-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"ZxCsw/Jp\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g66X02lmZz1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 07:20:16 +1000 (AEST)",
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g66X02Frnz4wTZ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 07:20:16 +1000 (AEST)",
            "by gandalf.ozlabs.org (Postfix)\n\tid 4g66X029rGz4wck; Fri, 01 May 2026 07:20:16 +1000 (AEST)",
            "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g66Ww5BXrz4wTZ\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 01 May 2026 07:20:12 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id A2CD630429B1\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 30 Apr 2026 21:17:24 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 79F0339DBC1;\n\tThu, 30 Apr 2026 21:17:23 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A7B42FE066;\n\tThu, 30 Apr 2026 21:17:22 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id C27EDC2BCB3;\n\tThu, 30 Apr 2026 21:17:22 +0000 (UTC)"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777584016; cv=pass;\n\tb=yHKMq8FpRMp+LE9s1NkXKXRZ2pvedNRZb0TbCVfljNRgjdmQ1hNf7GsbubuOHToqrVzBb4qyv8hOaUeCy6kCiSLAK9cmIkTX5hqSwyFql1iDPH3ATDFcxTmTThsHBHmx6u4hJozc1a8S2ydvYGVWvQK2SAqMqQV33EA+/upTorYYjJIxOxbTq/a9pZUd5dsejO+2qBqdTAfs+4OluLqpxba48xhJPZbGP6Wqf10gArYxwm3jch9BOMOsDhsSHNTZRGAkp7AgbhZAA57coetVvJOBtaL5dpCrw32P6J5+j6OB+oNqGgfs59GMpGfLH5DLeyKnXaXJFF7P0B8HTKGI3Q==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777583843; cv=none;\n b=efPh9GvvPb6l/KPNZanCiDriDxpPaFmnSB/xqo05SqJ9ixZaDqpQ0jSa6EWIlv1hCgshIHRjOVA6NH/0t0tmUquzDAtTk02WVK+DPtAjkV61ngUMDrtVU0c0HyVFkgs+PDmCJVLZPZGLLCutqyImJfd06xWMEJfXJqV09t3yGtc="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777584016; c=relaxed/relaxed;\n\tbh=TZqEGV9mTQMesBbEdzWE4S1xq3OJQSpxrII+tPNg418=;\n\th=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=Tje5CbHTc00ZI/bb3a0wIIuDMVOY/1HrA0qKeWViWI+r3WzuYP5llCnSSaSA64WEdShwkwLrmd0wnhXaxBU4diu/gvHAZs846sdtr+7el/4/93Dy8RX1IlrPrYhSJnXwQ+GbGv8FzcSMLiNGjWMHNH4Y3iR2IT7bk9X0wD/A29pICDUSqppBxKHOc7nK3rJmy37OmakbNBCyZpbj6heA8v+u+du9UzZ+Ss3CbdIbzlemvJ7MMK8wruy38X27AvvsaNTpgKAnqbFLSEv51ksrlfH6iLGJeYLDUEYx8vscK3mcDGQJYD/4XSPRvSZ/PHG8GkaKdCvElvdqi7WaQGz/Zg==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777583843; c=relaxed/simple;\n\tbh=7lvNUn1N13PUSzQsaq7P25Kqokw4Uulf0kfs9uTn9mI=;\n\th=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=cqL5tvRAlzlVqU3d0FPsIsUNSV5kNjD9DKSLXgNENtVoiQQuANN2cKAGf+T+6imaINszTLsSWrnXAOzJoCqUjHn/Ff1Zf7YO3bLNPL9TmW+T5oNzkjxYXuh0mesGXH1Ji5L2vSg4uLfThYgYUtEzMWccxUvgSmJkOApPWT94p68="
        ],
        "ARC-Authentication-Results": [
            "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=ZxCsw/Jp; dkim-atps=neutral;\n spf=pass (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16261-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org",
            "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=ZxCsw/Jp; arc=none smtp.client-ip=10.30.226.201"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777583842;\n\tbh=7lvNUn1N13PUSzQsaq7P25Kqokw4Uulf0kfs9uTn9mI=;\n\th=Date:Subject:From:To:Cc:In-Reply-To:References:From;\n\tb=ZxCsw/JpwR8uU4wZNyyakh7P/5K/K7DbIrWDxGtSODE5NJklr/0AE8rtOI6ek2yFA\n\t jjzifrOafjrZjTujmJwIo2Yz7eUGxXggJIuj+tUOjHFXDyN6bELNdGaFPFIgmRgpc1\n\t rWQEk14F77ipXlwdMepy3MYdYLL3muAoraNxaBUMcEbDfA6/CN+qtmRdSK4PXhLMli\n\t 9RByD6+irolwAm3Ruj0MCqXvjJVTWHOgDrpKilevlDtMwSwGROxutrqEInpUjOPnVA\n\t ahnhxXQzOOQGqGK0+U9PdzjaFvwluZnb/78tp6+Q7BW83BvhSyeiUlYFpMBVNJ9Yzr\n\t eGYHjBC9MaRtw==",
        "Date": "Thu, 30 Apr 2026 14:17:22 -0700",
        "Subject": "[PATCH 09/13] mount.fuse3: integrate systemd service startup",
        "From": "\"Darrick J. Wong\" <djwong@kernel.org>",
        "To": "bernd@bsbernd.com, djwong@kernel.org",
        "Cc": "linux-fsdevel@vger.kernel.org, fuse-devel@lists.linux.dev,\n linux-ext4@vger.kernel.org, miklos@szeredi.hu, neal@gompa.dev,\n joannelkoong@gmail.com",
        "Message-ID": "<177758363694.1314717.18298115158990525436.stgit@frogsfrogsfrogs>",
        "In-Reply-To": "<177758363484.1314717.11777978893472254088.stgit@frogsfrogsfrogs>",
        "References": "<177758363484.1314717.11777978893472254088.stgit@frogsfrogsfrogs>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-ext4@vger.kernel.org",
        "List-Id": "<linux-ext4.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"
    },
    "content": "From: Darrick J. Wong <djwong@kernel.org>\n\nTeach mount.fuse3 how to start fuse via systemd service, if present.\n\nSigned-off-by: \"Darrick J. Wong\" <djwong@kernel.org>\n---\n util/mount_service.h  |    9 +++\n doc/fuservicemount3.8 |   10 +++\n meson.build           |    3 +\n util/fuservicemount.c |   47 +++++++++++++\n util/meson.build      |   14 +++-\n util/mount.fuse.c     |  171 +++++++++++++++++++++++++++++++++++++++++++------\n util/mount_service.c  |   43 ++++++++++++\n 7 files changed, 270 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/util/mount_service.h b/util/mount_service.h\nindex a0b952a15dacf3..ec8008a7f53942 100644\n--- a/util/mount_service.h\n+++ b/util/mount_service.h\n@@ -37,4 +37,13 @@ int mount_service_main(int argc, char *argv[]);\n  */\n const char *mount_service_subtype(const char *fstype);\n \n+/**\n+ * Discover if there is a fuse service socket for the given fuse filesystem type.\n+ * The type must not contain a path separator.\n+ *\n+ * @param fstype the type of a fuse filesystem type (e.g. fuse.Y, fuseblk.Y, or Y)\n+ * @return true if available, false if not\n+ */\n+bool mount_service_present(const char *fstype);\n+\n #endif /* MOUNT_SERVICE_H_ */\ndiff --git a/doc/fuservicemount3.8 b/doc/fuservicemount3.8\nindex e45d6a89c8b81a..aa2167cb4872c6 100644\n--- a/doc/fuservicemount3.8\n+++ b/doc/fuservicemount3.8\n@@ -7,12 +7,20 @@ .SH SYNOPSIS\n .B mountpoint\n .BI -t \" fstype\"\n [\n-.I options\n+.BI -o \" options\"\n ]\n+\n+.B fuservicemount3\n+.BI -t \" fstype\"\n+.B --check\n+\n .SH DESCRIPTION\n Mount a filesystem using a FUSE server that runs as a socket service.\n These servers can be contained using the platform's service management\n framework.\n+\n+The second form checks if there is a FUSE service available for the given\n+filesystem type.\n .SH \"AUTHORS\"\n .LP\n The author of the fuse socket service code is Darrick J. Wong <djwong@kernel.org>.\ndiff --git a/meson.build b/meson.build\nindex c8326b79fcee8f..827ec45ad3ad75 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -83,7 +83,8 @@ private_cfg.set('FUSE_SERVICE_SOCKET_PERMS', service_socket_perms)\n # Test for presence of some functions\n test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2',\n                'splice', 'vmsplice', 'posix_fallocate', 'fdatasync',\n-               'utimensat', 'copy_file_range', 'fallocate', 'fspacectl' ]\n+               'utimensat', 'copy_file_range', 'fallocate', 'fspacectl',\n+               'faccessat' ]\n foreach func : test_funcs\n     private_cfg.set('HAVE_' + func.to_upper(),\n         cc.has_function(func, prefix: include_default, args: args_default))\ndiff --git a/util/fuservicemount.c b/util/fuservicemount.c\nindex 9c694a4290f94e..4d4cad6cb9253c 100644\n--- a/util/fuservicemount.c\n+++ b/util/fuservicemount.c\n@@ -9,10 +9,57 @@\n  * This program wraps the mounting of FUSE filesystems that run in systemd\n  */\n #define _GNU_SOURCE\n+#include <stdbool.h>\n+#include <stdio.h>\n+#include <string.h>\n+#include <stdlib.h>\n #include \"fuse_config.h\"\n #include \"mount_service.h\"\n \n+static int check_service(const char *fstype)\n+{\n+\tif (!fstype) {\n+\t\tfprintf(stderr,\n+\t\t\t\"fuservicemount: expected fs type for --check\\n\");\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n+\treturn mount_service_present(fstype) ? EXIT_SUCCESS : EXIT_FAILURE;\n+}\n+\n int main(int argc, char *argv[])\n {\n+\tchar *fstype = NULL;\n+\tbool check = false;\n+\tint i;\n+\n+\t/*\n+\t * If the user passes us exactly the args -t FSTYPE --check then\n+\t * we'll just check if there's a service for the FSTYPE fuse server.\n+\t * This doesn't tell us if the listening socket is actually connected\n+\t * to anything.\n+\t */\n+\tfor (i = 1; i < argc; i++) {\n+\t\tif (!strcmp(argv[i], \"--check\")) {\n+\t\t\tif (check) {\n+\t\t\t\tcheck = false;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tcheck = true;\n+\t\t} else if (!strcmp(argv[i], \"-t\") && i + 1 < argc) {\n+\t\t\tif (fstype) {\n+\t\t\t\tcheck = false;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tfstype = argv[i + 1];\n+\t\t\ti++;\n+\t\t} else {\n+\t\t\tcheck = false;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tif (check)\n+\t\treturn check_service(fstype);\n+\n \treturn mount_service_main(argc, argv);\n }\ndiff --git a/util/meson.build b/util/meson.build\nindex aa646ef3c77d16..85b54d5d322dcb 100644\n--- a/util/meson.build\n+++ b/util/meson.build\n@@ -6,21 +6,27 @@ executable('fusermount3', ['fusermount.c', '../lib/mount_util.c', '../lib/util.c\n            install_dir: get_option('bindir'),\n            c_args: '-DFUSE_CONF=\"@0@\"'.format(fuseconf_path))\n \n+mount_service_sources = []\n+mount_service_cflags = []\n if private_cfg.get('HAVE_SERVICEMOUNT', false)\n-  executable('fuservicemount3', ['mount_service.c', 'fuservicemount.c', '../lib/mount_util.c', 'fuser_conf.c'],\n+  mount_service_sources += ['mount_service.c', '../lib/mount_util.c', 'fuser_conf.c']\n+  mount_service_cflags += ['-DFUSE_CONF=\"@0@\"'.format(fuseconf_path)]\n+  fuservicemount_path = join_paths(get_option('prefix'), get_option('sbindir'))\n+  mount_service_cflags += ['-DFUSERVICEMOUNT_DIR=\"@0@\"'.format(fuservicemount_path)]\n+  executable('fuservicemount3', ['fuservicemount.c'] + mount_service_sources,\n              include_directories: include_dirs,\n              link_with: [ libfuse ],\n              install: true,\n              install_dir: get_option('sbindir'),\n-             c_args: ['-DFUSE_USE_VERSION=319', '-DFUSE_CONF=\"@0@\"'.format(fuseconf_path)])\n+             c_args: ['-DFUSE_USE_VERSION=319'] + mount_service_cflags)\n endif\n \n-executable('mount.fuse3', ['mount.fuse.c'],\n+executable('mount.fuse3', ['mount.fuse.c'] + mount_service_sources,\n            include_directories: include_dirs,\n            link_with: [ libfuse ],\n            install: true,\n            install_dir: get_option('sbindir'),\n-           c_args: '-DFUSE_USE_VERSION=317')\n+           c_args: ['-DFUSE_USE_VERSION=319'] + mount_service_cflags)\n \n \n udevrulesdir = get_option('udevrulesdir')\ndiff --git a/util/mount.fuse.c b/util/mount.fuse.c\nindex 382f77165a903c..802d7f99fe7815 100644\n--- a/util/mount.fuse.c\n+++ b/util/mount.fuse.c\n@@ -6,6 +6,9 @@\n   See the file GPL2.txt.\n */\n \n+/* For environ */\n+#define _GNU_SOURCE\n+\n #include \"fuse_config.h\"\n \n #include <stdio.h>\n@@ -17,6 +20,9 @@\n #include <fcntl.h>\n #include <pwd.h>\n #include <sys/wait.h>\n+#ifdef HAVE_SERVICEMOUNT\n+#include <spawn.h>\n+#endif\n \n #ifdef linux\n #include <sys/prctl.h>\n@@ -49,6 +55,9 @@\n #endif\n \n #include \"fuse.h\"\n+#ifdef HAVE_SERVICEMOUNT\n+# include \"mount_service.h\"\n+#endif\n \n static char *progname;\n \n@@ -233,6 +242,107 @@ static void drop_and_lock_capabilities(void)\n }\n #endif\n \n+#ifdef HAVE_SERVICEMOUNT\n+#define FUSERVICEMOUNT_PROG\t\"fuservicemount3\"\n+\n+static int mount_service_child(char **argv)\n+{\n+\tconst char *full_path = FUSERVICEMOUNT_DIR \"/\" FUSERVICEMOUNT_PROG;\n+\tpid_t child_pid;\n+\tint child_status;\n+\tint ret;\n+\n+\t/*\n+\t * First try the install path, then a system install, just like we do\n+\t * for fusermount.  See man 7 environ for the global environ pointer.\n+\t */\n+\tret = posix_spawn(&child_pid, full_path, NULL, NULL,\n+\t\t\t  (char *const *)argv, environ);\n+\tif (ret)\n+\t\tret = posix_spawnp(&child_pid, FUSERVICEMOUNT_PROG, NULL, NULL,\n+\t\t\t\t   (char * const *)argv, environ);\n+\tif (ret) {\n+\t\tfprintf(stderr, \"%s: could not start %s helper: %s\\n\",\n+\t\t\targv[0], FUSERVICEMOUNT_PROG, strerror(ret));\n+\t\treturn MOUNT_SERVICE_FALLBACK_NEEDED;\n+\t}\n+\n+\tdo {\n+\t\tret = waitpid(child_pid, &child_status, 0);\n+\t} while (ret < 0 && errno == EINTR);\n+\tif (ret < 0) {\n+\t\tfprintf(stderr, \"%s: could not wait for %s helper: %s\\n\",\n+\t\t\targv[0], FUSERVICEMOUNT_PROG, strerror(errno));\n+\t\treturn MOUNT_SERVICE_FALLBACK_NEEDED;\n+\t}\n+\n+\tif (WIFEXITED(child_status))\n+\t\treturn WEXITSTATUS(child_status);\n+\n+\t/* terminated due to signal or coredump */\n+\treturn EXIT_FAILURE;\n+}\n+\n+static int try_service_main(char *argv0, char *fstype, char *source,\n+\t\t\t    const char *mountpoint, char *options)\n+{\n+\tchar **argv;\n+\tchar dash_o[] = \"-o\";\n+\tchar dash_t[] = \"-t\";\n+\tchar *mntpt;\n+\tint argc = 5; /* argv[0], -t type, mountpoint, and trailing NULL */\n+\tint i = 0;\n+\tint ret;\n+\n+\tif (!mount_service_present(fstype))\n+\t\treturn MOUNT_SERVICE_FALLBACK_NEEDED;\n+\n+\t/* This can be an empty string if \"mount.fuse3 null# /tmp/a\" */\n+\tif (source && source[0] == 0)\n+\t\tsource = NULL;\n+\n+\tmntpt = strdup(mountpoint);\n+\tif (!mntpt) {\n+\t\tperror(\"mountpoint allocation\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (source)\n+\t\targc++;\n+\tif (options)\n+\t\targc += 2;\n+\n+\targv = calloc(argc, sizeof(char *));\n+\tif (!argv) {\n+\t\tperror(\"argv allocation\");\n+\t\tfree(mntpt);\n+\t\treturn -1;\n+\t}\n+\n+\targv[i++] = argv0;\n+\tif (source)\n+\t\targv[i++] = source;\n+\targv[i++] = mntpt;\n+\targv[i++] = dash_t;\n+\targv[i++] = fstype;\n+\tif (options) {\n+\t\targv[i++] = dash_o;\n+\t\targv[i++] = options;\n+\t}\n+\targv[i] = 0;\n+\n+\tif (getuid() != 0) {\n+\t\tret = mount_service_child(argv);\n+\t} else {\n+\t\t/* We're root, just do the mount directly. */\n+\t\tret = mount_service_main(argc - 1, argv);\n+\t}\n+\tfree(argv);\n+\tfree(mntpt);\n+\treturn ret;\n+}\n+#endif\n+\n int main(int argc, char *argv[])\n {\n \tchar *type = NULL;\n@@ -280,9 +390,7 @@ int main(int argc, char *argv[])\n \tmountpoint = argv[2];\n \n \tfor (i = 3; i < argc; i++) {\n-\t\tif (strcmp(argv[i], \"-v\") == 0) {\n-\t\t\tcontinue;\n-\t\t} else if (strcmp(argv[i], \"-t\") == 0) {\n+\t\tif (strcmp(argv[i], \"-t\") == 0) {\n \t\t\ti++;\n \n \t\t\tif (i == argc) {\n@@ -303,6 +411,30 @@ int main(int argc, char *argv[])\n \t\t\t\t\tprogname);\n \t\t\t\texit(1);\n \t\t\t}\n+\t\t}\n+\t}\n+\n+\tif (!type) {\n+\t\tif (source) {\n+\t\t\tdup_source = xstrdup(source);\n+\t\t\ttype = dup_source;\n+\t\t\tsource = strchr(type, '#');\n+\t\t\tif (source)\n+\t\t\t\t*source++ = '\\0';\n+\t\t\tif (!type[0]) {\n+\t\t\t\tfprintf(stderr, \"%s: empty filesystem type\\n\",\n+\t\t\t\t\tprogname);\n+\t\t\t\texit(1);\n+\t\t\t}\n+\t\t} else {\n+\t\t\tfprintf(stderr, \"%s: empty source\\n\", progname);\n+\t\t\texit(1);\n+\t\t}\n+\t}\n+\n+\tfor (i = 3; i < argc; i++) {\n+\t\tif (strcmp(argv[i], \"-v\") == 0) {\n+\t\t\tcontinue;\n \t\t} else\tif (strcmp(argv[i], \"-o\") == 0) {\n \t\t\tchar *opts;\n \t\t\tconst char *opt;\n@@ -366,24 +498,6 @@ int main(int argc, char *argv[])\n \tif (suid)\n \t\toptions = add_option(\"suid\", options);\n \n-\tif (!type) {\n-\t\tif (source) {\n-\t\t\tdup_source = xstrdup(source);\n-\t\t\ttype = dup_source;\n-\t\t\tsource = strchr(type, '#');\n-\t\t\tif (source)\n-\t\t\t\t*source++ = '\\0';\n-\t\t\tif (!type[0]) {\n-\t\t\t\tfprintf(stderr, \"%s: empty filesystem type\\n\",\n-\t\t\t\t\tprogname);\n-\t\t\t\texit(1);\n-\t\t\t}\n-\t\t} else {\n-\t\t\tfprintf(stderr, \"%s: empty source\\n\", progname);\n-\t\t\texit(1);\n-\t\t}\n-\t}\n-\n \tif (setuid_name && setuid_name[0]) {\n #ifdef linux\n \t\tif (drop_privileges) {\n@@ -429,6 +543,21 @@ int main(int argc, char *argv[])\n \t\tdrop_and_lock_capabilities();\n \t}\n #endif\n+\n+#ifdef HAVE_SERVICEMOUNT\n+\t/*\n+\t * Now that we know the desired filesystem type, see if we can find\n+\t * a socket service implementing that, if we haven't selected any weird\n+\t * options that would prevent that.\n+\t */\n+\tif (!pass_fuse_fd && !(setuid_name && setuid_name[0])) {\n+\t\tint ret = try_service_main(argv[0], type, source, mountpoint,\n+\t\t\t\t\t   options);\n+\t\tif (ret != MOUNT_SERVICE_FALLBACK_NEEDED)\n+\t\t\treturn ret;\n+\t}\n+#endif\n+\n \tadd_arg(&command, type);\n \tif (source)\n \t\tadd_arg(&command, source);\ndiff --git a/util/mount_service.c b/util/mount_service.c\nindex 95de56f2b625fe..bc5940bc900dad 100644\n--- a/util/mount_service.c\n+++ b/util/mount_service.c\n@@ -2066,3 +2066,46 @@ int mount_service_main(int argc, char *argv[])\n \tmount_service_destroy(&mo);\n \treturn ret;\n }\n+\n+bool mount_service_present(const char *fstype)\n+{\n+\tstruct sockaddr_un name;\n+\tstruct stat stbuf;\n+\tchar path[PATH_MAX];\n+\tconst char *subtype;\n+\tssize_t written;\n+\tint ret;\n+\n+\tsubtype = mount_service_subtype(fstype);\n+\tif (!subtype)\n+\t\treturn false;\n+\n+\t/*\n+\t * The full path to the socket must fit within the AF_UNIX socket path\n+\t * buffer, which is much shorter than PATH_MAX.\n+\t */\n+\twritten = snprintf(path, sizeof(path), FUSE_SERVICE_SOCKET_DIR \"/%s\",\n+\t\t\t   subtype);\n+\tif (written >= sizeof(name.sun_path) || written >= sizeof(path))\n+\t\treturn false;\n+\n+\tret = stat(path, &stbuf);\n+\tif (ret)\n+\t\treturn false;\n+\n+\tif (!S_ISSOCK(stbuf.st_mode))\n+\t\treturn false;\n+\n+#ifdef HAVE_FACCESSAT\n+\t/*\n+\t * Can we write to the service socket with the real uid?  This accounts\n+\t * for setuid and ACLs on the socket.  Note that we connect() to the\n+\t * socket having dropped setuid privileges.\n+\t */\n+\tret = faccessat(AT_FDCWD, path, W_OK, 0);\n+#else\n+\t/* Can we write to the service socket with the real uid? */\n+\tret = access(path, W_OK);\n+#endif\n+\treturn ret == 0;\n+}\n",
    "prefixes": [
        "09/13"
    ]
}