diff mbox

[PoC,4/7] Report file system events

Message ID 1461895282-4941-5-git-send-email-rgoldwyn@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Goldwyn Rodrigues April 29, 2016, 2:01 a.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

This would allow the filesystems to report back events to the userspace.
Examples could be but not limited to:
 - Reporting ENOSPC on a filesystem
 	This could be used to trigger commands that would either clear
	up temporary files and/or inform the administrator
 - Reporting file errors
 	Filesystems tend to turn read-only at the drop of a hat. This could
	be used to develop utilities that would focus on clearing the errors
	as opposed to umounting and checking the entire filesystem. Even
	though checking the entire filesystem may be a good idea for this.
	Such a feature would improve availability (yes, perhaps at the cost of
	integrity) and improve modularize online filesystem checking.

This was the original idea of this effort which extended to kobjectifying
the entire filesystem series.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/super.c         | 6 ++++++
 include/linux/fs.h | 1 +
 2 files changed, 7 insertions(+)
diff mbox

Patch

diff --git a/fs/super.c b/fs/super.c
index f6cef10..50b5ae5 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -190,6 +190,12 @@  static int register_kobj(struct super_block *sb)
 			"%s", sb->s_id);
 }
 
+int sb_report_event(struct super_block *sb, char *envp[])
+{
+	return kobject_uevent_env(&sb->s_kobj, KOBJ_CHANGE, envp);
+}
+EXPORT_SYMBOL(sb_report_event);
+
 /**
  *	destroy_super	-	frees a superblock
  *	@s: superblock to free
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 59b84a8..d356485 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2092,6 +2092,7 @@  extern int vfs_ustat(dev_t, struct kstatfs *);
 extern int freeze_super(struct super_block *super);
 extern int thaw_super(struct super_block *super);
 extern bool our_mnt(struct vfsmount *mnt);
+extern int sb_report_event(struct super_block *sb, char *envp[]);
 
 extern int current_umask(void);