[Devel] [PATCH RH9 07/10] fs: Move s_err_event_sent() and s_abrt_event_sent() to super_block

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jan 25 15:23:20 MSK 2022


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/ext4/ext4.h     |    3 ---
 fs/ext4/super.c    |    6 ++----
 fs/super.c         |    4 ++++
 include/linux/fs.h |    4 ++++
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index a9df91038463..5f6fdd5514b2 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1625,9 +1625,6 @@ struct ext4_sb_info {
 	/* Precomputed FS UUID checksum for seeding other checksums */
 	__u32 s_csum_seed;
 
-	bool s_err_event_sent;
-	bool s_abrt_event_sent;
-
 	/* Reclaim extents from extent status tree */
 	struct shrinker s_es_shrinker;
 	struct list_head s_es_list;	/* List of inodes with reclaimable extents */
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6396b601ae6b..623150be389d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -649,16 +649,14 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error,
 	journal_t *journal = EXT4_SB(sb)->s_journal;
 	bool continue_fs = !force_ro && test_opt(sb, ERRORS_CONT);
 
-	if (!xchg(&EXT4_SB(sb)->s_err_event_sent, 1))
-		ext4_send_uevent(sb, FS_UA_ERROR);
+	ext4_send_uevent(sb, FS_UA_ERROR);
 
 	EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
 	if (test_opt(sb, WARN_ON_ERROR))
 		WARN_ON_ONCE(1);
 
 	if (!continue_fs && !sb_rdonly(sb)) {
-		if (!xchg(&EXT4_SB(sb)->s_abrt_event_sent, 1))
-			ext4_send_uevent(sb, FS_UA_ABORT);
+		ext4_send_uevent(sb, FS_UA_ABORT);
 
 		ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
 		if (journal)
diff --git a/fs/super.c b/fs/super.c
index 3526cf6b1179..9a3352907716 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1899,6 +1899,10 @@ void fs_send_uevent(struct super_block *sb, struct kobject *kobj,
 
 	if (!fs_events_wq)
 		return;
+	if (action == FS_UA_ERROR && xchg(&sb->s_err_event_sent, 1))
+		return;
+	if (action == FS_UA_ABORT && xchg(&sb->s_abrt_event_sent, 1))
+		return;
 
 	e = kzalloc(sizeof(*e), GFP_NOIO);
 	if (!e)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 45e7393858eb..cd71b108ee24 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1526,6 +1526,10 @@ struct super_block {
 	/* per-sb errseq_t for reporting writeback errors via syncfs */
 	errseq_t s_wb_err;
 
+	/* For fs_send_uevent() */
+	bool s_err_event_sent;
+	bool s_abrt_event_sent;
+
 	/* AIO completions deferred from interrupt context */
 	struct workqueue_struct *s_dio_done_wq;
 	struct hlist_head s_pins;




More information about the Devel mailing list