From: Long Li <leo.lilong@huawei.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: <cem@kernel.org>, <linux-xfs@vger.kernel.org>,
<david@fromorbit.com>, <yi.zhang@huawei.com>,
<houtao1@huawei.com>, <yangerkun@huawei.com>,
<lonuxli.64@gmail.com>
Subject: Re: [PATCH 1/2] xfs: correct the sb_rgcount when the disk not support rt volume
Date: Tue, 7 Jan 2025 21:11:23 +0800 [thread overview]
Message-ID: <Z30n-9IusvggTuwP@localhost.localdomain> (raw)
In-Reply-To: <20250106195220.GK6174@frogsfrogsfrogs>
On Mon, Jan 06, 2025 at 11:52:20AM -0800, Darrick J. Wong wrote:
> On Tue, Dec 31, 2024 at 10:34:22AM +0800, Long Li wrote:
> > When mounting an xfs disk that incompat with metadir and has no realtime
> > subvolume, if CONFIG_XFS_RT is not enabled in the kernel, the mount will
> > fail. During superblock log recovery, since mp->m_sb.sb_rgcount is greater
> > than 0, updating the last rtag in-core is required, however, without
> > CONFIG_XFS_RT enabled, xfs_update_last_rtgroup_size() always returns
> > -EOPNOTSUPP, leading to mount failure.
>
> Didn't we fix the xfs_update_last_rtgroup_size stub to return 0?
>
> --D
Indeed, when CONFIG_XFS_RT is not enabled, xfs_update_last_rtgroup_size() should
return 0, as returning an error is meaningless.
1) For kernels without CONFIG_XFS_RT, mounting an image with realtime subvolume will
fail at xfs_rtmount_init().
2) For kernels without CONFIG_XFS_RT, mounting an image without realtime subvolume
should succeed.
However, in the current scenario, should sb_rgcount be initialized to 0 ? it will
consistent with metadir feature is enabled. The xfs-documentation [1] describes
sb_rgcount as follows:
"Count of realtime groups in the filesystem, if the XFS_SB_FEAT_RO_INCOMPAT_METADIR
feature is enabled. If no realtime subvolume exists, this value will be zero."
[1] https://git.kernel.org/pub/scm/fs/xfs/xfs-documentation.git/tree/design/XFS_Filesystem_Structure/superblock.asciidoc
Thanks,
Long Li
>
> > Initializing sb_rgcount as 1 is incorrect in this scenario. If no
> > realtime subvolume exists, the value of sb_rgcount should be set
> > to zero. Fix it by initializing sb_rgcount based on the actual number
> > of realtime blocks.
> >
> > Fixes: 87fe4c34a383 ("xfs: create incore realtime group structures")
> > Signed-off-by: Long Li <leo.lilong@huawei.com>
> > ---
> > fs/xfs/libxfs/xfs_sb.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> > index 3b5623611eba..1ea28f04b75a 100644
> > --- a/fs/xfs/libxfs/xfs_sb.c
> > +++ b/fs/xfs/libxfs/xfs_sb.c
> > @@ -830,7 +830,7 @@ __xfs_sb_from_disk(
> > to->sb_rsumino = NULLFSINO;
> > } else {
> > to->sb_metadirino = NULLFSINO;
> > - to->sb_rgcount = 1;
> > + to->sb_rgcount = to->sb_rblocks > 0 ? 1 : 0;
> > to->sb_rgextents = 0;
> > }
> > }
> > --
> > 2.39.2
> >
> >
>
next prev parent reply other threads:[~2025-01-07 13:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-31 2:34 [PATCH 0/2] xfs: fix two issues regarding mount failures Long Li
2024-12-31 2:34 ` [PATCH 1/2] xfs: correct the sb_rgcount when the disk not support rt volume Long Li
2025-01-06 19:52 ` Darrick J. Wong
2025-01-07 13:11 ` Long Li [this message]
2025-01-08 0:32 ` Darrick J. Wong
2025-01-08 1:26 ` Long Li
2025-01-08 6:58 ` Christoph Hellwig
2025-01-08 7:22 ` Long Li
2025-01-08 6:55 ` Christoph Hellwig
2025-01-08 7:10 ` Long Li
2024-12-31 2:34 ` [PATCH 2/2] xfs: fix mount hang during primary superblock recovery failure Long Li
2025-01-06 19:55 ` Darrick J. Wong
2025-01-07 13:39 ` Long Li
2025-01-08 0:34 ` Darrick J. Wong
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=Z30n-9IusvggTuwP@localhost.localdomain \
--to=leo.lilong@huawei.com \
--cc=cem@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=houtao1@huawei.com \
--cc=linux-xfs@vger.kernel.org \
--cc=lonuxli.64@gmail.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.