diff options
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/zfs_vfsops.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index b60045a95..33557157b 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -1763,8 +1763,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); @@ -1774,7 +1781,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); } |