lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176602332590.688213.9240067999700074165.stgit@frogsfrogsfrogs>
Date: Wed, 17 Dec 2025 18:05:16 -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 4/4] ext4: 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 people can trigger systemd services when major events happen.

Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
 fs/ext4/ioctl.c |    2 ++
 fs/ext4/super.c |    6 ++++++
 fs/ext4/sysfs.c |    2 ++
 3 files changed, 10 insertions(+)


diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index ea26cd03d3ce28..48ea33cdebbf0c 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -27,6 +27,7 @@
 #include "fsmap.h"
 #include <trace/events/ext4.h>
 #include <linux/fserror.h>
+#include <linux/fsevent.h>
 
 typedef void ext4_update_sb_callback(struct ext4_sb_info *sbi,
 				     struct ext4_super_block *es,
@@ -845,6 +846,7 @@ int ext4_force_shutdown(struct super_block *sb, u32 flags)
 		return -EINVAL;
 	}
 	clear_opt(sb, DISCARD);
+	fsevent_send_shutdown(sb, &sbi->s_kobj);
 	fserror_report_shutdown(sb, GFP_KERNEL);
 	return 0;
 }
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a6241ffb8639c3..649eed02d45dbb 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -49,6 +49,7 @@
 #include <linux/fs_context.h>
 #include <linux/fs_parser.h>
 #include <linux/fserror.h>
+#include <linux/fsevent.h>
 
 #include "ext4.h"
 #include "ext4_extents.h"	/* Needed for trace points definition */
@@ -1284,6 +1285,8 @@ static void ext4_put_super(struct super_block *sb)
 	int aborted = 0;
 	int err;
 
+	fsevent_send_unmount(sb, &sbi->s_kobj);
+
 	/*
 	 * Unregister sysfs before destroying jbd2 journal.
 	 * Since we could still access attr_journal_task attribute via sysfs
@@ -5698,6 +5701,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 	if (err)
 		goto failed_mount9;
 
+	fsevent_send_mount(sb, &sbi->s_kobj, fc);
 	return 0;
 
 failed_mount9:
@@ -6835,6 +6839,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
 static int ext4_reconfigure(struct fs_context *fc)
 {
 	struct super_block *sb = fc->root->d_sb;
+	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	int ret;
 	bool old_ro = sb_rdonly(sb);
 
@@ -6852,6 +6857,7 @@ static int ext4_reconfigure(struct fs_context *fc)
 		 &sb->s_uuid,
 		 (old_ro != sb_rdonly(sb)) ? (sb_rdonly(sb) ? " ro" : " r/w") : "");
 
+	fsevent_send_remount(sb, &sbi->s_kobj);
 	return 0;
 }
 
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index e6a14585244308..9d9812a5b265ba 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -335,6 +335,7 @@ EXT4_ATTR_FEATURE(encrypted_casefold);
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 EXT4_ATTR_FEATURE(blocksize_gt_pagesize);
 #endif
+EXT4_ATTR_FEATURE(uevents);
 
 static struct attribute *ext4_feat_attrs[] = {
 	ATTR_LIST(lazy_itable_init),
@@ -358,6 +359,7 @@ static struct attribute *ext4_feat_attrs[] = {
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	ATTR_LIST(blocksize_gt_pagesize),
 #endif
+	ATTR_LIST(uevents),
 	NULL,
 };
 ATTRIBUTE_GROUPS(ext4_feat);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ