Skip to content

Commit

Permalink
Merge tag 'xfs-6.8-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xf…
Browse files Browse the repository at this point in the history
…s-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
  • Loading branch information
torvalds committed Jan 27, 2024
2 parents 064a4a5 + d8d222e commit cd2286f
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions fs/xfs/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit cd2286f

Please sign in to comment.