Bug fixes for 6.8-rc2:

* Fix read only mounts when using fsopen mount API
 
 Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQjMC4mbgVeU7MxEIYH7y4RirJu9AUCZbCl9wAKCRAH7y4RirJu
 9AbqAP43B2qBRn2o16MrK3qwGTNOvecck1Nze1klaQIKnwyTAQD7BbcpuNlLOKqZ
 7HkZcaXnyIrzNm1DrnDFX1zIagDY+QA=
 =S9zy
 -----END PGP SIGNATURE-----

Merge tag 'xfs-6.8-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fix from Chandan Babu:

 - Fix read only mounts when using fsopen mount API

* tag 'xfs-6.8-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: read only mounts with fsopen mount API are busted
This commit is contained in:
Linus Torvalds 2024-01-27 09:17:01 -08:00
commit cd2286fc57

View File

@ -1496,6 +1496,18 @@ xfs_fs_fill_super(
mp->m_super = sb;
/*
* Copy VFS mount flags from the context now that all parameter parsing
* is guaranteed to have been completed by either the old mount API or
* the newer fsopen/fsconfig API.
*/
if (fc->sb_flags & SB_RDONLY)
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
if (fc->sb_flags & SB_DIRSYNC)
mp->m_features |= XFS_FEAT_DIRSYNC;
if (fc->sb_flags & SB_SYNCHRONOUS)
mp->m_features |= XFS_FEAT_WSYNC;
error = xfs_fs_validate_params(mp);
if (error)
return error;
@ -1965,6 +1977,11 @@ static const struct fs_context_operations xfs_context_ops = {
.free = xfs_fs_free,
};
/*
* WARNING: do not initialise any parameters in this function that depend on
* mount option parsing having already been performed as this can be called from
* fsopen() before any parameters have been set.
*/
static int xfs_init_fs_context(
struct fs_context *fc)
{
@ -1996,16 +2013,6 @@ static int xfs_init_fs_context(
mp->m_logbsize = -1;
mp->m_allocsize_log = 16; /* 64k */
/*
* Copy binary VFS mount flags we are interested in.
*/
if (fc->sb_flags & SB_RDONLY)
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
if (fc->sb_flags & SB_DIRSYNC)
mp->m_features |= XFS_FEAT_DIRSYNC;
if (fc->sb_flags & SB_SYNCHRONOUS)
mp->m_features |= XFS_FEAT_WSYNC;
fc->s_fs_info = mp;
fc->ops = &xfs_context_ops;