* [PATCH] ext4: notify sysfs on errors_count value change
@ 2021-06-11 14:02 Jonathan Davies
2021-06-24 16:24 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Davies @ 2021-06-11 14:02 UTC (permalink / raw)
To: Theodore Ts'o
Cc: Jonathan Davies, Andreas Dilger, linux-ext4, linux-kernel
After s_error_count is incremented, signal the change in the
corresponding sysfs attribute via sysfs_notify. This allows userspace to
poll() on changes to /sys/fs/ext4/*/errors_count.
Signed-off-by: Jonathan Davies <jonathan.davies@nutanix.com>
---
fs/ext4/ext4.h | 1 +
fs/ext4/super.c | 1 +
fs/ext4/sysfs.c | 7 +++++++
3 files changed, 9 insertions(+)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 37002663..f313f5be 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -3614,6 +3614,7 @@ extern const struct inode_operations ext4_symlink_inode_operations;
extern const struct inode_operations ext4_fast_symlink_inode_operations;
/* sysfs.c */
+extern void ext4_notify_error_sysfs(struct super_block *sb);
extern int ext4_register_sysfs(struct super_block *sb);
extern void ext4_unregister_sysfs(struct super_block *sb);
extern int __init ext4_init_sysfs(void);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d29f6aa..2525239 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5579,6 +5579,7 @@ static void ext4_update_super(struct super_block *sb)
if (!es->s_error_count)
mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ);
le32_add_cpu(&es->s_error_count, sbi->s_add_error_count);
+ ext4_notify_error_sysfs(sb);
sbi->s_add_error_count = 0;
}
spin_unlock(&sbi->s_error_lock);
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 55fcab6..254b7fc 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -506,6 +506,13 @@ static struct kobj_type ext4_feat_ktype = {
.release = (void (*)(struct kobject *))kfree,
};
+void ext4_notify_error_sysfs(struct super_block *sb)
+{
+ struct ext4_sb_info *sbi = EXT4_SB(sb);
+
+ sysfs_notify(&sbi->s_kobj, NULL, "errors_count");
+}
+
static struct kobject *ext4_root;
static struct kobject *ext4_feat;
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: notify sysfs on errors_count value change
2021-06-11 14:02 [PATCH] ext4: notify sysfs on errors_count value change Jonathan Davies
@ 2021-06-24 16:24 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2021-06-24 16:24 UTC (permalink / raw)
To: Jonathan Davies; +Cc: Andreas Dilger, linux-ext4, linux-kernel
On Fri, Jun 11, 2021 at 02:02:08PM +0000, Jonathan Davies wrote:
> After s_error_count is incremented, signal the change in the
> corresponding sysfs attribute via sysfs_notify. This allows userspace to
> poll() on changes to /sys/fs/ext4/*/errors_count.
>
> Signed-off-by: Jonathan Davies <jonathan.davies@nutanix.com>
Applied, thanks.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-24 16:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 14:02 [PATCH] ext4: notify sysfs on errors_count value change Jonathan Davies
2021-06-24 16:24 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).