[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176602332548.688213.501157461742943815.stgit@frogsfrogsfrogs>
Date: Wed, 17 Dec 2025 18:04:45 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: brauner@...nel.org, djwong@...nel.org
Cc: linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org, hch@....de,
linux-fsdevel@...r.kernel.org
Subject: [PATCH 2/4] xfs: send uevents when major filesystem events happen
From: Darrick J. Wong <djwong@...nel.org>
Send uevents when we mount, unmount, and shut down the filesystem, so
that we can trigger systemd services when major events happen. This
enables us to create a udev rule that will start up xfs_healer whenever
a filesystem is mounted.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
fs/xfs/xfs_fsops.c | 2 ++
fs/xfs/xfs_super.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index b7c21f68edc78d..bd1022ecd2eb4c 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -27,6 +27,7 @@
#include "xfs_metafile.h"
#include <linux/fserror.h>
+#include <linux/fsevent.h>
/*
* Write new AG headers to disk. Non-transactional, but need to be
@@ -544,6 +545,7 @@ xfs_do_force_shutdown(
xfs_stack_trace();
fserror_report_shutdown(mp->m_super, GFP_KERNEL);
+ fsevent_send_shutdown(mp->m_super, &mp->m_kobj.kobject);
}
/*
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index bc71aa9dcee8d6..bd078c99389bc1 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -53,6 +53,8 @@
#include <linux/magic.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
+#include <linux/uuid.h>
+#include <linux/fsevent.h>
static const struct super_operations xfs_super_operations;
@@ -1249,6 +1251,8 @@ xfs_fs_put_super(
{
struct xfs_mount *mp = XFS_M(sb);
+ fsevent_send_unmount(mp->m_super, &mp->m_kobj.kobject);
+
xfs_notice(mp, "Unmounting Filesystem %pU", &mp->m_sb.sb_uuid);
xfs_filestream_unmount(mp);
xfs_unmountfs(mp);
@@ -1972,6 +1976,11 @@ xfs_fs_fill_super(
goto out_unmount;
}
+ /*
+ * Send a uevent signalling that the mount succeeded so we can use udev
+ * rules to start background services.
+ */
+ fsevent_send_mount(mp->m_super, &mp->m_kobj.kobject, fc);
return 0;
out_filestream_unmount:
@@ -2217,6 +2226,7 @@ xfs_fs_reconfigure(
return error;
}
+ fsevent_send_remount(mp->m_super, &mp->m_kobj.kobject);
return 0;
}
Powered by blists - more mailing lists