From: "Darrick J. Wong" <djwong@kernel.org>
To: Carlos Maiolino <cem@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
Hans Holmberg <hans.holmberg@wdc.com>,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 06/10] xfs: allow setting errortags at mount time
Date: Wed, 28 Jan 2026 08:11:42 -0800 [thread overview]
Message-ID: <20260128161142.GT5945@frogsfrogsfrogs> (raw)
In-Reply-To: <aXnyfoEDhdHTIf-E@nidhogg.toxiclabs.cc>
On Wed, Jan 28, 2026 at 12:30:05PM +0100, Carlos Maiolino wrote:
> On Tue, Jan 27, 2026 at 05:05:46PM +0100, Christoph Hellwig wrote:
> > Add an errortag mount option that enables an errortag with the default
> > injection frequency. This allows injecting errors into the mount
> > process instead of just on live file systems, and thus test mount
> > error handling.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> > Documentation/admin-guide/xfs.rst | 6 ++++++
> > fs/xfs/xfs_error.c | 36 +++++++++++++++++++++++++++++++
> > fs/xfs/xfs_error.h | 4 ++++
> > fs/xfs/xfs_super.c | 8 ++++++-
> > 4 files changed, 53 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/admin-guide/xfs.rst b/Documentation/admin-guide/xfs.rst
> > index c85cd327af28..cb8cd12660d7 100644
> > --- a/Documentation/admin-guide/xfs.rst
> > +++ b/Documentation/admin-guide/xfs.rst
> > @@ -215,6 +215,12 @@ When mounting an XFS filesystem, the following options are accepted.
> > inconsistent namespace presentation during or after a
> > failover event.
> >
> > + errortag=tagname
> > + When specified, enables the error inject tag named "tagname" with the
> > + default frequency. Can be specified multiple times to enable multiple
> > + errortags. Specifying this option on remount will reset the error tag
> > + to the default value if it was set to any other value before.
> > +
>
> I think this should include the fact it is only supported with DEBUG
> enabled.
> I'm sure we'll get user complains about why 'errortag=foo' is not working?
> And, in some unfortunate case somebody has DEBUG enabled when they
> shouldn't have, at least the documentation says so this shouldn't be
> used...
Should we explicitly state here that the errortag=XXX will /not/ be
echoed back via /proc/mounts? Seeing as we recently had bug reports
about scripts encoding /proc/mounts into /etc/fstab.
(That's why I hate mount options)
--D
> I'm happy taking this patch though and we work on the above later, so...
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
>
> > Deprecation of V4 Format
> > ========================
> >
> > diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> > index 53704f1ed791..d652240a1dca 100644
> > --- a/fs/xfs/xfs_error.c
> > +++ b/fs/xfs/xfs_error.c
> > @@ -22,6 +22,12 @@
> > static const unsigned int xfs_errortag_random_default[] = { XFS_ERRTAGS };
> > #undef XFS_ERRTAG
> >
> > +#define XFS_ERRTAG(_tag, _name, _default) \
> > + [XFS_ERRTAG_##_tag] = __stringify(_name),
> > +#include "xfs_errortag.h"
> > +static const char *xfs_errortag_names[] = { XFS_ERRTAGS };
> > +#undef XFS_ERRTAG
> > +
> > struct xfs_errortag_attr {
> > struct attribute attr;
> > unsigned int tag;
> > @@ -189,6 +195,36 @@ xfs_errortag_add(
> > return 0;
> > }
> >
> > +int
> > +xfs_errortag_add_name(
> > + struct xfs_mount *mp,
> > + const char *tag_name)
> > +{
> > + unsigned int i;
> > +
> > + for (i = 0; i < XFS_ERRTAG_MAX; i++) {
> > + if (xfs_errortag_names[i] &&
> > + !strcmp(xfs_errortag_names[i], tag_name))
> > + return xfs_errortag_add(mp, i);
> > + }
> > +
> > + return -EINVAL;
> > +}
> > +
> > +void
> > +xfs_errortag_copy(
> > + struct xfs_mount *dst_mp,
> > + struct xfs_mount *src_mp)
> > +{
> > + unsigned int val, i;
> > +
> > + for (i = 0; i < XFS_ERRTAG_MAX; i++) {
> > + val = READ_ONCE(src_mp->m_errortag[i]);
> > + if (val)
> > + WRITE_ONCE(dst_mp->m_errortag[i], val);
> > + }
> > +}
> > +
> > int
> > xfs_errortag_clearall(
> > struct xfs_mount *mp)
> > diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
> > index b40e7c671d2a..05fc1d1cf521 100644
> > --- a/fs/xfs/xfs_error.h
> > +++ b/fs/xfs/xfs_error.h
> > @@ -45,6 +45,8 @@ void xfs_errortag_delay(struct xfs_mount *mp, const char *file, int line,
> > #define XFS_ERRORTAG_DELAY(mp, tag) \
> > xfs_errortag_delay((mp), __FILE__, __LINE__, (tag))
> > int xfs_errortag_add(struct xfs_mount *mp, unsigned int error_tag);
> > +int xfs_errortag_add_name(struct xfs_mount *mp, const char *tag_name);
> > +void xfs_errortag_copy(struct xfs_mount *dst_mp, struct xfs_mount *src_mp);
> > int xfs_errortag_clearall(struct xfs_mount *mp);
> > #else
> > #define xfs_errortag_init(mp) (0)
> > @@ -52,6 +54,8 @@ int xfs_errortag_clearall(struct xfs_mount *mp);
> > #define XFS_TEST_ERROR(mp, tag) (false)
> > #define XFS_ERRORTAG_DELAY(mp, tag) ((void)0)
> > #define xfs_errortag_add(mp, tag) (-ENOSYS)
> > +#define xfs_errortag_copy(dst_mp, src_mp) ((void)0)
> > +#define xfs_errortag_add_name(mp, tag_name) (-ENOSYS)
> > #define xfs_errortag_clearall(mp) (-ENOSYS)
> > #endif /* DEBUG */
> >
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index ee335dbe5811..d5aec07c3a5b 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -40,6 +40,7 @@
> > #include "xfs_defer.h"
> > #include "xfs_attr_item.h"
> > #include "xfs_xattr.h"
> > +#include "xfs_error.h"
> > #include "xfs_errortag.h"
> > #include "xfs_iunlink_item.h"
> > #include "xfs_dahash_test.h"
> > @@ -112,7 +113,7 @@ enum {
> > Opt_prjquota, Opt_uquota, Opt_gquota, Opt_pquota,
> > Opt_uqnoenforce, Opt_gqnoenforce, Opt_pqnoenforce, Opt_qnoenforce,
> > Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum, Opt_max_open_zones,
> > - Opt_lifetime, Opt_nolifetime, Opt_max_atomic_write,
> > + Opt_lifetime, Opt_nolifetime, Opt_max_atomic_write, Opt_errortag,
> > };
> >
> > #define fsparam_dead(NAME) \
> > @@ -171,6 +172,7 @@ static const struct fs_parameter_spec xfs_fs_parameters[] = {
> > fsparam_flag("lifetime", Opt_lifetime),
> > fsparam_flag("nolifetime", Opt_nolifetime),
> > fsparam_string("max_atomic_write", Opt_max_atomic_write),
> > + fsparam_string("errortag", Opt_errortag),
> > {}
> > };
> >
> > @@ -1581,6 +1583,8 @@ xfs_fs_parse_param(
> > return -EINVAL;
> > }
> > return 0;
> > + case Opt_errortag:
> > + return xfs_errortag_add_name(parsing_mp, param->string);
> > default:
> > xfs_warn(parsing_mp, "unknown mount option [%s].", param->key);
> > return -EINVAL;
> > @@ -2172,6 +2176,8 @@ xfs_fs_reconfigure(
> > if (error)
> > return error;
> >
> > + xfs_errortag_copy(mp, new_mp);
> > +
> > /* Validate new max_atomic_write option before making other changes */
> > if (mp->m_awu_max_bytes != new_mp->m_awu_max_bytes) {
> > error = xfs_set_max_atomic_write_opt(mp,
> > --
> > 2.47.3
> >
> >
>
next prev parent reply other threads:[~2026-01-28 16:11 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 16:05 stats and error injection for zoned GC Christoph Hellwig
2026-01-27 16:05 ` [PATCH 01/10] xfs: fix the errno sign for the xfs_errortag_{add,clearall} stubs Christoph Hellwig
2026-01-28 1:31 ` Darrick J. Wong
2026-01-28 10:50 ` Carlos Maiolino
2026-01-28 12:12 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 02/10] xfs: allocate m_errortag early Christoph Hellwig
2026-01-28 1:32 ` Darrick J. Wong
2026-01-28 3:42 ` Christoph Hellwig
2026-01-28 11:02 ` Carlos Maiolino
2026-01-28 12:12 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 03/10] xfs: don't validate error tags in the I/O path Christoph Hellwig
2026-01-28 1:33 ` Darrick J. Wong
2026-01-28 11:08 ` Carlos Maiolino
2026-01-28 12:14 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 04/10] xfs: move the guts of XFS_ERRORTAG_DELAY out of line Christoph Hellwig
2026-01-28 1:35 ` Darrick J. Wong
2026-01-28 3:44 ` Christoph Hellwig
2026-01-28 5:02 ` Darrick J. Wong
2026-01-28 5:03 ` Christoph Hellwig
2026-01-28 11:18 ` Carlos Maiolino
2026-01-28 14:10 ` Christoph Hellwig
2026-01-28 16:09 ` Darrick J. Wong
2026-01-28 17:43 ` Carlos Maiolino
2026-01-28 11:13 ` Carlos Maiolino
2026-01-28 12:14 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 05/10] xfs: use WRITE_ONCE/READ_ONCE for m_errortag Christoph Hellwig
2026-01-28 1:36 ` Darrick J. Wong
2026-01-28 11:21 ` Carlos Maiolino
2026-01-28 12:15 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 06/10] xfs: allow setting errortags at mount time Christoph Hellwig
2026-01-28 1:37 ` Darrick J. Wong
2026-01-28 3:45 ` Christoph Hellwig
2026-01-28 5:07 ` Darrick J. Wong
2026-01-28 5:12 ` Christoph Hellwig
2026-01-28 11:30 ` Carlos Maiolino
2026-01-28 14:11 ` Christoph Hellwig
2026-01-28 16:11 ` Darrick J. Wong [this message]
2026-01-28 16:13 ` Christoph Hellwig
2026-01-28 16:16 ` Darrick J. Wong
2026-01-28 17:48 ` Carlos Maiolino
2026-01-28 12:15 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 07/10] xfs: don't mark all discard issued by zoned GC as sync Christoph Hellwig
2026-01-28 1:38 ` Darrick J. Wong
2026-01-28 3:47 ` Christoph Hellwig
2026-01-28 11:30 ` Carlos Maiolino
2026-01-28 12:15 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 08/10] xfs: refactor zone reset handling Christoph Hellwig
2026-01-28 1:39 ` Darrick J. Wong
2026-01-28 11:34 ` Carlos Maiolino
2026-01-28 12:16 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 09/10] xfs: add zone reset error injection Christoph Hellwig
2026-01-28 1:39 ` Darrick J. Wong
2026-01-28 11:35 ` Carlos Maiolino
2026-01-28 12:19 ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 10/10] xfs: add sysfs stats for zoned GC Christoph Hellwig
2026-01-28 1:40 ` Darrick J. Wong
2026-01-28 11:37 ` Carlos Maiolino
2026-01-28 12:53 ` Hans Holmberg
2026-01-28 14:12 ` hch
2026-01-28 15:11 ` Hans Holmberg
2026-01-28 15:12 ` hch
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=20260128161142.GT5945@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=hans.holmberg@wdc.com \
--cc=hch@lst.de \
--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