Skip to content

Commit 0f0d127

Browse files
committed
Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull mount flag updates from Al Viro: "Another chunk of fmount preparations from dhowells; only trivial conflicts for that part. It separates MS_... bits (very grotty mount(2) ABI) from the struct super_block ->s_flags (kernel-internal, only a small subset of MS_... stuff). This does *not* convert the filesystems to new constants; only the infrastructure is done here. The next step in that series is where the conflicts would be; that's the conversion of filesystems. It's purely mechanical and it's better done after the merge, so if you could run something like list=$(for i in MS_RDONLY MS_NOSUID MS_NODEV MS_NOEXEC MS_SYNCHRONOUS MS_MANDLOCK MS_DIRSYNC MS_NOATIME MS_NODIRATIME MS_SILENT MS_POSIXACL MS_KERNMOUNT MS_I_VERSION MS_LAZYTIME; do git grep -l $i fs drivers/staging/lustre drivers/mtd ipc mm include/linux; done|sort|uniq|grep -v '^fs/namespace.c$') sed -i -e 's/\<MS_RDONLY\>/SB_RDONLY/g' \ -e 's/\<MS_NOSUID\>/SB_NOSUID/g' \ -e 's/\<MS_NODEV\>/SB_NODEV/g' \ -e 's/\<MS_NOEXEC\>/SB_NOEXEC/g' \ -e 's/\<MS_SYNCHRONOUS\>/SB_SYNCHRONOUS/g' \ -e 's/\<MS_MANDLOCK\>/SB_MANDLOCK/g' \ -e 's/\<MS_DIRSYNC\>/SB_DIRSYNC/g' \ -e 's/\<MS_NOATIME\>/SB_NOATIME/g' \ -e 's/\<MS_NODIRATIME\>/SB_NODIRATIME/g' \ -e 's/\<MS_SILENT\>/SB_SILENT/g' \ -e 's/\<MS_POSIXACL\>/SB_POSIXACL/g' \ -e 's/\<MS_KERNMOUNT\>/SB_KERNMOUNT/g' \ -e 's/\<MS_I_VERSION\>/SB_I_VERSION/g' \ -e 's/\<MS_LAZYTIME\>/SB_LAZYTIME/g' \ $list and commit it with something along the lines of 'convert filesystems away from use of MS_... constants' as commit message, it would save a quite a bit of headache next cycle" * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: VFS: Differentiate mount flags (MS_*) from internal superblock flags VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb) vfs: Add sb_rdonly(sb) to query the MS_RDONLY flag on s_flags
2 parents 581bfce + e462ec5 commit 0f0d127

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+314
-296
lines changed

Documentation/filesystems/porting

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ anything from oops to silent memory corruption.
228228
---
229229
[mandatory]
230230

231-
FS_NOMOUNT is gone. If you use it - just set MS_NOUSER in flags
231+
FS_NOMOUNT is gone. If you use it - just set SB_NOUSER in flags
232232
(see rootfs for one kind of solution and bdev/socket/pipe for another).
233233

234234
---

drivers/staging/lustre/lustre/llite/llite_lib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
210210
data->ocd_ibits_known = MDS_INODELOCK_FULL;
211211
data->ocd_version = LUSTRE_VERSION_CODE;
212212

213-
if (sb->s_flags & MS_RDONLY)
213+
if (sb_rdonly(sb))
214214
data->ocd_connect_flags |= OBD_CONNECT_RDONLY;
215215
if (sbi->ll_flags & LL_SBI_USER_XATTR)
216216
data->ocd_connect_flags |= OBD_CONNECT_XATTR;
@@ -2031,7 +2031,7 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data)
20312031
int err;
20322032
__u32 read_only;
20332033

2034-
if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
2034+
if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) {
20352035
read_only = *flags & MS_RDONLY;
20362036
err = obd_set_info_async(NULL, sbi->ll_md_exp,
20372037
sizeof(KEY_READ_ONLY),

drivers/staging/lustre/lustre/llite/namei.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
561561
}
562562
}
563563

564-
if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE &&
565-
dentry->d_sb->s_flags & MS_RDONLY)
564+
if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && sb_rdonly(dentry->d_sb))
566565
return ERR_PTR(-EROFS);
567566

568567
if (it->it_op & IT_CREAT)

fs/affs/amigaffs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
450450
vaf.fmt = fmt;
451451
vaf.va = &args;
452452
pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf);
453-
if (!(sb->s_flags & MS_RDONLY))
453+
if (!sb_rdonly(sb))
454454
pr_warn("Remounting filesystem read-only\n");
455455
sb->s_flags |= MS_RDONLY;
456456
va_end(args);

fs/affs/bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ affs_count_free_blocks(struct super_block *sb)
1919

2020
pr_debug("%s()\n", __func__);
2121

22-
if (sb->s_flags & MS_RDONLY)
22+
if (sb_rdonly(sb))
2323
return 0;
2424

2525
mutex_lock(&AFFS_SB(sb)->s_bmlock);

fs/affs/super.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void affs_mark_sb_dirty(struct super_block *sb)
8080
struct affs_sb_info *sbi = AFFS_SB(sb);
8181
unsigned long delay;
8282

83-
if (sb->s_flags & MS_RDONLY)
83+
if (sb_rdonly(sb))
8484
return;
8585

8686
spin_lock(&sbi->work_lock);
@@ -464,7 +464,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
464464
* not recommended.
465465
*/
466466
if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS
467-
|| chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) {
467+
|| chksum == MUFS_DCOFS) && !sb_rdonly(sb)) {
468468
pr_notice("Dircache FS - mounting %s read only\n", sb->s_id);
469469
sb->s_flags |= MS_RDONLY;
470470
}
@@ -596,7 +596,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
596596
memcpy(sbi->s_volume, volume, 32);
597597
spin_unlock(&sbi->symlink_lock);
598598

599-
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
599+
if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb))
600600
return 0;
601601

602602
if (*flags & MS_RDONLY)

fs/befs/linuxvfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
838838

839839
befs_debug(sb, "---> %s", __func__);
840840

841-
if (!(sb->s_flags & MS_RDONLY)) {
841+
if (!sb_rdonly(sb)) {
842842
befs_warning(sb,
843843
"No write support. Marking filesystem read-only");
844844
sb->s_flags |= MS_RDONLY;

fs/btrfs/dev-replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
704704
u64 result;
705705
int ret;
706706

707-
if (fs_info->sb->s_flags & MS_RDONLY)
707+
if (sb_rdonly(fs_info->sb))
708708
return -EROFS;
709709

710710
mutex_lock(&dev_replace->lock_finishing_cancel_unmount);

fs/btrfs/disk-io.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,7 +2478,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
24782478
return ret;
24792479
}
24802480

2481-
if (fs_info->sb->s_flags & MS_RDONLY) {
2481+
if (sb_rdonly(fs_info->sb)) {
24822482
ret = btrfs_commit_super(fs_info);
24832483
if (ret)
24842484
return ret;
@@ -2876,7 +2876,7 @@ int open_ctree(struct super_block *sb,
28762876

28772877
features = btrfs_super_compat_ro_flags(disk_super) &
28782878
~BTRFS_FEATURE_COMPAT_RO_SUPP;
2879-
if (!(sb->s_flags & MS_RDONLY) && features) {
2879+
if (!sb_rdonly(sb) && features) {
28802880
btrfs_err(fs_info,
28812881
"cannot mount read-write because of unsupported optional features (%llx)",
28822882
features);
@@ -3038,7 +3038,7 @@ int open_ctree(struct super_block *sb,
30383038
goto fail_sysfs;
30393039
}
30403040

3041-
if (!(sb->s_flags & MS_RDONLY) && !btrfs_check_rw_degradable(fs_info)) {
3041+
if (!sb_rdonly(sb) && !btrfs_check_rw_degradable(fs_info)) {
30423042
btrfs_warn(fs_info,
30433043
"writeable mount is not allowed due to too many missing devices");
30443044
goto fail_sysfs;
@@ -3097,7 +3097,7 @@ int open_ctree(struct super_block *sb,
30973097
if (ret)
30983098
goto fail_qgroup;
30993099

3100-
if (!(sb->s_flags & MS_RDONLY)) {
3100+
if (!sb_rdonly(sb)) {
31013101
ret = btrfs_cleanup_fs_roots(fs_info);
31023102
if (ret)
31033103
goto fail_qgroup;
@@ -3123,7 +3123,7 @@ int open_ctree(struct super_block *sb,
31233123
goto fail_qgroup;
31243124
}
31253125

3126-
if (sb->s_flags & MS_RDONLY)
3126+
if (sb_rdonly(sb))
31273127
return 0;
31283128

31293129
if (btrfs_test_opt(fs_info, CLEAR_CACHE) &&
@@ -3878,7 +3878,7 @@ void close_ctree(struct btrfs_fs_info *fs_info)
38783878

38793879
cancel_work_sync(&fs_info->async_reclaim_work);
38803880

3881-
if (!(fs_info->sb->s_flags & MS_RDONLY)) {
3881+
if (!sb_rdonly(fs_info->sb)) {
38823882
/*
38833883
* If the cleaner thread is stopped and there are
38843884
* block groups queued for removal, the deletion will be

fs/btrfs/extent_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info,
20602060
unsigned long i, num_pages = num_extent_pages(eb->start, eb->len);
20612061
int ret = 0;
20622062

2063-
if (fs_info->sb->s_flags & MS_RDONLY)
2063+
if (sb_rdonly(fs_info->sb))
20642064
return -EROFS;
20652065

20662066
for (i = 0; i < num_pages; i++) {
@@ -2110,7 +2110,7 @@ int clean_io_failure(struct btrfs_fs_info *fs_info,
21102110
failrec->start);
21112111
goto out;
21122112
}
2113-
if (fs_info->sb->s_flags & MS_RDONLY)
2113+
if (sb_rdonly(fs_info->sb))
21142114
goto out;
21152115

21162116
spin_lock(&io_tree->lock);

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5821,7 +5821,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
58215821

58225822
if (!IS_ERR(inode) && root != sub_root) {
58235823
down_read(&fs_info->cleanup_work_sem);
5824-
if (!(inode->i_sb->s_flags & MS_RDONLY))
5824+
if (!sb_rdonly(inode->i_sb))
58255825
ret = btrfs_orphan_cleanup(sub_root);
58265826
up_read(&fs_info->cleanup_work_sem);
58275827
if (ret) {

fs/btrfs/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4426,7 +4426,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info,
44264426

44274427
switch (p->cmd) {
44284428
case BTRFS_IOCTL_DEV_REPLACE_CMD_START:
4429-
if (fs_info->sb->s_flags & MS_RDONLY) {
4429+
if (sb_rdonly(fs_info->sb)) {
44304430
ret = -EROFS;
44314431
goto out;
44324432
}

fs/btrfs/root-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
228228
int ret;
229229
bool can_recover = true;
230230

231-
if (fs_info->sb->s_flags & MS_RDONLY)
231+
if (sb_rdonly(fs_info->sb))
232232
can_recover = false;
233233

234234
path = btrfs_alloc_path();

fs/btrfs/super.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
103103
{
104104
struct super_block *sb = fs_info->sb;
105105

106-
if (sb->s_flags & MS_RDONLY)
106+
if (sb_rdonly(sb))
107107
return;
108108

109109
if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
@@ -139,7 +139,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
139139
* Special case: if the error is EROFS, and we're already
140140
* under MS_RDONLY, then it is safe here.
141141
*/
142-
if (errno == -EROFS && (sb->s_flags & MS_RDONLY))
142+
if (errno == -EROFS && sb_rdonly(sb))
143143
return;
144144

145145
#ifdef CONFIG_PRINTK
@@ -1701,8 +1701,7 @@ static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info,
17011701
* close or the filesystem is read only.
17021702
*/
17031703
if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) &&
1704-
(!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) ||
1705-
(fs_info->sb->s_flags & MS_RDONLY))) {
1704+
(!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) {
17061705
btrfs_cleanup_defrag_inodes(fs_info);
17071706
}
17081707

@@ -1749,7 +1748,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
17491748
btrfs_resize_thread_pool(fs_info,
17501749
fs_info->thread_pool_size, old_thread_pool_size);
17511750

1752-
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
1751+
if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb))
17531752
goto out;
17541753

17551754
if (*flags & MS_RDONLY) {
@@ -1850,7 +1849,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
18501849

18511850
restore:
18521851
/* We've hit an error - don't reset MS_RDONLY */
1853-
if (sb->s_flags & MS_RDONLY)
1852+
if (sb_rdonly(sb))
18541853
old_flags |= MS_RDONLY;
18551854
sb->s_flags = old_flags;
18561855
fs_info->mount_opt = old_opts;

fs/btrfs/sysfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static ssize_t btrfs_feature_attr_store(struct kobject *kobj,
120120
if (!fs_info)
121121
return -EPERM;
122122

123-
if (fs_info->sb->s_flags & MS_RDONLY)
123+
if (sb_rdonly(fs_info->sb))
124124
return -EROFS;
125125

126126
ret = kstrtoul(skip_spaces(buf), 0, &val);
@@ -390,7 +390,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
390390
if (!fs_info)
391391
return -EPERM;
392392

393-
if (fs_info->sb->s_flags & MS_RDONLY)
393+
if (sb_rdonly(fs_info->sb))
394394
return -EROFS;
395395

396396
/*

fs/btrfs/volumes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
23242324
int seeding_dev = 0;
23252325
int ret = 0;
23262326

2327-
if ((sb->s_flags & MS_RDONLY) && !fs_info->fs_devices->seeding)
2327+
if (sb_rdonly(sb) && !fs_info->fs_devices->seeding)
23282328
return -EROFS;
23292329

23302330
bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL,
@@ -4053,7 +4053,7 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info)
40534053

40544054
int btrfs_cancel_balance(struct btrfs_fs_info *fs_info)
40554055
{
4056-
if (fs_info->sb->s_flags & MS_RDONLY)
4056+
if (sb_rdonly(fs_info->sb))
40574057
return -EROFS;
40584058

40594059
mutex_lock(&fs_info->balance_mutex);

fs/cachefiles/bind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
133133
goto error_unsupported;
134134

135135
ret = -EROFS;
136-
if (root->d_sb->s_flags & MS_RDONLY)
136+
if (sb_rdonly(root->d_sb))
137137
goto error_unsupported;
138138

139139
/* determine the security of the on-disk cache as this governs

fs/ecryptfs/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
568568
* 1) The lower mount is ro
569569
* 2) The ecryptfs_encrypted_view mount option is specified
570570
*/
571-
if (path.dentry->d_sb->s_flags & MS_RDONLY ||
572-
mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
571+
if (sb_rdonly(path.dentry->d_sb) || mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
573572
s->s_flags |= MS_RDONLY;
574573

575574
s->s_maxbytes = path.dentry->d_sb->s_maxbytes;

fs/efs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
306306
}
307307
brelse(bh);
308308

309-
if (!(s->s_flags & MS_RDONLY)) {
309+
if (!sb_rdonly(s)) {
310310
#ifdef DEBUG
311311
pr_info("forcing read-only mode\n");
312312
#endif

fs/ext2/super.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void ext2_error(struct super_block *sb, const char *function,
5252
struct ext2_sb_info *sbi = EXT2_SB(sb);
5353
struct ext2_super_block *es = sbi->s_es;
5454

55-
if (!(sb->s_flags & MS_RDONLY)) {
55+
if (!sb_rdonly(sb)) {
5656
spin_lock(&sbi->s_lock);
5757
sbi->s_mount_state |= EXT2_ERROR_FS;
5858
es->s_state |= cpu_to_le16(EXT2_ERROR_FS);
@@ -151,7 +151,7 @@ static void ext2_put_super (struct super_block * sb)
151151
ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
152152
sbi->s_ea_block_cache = NULL;
153153
}
154-
if (!(sb->s_flags & MS_RDONLY)) {
154+
if (!sb_rdonly(sb)) {
155155
struct ext2_super_block *es = sbi->s_es;
156156

157157
spin_lock(&sbi->s_lock);
@@ -943,8 +943,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
943943
le32_to_cpu(features));
944944
goto failed_mount;
945945
}
946-
if (!(sb->s_flags & MS_RDONLY) &&
947-
(features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){
946+
if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){
948947
ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of "
949948
"unsupported optional features (%x)",
950949
le32_to_cpu(features));
@@ -1173,7 +1172,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
11731172
if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
11741173
ext2_msg(sb, KERN_WARNING,
11751174
"warning: mounting ext3 filesystem as ext2");
1176-
if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY))
1175+
if (ext2_setup_super (sb, es, sb_rdonly(sb)))
11771176
sb->s_flags |= MS_RDONLY;
11781177
ext2_write_super(sb);
11791178
return 0;
@@ -1305,7 +1304,7 @@ static int ext2_unfreeze(struct super_block *sb)
13051304

13061305
static void ext2_write_super(struct super_block *sb)
13071306
{
1308-
if (!(sb->s_flags & MS_RDONLY))
1307+
if (!sb_rdonly(sb))
13091308
ext2_sync_fs(sb, 1);
13101309
}
13111310

@@ -1343,7 +1342,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
13431342
"dax flag with busy inodes while remounting");
13441343
sbi->s_mount_opt ^= EXT2_MOUNT_DAX;
13451344
}
1346-
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
1345+
if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) {
13471346
spin_unlock(&sbi->s_lock);
13481347
return 0;
13491348
}

fs/ext4/ext4_jbd2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int ext4_journal_check_start(struct super_block *sb)
4747
if (unlikely(ext4_forced_shutdown(EXT4_SB(sb))))
4848
return -EIO;
4949

50-
if (sb->s_flags & MS_RDONLY)
50+
if (sb_rdonly(sb))
5151
return -EROFS;
5252
WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE);
5353
journal = EXT4_SB(sb)->s_journal;

fs/ext4/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
371371
return -EIO;
372372

373373
if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) &&
374-
!(sb->s_flags & MS_RDONLY))) {
374+
!sb_rdonly(sb))) {
375375
sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED;
376376
/*
377377
* Sample where the filesystem has been mounted and

fs/ext4/fsync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
107107

108108
trace_ext4_sync_file_enter(file, datasync);
109109

110-
if (inode->i_sb->s_flags & MS_RDONLY) {
110+
if (sb_rdonly(inode->i_sb)) {
111111
/* Make sure that we read updated s_mount_flags value */
112112
smp_rmb();
113113
if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED)

fs/ext4/ialloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
13821382
int num, ret = 0, used_blks = 0;
13831383

13841384
/* This should not happen, but just to be sure check this */
1385-
if (sb->s_flags & MS_RDONLY) {
1385+
if (sb_rdonly(sb)) {
13861386
ret = 1;
13871387
goto out;
13881388
}

0 commit comments

Comments
 (0)