Skip to content

Commit cd2286f

Browse files
committed
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
2 parents 064a4a5 + d8d222e commit cd2286f

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

fs/xfs/xfs_super.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,18 @@ xfs_fs_fill_super(
14961496

14971497
mp->m_super = sb;
14981498

1499+
/*
1500+
* Copy VFS mount flags from the context now that all parameter parsing
1501+
* is guaranteed to have been completed by either the old mount API or
1502+
* the newer fsopen/fsconfig API.
1503+
*/
1504+
if (fc->sb_flags & SB_RDONLY)
1505+
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
1506+
if (fc->sb_flags & SB_DIRSYNC)
1507+
mp->m_features |= XFS_FEAT_DIRSYNC;
1508+
if (fc->sb_flags & SB_SYNCHRONOUS)
1509+
mp->m_features |= XFS_FEAT_WSYNC;
1510+
14991511
error = xfs_fs_validate_params(mp);
15001512
if (error)
15011513
return error;
@@ -1965,6 +1977,11 @@ static const struct fs_context_operations xfs_context_ops = {
19651977
.free = xfs_fs_free,
19661978
};
19671979

1980+
/*
1981+
* WARNING: do not initialise any parameters in this function that depend on
1982+
* mount option parsing having already been performed as this can be called from
1983+
* fsopen() before any parameters have been set.
1984+
*/
19681985
static int xfs_init_fs_context(
19691986
struct fs_context *fc)
19701987
{
@@ -1996,16 +2013,6 @@ static int xfs_init_fs_context(
19962013
mp->m_logbsize = -1;
19972014
mp->m_allocsize_log = 16; /* 64k */
19982015

1999-
/*
2000-
* Copy binary VFS mount flags we are interested in.
2001-
*/
2002-
if (fc->sb_flags & SB_RDONLY)
2003-
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
2004-
if (fc->sb_flags & SB_DIRSYNC)
2005-
mp->m_features |= XFS_FEAT_DIRSYNC;
2006-
if (fc->sb_flags & SB_SYNCHRONOUS)
2007-
mp->m_features |= XFS_FEAT_WSYNC;
2008-
20092016
fc->s_fs_info = mp;
20102017
fc->ops = &xfs_context_ops;
20112018

0 commit comments

Comments
 (0)