Skip to contentSkip to conversation

f2fs: add fsnotify_sb_error() in f2fs_save_errors

PATCH In review Yangtao Li 2 participants 2 messages May 11, 2023 – May 17, 2023 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 f2fs: add fsnotify_sb_error() in f2fs_save_errors

When an EFSCORRUPTED error occurs in f2fs, report the error to userspace monitoring tools.

---
 fs/f2fs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/super.c +3 -0
index 51812f459581..42d5aa504afe 100644
@@ -28,6 +28,7 @@
 #include <linux/part_stat.h>
 #include <linux/zstd.h>
 #include <linux/lz4.h>
+#include <linux/fsnotify.h>
 
 #include "f2fs.h"
 #include "node.h"
@@ -4000,6 +4001,8 @@ void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)
 		sbi->error_dirty = true;
 	}
 	spin_unlock_irqrestore(&sbi->error_lock, flags);
+
+	fsnotify_sb_error(sbi->sb, NULL, EFSCORRUPTED);
 }
 
 static bool f2fs_update_errors(struct f2fs_sb_info *sbi)
Signature · 1 line
2.39.0
maintainer
#1 lore raw
Quoted 21 lines · Yangtao Li

When an EFSCORRUPTED error occurs in f2fs, report the error to userspace monitoring tools.

---
  fs/f2fs/super.c | 3 +++
  1 file changed, 3 insertions(+)
fs/f2fs/super.c +1 -0
index 51812f459581..42d5aa504afe 100644
@@ -28,6 +28,7 @@
  #include <linux/part_stat.h>
  #include <linux/zstd.h>
  #include <linux/lz4.h>
+#include <linux/fsnotify.h>
 
  #include "f2fs.h"
  #include "node.h"

fs/f2fs/super.c void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag) · line 4005

Quoted 5 lines
fs/f2fs/super.c +2 -0
@@ -4000,6 +4001,8 @@ void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)
  		sbi->error_dirty = true;
  	}
  	spin_unlock_irqrestore(&sbi->error_lock, flags);
+
+	fsnotify_sb_error(sbi->sb, NULL, EFSCORRUPTED);

Can we call this function in irq context?

- f2fs_decompress_cluster
- f2fs_save_errors

Thanks,

Quoted 3 lines
fs/f2fs/super.c +0 -0
  }
 
  static bool f2fs_update_errors(struct f2fs_sb_info *sbi)