Return-Path: Received: from mx2.suse.de ([195.135.220.15]:53394 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752754AbcELSQC (ORCPT ); Thu, 12 May 2016 14:16:02 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5F1F0ADE4 for ; Thu, 12 May 2016 18:15:57 +0000 (UTC) From: Goldwyn Rodrigues To: linux-fsdevel@vger.kernel.org Cc: Goldwyn Rodrigues Subject: [RFC 3/8] Report file system events Date: Thu, 12 May 2016 13:14:58 -0500 Message-Id: <1463076903-14373-4-git-send-email-rgoldwyn@suse.de> In-Reply-To: <1463076903-14373-1-git-send-email-rgoldwyn@suse.de> References: <1463076903-14373-1-git-send-email-rgoldwyn@suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Goldwyn Rodrigues 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 --- fs/super.c | 6 ++++++ include/linux/fs.h | 1 + 2 files changed, 7 insertions(+) diff --git a/fs/super.c b/fs/super.c index 42568eb..c6b8801 100644 --- a/fs/super.c +++ b/fs/super.c @@ -153,6 +153,12 @@ static void destroy_super_rcu(struct rcu_head *head) schedule_work(&s->destroy_work); } +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 5ac8883..1cf2e011 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2071,6 +2071,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); -- 2.6.6