[Devel] [PATCH RHEL9 COMMIT] fs: add kobj into fs_uevent

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jan 27 17:36:52 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-4.vz9.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.12.2
------>
commit 33d0461eb2bfd79e7ff35a05c62e091e5c477359
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Jan 27 17:36:51 2022 +0300

    fs: add kobj into fs_uevent
    
    To_merge: ac6082c837be ("ext4: add generic uevent infrastructure")
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ====================
    xfs: Add notification about fs events like for ext4
    
    This patchset generalizes ext4's related code and introduced the same
    uevent notifications for xfs.
    
    https://jira.sw.ru/browse/PSBM-135476
    Feature: fs: udev events support
---
 fs/ext4/super.c    | 3 ++-
 include/linux/fs.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e40c511a9d26..efafb86937e3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -498,7 +498,7 @@ static void ext4_send_uevent_work(struct work_struct *w)
 	}
 	if (ret)
 		goto out;
-	ret = kobject_uevent_env(&(EXT4_SB(sb)->s_kobj), kaction, env->envp);
+	ret = kobject_uevent_env(e->kobject, kaction, env->envp);
 out:
 	kfree(env);
 	kfree(e);
@@ -529,6 +529,7 @@ void ext4_send_uevent(struct super_block *sb, enum fs_event_type action)
 	/* Do not forget to flush fs_events_wq before you kill sb */
 	e->sb = sb;
 	e->action = action;
+	e->kobject = &EXT4_SB(sb)->s_kobj;
 	INIT_WORK(&e->work, ext4_send_uevent_work);
 	queue_work(fs_events_wq, &e->work);
 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 226093049c17..6e76379d6035 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3173,6 +3173,7 @@ enum fs_event_type {
 struct fs_uevent {
 	struct super_block *sb;
 	enum fs_event_type action;
+	struct kobject *kobject;
 	struct work_struct work;
 };
 


More information about the Devel mailing list