linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][PATCH] xfs: add online uevent for mount operation
@ 2017-08-24 13:41 Hou Tao
  2017-08-24 17:10 ` Darrick J. Wong
  0 siblings, 1 reply; 15+ messages in thread
From: Hou Tao @ 2017-08-24 13:41 UTC (permalink / raw)
  To: linux-xfs; +Cc: darrick.wong, david

It will be useful if there is a corresponding online uevent after
a XFS filesystem has been mounted. A typical usage of the uevent
is setting the error configuration for a specific XFS filesystem
or all XFS filesystems by using udevd.

The following is an example of udevd rule which will shutdown
any XFS filesystem after the filesystem gets any IO error:

    ACTION=="online", SUBSYSTEM=="xfs", DEVPATH=="/fs/xfs/*", \
    RUN+="/bin/sh -c 'echo 0 > /sys%p/error/metadata/default/max_retries; \
	    echo 0 > /sys%p/error/metadata/EIO/max_retries; \
	    echo 0 > /sys%p/error/metadata/ENOSPC/max_retries; \
	    echo 0 > /sys%p/error/metadata/ENODEV/max_retries'"

Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 fs/xfs/xfs_super.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 38aaacd..695fe85f 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1530,6 +1530,19 @@ xfs_destroy_percpu_counters(
 	percpu_counter_destroy(&mp->m_fdblocks);
 }
 
+static void
+xfs_fs_uevent(
+	struct xfs_mount	*mp,
+	enum kobject_action	action)
+{
+	int err;
+
+	err = kobject_uevent(&mp->m_kobj.kobject, action);
+	if (err)
+		xfs_notice(mp, "Sending XFS uevent %d got error %d",
+				action, err);
+}
+
 STATIC int
 xfs_fs_fill_super(
 	struct super_block	*sb,
@@ -1667,6 +1680,8 @@ xfs_fs_fill_super(
 		goto out_unmount;
 	}
 
+	xfs_fs_uevent(mp, KOBJ_ONLINE);
+
 	return 0;
 
  out_filestream_unmount:
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-08-25  5:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 13:41 [RESEND][PATCH] xfs: add online uevent for mount operation Hou Tao
2017-08-24 17:10 ` Darrick J. Wong
2017-08-24 18:04   ` Filesystem configuration parsers - (was: Re: [RESEND][PATCH] xfs: add online uevent for mount operation) Luis R. Rodriguez
2017-08-24 18:13     ` Luis R. Rodriguez
2017-08-24 18:59     ` Luis R. Rodriguez
2017-08-24 22:11     ` NeilBrown
2017-08-24 22:39       ` Luis R. Rodriguez
2017-08-24 23:34       ` Theodore Ts'o
2017-08-25  0:02         ` Luis R. Rodriguez
2017-08-25  4:54         ` Darrick J. Wong
2017-08-25  1:01     ` Dave Chinner
2017-08-25  1:20       ` Luis R. Rodriguez
2017-08-25  2:18         ` Dave Chinner
2017-08-25  5:29           ` Darrick J. Wong
2017-08-25  0:27   ` [RESEND][PATCH] xfs: add online uevent for mount operation Dave Chinner

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).