Skip to content

Commit ec86bfe

Browse files
Eric Sandeengregkh
authored andcommitted
xfs: disallow rw remount on fs with unknown ro-compat features
commit d0a58e833931234c44e515b5b8bede32bd4e6eed upstream. Today, a kernel which refuses to mount a filesystem read-write due to unknown ro-compat features can still transition to read-write via the remount path. The old kernel is most likely none the wiser, because it's unaware of the new feature, and isn't using it. However, writing to the filesystem may well corrupt metadata related to that new feature, and moving to a newer kernel which understand the feature will have problems. Right now the only ro-compat feature we have is the free inode btree, which showed up in v3.16. It would be good to push this back to all the active stable kernels, I think, so that if anyone is using newer mkfs (which enables the finobt feature) with older kernel releases, they'll be protected. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Bill O'Donnell <billodo@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8edc7f0 commit ec86bfe

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

fs/xfs/xfs_super.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,16 @@ xfs_fs_remount(
12331233
return -EINVAL;
12341234
}
12351235

1236+
if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
1237+
xfs_sb_has_ro_compat_feature(sbp,
1238+
XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
1239+
xfs_warn(mp,
1240+
"ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem",
1241+
(sbp->sb_features_ro_compat &
1242+
XFS_SB_FEAT_RO_COMPAT_UNKNOWN));
1243+
return -EINVAL;
1244+
}
1245+
12361246
mp->m_flags &= ~XFS_MOUNT_RDONLY;
12371247

12381248
/*

0 commit comments

Comments
 (0)