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
Unified · Split
| @@ -1496,6 +1496,18 @@ xfs_fs_fill_super( · 1495 unmodified lines | ||
| 1496 | 1496 | |
| 1497 | 1497 | mp->m_super = sb; |
| 1498 | 1498 | |
| 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 | + | |
| 1499 | 1511 | error = xfs_fs_validate_params(mp); |
| 1500 | 1512 | if (error) |
| 1501 | 1513 | return error; |
| @@ -1965,6 +1977,11 @@ static const struct fs_context_operations xfs_context_ops = { · 463 unmodified lines | ||
| 1965 | 1977 | .free = xfs_fs_free, |
| 1966 | 1978 | }; |
| 1967 | 1979 | |
| 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 | + */ | |
| 1968 | 1985 | static int xfs_init_fs_context( |
| 1969 | 1986 | struct fs_context *fc) |
| 1970 | 1987 | { |
| @@ -1996,16 +2013,6 @@ static int xfs_init_fs_context( · 25 unmodified lines | ||
| 1996 | 2013 | mp->m_logbsize = -1; |
| 1997 | 2014 | mp->m_allocsize_log = 16; /* 64k */ |
| 1998 | 2015 | |
| 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 | − | |
| 2009 | 2016 | fc->s_fs_info = mp; |
| 2010 | 2017 | fc->ops = &xfs_context_ops; |
| 2011 | 2018 | |