mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix remounting snapshots read-write
It's not enough to preserve/restore MS_RDONLY on the superblock flags to avoid remounting a snapshot read-write: be explicit about our intentions to the VFS layer so the readonly bit is updated correctly in do_remount_sb(). Reviewed-by: Chunwei Chen <tuxoko@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #6510 Closes #6515
This commit is contained in:
@@ -1761,8 +1761,15 @@ zfs_remount(struct super_block *sb, int *flags, zfs_mnt_t *zm)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = sb->s_fs_info;
|
||||
vfs_t *vfsp;
|
||||
boolean_t issnap = dmu_objset_is_snapshot(zfsvfs->z_os);
|
||||
int error;
|
||||
|
||||
if ((issnap || !spa_writeable(dmu_objset_spa(zfsvfs->z_os))) &&
|
||||
!(*flags & MS_RDONLY)) {
|
||||
*flags |= MS_RDONLY;
|
||||
return (EROFS);
|
||||
}
|
||||
|
||||
error = zfsvfs_parse_options(zm->mnt_data, &vfsp);
|
||||
if (error)
|
||||
return (error);
|
||||
@@ -1772,7 +1779,8 @@ zfs_remount(struct super_block *sb, int *flags, zfs_mnt_t *zm)
|
||||
|
||||
vfsp->vfs_data = zfsvfs;
|
||||
zfsvfs->z_vfs = vfsp;
|
||||
(void) zfs_register_callbacks(vfsp);
|
||||
if (!issnap)
|
||||
(void) zfs_register_callbacks(vfsp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user