@@ -672,8 +672,8 @@ static int binderfs_fill_super(struct super_block *sb, struct fs_context *fc)
* allowed to do. So removing the SB_I_NODEV flag from s_iflags is both
* necessary and safe.
*/
- sb->s_iflags &= ~SB_I_NODEV;
- sb->s_iflags |= SB_I_NOEXEC;
+ sb_clear_iflag(sb, _SB_I_NODEV);
+ sb_set_iflag(sb, _SB_I_NOEXEC);
sb->s_magic = BINDERFS_SUPER_MAGIC;
sb->s_op = &binderfs_super_ops;
sb->s_time_gran = 1;
@@ -950,7 +950,7 @@ static int btrfs_fill_super(struct super_block *sb,
#endif
sb->s_xattr = btrfs_xattr_handlers;
sb->s_time_gran = 1;
- sb->s_iflags |= SB_I_CGROUPWB;
+ sb_set_iflag(sb, _SB_I_CGROUPWB);
err = super_setup_bdi(sb);
if (err) {
@@ -428,7 +428,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
struct inode *inode;
int error;
- s->s_iflags &= ~SB_I_NODEV;
+ sb_clear_iflag(s, _SB_I_NODEV);
s->s_blocksize = 1024;
s->s_blocksize_bits = 10;
s->s_magic = DEVPTS_SUPER_MAGIC;
@@ -112,7 +112,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
bool path_noexec(const struct path *path)
{
return (path->mnt->mnt_flags & MNT_NOEXEC) ||
- (path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC);
+ sb_test_iflag(path->mnt->mnt_sb, _SB_I_NOEXEC);
}
#ifdef CONFIG_USELIB
@@ -916,7 +916,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
- sb->s_iflags |= SB_I_CGROUPWB;
+ sb_set_iflag(sb, _SB_I_CGROUPWB);
if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV &&
(EXT2_HAS_COMPAT_FEATURE(sb, ~0U) ||
@@ -4972,7 +4972,7 @@ static int ext4_check_journal_data_mode(struct super_block *sb)
if (test_opt(sb, DELALLOC))
clear_opt(sb, DELALLOC);
} else {
- sb->s_iflags |= SB_I_CGROUPWB;
+ sb_set_iflag(sb, _SB_I_CGROUPWB);
}
return 0;
@@ -4472,7 +4472,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
(test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0);
super_set_uuid(sb, (void *) raw_super->uuid, sizeof(raw_super->uuid));
super_set_sysfs_name_bdev(sb);
- sb->s_iflags |= SB_I_CGROUPWB;
+ sb_set_iflag(sb, _SB_I_CGROUPWB);
/* init f2fs-specific super block info */
sbi->valid_super_block = valid_super_block;
@@ -1566,9 +1566,9 @@ static void fuse_sb_defaults(struct super_block *sb)
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_time_gran = 1;
sb->s_export_op = &fuse_export_operations;
- sb->s_iflags |= SB_I_IMA_UNVERIFIABLE_SIGNATURE;
+ sb_set_iflag(sb, _SB_I_IMA_UNVERIFIABLE_SIGNATURE);
if (sb->s_user_ns != &init_user_ns)
- sb->s_iflags |= SB_I_UNTRUSTED_MOUNTER;
+ sb_set_iflag(sb, _SB_I_UNTRUSTED_MOUNTER);
sb->s_flags &= ~(SB_NOSEC | SB_I_VERSION);
}
@@ -216,7 +216,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
lockdep_set_class_and_name(&mapping->invalidate_lock,
&sb->s_type->invalidate_lock_key,
"mapping.invalidate_lock");
- if (sb->s_iflags & SB_I_STABLE_WRITES)
+ if (sb_test_iflag(sb, _SB_I_STABLE_WRITES))
mapping_set_stable_writes(mapping);
inode->i_private = NULL;
inode->i_mapping = mapping;
@@ -252,7 +252,8 @@ static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *k
info->sb = sb;
/* Userspace would break if executables or devices appear on sysfs */
- sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
+ sb_set_iflag(sb, _SB_I_NOEXEC);
+ sb_set_iflag(sb, _SB_I_NODEV);
sb->s_blocksize = PAGE_SIZE;
sb->s_blocksize_bits = PAGE_SHIFT;
sb->s_magic = kfc->magic;
@@ -3308,7 +3308,7 @@ EXPORT_SYMBOL(vfs_mkobj);
bool may_open_dev(const struct path *path)
{
return !(path->mnt->mnt_flags & MNT_NODEV) &&
- !(path->mnt->mnt_sb->s_iflags & SB_I_NODEV);
+ !sb_test_iflag(path->mnt->mnt_sb, _SB_I_NODEV);
}
static int may_open(struct mnt_idmap *idmap, const struct path *path,
@@ -2919,7 +2919,7 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
struct super_block *sb = mnt->mnt_sb;
if (!__mnt_is_readonly(mnt) &&
- (!(sb->s_iflags & SB_I_TS_EXPIRY_WARNED)) &&
+ !sb_test_iflag(sb, _SB_I_TS_EXPIRY_WARNED) &&
(ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
char *buf = (char *)__get_free_page(GFP_KERNEL);
char *mntpath = buf ? d_path(mountpoint, buf, PAGE_SIZE) : ERR_PTR(-ENOMEM);
@@ -2931,7 +2931,7 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
(unsigned long long)sb->s_time_max);
free_page((unsigned long)buf);
- sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
+ sb_set_iflag(sb, _SB_I_TS_EXPIRY_WARNED);
}
}
@@ -1094,7 +1094,7 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
sb->s_export_op = &nfs_export_ops;
break;
case 4:
- sb->s_iflags |= SB_I_NOUMASK;
+ sb_set_iflag(sb, _SB_I_NOUMASK);
sb->s_time_gran = 1;
sb->s_time_min = S64_MIN;
sb->s_time_max = S64_MAX;
@@ -1453,14 +1453,14 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
#ifdef CONFIG_FS_POSIX_ACL
sb->s_flags |= SB_POSIXACL;
#endif
- sb->s_iflags |= SB_I_SKIP_SYNC;
+ sb_set_iflag(sb, _SB_I_SKIP_SYNC);
/*
* Ensure that umask handling is done by the filesystems used
* for the the upper layer instead of overlayfs as that would
* lead to unexpected results.
*/
- sb->s_iflags |= SB_I_NOUMASK;
- sb->s_iflags |= SB_I_EVM_HMAC_UNSUPPORTED;
+ sb_set_iflag(sb, _SB_I_NOUMASK);
+ sb_set_iflag(sb, _SB_I_EVM_HMAC_UNSUPPORTED);
err = -ENOMEM;
root_dentry = ovl_get_root(sb, ctx->upper.dentry, oe);
@@ -171,7 +171,9 @@ static int proc_fill_super(struct super_block *s, struct fs_context *fc)
proc_apply_options(fs_info, fc, current_user_ns());
/* User space would break if executables or devices appear on proc */
- s->s_iflags |= SB_I_USERNS_VISIBLE | SB_I_NOEXEC | SB_I_NODEV;
+ sb_set_iflag(s, _SB_I_USERNS_VISIBLE);
+ sb_set_iflag(s, _SB_I_NOEXEC);
+ sb_set_iflag(s, _SB_I_NODEV);
s->s_flags |= SB_NODIRATIME | SB_NOSUID | SB_NOEXEC;
s->s_blocksize = 1024;
s->s_blocksize_bits = 10;
@@ -355,7 +355,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
s->s_bdi = &noop_backing_dev_info;
s->s_flags = flags;
if (s->s_user_ns != &init_user_ns)
- s->s_iflags |= SB_I_NODEV;
+ sb_set_iflag(s, _SB_I_NODEV);
INIT_HLIST_NODE(&s->s_instances);
INIT_HLIST_BL_HEAD(&s->s_roots);
mutex_init(&s->s_sync_lock);
@@ -589,11 +589,11 @@ void retire_super(struct super_block *sb)
{
WARN_ON(!sb->s_bdev);
__super_lock_excl(sb);
- if (sb->s_iflags & SB_I_PERSB_BDI) {
+ if (sb_test_iflag(sb, _SB_I_PERSB_BDI)) {
bdi_unregister(sb->s_bdi);
- sb->s_iflags &= ~SB_I_PERSB_BDI;
+ sb_clear_iflag(sb, _SB_I_PERSB_BDI);
}
- sb->s_iflags |= SB_I_RETIRED;
+ sb_set_iflag(sb, _SB_I_RETIRED);
super_unlock_excl(sb);
}
EXPORT_SYMBOL(retire_super);
@@ -678,7 +678,7 @@ void generic_shutdown_super(struct super_block *sb)
super_wake(sb, SB_DYING);
super_unlock_excl(sb);
if (sb->s_bdi != &noop_backing_dev_info) {
- if (sb->s_iflags & SB_I_PERSB_BDI)
+ if (sb_test_iflag(sb, _SB_I_PERSB_BDI))
bdi_unregister(sb->s_bdi);
bdi_put(sb->s_bdi);
sb->s_bdi = &noop_backing_dev_info;
@@ -1331,7 +1331,7 @@ static int super_s_dev_set(struct super_block *s, struct fs_context *fc)
static int super_s_dev_test(struct super_block *s, struct fs_context *fc)
{
- return !(s->s_iflags & SB_I_RETIRED) &&
+ return !sb_test_iflag(s, _SB_I_RETIRED) &&
s->s_dev == *(dev_t *)fc->sget_key;
}
@@ -1584,7 +1584,7 @@ int setup_bdev_super(struct super_block *sb, int sb_flags,
sb->s_bdev = bdev;
sb->s_bdi = bdi_get(bdev->bd_disk->bdi);
if (bdev_stable_writes(bdev))
- sb->s_iflags |= SB_I_STABLE_WRITES;
+ sb_set_iflag(sb, _SB_I_STABLE_WRITES);
spin_unlock(&sb_lock);
snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev);
@@ -1648,7 +1648,7 @@ EXPORT_SYMBOL(get_tree_bdev);
static int test_bdev_super(struct super_block *s, void *data)
{
- return !(s->s_iflags & SB_I_RETIRED) && s->s_dev == *(dev_t *)data;
+ return !sb_test_iflag(s, _SB_I_RETIRED) && s->s_dev == *(dev_t *)data;
}
struct dentry *mount_bdev(struct file_system_type *fs_type,
@@ -1864,7 +1864,7 @@ int super_setup_bdi_name(struct super_block *sb, char *fmt, ...)
}
WARN_ON(sb->s_bdi != &noop_backing_dev_info);
sb->s_bdi = bdi;
- sb->s_iflags |= SB_I_PERSB_BDI;
+ sb_set_iflag(sb, _SB_I_PERSB_BDI);
return 0;
}
@@ -79,7 +79,7 @@ static void sync_inodes_one_sb(struct super_block *sb, void *arg)
static void sync_fs_one_sb(struct super_block *sb, void *arg)
{
- if (!sb_rdonly(sb) && !(sb->s_iflags & SB_I_SKIP_SYNC) &&
+ if (!sb_rdonly(sb) && !sb_test_iflag(sb, _SB_I_SKIP_SYNC) &&
sb->s_op->sync_fs)
sb->s_op->sync_fs(sb, *(int *)arg);
}
@@ -33,7 +33,7 @@ static int sysfs_get_tree(struct fs_context *fc)
return ret;
if (kfc->new_sb_created)
- fc->root->d_sb->s_iflags |= SB_I_USERNS_VISIBLE;
+ sb_set_iflag(fc->root->d_sb, _SB_I_USERNS_VISIBLE);
return 0;
}
@@ -1701,7 +1701,7 @@ xfs_fs_fill_super(
sb->s_time_max = XFS_LEGACY_TIME_MAX;
}
trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max);
- sb->s_iflags |= SB_I_CGROUPWB;
+ sb_set_iflag(sb, _SB_I_CGROUPWB);
set_posix_acl_flag(sb);
@@ -176,7 +176,7 @@ static inline bool inode_cgwb_enabled(struct inode *inode)
return cgroup_subsys_on_dfl(memory_cgrp_subsys) &&
cgroup_subsys_on_dfl(io_cgrp_subsys) &&
(bdi->capabilities & BDI_CAP_WRITEBACK) &&
- (inode->i_sb->s_iflags & SB_I_CGROUPWB);
+ sb_test_iflag(inode->i_sb, _SB_I_CGROUPWB);
}
/**
@@ -107,7 +107,7 @@ extern void unlock_rename(struct dentry *, struct dentry *);
*/
static inline umode_t __must_check mode_strip_umask(const struct inode *dir, umode_t mode)
{
- if (!IS_POSIXACL(dir) && !(dir->i_sb->s_iflags & SB_I_NOUMASK))
+ if (!IS_POSIXACL(dir) && !sb_test_iflag(dir->i_sb, _SB_I_NOUMASK))
mode &= ~current_umask();
return mode;
}
@@ -406,7 +406,8 @@ static int mqueue_fill_super(struct super_block *sb, struct fs_context *fc)
struct inode *inode;
struct ipc_namespace *ns = sb->s_fs_info;
- sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
+ sb_set_iflag(sb, _SB_I_NOEXEC);
+ sb_set_iflag(sb, _SB_I_NODEV);
sb->s_blocksize = PAGE_SIZE;
sb->s_blocksize_bits = PAGE_SHIFT;
sb->s_magic = MQUEUE_MAGIC;
@@ -155,7 +155,7 @@ static int is_unsupported_hmac_fs(struct dentry *dentry)
{
struct inode *inode = d_backing_inode(dentry);
- if (inode->i_sb->s_iflags & SB_I_EVM_HMAC_UNSUPPORTED) {
+ if (sb_test_iflag(inode->i_sb, _SB_I_EVM_HMAC_UNSUPPORTED)) {
pr_info_once("%s not supported\n", inode->i_sb->s_type->name);
return 1;
}
@@ -564,8 +564,8 @@ int ima_appraise_measurement(enum ima_hooks func, struct ima_iint_cache *iint,
* system not willing to accept such a risk, fail the file signature
* verification.
*/
- if ((inode->i_sb->s_iflags & SB_I_IMA_UNVERIFIABLE_SIGNATURE) &&
- ((inode->i_sb->s_iflags & SB_I_UNTRUSTED_MOUNTER) ||
+ if (sb_test_iflag(inode->i_sb, _SB_I_IMA_UNVERIFIABLE_SIGNATURE) &&
+ (sb_test_iflag(inode->i_sb, _SB_I_UNTRUSTED_MOUNTER) ||
(iint->flags & IMA_FAIL_UNVERIFIABLE_SIGS))) {
status = INTEGRITY_FAIL;
cause = "unverifiable-signature";
@@ -280,8 +280,8 @@ static int process_measurement(struct file *file, const struct cred *cred,
* (Limited to privileged mounted filesystems.)
*/
if (test_and_clear_bit(IMA_CHANGE_XATTR, &iint->atomic_flags) ||
- ((inode->i_sb->s_iflags & SB_I_IMA_UNVERIFIABLE_SIGNATURE) &&
- !(inode->i_sb->s_iflags & SB_I_UNTRUSTED_MOUNTER) &&
+ (sb_test_iflag(inode->i_sb, _SB_I_IMA_UNVERIFIABLE_SIGNATURE) &&
+ !sb_test_iflag(inode->i_sb, _SB_I_UNTRUSTED_MOUNTER) &&
!(action & IMA_FAIL_UNVERIFIABLE_SIGS))) {
iint->flags &= ~IMA_DONE_MASK;
iint->measured_pcrs = 0;
Convert remaining handling of sb->s_iflags to use the new helper functions and new bit constants. The patch was generated using coccinelle with a few manual fixups to improve code style. Signed-off-by: Jan Kara <jack@suse.cz> --- drivers/android/binderfs.c | 4 ++-- fs/btrfs/super.c | 2 +- fs/devpts/inode.c | 2 +- fs/exec.c | 2 +- fs/ext2/super.c | 2 +- fs/ext4/super.c | 2 +- fs/f2fs/super.c | 2 +- fs/fuse/inode.c | 4 ++-- fs/inode.c | 2 +- fs/kernfs/mount.c | 3 ++- fs/namei.c | 2 +- fs/namespace.c | 4 ++-- fs/nfs/super.c | 2 +- fs/overlayfs/super.c | 6 +++--- fs/proc/root.c | 4 +++- fs/super.c | 18 +++++++++--------- fs/sync.c | 2 +- fs/sysfs/mount.c | 2 +- fs/xfs/xfs_super.c | 2 +- include/linux/backing-dev.h | 2 +- include/linux/namei.h | 2 +- ipc/mqueue.c | 3 ++- security/integrity/evm/evm_main.c | 2 +- security/integrity/ima/ima_appraise.c | 4 ++-- security/integrity/ima/ima_main.c | 4 ++-- 25 files changed, 44 insertions(+), 40 deletions(-)