From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>,
Hans Holmberg <hans.holmberg@wdc.com>,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 02/10] xfs: allocate m_errortag early
Date: Tue, 27 Jan 2026 17:32:59 -0800 [thread overview]
Message-ID: <20260128013259.GB5945@frogsfrogsfrogs> (raw)
In-Reply-To: <20260127160619.330250-3-hch@lst.de>
On Tue, Jan 27, 2026 at 05:05:42PM +0100, Christoph Hellwig wrote:
> Ensure the mount structure always has a valid m_errortag for debug
> builds. This removes the NULL checking from the runtime code, and
> prepares for allowing to set errortags from mount.
Hrmm. Are you /sure/ you want to allow errortag mount options?
Saying that only because I really hate mount options.
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Pre-failing the errortag array creation doesn't bother me that much
though, so
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_error.c | 26 +-------------------------
> fs/xfs/xfs_super.c | 12 ++++++++++++
> 2 files changed, 13 insertions(+), 25 deletions(-)
>
> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> index 873f2d1a134c..dfa4abf9fd1a 100644
> --- a/fs/xfs/xfs_error.c
> +++ b/fs/xfs/xfs_error.c
> @@ -114,18 +114,8 @@ int
> xfs_errortag_init(
> struct xfs_mount *mp)
> {
> - int ret;
> -
> - mp->m_errortag = kzalloc(sizeof(unsigned int) * XFS_ERRTAG_MAX,
> - GFP_KERNEL | __GFP_RETRY_MAYFAIL);
> - if (!mp->m_errortag)
> - return -ENOMEM;
> -
> - ret = xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype,
> + return xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype,
> &mp->m_kobj, "errortag");
> - if (ret)
> - kfree(mp->m_errortag);
> - return ret;
> }
>
> void
> @@ -133,7 +123,6 @@ xfs_errortag_del(
> struct xfs_mount *mp)
> {
> xfs_sysfs_del(&mp->m_errortag_kobj);
> - kfree(mp->m_errortag);
> }
>
> static bool
> @@ -154,8 +143,6 @@ xfs_errortag_enabled(
> struct xfs_mount *mp,
> unsigned int tag)
> {
> - if (!mp->m_errortag)
> - return false;
> if (!xfs_errortag_valid(tag))
> return false;
>
> @@ -171,17 +158,6 @@ xfs_errortag_test(
> {
> unsigned int randfactor;
>
> - /*
> - * To be able to use error injection anywhere, we need to ensure error
> - * injection mechanism is already initialized.
> - *
> - * Code paths like I/O completion can be called before the
> - * initialization is complete, but be able to inject errors in such
> - * places is still useful.
> - */
> - if (!mp->m_errortag)
> - return false;
> -
> if (!xfs_errortag_valid(error_tag))
> return false;
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index e05bf62a5413..ee335dbe5811 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_errortag.h"
> #include "xfs_iunlink_item.h"
> #include "xfs_dahash_test.h"
> #include "xfs_rtbitmap.h"
> @@ -822,6 +823,9 @@ xfs_mount_free(
> debugfs_remove(mp->m_debugfs);
> kfree(mp->m_rtname);
> kfree(mp->m_logname);
> +#ifdef DEBUG
> + kfree(mp->m_errortag);
> +#endif
> kfree(mp);
> }
>
> @@ -2254,6 +2258,14 @@ xfs_init_fs_context(
> mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL);
> if (!mp)
> return -ENOMEM;
> +#ifdef DEBUG
> + mp->m_errortag = kcalloc(XFS_ERRTAG_MAX, sizeof(*mp->m_errortag),
> + GFP_KERNEL);
> + if (!mp->m_errortag) {
> + kfree(mp);
> + return -ENOMEM;
> + }
> +#endif
>
> spin_lock_init(&mp->m_sb_lock);
> for (i = 0; i < XG_TYPE_MAX; i++)
> --
> 2.47.3
>
>
next prev parent reply other threads:[~2026-01-28 1:33 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 [this message]
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
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=20260128013259.GB5945@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