From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Hou Tao <houtao1@huawei.com>, linux-xfs@vger.kernel.org
Subject: Re: [RESEND][PATCH] xfs: add online uevent for mount operation
Date: Fri, 25 Aug 2017 10:27:52 +1000 [thread overview]
Message-ID: <20170825002752.GJ21024@dastard> (raw)
In-Reply-To: <20170824171028.GF4796@magnolia>
On Thu, Aug 24, 2017 at 10:10:28AM -0700, Darrick J. Wong wrote:
> On Thu, Aug 24, 2017 at 09:41:55PM +0800, Hou Tao wrote:
> > 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);
>
> It might be useful to send kobject_uevent_env so that we can squeeze in
> things like the fs uuid for easier identification? I envision a
> /etc/xfs/fs.conf file like this:
>
> [903db5b1-82cd-4f26-8221-443a4ed0563a]
> error.metadata.EIO.max_retries = 0
> error.fail_at_unmount = 1
> config.cowextsize = 1048576
> config.inherit_noatime = 1
>
> With a udev helper that uses the fsuuid to find the appropriate section
> of the ini^Wconfig file and load the appropriate values into sysfs. If
> we ever decide to expose more config knobs through sysfs then they'll
> be automatically supported.
Yup, that's sounds like a good idea.
> > + 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);
>
> That said, I wonder if we ought to move this discussion to fsdevel to
> pull in any /other/ filesystems that have sysfs knobs that they might
> like to be able to persist? ext4 has a bunch of tunables too...
Nope. We'll never get anywhere if we do that, just like the last
umpteenth times that generic fs events have been discussed. These
are XFS specific kobjs so we can do what we like with them and we
have an XFS specific problem that needs solving....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2017-08-25 0:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Dave Chinner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170825002752.GJ21024@dastard \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=houtao1@huawei.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).