From: Darrick J. Wong Date: Thu, 11 Jun 2026 14:05:37 +0000 (-0700) Subject: xfs_healer_start: check listmount when doing a --check X-Git-Tag: v7.1.0~43 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=425126caa89ca64acb26843a20b92329526f195b;p=xfsprogs-dev.git xfs_healer_start: check listmount when doing a --check Codex noticed that xfs_healer_start doesn't try out listmount() when it's doing a --check. Because systemd uses --check for an ExecCondition, if it's run on a pre-6.9 kernel (very unlikely) then the service will fail instead of simply not being run. Fix that. Signed-off-by: "Darrick J. Wong" Reviewed-by: Andrey Albershteyn --- diff --git a/healer/xfs_healer_start.c b/healer/xfs_healer_start.c index 19fd1328..6bf2b9bf 100644 --- a/healer/xfs_healer_start.c +++ b/healer/xfs_healer_start.c @@ -157,6 +157,28 @@ handle_mount_event( } } +/* Make sure listmount actually works so we can start up existing mounts */ +static int +check_listmount( + int mnt_ns_fd) +{ + uint64_t mnt_ids[1]; + uint64_t cursor = LISTMOUNT_INIT_CURSOR; + int ret; + + ret = libfrog_listmount(LSMT_ROOT, mnt_ns_fd, &cursor, mnt_ids, 1); + if (ret >= 0) + return 0; + + if (errno == ENOSYS) + fprintf(stderr, "%s\n", + _("This program requires the listmount system call.")); + else + perror("listmount"); + + return -1; +} + #define NR_MNT_IDS (32) /* Start healer services for existing XFS mounts. */ @@ -336,6 +358,10 @@ main( } if (support_check) { + ret = check_listmount(mnt_ns_fd); + if (ret) + goto out; + /* * We're being run as an ExecCondition process and we've * decided to start the main service. There is no need to wait