Skip to content

Commit

Permalink
Linux 5.0 compat: Convert MS_* macros to SB_*
Browse files Browse the repository at this point in the history
In the 5.0 kernel, only the mount namespace code should use the MS_*
macos. Filesystems should use the SB_* ones.

https://patchwork.kernel.org/patch/10552493/

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes openzfs#8264
  • Loading branch information
tonyhutter authored and behlendorf committed Jan 28, 2019
1 parent 031cea1 commit 0580549
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <sys/zio.h>
#include <linux/mod_compat.h>
#include <linux/msdos_fs.h>
#include <linux/vfs_compat.h>

char *zfs_vdev_scheduler = VDEV_SCHEDULER;
static void *zfs_vdev_holder = VDEV_HOLDER;
Expand Down Expand Up @@ -79,7 +80,7 @@ vdev_bdev_mode(int smode)
ASSERT3S(smode & (FREAD | FWRITE), !=, 0);

if ((smode & FREAD) && !(smode & FWRITE))
mode = MS_RDONLY;
mode = SB_RDONLY;

return (mode);
}
Expand Down
23 changes: 12 additions & 11 deletions module/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <sys/dmu_objset.h>
#include <sys/spa_boot.h>
#include <sys/zpl.h>
#include <linux/vfs_compat.h>
#include "zfs_comutil.h"

enum {
Expand Down Expand Up @@ -249,7 +250,7 @@ zfsvfs_parse_options(char *mntopts, vfs_t **vfsp)
boolean_t
zfs_is_readonly(zfsvfs_t *zfsvfs)
{
return (!!(zfsvfs->z_sb->s_flags & MS_RDONLY));
return (!!(zfsvfs->z_sb->s_flags & SB_RDONLY));
}

/*ARGSUSED*/
Expand Down Expand Up @@ -336,15 +337,15 @@ acltype_changed_cb(void *arg, uint64_t newval)
switch (newval) {
case ZFS_ACLTYPE_OFF:
zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF;
zfsvfs->z_sb->s_flags &= ~MS_POSIXACL;
zfsvfs->z_sb->s_flags &= ~SB_POSIXACL;
break;
case ZFS_ACLTYPE_POSIXACL:
#ifdef CONFIG_FS_POSIX_ACL
zfsvfs->z_acl_type = ZFS_ACLTYPE_POSIXACL;
zfsvfs->z_sb->s_flags |= MS_POSIXACL;
zfsvfs->z_sb->s_flags |= SB_POSIXACL;
#else
zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF;
zfsvfs->z_sb->s_flags &= ~MS_POSIXACL;
zfsvfs->z_sb->s_flags &= ~SB_POSIXACL;
#endif /* CONFIG_FS_POSIX_ACL */
break;
default:
Expand Down Expand Up @@ -373,9 +374,9 @@ readonly_changed_cb(void *arg, uint64_t newval)
return;

if (newval)
sb->s_flags |= MS_RDONLY;
sb->s_flags |= SB_RDONLY;
else
sb->s_flags &= ~MS_RDONLY;
sb->s_flags &= ~SB_RDONLY;
}

static void
Expand Down Expand Up @@ -403,9 +404,9 @@ nbmand_changed_cb(void *arg, uint64_t newval)
return;

if (newval == TRUE)
sb->s_flags |= MS_MANDLOCK;
sb->s_flags |= SB_MANDLOCK;
else
sb->s_flags &= ~MS_MANDLOCK;
sb->s_flags &= ~SB_MANDLOCK;
}

static void
Expand Down Expand Up @@ -1954,16 +1955,16 @@ zfs_remount(struct super_block *sb, int *flags, zfs_mnt_t *zm)
int error;

if ((issnap || !spa_writeable(dmu_objset_spa(zfsvfs->z_os))) &&
!(*flags & MS_RDONLY)) {
*flags |= MS_RDONLY;
!(*flags & SB_RDONLY)) {
*flags |= SB_RDONLY;
return (EROFS);
}

error = zfsvfs_parse_options(zm->mnt_data, &vfsp);
if (error)
return (error);

if (!zfs_is_readonly(zfsvfs) && (*flags & MS_RDONLY))
if (!zfs_is_readonly(zfsvfs) && (*flags & SB_RDONLY))
txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0);

zfs_unregister_callbacks(zfsvfs);
Expand Down

0 comments on commit 0580549

Please sign in to comment.