diff options
74 files changed, 210 insertions, 226 deletions
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 974a05d6c969..2c33b92b5d4d 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c | |||
@@ -210,7 +210,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, | |||
210 | data->ocd_ibits_known = MDS_INODELOCK_FULL; | 210 | data->ocd_ibits_known = MDS_INODELOCK_FULL; |
211 | data->ocd_version = LUSTRE_VERSION_CODE; | 211 | data->ocd_version = LUSTRE_VERSION_CODE; |
212 | 212 | ||
213 | if (sb->s_flags & MS_RDONLY) | 213 | if (sb_rdonly(sb)) |
214 | data->ocd_connect_flags |= OBD_CONNECT_RDONLY; | 214 | data->ocd_connect_flags |= OBD_CONNECT_RDONLY; |
215 | if (sbi->ll_flags & LL_SBI_USER_XATTR) | 215 | if (sbi->ll_flags & LL_SBI_USER_XATTR) |
216 | data->ocd_connect_flags |= OBD_CONNECT_XATTR; | 216 | data->ocd_connect_flags |= OBD_CONNECT_XATTR; |
@@ -2033,7 +2033,7 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data) | |||
2033 | int err; | 2033 | int err; |
2034 | __u32 read_only; | 2034 | __u32 read_only; |
2035 | 2035 | ||
2036 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 2036 | if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { |
2037 | read_only = *flags & MS_RDONLY; | 2037 | read_only = *flags & MS_RDONLY; |
2038 | err = obd_set_info_async(NULL, sbi->ll_md_exp, | 2038 | err = obd_set_info_async(NULL, sbi->ll_md_exp, |
2039 | sizeof(KEY_READ_ONLY), | 2039 | sizeof(KEY_READ_ONLY), |
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index a208a8b02c2c..483890fa01a2 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c | |||
@@ -562,8 +562,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, | |||
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && | 565 | if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && sb_rdonly(dentry->d_sb)) |
566 | dentry->d_sb->s_flags & MS_RDONLY) | ||
567 | return ERR_PTR(-EROFS); | 566 | return ERR_PTR(-EROFS); |
568 | 567 | ||
569 | if (it->it_op & IT_CREAT) | 568 | if (it->it_op & IT_CREAT) |
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index b573c3b9a328..8cf941c3b511 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
@@ -450,7 +450,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...) | |||
450 | vaf.fmt = fmt; | 450 | vaf.fmt = fmt; |
451 | vaf.va = &args; | 451 | vaf.va = &args; |
452 | pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf); | 452 | 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)) |
454 | pr_warn("Remounting filesystem read-only\n"); | 454 | pr_warn("Remounting filesystem read-only\n"); |
455 | sb->s_flags |= MS_RDONLY; | 455 | sb->s_flags |= MS_RDONLY; |
456 | va_end(args); | 456 | va_end(args); |
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index 675148950fed..2b2112475ec2 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c | |||
@@ -19,7 +19,7 @@ affs_count_free_blocks(struct super_block *sb) | |||
19 | 19 | ||
20 | pr_debug("%s()\n", __func__); | 20 | pr_debug("%s()\n", __func__); |
21 | 21 | ||
22 | if (sb->s_flags & MS_RDONLY) | 22 | if (sb_rdonly(sb)) |
23 | return 0; | 23 | return 0; |
24 | 24 | ||
25 | mutex_lock(&AFFS_SB(sb)->s_bmlock); | 25 | mutex_lock(&AFFS_SB(sb)->s_bmlock); |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 7bf47a41cb4f..884bedab7266 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -80,7 +80,7 @@ void affs_mark_sb_dirty(struct super_block *sb) | |||
80 | struct affs_sb_info *sbi = AFFS_SB(sb); | 80 | struct affs_sb_info *sbi = AFFS_SB(sb); |
81 | unsigned long delay; | 81 | unsigned long delay; |
82 | 82 | ||
83 | if (sb->s_flags & MS_RDONLY) | 83 | if (sb_rdonly(sb)) |
84 | return; | 84 | return; |
85 | 85 | ||
86 | spin_lock(&sbi->work_lock); | 86 | spin_lock(&sbi->work_lock); |
@@ -464,7 +464,7 @@ got_root: | |||
464 | * not recommended. | 464 | * not recommended. |
465 | */ | 465 | */ |
466 | if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS | 466 | 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)) { |
468 | pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); | 468 | pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); |
469 | sb->s_flags |= MS_RDONLY; | 469 | sb->s_flags |= MS_RDONLY; |
470 | } | 470 | } |
@@ -596,7 +596,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
596 | memcpy(sbi->s_volume, volume, 32); | 596 | memcpy(sbi->s_volume, volume, 32); |
597 | spin_unlock(&sbi->symlink_lock); | 597 | spin_unlock(&sbi->symlink_lock); |
598 | 598 | ||
599 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 599 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
600 | return 0; | 600 | return 0; |
601 | 601 | ||
602 | if (*flags & MS_RDONLY) | 602 | if (*flags & MS_RDONLY) |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 4a4a5a366158..a92355cc453b 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -838,7 +838,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | |||
838 | 838 | ||
839 | befs_debug(sb, "---> %s", __func__); | 839 | befs_debug(sb, "---> %s", __func__); |
840 | 840 | ||
841 | if (!(sb->s_flags & MS_RDONLY)) { | 841 | if (!sb_rdonly(sb)) { |
842 | befs_warning(sb, | 842 | befs_warning(sb, |
843 | "No write support. Marking filesystem read-only"); | 843 | "No write support. Marking filesystem read-only"); |
844 | sb->s_flags |= MS_RDONLY; | 844 | sb->s_flags |= MS_RDONLY; |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index bee3edeea7a3..cd42d95e9e05 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -690,7 +690,7 @@ static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) | |||
690 | u64 result; | 690 | u64 result; |
691 | int ret; | 691 | int ret; |
692 | 692 | ||
693 | if (fs_info->sb->s_flags & MS_RDONLY) | 693 | if (sb_rdonly(fs_info->sb)) |
694 | return -EROFS; | 694 | return -EROFS; |
695 | 695 | ||
696 | mutex_lock(&dev_replace->lock_finishing_cancel_unmount); | 696 | mutex_lock(&dev_replace->lock_finishing_cancel_unmount); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 080e2ebb8aa0..4a9b40f604fa 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2478,7 +2478,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info, | |||
2478 | return ret; | 2478 | return ret; |
2479 | } | 2479 | } |
2480 | 2480 | ||
2481 | if (fs_info->sb->s_flags & MS_RDONLY) { | 2481 | if (sb_rdonly(fs_info->sb)) { |
2482 | ret = btrfs_commit_super(fs_info); | 2482 | ret = btrfs_commit_super(fs_info); |
2483 | if (ret) | 2483 | if (ret) |
2484 | return ret; | 2484 | return ret; |
@@ -2874,7 +2874,7 @@ int open_ctree(struct super_block *sb, | |||
2874 | 2874 | ||
2875 | features = btrfs_super_compat_ro_flags(disk_super) & | 2875 | features = btrfs_super_compat_ro_flags(disk_super) & |
2876 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; | 2876 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; |
2877 | if (!(sb->s_flags & MS_RDONLY) && features) { | 2877 | if (!sb_rdonly(sb) && features) { |
2878 | btrfs_err(fs_info, | 2878 | btrfs_err(fs_info, |
2879 | "cannot mount read-write because of unsupported optional features (%llx)", | 2879 | "cannot mount read-write because of unsupported optional features (%llx)", |
2880 | features); | 2880 | features); |
@@ -3039,7 +3039,7 @@ retry_root_backup: | |||
3039 | btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); | 3039 | btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); |
3040 | if (fs_info->fs_devices->missing_devices > | 3040 | if (fs_info->fs_devices->missing_devices > |
3041 | fs_info->num_tolerated_disk_barrier_failures && | 3041 | fs_info->num_tolerated_disk_barrier_failures && |
3042 | !(sb->s_flags & MS_RDONLY)) { | 3042 | !sb_rdonly(sb)) { |
3043 | btrfs_warn(fs_info, | 3043 | btrfs_warn(fs_info, |
3044 | "missing devices (%llu) exceeds the limit (%d), writeable mount is not allowed", | 3044 | "missing devices (%llu) exceeds the limit (%d), writeable mount is not allowed", |
3045 | fs_info->fs_devices->missing_devices, | 3045 | fs_info->fs_devices->missing_devices, |
@@ -3102,7 +3102,7 @@ retry_root_backup: | |||
3102 | if (ret) | 3102 | if (ret) |
3103 | goto fail_qgroup; | 3103 | goto fail_qgroup; |
3104 | 3104 | ||
3105 | if (!(sb->s_flags & MS_RDONLY)) { | 3105 | if (!sb_rdonly(sb)) { |
3106 | ret = btrfs_cleanup_fs_roots(fs_info); | 3106 | ret = btrfs_cleanup_fs_roots(fs_info); |
3107 | if (ret) | 3107 | if (ret) |
3108 | goto fail_qgroup; | 3108 | goto fail_qgroup; |
@@ -3128,7 +3128,7 @@ retry_root_backup: | |||
3128 | goto fail_qgroup; | 3128 | goto fail_qgroup; |
3129 | } | 3129 | } |
3130 | 3130 | ||
3131 | if (sb->s_flags & MS_RDONLY) | 3131 | if (sb_rdonly(sb)) |
3132 | return 0; | 3132 | return 0; |
3133 | 3133 | ||
3134 | if (btrfs_test_opt(fs_info, CLEAR_CACHE) && | 3134 | if (btrfs_test_opt(fs_info, CLEAR_CACHE) && |
@@ -3928,7 +3928,7 @@ void close_ctree(struct btrfs_fs_info *fs_info) | |||
3928 | 3928 | ||
3929 | cancel_work_sync(&fs_info->async_reclaim_work); | 3929 | cancel_work_sync(&fs_info->async_reclaim_work); |
3930 | 3930 | ||
3931 | if (!(fs_info->sb->s_flags & MS_RDONLY)) { | 3931 | if (!sb_rdonly(fs_info->sb)) { |
3932 | /* | 3932 | /* |
3933 | * If the cleaner thread is stopped and there are | 3933 | * If the cleaner thread is stopped and there are |
3934 | * block groups queued for removal, the deletion will be | 3934 | * block groups queued for removal, the deletion will be |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 0aff9b278c19..5074e9b26f1a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2061,7 +2061,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, | |||
2061 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); | 2061 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); |
2062 | int ret = 0; | 2062 | int ret = 0; |
2063 | 2063 | ||
2064 | if (fs_info->sb->s_flags & MS_RDONLY) | 2064 | if (sb_rdonly(fs_info->sb)) |
2065 | return -EROFS; | 2065 | return -EROFS; |
2066 | 2066 | ||
2067 | for (i = 0; i < num_pages; i++) { | 2067 | for (i = 0; i < num_pages; i++) { |
@@ -2111,7 +2111,7 @@ int clean_io_failure(struct btrfs_fs_info *fs_info, | |||
2111 | failrec->start); | 2111 | failrec->start); |
2112 | goto out; | 2112 | goto out; |
2113 | } | 2113 | } |
2114 | if (fs_info->sb->s_flags & MS_RDONLY) | 2114 | if (sb_rdonly(fs_info->sb)) |
2115 | goto out; | 2115 | goto out; |
2116 | 2116 | ||
2117 | spin_lock(&io_tree->lock); | 2117 | spin_lock(&io_tree->lock); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 95c212037095..07a18ce55d56 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -5817,7 +5817,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
5817 | 5817 | ||
5818 | if (!IS_ERR(inode) && root != sub_root) { | 5818 | if (!IS_ERR(inode) && root != sub_root) { |
5819 | down_read(&fs_info->cleanup_work_sem); | 5819 | down_read(&fs_info->cleanup_work_sem); |
5820 | if (!(inode->i_sb->s_flags & MS_RDONLY)) | 5820 | if (!sb_rdonly(inode->i_sb)) |
5821 | ret = btrfs_orphan_cleanup(sub_root); | 5821 | ret = btrfs_orphan_cleanup(sub_root); |
5822 | up_read(&fs_info->cleanup_work_sem); | 5822 | up_read(&fs_info->cleanup_work_sem); |
5823 | if (ret) { | 5823 | if (ret) { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fa1b78cf25f6..8a27255173b7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -4438,7 +4438,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info, | |||
4438 | 4438 | ||
4439 | switch (p->cmd) { | 4439 | switch (p->cmd) { |
4440 | case BTRFS_IOCTL_DEV_REPLACE_CMD_START: | 4440 | case BTRFS_IOCTL_DEV_REPLACE_CMD_START: |
4441 | if (fs_info->sb->s_flags & MS_RDONLY) { | 4441 | if (sb_rdonly(fs_info->sb)) { |
4442 | ret = -EROFS; | 4442 | ret = -EROFS; |
4443 | goto out; | 4443 | goto out; |
4444 | } | 4444 | } |
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 460db0cb2d07..bfa1ae1dc0fa 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c | |||
@@ -228,7 +228,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) | |||
228 | int ret; | 228 | int ret; |
229 | bool can_recover = true; | 229 | bool can_recover = true; |
230 | 230 | ||
231 | if (fs_info->sb->s_flags & MS_RDONLY) | 231 | if (sb_rdonly(fs_info->sb)) |
232 | can_recover = false; | 232 | can_recover = false; |
233 | 233 | ||
234 | path = btrfs_alloc_path(); | 234 | path = btrfs_alloc_path(); |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 12540b6104b5..086819312a44 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -102,7 +102,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info) | |||
102 | { | 102 | { |
103 | struct super_block *sb = fs_info->sb; | 103 | struct super_block *sb = fs_info->sb; |
104 | 104 | ||
105 | if (sb->s_flags & MS_RDONLY) | 105 | if (sb_rdonly(sb)) |
106 | return; | 106 | return; |
107 | 107 | ||
108 | if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { | 108 | if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { |
@@ -138,7 +138,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function | |||
138 | * Special case: if the error is EROFS, and we're already | 138 | * Special case: if the error is EROFS, and we're already |
139 | * under MS_RDONLY, then it is safe here. | 139 | * under MS_RDONLY, then it is safe here. |
140 | */ | 140 | */ |
141 | if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) | 141 | if (errno == -EROFS && sb_rdonly(sb)) |
142 | return; | 142 | return; |
143 | 143 | ||
144 | #ifdef CONFIG_PRINTK | 144 | #ifdef CONFIG_PRINTK |
@@ -1687,8 +1687,7 @@ static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, | |||
1687 | * close or the filesystem is read only. | 1687 | * close or the filesystem is read only. |
1688 | */ | 1688 | */ |
1689 | if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && | 1689 | if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && |
1690 | (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || | 1690 | (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { |
1691 | (fs_info->sb->s_flags & MS_RDONLY))) { | ||
1692 | btrfs_cleanup_defrag_inodes(fs_info); | 1691 | btrfs_cleanup_defrag_inodes(fs_info); |
1693 | } | 1692 | } |
1694 | 1693 | ||
@@ -1735,7 +1734,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1735 | btrfs_resize_thread_pool(fs_info, | 1734 | btrfs_resize_thread_pool(fs_info, |
1736 | fs_info->thread_pool_size, old_thread_pool_size); | 1735 | fs_info->thread_pool_size, old_thread_pool_size); |
1737 | 1736 | ||
1738 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 1737 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
1739 | goto out; | 1738 | goto out; |
1740 | 1739 | ||
1741 | if (*flags & MS_RDONLY) { | 1740 | if (*flags & MS_RDONLY) { |
@@ -1835,7 +1834,7 @@ out: | |||
1835 | 1834 | ||
1836 | restore: | 1835 | restore: |
1837 | /* We've hit an error - don't reset MS_RDONLY */ | 1836 | /* We've hit an error - don't reset MS_RDONLY */ |
1838 | if (sb->s_flags & MS_RDONLY) | 1837 | if (sb_rdonly(sb)) |
1839 | old_flags |= MS_RDONLY; | 1838 | old_flags |= MS_RDONLY; |
1840 | sb->s_flags = old_flags; | 1839 | sb->s_flags = old_flags; |
1841 | fs_info->mount_opt = old_opts; | 1840 | fs_info->mount_opt = old_opts; |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index c2d5f3580b4c..432294d040d5 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
@@ -120,7 +120,7 @@ static ssize_t btrfs_feature_attr_store(struct kobject *kobj, | |||
120 | if (!fs_info) | 120 | if (!fs_info) |
121 | return -EPERM; | 121 | return -EPERM; |
122 | 122 | ||
123 | if (fs_info->sb->s_flags & MS_RDONLY) | 123 | if (sb_rdonly(fs_info->sb)) |
124 | return -EROFS; | 124 | return -EROFS; |
125 | 125 | ||
126 | ret = kstrtoul(skip_spaces(buf), 0, &val); | 126 | ret = kstrtoul(skip_spaces(buf), 0, &val); |
@@ -388,7 +388,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj, | |||
388 | if (!fs_info) | 388 | if (!fs_info) |
389 | return -EPERM; | 389 | return -EPERM; |
390 | 390 | ||
391 | if (fs_info->sb->s_flags & MS_RDONLY) | 391 | if (sb_rdonly(fs_info->sb)) |
392 | return -EROFS; | 392 | return -EROFS; |
393 | 393 | ||
394 | /* | 394 | /* |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5eb7217738ed..6646695c9072 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2337,7 +2337,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path | |||
2337 | int seeding_dev = 0; | 2337 | int seeding_dev = 0; |
2338 | int ret = 0; | 2338 | int ret = 0; |
2339 | 2339 | ||
2340 | if ((sb->s_flags & MS_RDONLY) && !fs_info->fs_devices->seeding) | 2340 | if (sb_rdonly(sb) && !fs_info->fs_devices->seeding) |
2341 | return -EROFS; | 2341 | return -EROFS; |
2342 | 2342 | ||
2343 | bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, | 2343 | bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, |
@@ -4085,7 +4085,7 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info) | |||
4085 | 4085 | ||
4086 | int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) | 4086 | int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) |
4087 | { | 4087 | { |
4088 | if (fs_info->sb->s_flags & MS_RDONLY) | 4088 | if (sb_rdonly(fs_info->sb)) |
4089 | return -EROFS; | 4089 | return -EROFS; |
4090 | 4090 | ||
4091 | mutex_lock(&fs_info->balance_mutex); | 4091 | mutex_lock(&fs_info->balance_mutex); |
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c index 3ff867f87d73..d9f001078e08 100644 --- a/fs/cachefiles/bind.c +++ b/fs/cachefiles/bind.c | |||
@@ -133,7 +133,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) | |||
133 | goto error_unsupported; | 133 | goto error_unsupported; |
134 | 134 | ||
135 | ret = -EROFS; | 135 | ret = -EROFS; |
136 | if (root->d_sb->s_flags & MS_RDONLY) | 136 | if (sb_rdonly(root->d_sb)) |
137 | goto error_unsupported; | 137 | goto error_unsupported; |
138 | 138 | ||
139 | /* determine the security of the on-disk cache as this governs | 139 | /* determine the security of the on-disk cache as this governs |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 9014479d0160..6b801186baa5 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -568,8 +568,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
568 | * 1) The lower mount is ro | 568 | * 1) The lower mount is ro |
569 | * 2) The ecryptfs_encrypted_view mount option is specified | 569 | * 2) The ecryptfs_encrypted_view mount option is specified |
570 | */ | 570 | */ |
571 | if (path.dentry->d_sb->s_flags & MS_RDONLY || | 571 | if (sb_rdonly(path.dentry->d_sb) || mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) |
572 | mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) | ||
573 | s->s_flags |= MS_RDONLY; | 572 | s->s_flags |= MS_RDONLY; |
574 | 573 | ||
575 | s->s_maxbytes = path.dentry->d_sb->s_maxbytes; | 574 | s->s_maxbytes = path.dentry->d_sb->s_maxbytes; |
diff --git a/fs/efs/super.c b/fs/efs/super.c index 368f7dd21c61..5c42f1e34a2f 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c | |||
@@ -306,7 +306,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | |||
306 | } | 306 | } |
307 | brelse(bh); | 307 | brelse(bh); |
308 | 308 | ||
309 | if (!(s->s_flags & MS_RDONLY)) { | 309 | if (!sb_rdonly(s)) { |
310 | #ifdef DEBUG | 310 | #ifdef DEBUG |
311 | pr_info("forcing read-only mode\n"); | 311 | pr_info("forcing read-only mode\n"); |
312 | #endif | 312 | #endif |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 7b1bc9059863..448ebfe60233 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -52,7 +52,7 @@ void ext2_error(struct super_block *sb, const char *function, | |||
52 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 52 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
53 | struct ext2_super_block *es = sbi->s_es; | 53 | struct ext2_super_block *es = sbi->s_es; |
54 | 54 | ||
55 | if (!(sb->s_flags & MS_RDONLY)) { | 55 | if (!sb_rdonly(sb)) { |
56 | spin_lock(&sbi->s_lock); | 56 | spin_lock(&sbi->s_lock); |
57 | sbi->s_mount_state |= EXT2_ERROR_FS; | 57 | sbi->s_mount_state |= EXT2_ERROR_FS; |
58 | es->s_state |= cpu_to_le16(EXT2_ERROR_FS); | 58 | es->s_state |= cpu_to_le16(EXT2_ERROR_FS); |
@@ -151,7 +151,7 @@ static void ext2_put_super (struct super_block * sb) | |||
151 | ext2_xattr_destroy_cache(sbi->s_ea_block_cache); | 151 | ext2_xattr_destroy_cache(sbi->s_ea_block_cache); |
152 | sbi->s_ea_block_cache = NULL; | 152 | sbi->s_ea_block_cache = NULL; |
153 | } | 153 | } |
154 | if (!(sb->s_flags & MS_RDONLY)) { | 154 | if (!sb_rdonly(sb)) { |
155 | struct ext2_super_block *es = sbi->s_es; | 155 | struct ext2_super_block *es = sbi->s_es; |
156 | 156 | ||
157 | spin_lock(&sbi->s_lock); | 157 | spin_lock(&sbi->s_lock); |
@@ -940,8 +940,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
940 | le32_to_cpu(features)); | 940 | le32_to_cpu(features)); |
941 | goto failed_mount; | 941 | goto failed_mount; |
942 | } | 942 | } |
943 | if (!(sb->s_flags & MS_RDONLY) && | 943 | if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ |
944 | (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ | ||
945 | ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " | 944 | ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " |
946 | "unsupported optional features (%x)", | 945 | "unsupported optional features (%x)", |
947 | le32_to_cpu(features)); | 946 | le32_to_cpu(features)); |
@@ -1170,7 +1169,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1170 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 1169 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) |
1171 | ext2_msg(sb, KERN_WARNING, | 1170 | ext2_msg(sb, KERN_WARNING, |
1172 | "warning: mounting ext3 filesystem as ext2"); | 1171 | "warning: mounting ext3 filesystem as ext2"); |
1173 | if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) | 1172 | if (ext2_setup_super (sb, es, sb_rdonly(sb))) |
1174 | sb->s_flags |= MS_RDONLY; | 1173 | sb->s_flags |= MS_RDONLY; |
1175 | ext2_write_super(sb); | 1174 | ext2_write_super(sb); |
1176 | return 0; | 1175 | return 0; |
@@ -1301,7 +1300,7 @@ static int ext2_unfreeze(struct super_block *sb) | |||
1301 | 1300 | ||
1302 | static void ext2_write_super(struct super_block *sb) | 1301 | static void ext2_write_super(struct super_block *sb) |
1303 | { | 1302 | { |
1304 | if (!(sb->s_flags & MS_RDONLY)) | 1303 | if (!sb_rdonly(sb)) |
1305 | ext2_sync_fs(sb, 1); | 1304 | ext2_sync_fs(sb, 1); |
1306 | } | 1305 | } |
1307 | 1306 | ||
@@ -1339,7 +1338,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1339 | "dax flag with busy inodes while remounting"); | 1338 | "dax flag with busy inodes while remounting"); |
1340 | sbi->s_mount_opt ^= EXT2_MOUNT_DAX; | 1339 | sbi->s_mount_opt ^= EXT2_MOUNT_DAX; |
1341 | } | 1340 | } |
1342 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1341 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) { |
1343 | spin_unlock(&sbi->s_lock); | 1342 | spin_unlock(&sbi->s_lock); |
1344 | return 0; | 1343 | return 0; |
1345 | } | 1344 | } |
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index dd106b1d5d89..5b342ac67d2e 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c | |||
@@ -47,7 +47,7 @@ static int ext4_journal_check_start(struct super_block *sb) | |||
47 | if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) | 47 | if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) |
48 | return -EIO; | 48 | return -EIO; |
49 | 49 | ||
50 | if (sb->s_flags & MS_RDONLY) | 50 | if (sb_rdonly(sb)) |
51 | return -EROFS; | 51 | return -EROFS; |
52 | WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE); | 52 | WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE); |
53 | journal = EXT4_SB(sb)->s_journal; | 53 | journal = EXT4_SB(sb)->s_journal; |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 58294c9a7e1d..b33ec8a23678 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -388,7 +388,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
388 | return -EIO; | 388 | return -EIO; |
389 | 389 | ||
390 | if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && | 390 | if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && |
391 | !(sb->s_flags & MS_RDONLY))) { | 391 | !sb_rdonly(sb))) { |
392 | sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; | 392 | sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; |
393 | /* | 393 | /* |
394 | * Sample where the filesystem has been mounted and | 394 | * Sample where the filesystem has been mounted and |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index aae2c3971cef..f9230580a84b 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -107,7 +107,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
107 | 107 | ||
108 | trace_ext4_sync_file_enter(file, datasync); | 108 | trace_ext4_sync_file_enter(file, datasync); |
109 | 109 | ||
110 | if (inode->i_sb->s_flags & MS_RDONLY) { | 110 | if (sb_rdonly(inode->i_sb)) { |
111 | /* Make sure that we read updated s_mount_flags value */ | 111 | /* Make sure that we read updated s_mount_flags value */ |
112 | smp_rmb(); | 112 | smp_rmb(); |
113 | if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED) | 113 | if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED) |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 507bfb3344d4..360e87dbba74 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -1355,7 +1355,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, | |||
1355 | int num, ret = 0, used_blks = 0; | 1355 | int num, ret = 0, used_blks = 0; |
1356 | 1356 | ||
1357 | /* This should not happen, but just to be sure check this */ | 1357 | /* This should not happen, but just to be sure check this */ |
1358 | if (sb->s_flags & MS_RDONLY) { | 1358 | if (sb_rdonly(sb)) { |
1359 | ret = 1; | 1359 | ret = 1; |
1360 | goto out; | 1360 | goto out; |
1361 | } | 1361 | } |
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index eb9835638680..899b0761ca1c 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c | |||
@@ -185,7 +185,7 @@ static int kmmpd(void *data) | |||
185 | goto exit_thread; | 185 | goto exit_thread; |
186 | } | 186 | } |
187 | 187 | ||
188 | if (sb->s_flags & MS_RDONLY) { | 188 | if (sb_rdonly(sb)) { |
189 | ext4_warning(sb, "kmmpd being stopped since filesystem " | 189 | ext4_warning(sb, "kmmpd being stopped since filesystem " |
190 | "has been remounted as readonly."); | 190 | "has been remounted as readonly."); |
191 | goto exit_thread; | 191 | goto exit_thread; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 0886fe82e9c4..d9701c869dd3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -405,7 +405,7 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) | |||
405 | 405 | ||
406 | static void ext4_handle_error(struct super_block *sb) | 406 | static void ext4_handle_error(struct super_block *sb) |
407 | { | 407 | { |
408 | if (sb->s_flags & MS_RDONLY) | 408 | if (sb_rdonly(sb)) |
409 | return; | 409 | return; |
410 | 410 | ||
411 | if (!test_opt(sb, ERRORS_CONT)) { | 411 | if (!test_opt(sb, ERRORS_CONT)) { |
@@ -587,8 +587,7 @@ void __ext4_std_error(struct super_block *sb, const char *function, | |||
587 | /* Special case: if the error is EROFS, and we're not already | 587 | /* Special case: if the error is EROFS, and we're not already |
588 | * inside a transaction, then there's really no point in logging | 588 | * inside a transaction, then there's really no point in logging |
589 | * an error. */ | 589 | * an error. */ |
590 | if (errno == -EROFS && journal_current_handle() == NULL && | 590 | if (errno == -EROFS && journal_current_handle() == NULL && sb_rdonly(sb)) |
591 | (sb->s_flags & MS_RDONLY)) | ||
592 | return; | 591 | return; |
593 | 592 | ||
594 | if (ext4_error_ratelimit(sb)) { | 593 | if (ext4_error_ratelimit(sb)) { |
@@ -628,7 +627,7 @@ void __ext4_abort(struct super_block *sb, const char *function, | |||
628 | sb->s_id, function, line, &vaf); | 627 | sb->s_id, function, line, &vaf); |
629 | va_end(args); | 628 | va_end(args); |
630 | 629 | ||
631 | if ((sb->s_flags & MS_RDONLY) == 0) { | 630 | if (sb_rdonly(sb) == 0) { |
632 | ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); | 631 | ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); |
633 | EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; | 632 | EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; |
634 | /* | 633 | /* |
@@ -889,11 +888,11 @@ static void ext4_put_super(struct super_block *sb) | |||
889 | ext4_mb_release(sb); | 888 | ext4_mb_release(sb); |
890 | ext4_ext_release(sb); | 889 | ext4_ext_release(sb); |
891 | 890 | ||
892 | if (!(sb->s_flags & MS_RDONLY) && !aborted) { | 891 | if (!sb_rdonly(sb) && !aborted) { |
893 | ext4_clear_feature_journal_needs_recovery(sb); | 892 | ext4_clear_feature_journal_needs_recovery(sb); |
894 | es->s_state = cpu_to_le16(sbi->s_mount_state); | 893 | es->s_state = cpu_to_le16(sbi->s_mount_state); |
895 | } | 894 | } |
896 | if (!(sb->s_flags & MS_RDONLY)) | 895 | if (!sb_rdonly(sb)) |
897 | ext4_commit_super(sb, 1); | 896 | ext4_commit_super(sb, 1); |
898 | 897 | ||
899 | for (i = 0; i < sbi->s_gdb_count; i++) | 898 | for (i = 0; i < sbi->s_gdb_count; i++) |
@@ -2101,7 +2100,7 @@ int ext4_seq_options_show(struct seq_file *seq, void *offset) | |||
2101 | struct super_block *sb = seq->private; | 2100 | struct super_block *sb = seq->private; |
2102 | int rc; | 2101 | int rc; |
2103 | 2102 | ||
2104 | seq_puts(seq, (sb->s_flags & MS_RDONLY) ? "ro" : "rw"); | 2103 | seq_puts(seq, sb_rdonly(sb) ? "ro" : "rw"); |
2105 | rc = _ext4_show_options(seq, sb, 1); | 2104 | rc = _ext4_show_options(seq, sb, 1); |
2106 | seq_puts(seq, "\n"); | 2105 | seq_puts(seq, "\n"); |
2107 | return rc; | 2106 | return rc; |
@@ -2369,7 +2368,7 @@ static int ext4_check_descriptors(struct super_block *sb, | |||
2369 | "Checksum for group %u failed (%u!=%u)", | 2368 | "Checksum for group %u failed (%u!=%u)", |
2370 | i, le16_to_cpu(ext4_group_desc_csum(sb, i, | 2369 | i, le16_to_cpu(ext4_group_desc_csum(sb, i, |
2371 | gdp)), le16_to_cpu(gdp->bg_checksum)); | 2370 | gdp)), le16_to_cpu(gdp->bg_checksum)); |
2372 | if (!(sb->s_flags & MS_RDONLY)) { | 2371 | if (!sb_rdonly(sb)) { |
2373 | ext4_unlock_group(sb, i); | 2372 | ext4_unlock_group(sb, i); |
2374 | return 0; | 2373 | return 0; |
2375 | } | 2374 | } |
@@ -3116,8 +3115,7 @@ int ext4_register_li_request(struct super_block *sb, | |||
3116 | goto out; | 3115 | goto out; |
3117 | } | 3116 | } |
3118 | 3117 | ||
3119 | if (first_not_zeroed == ngroups || | 3118 | if (first_not_zeroed == ngroups || sb_rdonly(sb) || |
3120 | (sb->s_flags & MS_RDONLY) || | ||
3121 | !test_opt(sb, INIT_INODE_TABLE)) | 3119 | !test_opt(sb, INIT_INODE_TABLE)) |
3122 | goto out; | 3120 | goto out; |
3123 | 3121 | ||
@@ -3661,7 +3659,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3661 | * previously didn't change the revision level when setting the flags, | 3659 | * previously didn't change the revision level when setting the flags, |
3662 | * so there is a chance incompat flags are set on a rev 0 filesystem. | 3660 | * so there is a chance incompat flags are set on a rev 0 filesystem. |
3663 | */ | 3661 | */ |
3664 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | 3662 | if (!ext4_feature_set_ok(sb, (sb_rdonly(sb)))) |
3665 | goto failed_mount; | 3663 | goto failed_mount; |
3666 | 3664 | ||
3667 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | 3665 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); |
@@ -3790,12 +3788,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3790 | sbi->s_hash_unsigned = 3; | 3788 | sbi->s_hash_unsigned = 3; |
3791 | else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { | 3789 | else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { |
3792 | #ifdef __CHAR_UNSIGNED__ | 3790 | #ifdef __CHAR_UNSIGNED__ |
3793 | if (!(sb->s_flags & MS_RDONLY)) | 3791 | if (!sb_rdonly(sb)) |
3794 | es->s_flags |= | 3792 | es->s_flags |= |
3795 | cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); | 3793 | cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); |
3796 | sbi->s_hash_unsigned = 3; | 3794 | sbi->s_hash_unsigned = 3; |
3797 | #else | 3795 | #else |
3798 | if (!(sb->s_flags & MS_RDONLY)) | 3796 | if (!sb_rdonly(sb)) |
3799 | es->s_flags |= | 3797 | es->s_flags |= |
3800 | cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | 3798 | cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); |
3801 | #endif | 3799 | #endif |
@@ -3995,7 +3993,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3995 | needs_recovery = (es->s_last_orphan != 0 || | 3993 | needs_recovery = (es->s_last_orphan != 0 || |
3996 | ext4_has_feature_journal_needs_recovery(sb)); | 3994 | ext4_has_feature_journal_needs_recovery(sb)); |
3997 | 3995 | ||
3998 | if (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY)) | 3996 | if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) |
3999 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | 3997 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) |
4000 | goto failed_mount3a; | 3998 | goto failed_mount3a; |
4001 | 3999 | ||
@@ -4007,7 +4005,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
4007 | err = ext4_load_journal(sb, es, journal_devnum); | 4005 | err = ext4_load_journal(sb, es, journal_devnum); |
4008 | if (err) | 4006 | if (err) |
4009 | goto failed_mount3a; | 4007 | goto failed_mount3a; |
4010 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && | 4008 | } else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) && |
4011 | ext4_has_feature_journal_needs_recovery(sb)) { | 4009 | ext4_has_feature_journal_needs_recovery(sb)) { |
4012 | ext4_msg(sb, KERN_ERR, "required journal recovery " | 4010 | ext4_msg(sb, KERN_ERR, "required journal recovery " |
4013 | "suppressed and not mounted read-only"); | 4011 | "suppressed and not mounted read-only"); |
@@ -4121,7 +4119,7 @@ no_journal: | |||
4121 | goto failed_mount_wq; | 4119 | goto failed_mount_wq; |
4122 | } | 4120 | } |
4123 | 4121 | ||
4124 | if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) && | 4122 | if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) && |
4125 | !ext4_has_feature_encrypt(sb)) { | 4123 | !ext4_has_feature_encrypt(sb)) { |
4126 | ext4_set_feature_encrypt(sb); | 4124 | ext4_set_feature_encrypt(sb); |
4127 | ext4_commit_super(sb, 1); | 4125 | ext4_commit_super(sb, 1); |
@@ -4175,7 +4173,7 @@ no_journal: | |||
4175 | goto failed_mount4; | 4173 | goto failed_mount4; |
4176 | } | 4174 | } |
4177 | 4175 | ||
4178 | if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) | 4176 | if (ext4_setup_super(sb, es, sb_rdonly(sb))) |
4179 | sb->s_flags |= MS_RDONLY; | 4177 | sb->s_flags |= MS_RDONLY; |
4180 | 4178 | ||
4181 | /* determine the minimum size of new large inodes, if present */ | 4179 | /* determine the minimum size of new large inodes, if present */ |
@@ -4263,7 +4261,7 @@ no_journal: | |||
4263 | 4261 | ||
4264 | #ifdef CONFIG_QUOTA | 4262 | #ifdef CONFIG_QUOTA |
4265 | /* Enable quota usage during mount. */ | 4263 | /* Enable quota usage during mount. */ |
4266 | if (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) { | 4264 | if (ext4_has_feature_quota(sb) && !sb_rdonly(sb)) { |
4267 | err = ext4_enable_quotas(sb); | 4265 | err = ext4_enable_quotas(sb); |
4268 | if (err) | 4266 | if (err) |
4269 | goto failed_mount8; | 4267 | goto failed_mount8; |
@@ -4586,7 +4584,7 @@ static int ext4_load_journal(struct super_block *sb, | |||
4586 | * can get read-write access to the device. | 4584 | * can get read-write access to the device. |
4587 | */ | 4585 | */ |
4588 | if (ext4_has_feature_journal_needs_recovery(sb)) { | 4586 | if (ext4_has_feature_journal_needs_recovery(sb)) { |
4589 | if (sb->s_flags & MS_RDONLY) { | 4587 | if (sb_rdonly(sb)) { |
4590 | ext4_msg(sb, KERN_INFO, "INFO: recovery " | 4588 | ext4_msg(sb, KERN_INFO, "INFO: recovery " |
4591 | "required on readonly filesystem"); | 4589 | "required on readonly filesystem"); |
4592 | if (really_read_only) { | 4590 | if (really_read_only) { |
@@ -4741,8 +4739,7 @@ static void ext4_mark_recovery_complete(struct super_block *sb, | |||
4741 | if (jbd2_journal_flush(journal) < 0) | 4739 | if (jbd2_journal_flush(journal) < 0) |
4742 | goto out; | 4740 | goto out; |
4743 | 4741 | ||
4744 | if (ext4_has_feature_journal_needs_recovery(sb) && | 4742 | if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { |
4745 | sb->s_flags & MS_RDONLY) { | ||
4746 | ext4_clear_feature_journal_needs_recovery(sb); | 4743 | ext4_clear_feature_journal_needs_recovery(sb); |
4747 | ext4_commit_super(sb, 1); | 4744 | ext4_commit_super(sb, 1); |
4748 | } | 4745 | } |
@@ -4798,7 +4795,7 @@ int ext4_force_commit(struct super_block *sb) | |||
4798 | { | 4795 | { |
4799 | journal_t *journal; | 4796 | journal_t *journal; |
4800 | 4797 | ||
4801 | if (sb->s_flags & MS_RDONLY) | 4798 | if (sb_rdonly(sb)) |
4802 | return 0; | 4799 | return 0; |
4803 | 4800 | ||
4804 | journal = EXT4_SB(sb)->s_journal; | 4801 | journal = EXT4_SB(sb)->s_journal; |
@@ -4863,7 +4860,7 @@ static int ext4_freeze(struct super_block *sb) | |||
4863 | int error = 0; | 4860 | int error = 0; |
4864 | journal_t *journal; | 4861 | journal_t *journal; |
4865 | 4862 | ||
4866 | if (sb->s_flags & MS_RDONLY) | 4863 | if (sb_rdonly(sb)) |
4867 | return 0; | 4864 | return 0; |
4868 | 4865 | ||
4869 | journal = EXT4_SB(sb)->s_journal; | 4866 | journal = EXT4_SB(sb)->s_journal; |
@@ -4898,7 +4895,7 @@ out: | |||
4898 | */ | 4895 | */ |
4899 | static int ext4_unfreeze(struct super_block *sb) | 4896 | static int ext4_unfreeze(struct super_block *sb) |
4900 | { | 4897 | { |
4901 | if ((sb->s_flags & MS_RDONLY) || ext4_forced_shutdown(EXT4_SB(sb))) | 4898 | if (sb_rdonly(sb) || ext4_forced_shutdown(EXT4_SB(sb))) |
4902 | return 0; | 4899 | return 0; |
4903 | 4900 | ||
4904 | if (EXT4_SB(sb)->s_journal) { | 4901 | if (EXT4_SB(sb)->s_journal) { |
@@ -5036,7 +5033,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
5036 | if (*flags & MS_LAZYTIME) | 5033 | if (*flags & MS_LAZYTIME) |
5037 | sb->s_flags |= MS_LAZYTIME; | 5034 | sb->s_flags |= MS_LAZYTIME; |
5038 | 5035 | ||
5039 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 5036 | if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { |
5040 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { | 5037 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { |
5041 | err = -EROFS; | 5038 | err = -EROFS; |
5042 | goto restore_opts; | 5039 | goto restore_opts; |
@@ -5131,7 +5128,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
5131 | * Reinitialize lazy itable initialization thread based on | 5128 | * Reinitialize lazy itable initialization thread based on |
5132 | * current settings | 5129 | * current settings |
5133 | */ | 5130 | */ |
5134 | if ((sb->s_flags & MS_RDONLY) || !test_opt(sb, INIT_INODE_TABLE)) | 5131 | if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE)) |
5135 | ext4_unregister_li_request(sb); | 5132 | ext4_unregister_li_request(sb); |
5136 | else { | 5133 | else { |
5137 | ext4_group_t first_not_zeroed; | 5134 | ext4_group_t first_not_zeroed; |
@@ -5703,7 +5700,7 @@ static inline int ext2_feature_set_ok(struct super_block *sb) | |||
5703 | { | 5700 | { |
5704 | if (ext4_has_unknown_ext2_incompat_features(sb)) | 5701 | if (ext4_has_unknown_ext2_incompat_features(sb)) |
5705 | return 0; | 5702 | return 0; |
5706 | if (sb->s_flags & MS_RDONLY) | 5703 | if (sb_rdonly(sb)) |
5707 | return 1; | 5704 | return 1; |
5708 | if (ext4_has_unknown_ext2_ro_compat_features(sb)) | 5705 | if (ext4_has_unknown_ext2_ro_compat_features(sb)) |
5709 | return 0; | 5706 | return 0; |
@@ -5734,7 +5731,7 @@ static inline int ext3_feature_set_ok(struct super_block *sb) | |||
5734 | return 0; | 5731 | return 0; |
5735 | if (!ext4_has_feature_journal(sb)) | 5732 | if (!ext4_has_feature_journal(sb)) |
5736 | return 0; | 5733 | return 0; |
5737 | if (sb->s_flags & MS_RDONLY) | 5734 | if (sb_rdonly(sb)) |
5738 | return 1; | 5735 | return 1; |
5739 | if (ext4_has_unknown_ext3_ro_compat_features(sb)) | 5736 | if (ext4_has_unknown_ext3_ro_compat_features(sb)) |
5740 | return 0; | 5737 | return 0; |
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 1d9a8c4e9de0..48b2336692f9 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c | |||
@@ -309,7 +309,7 @@ static void mark_fsinfo_dirty(struct super_block *sb) | |||
309 | { | 309 | { |
310 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 310 | struct msdos_sb_info *sbi = MSDOS_SB(sb); |
311 | 311 | ||
312 | if (sb->s_flags & MS_RDONLY || sbi->fat_bits != 32) | 312 | if (sb_rdonly(sb) || sbi->fat_bits != 32) |
313 | return; | 313 | return; |
314 | 314 | ||
315 | __mark_inode_dirty(sbi->fsinfo_inode, I_DIRTY_SYNC); | 315 | __mark_inode_dirty(sbi->fsinfo_inode, I_DIRTY_SYNC); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index a2c05f2ada6d..30c52394a7ad 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -657,7 +657,7 @@ static void fat_set_state(struct super_block *sb, | |||
657 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 657 | struct msdos_sb_info *sbi = MSDOS_SB(sb); |
658 | 658 | ||
659 | /* do not change any thing if mounted read only */ | 659 | /* do not change any thing if mounted read only */ |
660 | if ((sb->s_flags & MS_RDONLY) && !force) | 660 | if (sb_rdonly(sb) && !force) |
661 | return; | 661 | return; |
662 | 662 | ||
663 | /* do not change state if fs was dirty */ | 663 | /* do not change state if fs was dirty */ |
@@ -787,7 +787,7 @@ static int fat_remount(struct super_block *sb, int *flags, char *data) | |||
787 | 787 | ||
788 | /* make sure we update state on remount. */ | 788 | /* make sure we update state on remount. */ |
789 | new_rdonly = *flags & MS_RDONLY; | 789 | new_rdonly = *flags & MS_RDONLY; |
790 | if (new_rdonly != (sb->s_flags & MS_RDONLY)) { | 790 | if (new_rdonly != sb_rdonly(sb)) { |
791 | if (new_rdonly) | 791 | if (new_rdonly) |
792 | fat_set_state(sb, 0, 0); | 792 | fat_set_state(sb, 0, 0); |
793 | else | 793 | else |
diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 8a8698119ff7..acc3aa30ee54 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c | |||
@@ -32,7 +32,7 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...) | |||
32 | 32 | ||
33 | if (opts->errors == FAT_ERRORS_PANIC) | 33 | if (opts->errors == FAT_ERRORS_PANIC) |
34 | panic("FAT-fs (%s): fs panic from previous error\n", sb->s_id); | 34 | panic("FAT-fs (%s): fs panic from previous error\n", sb->s_id); |
35 | else if (opts->errors == FAT_ERRORS_RO && !(sb->s_flags & MS_RDONLY)) { | 35 | else if (opts->errors == FAT_ERRORS_RO && !sb_rdonly(sb)) { |
36 | sb->s_flags |= MS_RDONLY; | 36 | sb->s_flags |= MS_RDONLY; |
37 | fat_msg(sb, KERN_ERR, "Filesystem has been set read-only"); | 37 | fat_msg(sb, KERN_ERR, "Filesystem has been set read-only"); |
38 | } | 38 | } |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 5e69636d4dd3..eb3ed24d85ee 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -580,7 +580,7 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote) | |||
580 | struct gfs2_inode *ip = gl->gl_object; | 580 | struct gfs2_inode *ip = gl->gl_object; |
581 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | 581 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
582 | 582 | ||
583 | if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY)) | 583 | if (!remote || sb_rdonly(sdp->sd_vfs)) |
584 | return; | 584 | return; |
585 | 585 | ||
586 | if (gl->gl_demote_state == LM_ST_UNLOCKED && | 586 | if (gl->gl_demote_state == LM_ST_UNLOCKED && |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index e76058d34b74..49db6d0eb7c0 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -1037,7 +1037,7 @@ void gfs2_online_uevent(struct gfs2_sbd *sdp) | |||
1037 | char ro[20]; | 1037 | char ro[20]; |
1038 | char spectator[20]; | 1038 | char spectator[20]; |
1039 | char *envp[] = { ro, spectator, NULL }; | 1039 | char *envp[] = { ro, spectator, NULL }; |
1040 | sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); | 1040 | sprintf(ro, "RDONLY=%d", sb_rdonly(sb)); |
1041 | sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | 1041 | sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); |
1042 | kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp); | 1042 | kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp); |
1043 | } | 1043 | } |
@@ -1179,7 +1179,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent | |||
1179 | goto fail_per_node; | 1179 | goto fail_per_node; |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | if (!(sb->s_flags & MS_RDONLY)) { | 1182 | if (!sb_rdonly(sb)) { |
1183 | error = gfs2_make_fs_rw(sdp); | 1183 | error = gfs2_make_fs_rw(sdp); |
1184 | if (error) { | 1184 | if (error) { |
1185 | fs_err(sdp, "can't make FS RW: %d\n", error); | 1185 | fs_err(sdp, "can't make FS RW: %d\n", error); |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index c2ca9566b764..2d815b0fc8e8 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -452,7 +452,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp) | |||
452 | 452 | ||
453 | *qdp = NULL; | 453 | *qdp = NULL; |
454 | 454 | ||
455 | if (sdp->sd_vfs->s_flags & MS_RDONLY) | 455 | if (sb_rdonly(sdp->sd_vfs)) |
456 | return 0; | 456 | return 0; |
457 | 457 | ||
458 | spin_lock(&qd_lock); | 458 | spin_lock(&qd_lock); |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index 113b6095a58d..9395a3db1a60 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -522,7 +522,7 @@ void gfs2_recover_func(struct work_struct *work) | |||
522 | if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) | 522 | if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) |
523 | ro = 1; | 523 | ro = 1; |
524 | } else { | 524 | } else { |
525 | if (sdp->sd_vfs->s_flags & MS_RDONLY) { | 525 | if (sb_rdonly(sdp->sd_vfs)) { |
526 | /* check if device itself is read-only */ | 526 | /* check if device itself is read-only */ |
527 | ro = bdev_read_only(sdp->sd_vfs->s_bdev); | 527 | ro = bdev_read_only(sdp->sd_vfs->s_bdev); |
528 | if (!ro) { | 528 | if (!ro) { |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index fdedec379b78..51bf287080b4 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -893,7 +893,7 @@ restart: | |||
893 | } | 893 | } |
894 | spin_unlock(&sdp->sd_jindex_spin); | 894 | spin_unlock(&sdp->sd_jindex_spin); |
895 | 895 | ||
896 | if (!(sb->s_flags & MS_RDONLY)) { | 896 | if (!sb_rdonly(sb)) { |
897 | error = gfs2_make_fs_ro(sdp); | 897 | error = gfs2_make_fs_ro(sdp); |
898 | if (error) | 898 | if (error) |
899 | gfs2_io_error(sdp); | 899 | gfs2_io_error(sdp); |
@@ -1535,7 +1535,7 @@ static void gfs2_evict_inode(struct inode *inode) | |||
1535 | return; | 1535 | return; |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | if (inode->i_nlink || (sb->s_flags & MS_RDONLY)) | 1538 | if (inode->i_nlink || sb_rdonly(sb)) |
1539 | goto out; | 1539 | goto out; |
1540 | 1540 | ||
1541 | if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) { | 1541 | if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) { |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index ca1f97ff898c..9eb9d0a1abd9 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -645,7 +645,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
645 | char *envp[] = { ro, spectator, NULL }; | 645 | char *envp[] = { ro, spectator, NULL }; |
646 | int sysfs_frees_sdp = 0; | 646 | int sysfs_frees_sdp = 0; |
647 | 647 | ||
648 | sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); | 648 | sprintf(ro, "RDONLY=%d", sb_rdonly(sb)); |
649 | sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | 649 | sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); |
650 | 650 | ||
651 | sdp->sd_kobj.kset = gfs2_kset; | 651 | sdp->sd_kobj.kset = gfs2_kset; |
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c index 482081bcdf70..894994d2c885 100644 --- a/fs/hfs/mdb.c +++ b/fs/hfs/mdb.c | |||
@@ -210,7 +210,7 @@ int hfs_mdb_get(struct super_block *sb) | |||
210 | pr_warn("filesystem is marked locked, mounting read-only.\n"); | 210 | pr_warn("filesystem is marked locked, mounting read-only.\n"); |
211 | sb->s_flags |= MS_RDONLY; | 211 | sb->s_flags |= MS_RDONLY; |
212 | } | 212 | } |
213 | if (!(sb->s_flags & MS_RDONLY)) { | 213 | if (!sb_rdonly(sb)) { |
214 | /* Mark the volume uncleanly unmounted in case we crash */ | 214 | /* Mark the volume uncleanly unmounted in case we crash */ |
215 | attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); | 215 | attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); |
216 | attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); | 216 | attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); |
@@ -259,7 +259,7 @@ void hfs_mdb_commit(struct super_block *sb) | |||
259 | { | 259 | { |
260 | struct hfs_mdb *mdb = HFS_SB(sb)->mdb; | 260 | struct hfs_mdb *mdb = HFS_SB(sb)->mdb; |
261 | 261 | ||
262 | if (sb->s_flags & MS_RDONLY) | 262 | if (sb_rdonly(sb)) |
263 | return; | 263 | return; |
264 | 264 | ||
265 | lock_buffer(HFS_SB(sb)->mdb_bh); | 265 | lock_buffer(HFS_SB(sb)->mdb_bh); |
@@ -334,7 +334,7 @@ void hfs_mdb_commit(struct super_block *sb) | |||
334 | void hfs_mdb_close(struct super_block *sb) | 334 | void hfs_mdb_close(struct super_block *sb) |
335 | { | 335 | { |
336 | /* update volume attributes */ | 336 | /* update volume attributes */ |
337 | if (sb->s_flags & MS_RDONLY) | 337 | if (sb_rdonly(sb)) |
338 | return; | 338 | return; |
339 | HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); | 339 | HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); |
340 | HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); | 340 | HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index bf6304a350a6..7e0d65e9586c 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -71,7 +71,7 @@ void hfs_mark_mdb_dirty(struct super_block *sb) | |||
71 | struct hfs_sb_info *sbi = HFS_SB(sb); | 71 | struct hfs_sb_info *sbi = HFS_SB(sb); |
72 | unsigned long delay; | 72 | unsigned long delay; |
73 | 73 | ||
74 | if (sb->s_flags & MS_RDONLY) | 74 | if (sb_rdonly(sb)) |
75 | return; | 75 | return; |
76 | 76 | ||
77 | spin_lock(&sbi->work_lock); | 77 | spin_lock(&sbi->work_lock); |
@@ -115,7 +115,7 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data) | |||
115 | { | 115 | { |
116 | sync_filesystem(sb); | 116 | sync_filesystem(sb); |
117 | *flags |= MS_NODIRATIME; | 117 | *flags |= MS_NODIRATIME; |
118 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 118 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
119 | return 0; | 119 | return 0; |
120 | if (!(*flags & MS_RDONLY)) { | 120 | if (!(*flags & MS_RDONLY)) { |
121 | if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { | 121 | if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 67aedf4c2e7c..e5bb2de2262a 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -264,7 +264,7 @@ void hfsplus_mark_mdb_dirty(struct super_block *sb) | |||
264 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | 264 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); |
265 | unsigned long delay; | 265 | unsigned long delay; |
266 | 266 | ||
267 | if (sb->s_flags & MS_RDONLY) | 267 | if (sb_rdonly(sb)) |
268 | return; | 268 | return; |
269 | 269 | ||
270 | spin_lock(&sbi->work_lock); | 270 | spin_lock(&sbi->work_lock); |
@@ -284,7 +284,7 @@ static void hfsplus_put_super(struct super_block *sb) | |||
284 | 284 | ||
285 | cancel_delayed_work_sync(&sbi->sync_work); | 285 | cancel_delayed_work_sync(&sbi->sync_work); |
286 | 286 | ||
287 | if (!(sb->s_flags & MS_RDONLY) && sbi->s_vhdr) { | 287 | if (!sb_rdonly(sb) && sbi->s_vhdr) { |
288 | struct hfsplus_vh *vhdr = sbi->s_vhdr; | 288 | struct hfsplus_vh *vhdr = sbi->s_vhdr; |
289 | 289 | ||
290 | vhdr->modify_date = hfsp_now2mt(); | 290 | vhdr->modify_date = hfsp_now2mt(); |
@@ -329,7 +329,7 @@ static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
329 | static int hfsplus_remount(struct super_block *sb, int *flags, char *data) | 329 | static int hfsplus_remount(struct super_block *sb, int *flags, char *data) |
330 | { | 330 | { |
331 | sync_filesystem(sb); | 331 | sync_filesystem(sb); |
332 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 332 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
333 | return 0; | 333 | return 0; |
334 | if (!(*flags & MS_RDONLY)) { | 334 | if (!(*flags & MS_RDONLY)) { |
335 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb)->s_vhdr; | 335 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb)->s_vhdr; |
@@ -462,7 +462,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
462 | pr_warn("Filesystem is marked locked, mounting read-only.\n"); | 462 | pr_warn("Filesystem is marked locked, mounting read-only.\n"); |
463 | sb->s_flags |= MS_RDONLY; | 463 | sb->s_flags |= MS_RDONLY; |
464 | } else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && | 464 | } else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && |
465 | !(sb->s_flags & MS_RDONLY)) { | 465 | !sb_rdonly(sb)) { |
466 | pr_warn("write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.\n"); | 466 | pr_warn("write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.\n"); |
467 | sb->s_flags |= MS_RDONLY; | 467 | sb->s_flags |= MS_RDONLY; |
468 | } | 468 | } |
@@ -535,7 +535,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
535 | } else | 535 | } else |
536 | hfs_find_exit(&fd); | 536 | hfs_find_exit(&fd); |
537 | 537 | ||
538 | if (!(sb->s_flags & MS_RDONLY)) { | 538 | if (!sb_rdonly(sb)) { |
539 | /* | 539 | /* |
540 | * H+LX == hfsplusutils, H+Lx == this driver, H+lx is unused | 540 | * H+LX == hfsplusutils, H+Lx == this driver, H+lx is unused |
541 | * all three are registered with Apple for our use | 541 | * all three are registered with Apple for our use |
diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c index d6a4b55d2ab0..098bf0f4f386 100644 --- a/fs/hpfs/alloc.c +++ b/fs/hpfs/alloc.c | |||
@@ -538,7 +538,7 @@ int hpfs_trim_fs(struct super_block *s, u64 start, u64 end, u64 minlen, unsigned | |||
538 | return 0; | 538 | return 0; |
539 | if (start < sbi->sb_dirband_start + sbi->sb_dirband_size && end > sbi->sb_dirband_start) { | 539 | if (start < sbi->sb_dirband_start + sbi->sb_dirband_size && end > sbi->sb_dirband_start) { |
540 | hpfs_lock(s); | 540 | hpfs_lock(s); |
541 | if (s->s_flags & MS_RDONLY) { | 541 | if (sb_rdonly(s)) { |
542 | err = -EROFS; | 542 | err = -EROFS; |
543 | goto unlock_1; | 543 | goto unlock_1; |
544 | } | 544 | } |
@@ -559,7 +559,7 @@ unlock_1: | |||
559 | end_bmp = (end + 0x3fff) >> 14; | 559 | end_bmp = (end + 0x3fff) >> 14; |
560 | while (start_bmp < end_bmp && !err) { | 560 | while (start_bmp < end_bmp && !err) { |
561 | hpfs_lock(s); | 561 | hpfs_lock(s); |
562 | if (s->s_flags & MS_RDONLY) { | 562 | if (sb_rdonly(s)) { |
563 | err = -EROFS; | 563 | err = -EROFS; |
564 | goto unlock_2; | 564 | goto unlock_2; |
565 | } | 565 | } |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 7b9150c2e75c..fa6bbb4f509f 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -264,7 +264,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in | |||
264 | hpfs_result = hpfs_i(result); | 264 | hpfs_result = hpfs_i(result); |
265 | if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; | 265 | if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; |
266 | 266 | ||
267 | if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { | 267 | if (de->has_acl || de->has_xtd_perm) if (!sb_rdonly(dir->i_sb)) { |
268 | hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); | 268 | hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); |
269 | goto bail1; | 269 | goto bail1; |
270 | } | 270 | } |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 82067ca22f2b..1516fb4e28f4 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | static void mark_dirty(struct super_block *s, int remount) | 22 | static void mark_dirty(struct super_block *s, int remount) |
23 | { | 23 | { |
24 | if (hpfs_sb(s)->sb_chkdsk && (remount || !(s->s_flags & MS_RDONLY))) { | 24 | if (hpfs_sb(s)->sb_chkdsk && (remount || !sb_rdonly(s))) { |
25 | struct buffer_head *bh; | 25 | struct buffer_head *bh; |
26 | struct hpfs_spare_block *sb; | 26 | struct hpfs_spare_block *sb; |
27 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | 27 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { |
@@ -41,7 +41,7 @@ static void unmark_dirty(struct super_block *s) | |||
41 | { | 41 | { |
42 | struct buffer_head *bh; | 42 | struct buffer_head *bh; |
43 | struct hpfs_spare_block *sb; | 43 | struct hpfs_spare_block *sb; |
44 | if (s->s_flags & MS_RDONLY) return; | 44 | if (sb_rdonly(s)) return; |
45 | sync_blockdev(s->s_bdev); | 45 | sync_blockdev(s->s_bdev); |
46 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | 46 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { |
47 | sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; | 47 | sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; |
@@ -73,14 +73,14 @@ void hpfs_error(struct super_block *s, const char *fmt, ...) | |||
73 | mark_dirty(s, 0); | 73 | mark_dirty(s, 0); |
74 | panic("HPFS panic"); | 74 | panic("HPFS panic"); |
75 | } else if (hpfs_sb(s)->sb_err == 1) { | 75 | } else if (hpfs_sb(s)->sb_err == 1) { |
76 | if (s->s_flags & MS_RDONLY) | 76 | if (sb_rdonly(s)) |
77 | pr_cont("; already mounted read-only\n"); | 77 | pr_cont("; already mounted read-only\n"); |
78 | else { | 78 | else { |
79 | pr_cont("; remounting read-only\n"); | 79 | pr_cont("; remounting read-only\n"); |
80 | mark_dirty(s, 0); | 80 | mark_dirty(s, 0); |
81 | s->s_flags |= MS_RDONLY; | 81 | s->s_flags |= MS_RDONLY; |
82 | } | 82 | } |
83 | } else if (s->s_flags & MS_RDONLY) | 83 | } else if (sb_rdonly(s)) |
84 | pr_cont("; going on - but anything won't be destroyed because it's read-only\n"); | 84 | pr_cont("; going on - but anything won't be destroyed because it's read-only\n"); |
85 | else | 85 | else |
86 | pr_cont("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); | 86 | pr_cont("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); |
@@ -607,8 +607,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
607 | } | 607 | } |
608 | 608 | ||
609 | /* Check version */ | 609 | /* Check version */ |
610 | if (!(s->s_flags & MS_RDONLY) && | 610 | if (!sb_rdonly(s) && superblock->funcversion != 2 && superblock->funcversion != 3) { |
611 | superblock->funcversion != 2 && superblock->funcversion != 3) { | ||
612 | pr_err("Bad version %d,%d. Mount readonly to go around\n", | 611 | pr_err("Bad version %d,%d. Mount readonly to go around\n", |
613 | (int)superblock->version, (int)superblock->funcversion); | 612 | (int)superblock->version, (int)superblock->funcversion); |
614 | pr_err("please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); | 613 | pr_err("please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); |
@@ -666,7 +665,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
666 | hpfs_error(s, "improperly stopped"); | 665 | hpfs_error(s, "improperly stopped"); |
667 | } | 666 | } |
668 | 667 | ||
669 | if (!(s->s_flags & MS_RDONLY)) { | 668 | if (!sb_rdonly(s)) { |
670 | spareblock->dirty = 1; | 669 | spareblock->dirty = 1; |
671 | spareblock->old_wrote = 0; | 670 | spareblock->old_wrote = 0; |
672 | mark_buffer_dirty(bh2); | 671 | mark_buffer_dirty(bh2); |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 8cf898a59730..2f6239c7073a 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -733,7 +733,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | |||
733 | 733 | ||
734 | root_found: | 734 | root_found: |
735 | /* We don't support read-write mounts */ | 735 | /* We don't support read-write mounts */ |
736 | if (!(s->s_flags & MS_RDONLY)) { | 736 | if (!sb_rdonly(s)) { |
737 | error = -EACCES; | 737 | error = -EACCES; |
738 | goto out_freebh; | 738 | goto out_freebh; |
739 | } | 739 | } |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 76fa814df3d1..e96c6b05e43e 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -395,14 +395,14 @@ int jffs2_do_remount_fs(struct super_block *sb, int *flags, char *data) | |||
395 | { | 395 | { |
396 | struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | 396 | struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); |
397 | 397 | ||
398 | if (c->flags & JFFS2_SB_FLAG_RO && !(sb->s_flags & MS_RDONLY)) | 398 | if (c->flags & JFFS2_SB_FLAG_RO && !sb_rdonly(sb)) |
399 | return -EROFS; | 399 | return -EROFS; |
400 | 400 | ||
401 | /* We stop if it was running, then restart if it needs to. | 401 | /* We stop if it was running, then restart if it needs to. |
402 | This also catches the case where it was stopped and this | 402 | This also catches the case where it was stopped and this |
403 | is just a remount to restart it. | 403 | is just a remount to restart it. |
404 | Flush the writebuffer, if neccecary, else we loose it */ | 404 | Flush the writebuffer, if neccecary, else we loose it */ |
405 | if (!(sb->s_flags & MS_RDONLY)) { | 405 | if (!sb_rdonly(sb)) { |
406 | jffs2_stop_garbage_collect_thread(c); | 406 | jffs2_stop_garbage_collect_thread(c); |
407 | mutex_lock(&c->alloc_sem); | 407 | mutex_lock(&c->alloc_sem); |
408 | jffs2_flush_wbuf_pad(c); | 408 | jffs2_flush_wbuf_pad(c); |
@@ -590,7 +590,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | |||
590 | sb->s_blocksize = PAGE_SIZE; | 590 | sb->s_blocksize = PAGE_SIZE; |
591 | sb->s_blocksize_bits = PAGE_SHIFT; | 591 | sb->s_blocksize_bits = PAGE_SHIFT; |
592 | sb->s_magic = JFFS2_SUPER_MAGIC; | 592 | sb->s_magic = JFFS2_SUPER_MAGIC; |
593 | if (!(sb->s_flags & MS_RDONLY)) | 593 | if (!sb_rdonly(sb)) |
594 | jffs2_start_garbage_collect_thread(c); | 594 | jffs2_start_garbage_collect_thread(c); |
595 | return 0; | 595 | return 0; |
596 | 596 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 5ef21f4c4c77..153f1c6eb169 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -342,7 +342,7 @@ static void jffs2_put_super (struct super_block *sb) | |||
342 | static void jffs2_kill_sb(struct super_block *sb) | 342 | static void jffs2_kill_sb(struct super_block *sb) |
343 | { | 343 | { |
344 | struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | 344 | struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); |
345 | if (!(sb->s_flags & MS_RDONLY)) | 345 | if (!sb_rdonly(sb)) |
346 | jffs2_stop_garbage_collect_thread(c); | 346 | jffs2_stop_garbage_collect_thread(c); |
347 | kill_mtd_super(sb); | 347 | kill_mtd_super(sb); |
348 | kfree(c); | 348 | kfree(c); |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index b25d28a21212..707cbe72e115 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -1162,7 +1162,7 @@ static void delayed_wbuf_sync(struct work_struct *work) | |||
1162 | struct jffs2_sb_info *c = work_to_sb(work); | 1162 | struct jffs2_sb_info *c = work_to_sb(work); |
1163 | struct super_block *sb = OFNI_BS_2SFFJ(c); | 1163 | struct super_block *sb = OFNI_BS_2SFFJ(c); |
1164 | 1164 | ||
1165 | if (!(sb->s_flags & MS_RDONLY)) { | 1165 | if (!sb_rdonly(sb)) { |
1166 | jffs2_dbg(1, "%s()\n", __func__); | 1166 | jffs2_dbg(1, "%s()\n", __func__); |
1167 | jffs2_flush_wbuf_gc(c, 0); | 1167 | jffs2_flush_wbuf_gc(c, 0); |
1168 | } | 1168 | } |
@@ -1173,7 +1173,7 @@ void jffs2_dirty_trigger(struct jffs2_sb_info *c) | |||
1173 | struct super_block *sb = OFNI_BS_2SFFJ(c); | 1173 | struct super_block *sb = OFNI_BS_2SFFJ(c); |
1174 | unsigned long delay; | 1174 | unsigned long delay; |
1175 | 1175 | ||
1176 | if (sb->s_flags & MS_RDONLY) | 1176 | if (sb_rdonly(sb)) |
1177 | return; | 1177 | return; |
1178 | 1178 | ||
1179 | delay = msecs_to_jiffies(dirty_writeback_interval * 10); | 1179 | delay = msecs_to_jiffies(dirty_writeback_interval * 10); |
diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c index 9895595fd2f2..d8658607bf46 100644 --- a/fs/jfs/jfs_mount.c +++ b/fs/jfs/jfs_mount.c | |||
@@ -362,7 +362,7 @@ static int chkSuper(struct super_block *sb) | |||
362 | 362 | ||
363 | /* validate fs state */ | 363 | /* validate fs state */ |
364 | if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && | 364 | if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && |
365 | !(sb->s_flags & MS_RDONLY)) { | 365 | !sb_rdonly(sb)) { |
366 | jfs_err("jfs_mount: Mount Failure: File System Dirty."); | 366 | jfs_err("jfs_mount: Mount Failure: File System Dirty."); |
367 | rc = -EINVAL; | 367 | rc = -EINVAL; |
368 | goto out; | 368 | goto out; |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index e8aad7d87b8c..8612a7db2a04 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -76,7 +76,7 @@ static void jfs_handle_error(struct super_block *sb) | |||
76 | { | 76 | { |
77 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 77 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
78 | 78 | ||
79 | if (sb->s_flags & MS_RDONLY) | 79 | if (sb_rdonly(sb)) |
80 | return; | 80 | return; |
81 | 81 | ||
82 | updateSuper(sb, FM_DIRTY); | 82 | updateSuper(sb, FM_DIRTY); |
@@ -468,7 +468,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
468 | return -EINVAL; | 468 | return -EINVAL; |
469 | 469 | ||
470 | if (newLVSize) { | 470 | if (newLVSize) { |
471 | if (sb->s_flags & MS_RDONLY) { | 471 | if (sb_rdonly(sb)) { |
472 | pr_err("JFS: resize requires volume to be mounted read-write\n"); | 472 | pr_err("JFS: resize requires volume to be mounted read-write\n"); |
473 | return -EROFS; | 473 | return -EROFS; |
474 | } | 474 | } |
@@ -477,7 +477,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
477 | return rc; | 477 | return rc; |
478 | } | 478 | } |
479 | 479 | ||
480 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 480 | if (sb_rdonly(sb) && !(*flags & MS_RDONLY)) { |
481 | /* | 481 | /* |
482 | * Invalidate any previously read metadata. fsck may have | 482 | * Invalidate any previously read metadata. fsck may have |
483 | * changed the on-disk data since we mounted r/o | 483 | * changed the on-disk data since we mounted r/o |
@@ -493,7 +493,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
493 | dquot_resume(sb, -1); | 493 | dquot_resume(sb, -1); |
494 | return ret; | 494 | return ret; |
495 | } | 495 | } |
496 | if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { | 496 | if (!sb_rdonly(sb) && (*flags & MS_RDONLY)) { |
497 | rc = dquot_suspend(sb, -1); | 497 | rc = dquot_suspend(sb, -1); |
498 | if (rc < 0) | 498 | if (rc < 0) |
499 | return rc; | 499 | return rc; |
@@ -502,7 +502,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
502 | return rc; | 502 | return rc; |
503 | } | 503 | } |
504 | if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) | 504 | if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) |
505 | if (!(sb->s_flags & MS_RDONLY)) { | 505 | if (!sb_rdonly(sb)) { |
506 | rc = jfs_umount_rw(sb); | 506 | rc = jfs_umount_rw(sb); |
507 | if (rc) | 507 | if (rc) |
508 | return rc; | 508 | return rc; |
@@ -592,7 +592,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
592 | jfs_err("jfs_mount failed w/return code = %d", rc); | 592 | jfs_err("jfs_mount failed w/return code = %d", rc); |
593 | goto out_mount_failed; | 593 | goto out_mount_failed; |
594 | } | 594 | } |
595 | if (sb->s_flags & MS_RDONLY) | 595 | if (sb_rdonly(sb)) |
596 | sbi->log = NULL; | 596 | sbi->log = NULL; |
597 | else { | 597 | else { |
598 | rc = jfs_mount_rw(sb, 0); | 598 | rc = jfs_mount_rw(sb, 0); |
@@ -658,7 +658,7 @@ static int jfs_freeze(struct super_block *sb) | |||
658 | struct jfs_log *log = sbi->log; | 658 | struct jfs_log *log = sbi->log; |
659 | int rc = 0; | 659 | int rc = 0; |
660 | 660 | ||
661 | if (!(sb->s_flags & MS_RDONLY)) { | 661 | if (!sb_rdonly(sb)) { |
662 | txQuiesce(sb); | 662 | txQuiesce(sb); |
663 | rc = lmLogShutdown(log); | 663 | rc = lmLogShutdown(log); |
664 | if (rc) { | 664 | if (rc) { |
@@ -688,7 +688,7 @@ static int jfs_unfreeze(struct super_block *sb) | |||
688 | struct jfs_log *log = sbi->log; | 688 | struct jfs_log *log = sbi->log; |
689 | int rc = 0; | 689 | int rc = 0; |
690 | 690 | ||
691 | if (!(sb->s_flags & MS_RDONLY)) { | 691 | if (!sb_rdonly(sb)) { |
692 | rc = updateSuper(sb, FM_MOUNT); | 692 | rc = updateSuper(sb, FM_MOUNT); |
693 | if (rc) { | 693 | if (rc) { |
694 | jfs_error(sb, "updateSuper failed\n"); | 694 | jfs_error(sb, "updateSuper failed\n"); |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 6ac76b0434e9..b6829d679643 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -42,7 +42,7 @@ static void minix_put_super(struct super_block *sb) | |||
42 | int i; | 42 | int i; |
43 | struct minix_sb_info *sbi = minix_sb(sb); | 43 | struct minix_sb_info *sbi = minix_sb(sb); |
44 | 44 | ||
45 | if (!(sb->s_flags & MS_RDONLY)) { | 45 | if (!sb_rdonly(sb)) { |
46 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | 46 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ |
47 | sbi->s_ms->s_state = sbi->s_mount_state; | 47 | sbi->s_ms->s_state = sbi->s_mount_state; |
48 | mark_buffer_dirty(sbi->s_sbh); | 48 | mark_buffer_dirty(sbi->s_sbh); |
@@ -125,7 +125,7 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) | |||
125 | 125 | ||
126 | sync_filesystem(sb); | 126 | sync_filesystem(sb); |
127 | ms = sbi->s_ms; | 127 | ms = sbi->s_ms; |
128 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 128 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
129 | return 0; | 129 | return 0; |
130 | if (*flags & MS_RDONLY) { | 130 | if (*flags & MS_RDONLY) { |
131 | if (ms->s_state & MINIX_VALID_FS || | 131 | if (ms->s_state & MINIX_VALID_FS || |
@@ -293,7 +293,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
293 | if (!s->s_root) | 293 | if (!s->s_root) |
294 | goto out_no_root; | 294 | goto out_no_root; |
295 | 295 | ||
296 | if (!(s->s_flags & MS_RDONLY)) { | 296 | if (!sb_rdonly(s)) { |
297 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | 297 | if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ |
298 | ms->s_state &= ~MINIX_VALID_FS; | 298 | ms->s_state &= ~MINIX_VALID_FS; |
299 | mark_buffer_dirty(bh); | 299 | mark_buffer_dirty(bh); |
diff --git a/fs/namei.c b/fs/namei.c index 88fd38d1e3e7..bf03a62e1f5d 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -447,8 +447,7 @@ static int sb_permission(struct super_block *sb, struct inode *inode, int mask) | |||
447 | umode_t mode = inode->i_mode; | 447 | umode_t mode = inode->i_mode; |
448 | 448 | ||
449 | /* Nobody gets write access to a read-only fs. */ | 449 | /* Nobody gets write access to a read-only fs. */ |
450 | if ((sb->s_flags & MS_RDONLY) && | 450 | if (sb_rdonly(sb) && (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) |
451 | (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) | ||
452 | return -EROFS; | 451 | return -EROFS; |
453 | } | 452 | } |
454 | return 0; | 453 | return 0; |
diff --git a/fs/namespace.c b/fs/namespace.c index f8893dc6a989..e42c9abfeaa8 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -275,7 +275,7 @@ int __mnt_is_readonly(struct vfsmount *mnt) | |||
275 | { | 275 | { |
276 | if (mnt->mnt_flags & MNT_READONLY) | 276 | if (mnt->mnt_flags & MNT_READONLY) |
277 | return 1; | 277 | return 1; |
278 | if (mnt->mnt_sb->s_flags & MS_RDONLY) | 278 | if (sb_rdonly(mnt->mnt_sb)) |
279 | return 1; | 279 | return 1; |
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
@@ -1534,7 +1534,7 @@ static int do_umount(struct mount *mnt, int flags) | |||
1534 | if (!capable(CAP_SYS_ADMIN)) | 1534 | if (!capable(CAP_SYS_ADMIN)) |
1535 | return -EPERM; | 1535 | return -EPERM; |
1536 | down_write(&sb->s_umount); | 1536 | down_write(&sb->s_umount); |
1537 | if (!(sb->s_flags & MS_RDONLY)) | 1537 | if (!sb_rdonly(sb)) |
1538 | retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); | 1538 | retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); |
1539 | up_write(&sb->s_umount); | 1539 | up_write(&sb->s_umount); |
1540 | return retval; | 1540 | return retval; |
@@ -3300,7 +3300,7 @@ static bool mnt_already_visible(struct mnt_namespace *ns, struct vfsmount *new, | |||
3300 | mnt_flags = mnt->mnt.mnt_flags; | 3300 | mnt_flags = mnt->mnt.mnt_flags; |
3301 | 3301 | ||
3302 | /* Don't miss readonly hidden in the superblock flags */ | 3302 | /* Don't miss readonly hidden in the superblock flags */ |
3303 | if (mnt->mnt.mnt_sb->s_flags & MS_RDONLY) | 3303 | if (sb_rdonly(mnt->mnt.mnt_sb)) |
3304 | mnt_flags |= MNT_LOCK_READONLY; | 3304 | mnt_flags |= MNT_LOCK_READONLY; |
3305 | 3305 | ||
3306 | /* Verify the mount flags are equal to or more permissive | 3306 | /* Verify the mount flags are equal to or more permissive |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index d828ef88e7db..65d247a68b07 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -812,7 +812,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root) | |||
812 | * Display all mount option settings | 812 | * Display all mount option settings |
813 | */ | 813 | */ |
814 | seq_printf(m, "\n\topts:\t"); | 814 | seq_printf(m, "\n\topts:\t"); |
815 | seq_puts(m, root->d_sb->s_flags & MS_RDONLY ? "ro" : "rw"); | 815 | seq_puts(m, sb_rdonly(root->d_sb) ? "ro" : "rw"); |
816 | seq_puts(m, root->d_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : ""); | 816 | seq_puts(m, root->d_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : ""); |
817 | seq_puts(m, root->d_sb->s_flags & MS_NOATIME ? ",noatime" : ""); | 817 | seq_puts(m, root->d_sb->s_flags & MS_NOATIME ? ",noatime" : ""); |
818 | seq_puts(m, root->d_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : ""); | 818 | seq_puts(m, root->d_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : ""); |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 7ffe71a8dfb9..6a612d832e7d 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -174,7 +174,7 @@ static int nilfs_writepages(struct address_space *mapping, | |||
174 | struct inode *inode = mapping->host; | 174 | struct inode *inode = mapping->host; |
175 | int err = 0; | 175 | int err = 0; |
176 | 176 | ||
177 | if (inode->i_sb->s_flags & MS_RDONLY) { | 177 | if (sb_rdonly(inode->i_sb)) { |
178 | nilfs_clear_dirty_pages(mapping, false); | 178 | nilfs_clear_dirty_pages(mapping, false); |
179 | return -EROFS; | 179 | return -EROFS; |
180 | } | 180 | } |
@@ -191,7 +191,7 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc) | |||
191 | struct inode *inode = page->mapping->host; | 191 | struct inode *inode = page->mapping->host; |
192 | int err; | 192 | int err; |
193 | 193 | ||
194 | if (inode->i_sb->s_flags & MS_RDONLY) { | 194 | if (sb_rdonly(inode->i_sb)) { |
195 | /* | 195 | /* |
196 | * It means that filesystem was remounted in read-only | 196 | * It means that filesystem was remounted in read-only |
197 | * mode because of error or metadata corruption. But we | 197 | * mode because of error or metadata corruption. But we |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 98835ed6bef4..c6bc1033e7d2 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -413,7 +413,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc) | |||
413 | struct super_block *sb; | 413 | struct super_block *sb; |
414 | int err = 0; | 414 | int err = 0; |
415 | 415 | ||
416 | if (inode && (inode->i_sb->s_flags & MS_RDONLY)) { | 416 | if (inode && sb_rdonly(inode->i_sb)) { |
417 | /* | 417 | /* |
418 | * It means that filesystem was remounted in read-only | 418 | * It means that filesystem was remounted in read-only |
419 | * mode because of error or metadata corruption. But we | 419 | * mode because of error or metadata corruption. But we |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 926682981d61..4fc018dfcfae 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -136,7 +136,7 @@ void __nilfs_error(struct super_block *sb, const char *function, | |||
136 | 136 | ||
137 | va_end(args); | 137 | va_end(args); |
138 | 138 | ||
139 | if (!(sb->s_flags & MS_RDONLY)) { | 139 | if (!sb_rdonly(sb)) { |
140 | nilfs_set_error(sb); | 140 | nilfs_set_error(sb); |
141 | 141 | ||
142 | if (nilfs_test_opt(nilfs, ERRORS_RO)) { | 142 | if (nilfs_test_opt(nilfs, ERRORS_RO)) { |
@@ -478,7 +478,7 @@ static void nilfs_put_super(struct super_block *sb) | |||
478 | 478 | ||
479 | nilfs_detach_log_writer(sb); | 479 | nilfs_detach_log_writer(sb); |
480 | 480 | ||
481 | if (!(sb->s_flags & MS_RDONLY)) { | 481 | if (!sb_rdonly(sb)) { |
482 | down_write(&nilfs->ns_sem); | 482 | down_write(&nilfs->ns_sem); |
483 | nilfs_cleanup_super(sb); | 483 | nilfs_cleanup_super(sb); |
484 | up_write(&nilfs->ns_sem); | 484 | up_write(&nilfs->ns_sem); |
@@ -578,7 +578,7 @@ static int nilfs_freeze(struct super_block *sb) | |||
578 | struct the_nilfs *nilfs = sb->s_fs_info; | 578 | struct the_nilfs *nilfs = sb->s_fs_info; |
579 | int err; | 579 | int err; |
580 | 580 | ||
581 | if (sb->s_flags & MS_RDONLY) | 581 | if (sb_rdonly(sb)) |
582 | return 0; | 582 | return 0; |
583 | 583 | ||
584 | /* Mark super block clean */ | 584 | /* Mark super block clean */ |
@@ -592,7 +592,7 @@ static int nilfs_unfreeze(struct super_block *sb) | |||
592 | { | 592 | { |
593 | struct the_nilfs *nilfs = sb->s_fs_info; | 593 | struct the_nilfs *nilfs = sb->s_fs_info; |
594 | 594 | ||
595 | if (sb->s_flags & MS_RDONLY) | 595 | if (sb_rdonly(sb)) |
596 | return 0; | 596 | return 0; |
597 | 597 | ||
598 | down_write(&nilfs->ns_sem); | 598 | down_write(&nilfs->ns_sem); |
@@ -898,7 +898,7 @@ int nilfs_check_feature_compatibility(struct super_block *sb, | |||
898 | } | 898 | } |
899 | features = le64_to_cpu(sbp->s_feature_compat_ro) & | 899 | features = le64_to_cpu(sbp->s_feature_compat_ro) & |
900 | ~NILFS_FEATURE_COMPAT_RO_SUPP; | 900 | ~NILFS_FEATURE_COMPAT_RO_SUPP; |
901 | if (!(sb->s_flags & MS_RDONLY) && features) { | 901 | if (!sb_rdonly(sb) && features) { |
902 | nilfs_msg(sb, KERN_ERR, | 902 | nilfs_msg(sb, KERN_ERR, |
903 | "couldn't mount RDWR because of unsupported optional features (%llx)", | 903 | "couldn't mount RDWR because of unsupported optional features (%llx)", |
904 | (unsigned long long)features); | 904 | (unsigned long long)features); |
@@ -1083,7 +1083,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) | |||
1083 | goto failed_unload; | 1083 | goto failed_unload; |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | if (!(sb->s_flags & MS_RDONLY)) { | 1086 | if (!sb_rdonly(sb)) { |
1087 | err = nilfs_attach_log_writer(sb, fsroot); | 1087 | err = nilfs_attach_log_writer(sb, fsroot); |
1088 | if (err) | 1088 | if (err) |
1089 | goto failed_checkpoint; | 1089 | goto failed_checkpoint; |
@@ -1095,7 +1095,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) | |||
1095 | 1095 | ||
1096 | nilfs_put_root(fsroot); | 1096 | nilfs_put_root(fsroot); |
1097 | 1097 | ||
1098 | if (!(sb->s_flags & MS_RDONLY)) { | 1098 | if (!sb_rdonly(sb)) { |
1099 | down_write(&nilfs->ns_sem); | 1099 | down_write(&nilfs->ns_sem); |
1100 | nilfs_setup_super(sb, true); | 1100 | nilfs_setup_super(sb, true); |
1101 | up_write(&nilfs->ns_sem); | 1101 | up_write(&nilfs->ns_sem); |
@@ -1144,7 +1144,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) | |||
1144 | goto restore_opts; | 1144 | goto restore_opts; |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 1147 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
1148 | goto out; | 1148 | goto out; |
1149 | if (*flags & MS_RDONLY) { | 1149 | if (*flags & MS_RDONLY) { |
1150 | /* Shutting down log writer */ | 1150 | /* Shutting down log writer */ |
@@ -1338,8 +1338,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1338 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 1338 | if ((flags ^ s->s_flags) & MS_RDONLY) { |
1339 | nilfs_msg(s, KERN_ERR, | 1339 | nilfs_msg(s, KERN_ERR, |
1340 | "the device already has a %s mount.", | 1340 | "the device already has a %s mount.", |
1341 | (s->s_flags & MS_RDONLY) ? | 1341 | sb_rdonly(s) ? "read-only" : "read/write"); |
1342 | "read-only" : "read/write"); | ||
1343 | err = -EBUSY; | 1342 | err = -EBUSY; |
1344 | goto failed_super; | 1343 | goto failed_super; |
1345 | } | 1344 | } |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index ecb49870a680..3f70f041dbe9 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -487,7 +487,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
487 | * When remounting read-only, mark the volume clean if no volume errors | 487 | * When remounting read-only, mark the volume clean if no volume errors |
488 | * have occurred. | 488 | * have occurred. |
489 | */ | 489 | */ |
490 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 490 | if (sb_rdonly(sb) && !(*flags & MS_RDONLY)) { |
491 | static const char *es = ". Cannot remount read-write."; | 491 | static const char *es = ". Cannot remount read-write."; |
492 | 492 | ||
493 | /* Remounting read-write. */ | 493 | /* Remounting read-write. */ |
@@ -548,7 +548,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
548 | NVolSetErrors(vol); | 548 | NVolSetErrors(vol); |
549 | return -EROFS; | 549 | return -EROFS; |
550 | } | 550 | } |
551 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { | 551 | } else if (!sb_rdonly(sb) && (*flags & MS_RDONLY)) { |
552 | /* Remounting read-only. */ | 552 | /* Remounting read-only. */ |
553 | if (!NVolErrors(vol)) { | 553 | if (!NVolErrors(vol)) { |
554 | if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) | 554 | if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) |
@@ -732,7 +732,7 @@ hotfix_primary_boot_sector: | |||
732 | * on a large sector device contains the whole boot loader or | 732 | * on a large sector device contains the whole boot loader or |
733 | * just the first 512 bytes). | 733 | * just the first 512 bytes). |
734 | */ | 734 | */ |
735 | if (!(sb->s_flags & MS_RDONLY)) { | 735 | if (!sb_rdonly(sb)) { |
736 | ntfs_warning(sb, "Hot-fix: Recovering invalid primary " | 736 | ntfs_warning(sb, "Hot-fix: Recovering invalid primary " |
737 | "boot sector from backup copy."); | 737 | "boot sector from backup copy."); |
738 | memcpy(bh_primary->b_data, bh_backup->b_data, | 738 | memcpy(bh_primary->b_data, bh_backup->b_data, |
@@ -1789,7 +1789,7 @@ static bool load_system_files(ntfs_volume *vol) | |||
1789 | static const char *es3 = ". Run ntfsfix and/or chkdsk."; | 1789 | static const char *es3 = ". Run ntfsfix and/or chkdsk."; |
1790 | 1790 | ||
1791 | /* If a read-write mount, convert it to a read-only mount. */ | 1791 | /* If a read-write mount, convert it to a read-only mount. */ |
1792 | if (!(sb->s_flags & MS_RDONLY)) { | 1792 | if (!sb_rdonly(sb)) { |
1793 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 1793 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
1794 | ON_ERRORS_CONTINUE))) { | 1794 | ON_ERRORS_CONTINUE))) { |
1795 | ntfs_error(sb, "%s and neither on_errors=" | 1795 | ntfs_error(sb, "%s and neither on_errors=" |
@@ -1928,7 +1928,7 @@ get_ctx_vol_failed: | |||
1928 | (unsigned)le16_to_cpu(vol->vol_flags)); | 1928 | (unsigned)le16_to_cpu(vol->vol_flags)); |
1929 | } | 1929 | } |
1930 | /* If a read-write mount, convert it to a read-only mount. */ | 1930 | /* If a read-write mount, convert it to a read-only mount. */ |
1931 | if (!(sb->s_flags & MS_RDONLY)) { | 1931 | if (!sb_rdonly(sb)) { |
1932 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 1932 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
1933 | ON_ERRORS_CONTINUE))) { | 1933 | ON_ERRORS_CONTINUE))) { |
1934 | ntfs_error(sb, "%s and neither on_errors=" | 1934 | ntfs_error(sb, "%s and neither on_errors=" |
@@ -1961,7 +1961,7 @@ get_ctx_vol_failed: | |||
1961 | 1961 | ||
1962 | es1 = !vol->logfile_ino ? es1a : es1b; | 1962 | es1 = !vol->logfile_ino ? es1a : es1b; |
1963 | /* If a read-write mount, convert it to a read-only mount. */ | 1963 | /* If a read-write mount, convert it to a read-only mount. */ |
1964 | if (!(sb->s_flags & MS_RDONLY)) { | 1964 | if (!sb_rdonly(sb)) { |
1965 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 1965 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
1966 | ON_ERRORS_CONTINUE))) { | 1966 | ON_ERRORS_CONTINUE))) { |
1967 | ntfs_error(sb, "%s and neither on_errors=" | 1967 | ntfs_error(sb, "%s and neither on_errors=" |
@@ -2010,7 +2010,7 @@ get_ctx_vol_failed: | |||
2010 | 2010 | ||
2011 | es1 = err < 0 ? es1a : es1b; | 2011 | es1 = err < 0 ? es1a : es1b; |
2012 | /* If a read-write mount, convert it to a read-only mount. */ | 2012 | /* If a read-write mount, convert it to a read-only mount. */ |
2013 | if (!(sb->s_flags & MS_RDONLY)) { | 2013 | if (!sb_rdonly(sb)) { |
2014 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 2014 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
2015 | ON_ERRORS_CONTINUE))) { | 2015 | ON_ERRORS_CONTINUE))) { |
2016 | ntfs_error(sb, "%s and neither on_errors=" | 2016 | ntfs_error(sb, "%s and neither on_errors=" |
@@ -2028,8 +2028,7 @@ get_ctx_vol_failed: | |||
2028 | NVolSetErrors(vol); | 2028 | NVolSetErrors(vol); |
2029 | } | 2029 | } |
2030 | /* If (still) a read-write mount, mark the volume dirty. */ | 2030 | /* If (still) a read-write mount, mark the volume dirty. */ |
2031 | if (!(sb->s_flags & MS_RDONLY) && | 2031 | if (!sb_rdonly(sb) && ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { |
2032 | ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { | ||
2033 | static const char *es1 = "Failed to set dirty bit in volume " | 2032 | static const char *es1 = "Failed to set dirty bit in volume " |
2034 | "information flags"; | 2033 | "information flags"; |
2035 | static const char *es2 = ". Run chkdsk."; | 2034 | static const char *es2 = ". Run chkdsk."; |
@@ -2075,8 +2074,7 @@ get_ctx_vol_failed: | |||
2075 | } | 2074 | } |
2076 | #endif | 2075 | #endif |
2077 | /* If (still) a read-write mount, empty the logfile. */ | 2076 | /* If (still) a read-write mount, empty the logfile. */ |
2078 | if (!(sb->s_flags & MS_RDONLY) && | 2077 | if (!sb_rdonly(sb) && !ntfs_empty_logfile(vol->logfile_ino)) { |
2079 | !ntfs_empty_logfile(vol->logfile_ino)) { | ||
2080 | static const char *es1 = "Failed to empty $LogFile"; | 2078 | static const char *es1 = "Failed to empty $LogFile"; |
2081 | static const char *es2 = ". Mount in Windows."; | 2079 | static const char *es2 = ". Mount in Windows."; |
2082 | 2080 | ||
@@ -2121,7 +2119,7 @@ get_ctx_vol_failed: | |||
2121 | static const char *es2 = ". Run chkdsk."; | 2119 | static const char *es2 = ". Run chkdsk."; |
2122 | 2120 | ||
2123 | /* If a read-write mount, convert it to a read-only mount. */ | 2121 | /* If a read-write mount, convert it to a read-only mount. */ |
2124 | if (!(sb->s_flags & MS_RDONLY)) { | 2122 | if (!sb_rdonly(sb)) { |
2125 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 2123 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
2126 | ON_ERRORS_CONTINUE))) { | 2124 | ON_ERRORS_CONTINUE))) { |
2127 | ntfs_error(sb, "%s and neither on_errors=" | 2125 | ntfs_error(sb, "%s and neither on_errors=" |
@@ -2139,8 +2137,7 @@ get_ctx_vol_failed: | |||
2139 | NVolSetErrors(vol); | 2137 | NVolSetErrors(vol); |
2140 | } | 2138 | } |
2141 | /* If (still) a read-write mount, mark the quotas out of date. */ | 2139 | /* If (still) a read-write mount, mark the quotas out of date. */ |
2142 | if (!(sb->s_flags & MS_RDONLY) && | 2140 | if (!sb_rdonly(sb) && !ntfs_mark_quotas_out_of_date(vol)) { |
2143 | !ntfs_mark_quotas_out_of_date(vol)) { | ||
2144 | static const char *es1 = "Failed to mark quotas out of date"; | 2141 | static const char *es1 = "Failed to mark quotas out of date"; |
2145 | static const char *es2 = ". Run chkdsk."; | 2142 | static const char *es2 = ". Run chkdsk."; |
2146 | 2143 | ||
@@ -2165,7 +2162,7 @@ get_ctx_vol_failed: | |||
2165 | static const char *es2 = ". Run chkdsk."; | 2162 | static const char *es2 = ". Run chkdsk."; |
2166 | 2163 | ||
2167 | /* If a read-write mount, convert it to a read-only mount. */ | 2164 | /* If a read-write mount, convert it to a read-only mount. */ |
2168 | if (!(sb->s_flags & MS_RDONLY)) { | 2165 | if (!sb_rdonly(sb)) { |
2169 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 2166 | if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | |
2170 | ON_ERRORS_CONTINUE))) { | 2167 | ON_ERRORS_CONTINUE))) { |
2171 | ntfs_error(sb, "%s and neither on_errors=" | 2168 | ntfs_error(sb, "%s and neither on_errors=" |
@@ -2183,7 +2180,7 @@ get_ctx_vol_failed: | |||
2183 | NVolSetErrors(vol); | 2180 | NVolSetErrors(vol); |
2184 | } | 2181 | } |
2185 | /* If (still) a read-write mount, stamp the transaction log. */ | 2182 | /* If (still) a read-write mount, stamp the transaction log. */ |
2186 | if (!(sb->s_flags & MS_RDONLY) && !ntfs_stamp_usnjrnl(vol)) { | 2183 | if (!sb_rdonly(sb) && !ntfs_stamp_usnjrnl(vol)) { |
2187 | static const char *es1 = "Failed to stamp transaction log " | 2184 | static const char *es1 = "Failed to stamp transaction log " |
2188 | "($UsnJrnl)"; | 2185 | "($UsnJrnl)"; |
2189 | static const char *es2 = ". Run chkdsk."; | 2186 | static const char *es2 = ". Run chkdsk."; |
@@ -2314,7 +2311,7 @@ static void ntfs_put_super(struct super_block *sb) | |||
2314 | * If a read-write mount and no volume errors have occurred, mark the | 2311 | * If a read-write mount and no volume errors have occurred, mark the |
2315 | * volume clean. Also, re-commit all affected inodes. | 2312 | * volume clean. Also, re-commit all affected inodes. |
2316 | */ | 2313 | */ |
2317 | if (!(sb->s_flags & MS_RDONLY)) { | 2314 | if (!sb_rdonly(sb)) { |
2318 | if (!NVolErrors(vol)) { | 2315 | if (!NVolErrors(vol)) { |
2319 | if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) | 2316 | if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) |
2320 | ntfs_warning(sb, "Failed to clear dirty bit " | 2317 | ntfs_warning(sb, "Failed to clear dirty bit " |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 83005f486451..1cf662ad377f 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -675,7 +675,7 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | |||
675 | } | 675 | } |
676 | 676 | ||
677 | /* We're going to/from readonly mode. */ | 677 | /* We're going to/from readonly mode. */ |
678 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 678 | if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { |
679 | /* Disable quota accounting before remounting RO */ | 679 | /* Disable quota accounting before remounting RO */ |
680 | if (*flags & MS_RDONLY) { | 680 | if (*flags & MS_RDONLY) { |
681 | ret = ocfs2_susp_quotas(osb, 0); | 681 | ret = ocfs2_susp_quotas(osb, 0); |
@@ -1063,7 +1063,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1063 | /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, | 1063 | /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, |
1064 | * heartbeat=none */ | 1064 | * heartbeat=none */ |
1065 | if (bdev_read_only(sb->s_bdev)) { | 1065 | if (bdev_read_only(sb->s_bdev)) { |
1066 | if (!(sb->s_flags & MS_RDONLY)) { | 1066 | if (!sb_rdonly(sb)) { |
1067 | status = -EACCES; | 1067 | status = -EACCES; |
1068 | mlog(ML_ERROR, "Readonly device detected but readonly " | 1068 | mlog(ML_ERROR, "Readonly device detected but readonly " |
1069 | "mount was not specified.\n"); | 1069 | "mount was not specified.\n"); |
@@ -1098,7 +1098,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | if (!ocfs2_is_hard_readonly(osb)) { | 1100 | if (!ocfs2_is_hard_readonly(osb)) { |
1101 | if (sb->s_flags & MS_RDONLY) | 1101 | if (sb_rdonly(sb)) |
1102 | ocfs2_set_ro_flag(osb, 0); | 1102 | ocfs2_set_ro_flag(osb, 0); |
1103 | } | 1103 | } |
1104 | 1104 | ||
@@ -1179,7 +1179,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1179 | /* Now we can initialize quotas because we can afford to wait | 1179 | /* Now we can initialize quotas because we can afford to wait |
1180 | * for cluster locks recovery now. That also means that truncation | 1180 | * for cluster locks recovery now. That also means that truncation |
1181 | * log recovery can happen but that waits for proper quota setup */ | 1181 | * log recovery can happen but that waits for proper quota setup */ |
1182 | if (!(sb->s_flags & MS_RDONLY)) { | 1182 | if (!sb_rdonly(sb)) { |
1183 | status = ocfs2_enable_quotas(osb); | 1183 | status = ocfs2_enable_quotas(osb); |
1184 | if (status < 0) { | 1184 | if (status < 0) { |
1185 | /* We have to err-out specially here because | 1185 | /* We have to err-out specially here because |
@@ -2180,8 +2180,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2180 | status = -EINVAL; | 2180 | status = -EINVAL; |
2181 | goto bail; | 2181 | goto bail; |
2182 | } | 2182 | } |
2183 | if (!(osb->sb->s_flags & MS_RDONLY) && | 2183 | if (!sb_rdonly(osb->sb) && (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { |
2184 | (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { | ||
2185 | mlog(ML_ERROR, "couldn't mount RDWR because of " | 2184 | mlog(ML_ERROR, "couldn't mount RDWR because of " |
2186 | "unsupported optional features (%x).\n", i); | 2185 | "unsupported optional features (%x).\n", i); |
2187 | status = -EINVAL; | 2186 | status = -EINVAL; |
@@ -2568,9 +2567,7 @@ static int ocfs2_handle_error(struct super_block *sb) | |||
2568 | rv = -EIO; | 2567 | rv = -EIO; |
2569 | } else { /* default option */ | 2568 | } else { /* default option */ |
2570 | rv = -EROFS; | 2569 | rv = -EROFS; |
2571 | if (sb->s_flags & MS_RDONLY && | 2570 | if (sb_rdonly(sb) && (ocfs2_is_soft_readonly(osb) || ocfs2_is_hard_readonly(osb))) |
2572 | (ocfs2_is_soft_readonly(osb) || | ||
2573 | ocfs2_is_hard_readonly(osb))) | ||
2574 | return rv; | 2571 | return rv; |
2575 | 2572 | ||
2576 | pr_crit("OCFS2: File system is now read-only.\n"); | 2573 | pr_crit("OCFS2: File system is now read-only.\n"); |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 44dc2d6ffe0f..22ee2a9ee784 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -869,7 +869,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
869 | goto out_free_config; | 869 | goto out_free_config; |
870 | 870 | ||
871 | /* Upper fs should not be r/o */ | 871 | /* Upper fs should not be r/o */ |
872 | if (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY) { | 872 | if (sb_rdonly(upperpath.mnt->mnt_sb)) { |
873 | pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); | 873 | pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); |
874 | err = -EINVAL; | 874 | err = -EINVAL; |
875 | goto out_put_upperpath; | 875 | goto out_put_upperpath; |
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c index b5713fefb4c1..99dff222fe67 100644 --- a/fs/proc_namespace.c +++ b/fs/proc_namespace.c | |||
@@ -178,7 +178,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt) | |||
178 | } else { | 178 | } else { |
179 | mangle(m, r->mnt_devname ? r->mnt_devname : "none"); | 179 | mangle(m, r->mnt_devname ? r->mnt_devname : "none"); |
180 | } | 180 | } |
181 | seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw"); | 181 | seq_puts(m, sb_rdonly(sb) ? " ro" : " rw"); |
182 | err = show_sb_opts(m, sb); | 182 | err = show_sb_opts(m, sb); |
183 | if (err) | 183 | if (err) |
184 | goto out; | 184 | goto out; |
diff --git a/fs/quota/quota.c b/fs/quota/quota.c index 07e08c7d05ca..a9c5dfe6b83e 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c | |||
@@ -753,7 +753,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, | |||
753 | case Q_XGETNEXTQUOTA: | 753 | case Q_XGETNEXTQUOTA: |
754 | return quota_getnextxquota(sb, type, id, addr); | 754 | return quota_getnextxquota(sb, type, id, addr); |
755 | case Q_XQUOTASYNC: | 755 | case Q_XQUOTASYNC: |
756 | if (sb->s_flags & MS_RDONLY) | 756 | if (sb_rdonly(sb)) |
757 | return -EROFS; | 757 | return -EROFS; |
758 | /* XFS quotas are fully coherent now, making this call a noop */ | 758 | /* XFS quotas are fully coherent now, making this call a noop */ |
759 | return 0; | 759 | return 0; |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 873fc04e9403..11a48affa882 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1776,7 +1776,7 @@ int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
1776 | struct reiserfs_transaction_handle th; | 1776 | struct reiserfs_transaction_handle th; |
1777 | int jbegin_count = 1; | 1777 | int jbegin_count = 1; |
1778 | 1778 | ||
1779 | if (inode->i_sb->s_flags & MS_RDONLY) | 1779 | if (sb_rdonly(inode->i_sb)) |
1780 | return -EROFS; | 1780 | return -EROFS; |
1781 | /* | 1781 | /* |
1782 | * memory pressure can sometimes initiate write_inode calls with | 1782 | * memory pressure can sometimes initiate write_inode calls with |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index a11d773e5ff3..e47da919f443 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -1918,7 +1918,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th, | |||
1918 | * we only want to flush out transactions if we were | 1918 | * we only want to flush out transactions if we were |
1919 | * called with error == 0 | 1919 | * called with error == 0 |
1920 | */ | 1920 | */ |
1921 | if (!error && !(sb->s_flags & MS_RDONLY)) { | 1921 | if (!error && !sb_rdonly(sb)) { |
1922 | /* end the current trans */ | 1922 | /* end the current trans */ |
1923 | BUG_ON(!th->t_trans_id); | 1923 | BUG_ON(!th->t_trans_id); |
1924 | do_journal_end(th, FLUSH_ALL); | 1924 | do_journal_end(th, FLUSH_ALL); |
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c index 4f3f928076f3..64f49cafbc5b 100644 --- a/fs/reiserfs/prints.c +++ b/fs/reiserfs/prints.c | |||
@@ -386,7 +386,7 @@ void __reiserfs_error(struct super_block *sb, const char *id, | |||
386 | printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n", | 386 | printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n", |
387 | sb->s_id, function, error_buf); | 387 | sb->s_id, function, error_buf); |
388 | 388 | ||
389 | if (sb->s_flags & MS_RDONLY) | 389 | if (sb_rdonly(sb)) |
390 | return; | 390 | return; |
391 | 391 | ||
392 | reiserfs_info(sb, "Remounting filesystem read-only\n"); | 392 | reiserfs_info(sb, "Remounting filesystem read-only\n"); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 306e4e9d172d..5464ec517702 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -121,7 +121,7 @@ void reiserfs_schedule_old_flush(struct super_block *s) | |||
121 | * Avoid scheduling flush when sb is being shut down. It can race | 121 | * Avoid scheduling flush when sb is being shut down. It can race |
122 | * with journal shutdown and free still queued delayed work. | 122 | * with journal shutdown and free still queued delayed work. |
123 | */ | 123 | */ |
124 | if (s->s_flags & MS_RDONLY || !(s->s_flags & MS_ACTIVE)) | 124 | if (sb_rdonly(s) || !(s->s_flags & MS_ACTIVE)) |
125 | return; | 125 | return; |
126 | 126 | ||
127 | spin_lock(&sbi->old_work_lock); | 127 | spin_lock(&sbi->old_work_lock); |
@@ -151,7 +151,7 @@ static int reiserfs_freeze(struct super_block *s) | |||
151 | reiserfs_cancel_old_flush(s); | 151 | reiserfs_cancel_old_flush(s); |
152 | 152 | ||
153 | reiserfs_write_lock(s); | 153 | reiserfs_write_lock(s); |
154 | if (!(s->s_flags & MS_RDONLY)) { | 154 | if (!sb_rdonly(s)) { |
155 | int err = journal_begin(&th, s, 1); | 155 | int err = journal_begin(&th, s, 1); |
156 | if (err) { | 156 | if (err) { |
157 | reiserfs_block_writes(&th); | 157 | reiserfs_block_writes(&th); |
@@ -599,7 +599,7 @@ static void reiserfs_put_super(struct super_block *s) | |||
599 | * change file system state to current state if it was mounted | 599 | * change file system state to current state if it was mounted |
600 | * with read-write permissions | 600 | * with read-write permissions |
601 | */ | 601 | */ |
602 | if (!(s->s_flags & MS_RDONLY)) { | 602 | if (!sb_rdonly(s)) { |
603 | if (!journal_begin(&th, s, 10)) { | 603 | if (!journal_begin(&th, s, 10)) { |
604 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), | 604 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), |
605 | 1); | 605 | 1); |
@@ -700,7 +700,7 @@ static void reiserfs_dirty_inode(struct inode *inode, int flags) | |||
700 | 700 | ||
701 | int err = 0; | 701 | int err = 0; |
702 | 702 | ||
703 | if (inode->i_sb->s_flags & MS_RDONLY) { | 703 | if (sb_rdonly(inode->i_sb)) { |
704 | reiserfs_warning(inode->i_sb, "clm-6006", | 704 | reiserfs_warning(inode->i_sb, "clm-6006", |
705 | "writing inode %lu on readonly FS", | 705 | "writing inode %lu on readonly FS", |
706 | inode->i_ino); | 706 | inode->i_ino); |
@@ -1525,7 +1525,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1525 | reiserfs_write_unlock(s); | 1525 | reiserfs_write_unlock(s); |
1526 | reiserfs_xattr_init(s, *mount_flags); | 1526 | reiserfs_xattr_init(s, *mount_flags); |
1527 | /* remount read-only */ | 1527 | /* remount read-only */ |
1528 | if (s->s_flags & MS_RDONLY) | 1528 | if (sb_rdonly(s)) |
1529 | /* it is read-only already */ | 1529 | /* it is read-only already */ |
1530 | goto out_ok_unlocked; | 1530 | goto out_ok_unlocked; |
1531 | 1531 | ||
@@ -1551,7 +1551,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1551 | journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s)); | 1551 | journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s)); |
1552 | } else { | 1552 | } else { |
1553 | /* remount read-write */ | 1553 | /* remount read-write */ |
1554 | if (!(s->s_flags & MS_RDONLY)) { | 1554 | if (!sb_rdonly(s)) { |
1555 | reiserfs_write_unlock(s); | 1555 | reiserfs_write_unlock(s); |
1556 | reiserfs_xattr_init(s, *mount_flags); | 1556 | reiserfs_xattr_init(s, *mount_flags); |
1557 | goto out_ok_unlocked; /* We are read-write already */ | 1557 | goto out_ok_unlocked; /* We are read-write already */ |
@@ -1855,7 +1855,7 @@ static int what_hash(struct super_block *s) | |||
1855 | * the super | 1855 | * the super |
1856 | */ | 1856 | */ |
1857 | if (code != UNSET_HASH && | 1857 | if (code != UNSET_HASH && |
1858 | !(s->s_flags & MS_RDONLY) && | 1858 | !sb_rdonly(s) && |
1859 | code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { | 1859 | code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { |
1860 | set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); | 1860 | set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); |
1861 | } | 1861 | } |
@@ -2052,7 +2052,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
2052 | if (replay_only(s)) | 2052 | if (replay_only(s)) |
2053 | goto error_unlocked; | 2053 | goto error_unlocked; |
2054 | 2054 | ||
2055 | if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { | 2055 | if (bdev_read_only(s->s_bdev) && !sb_rdonly(s)) { |
2056 | SWARN(silent, s, "clm-7000", | 2056 | SWARN(silent, s, "clm-7000", |
2057 | "Detected readonly device, marking FS readonly"); | 2057 | "Detected readonly device, marking FS readonly"); |
2058 | s->s_flags |= MS_RDONLY; | 2058 | s->s_flags |= MS_RDONLY; |
@@ -2101,7 +2101,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
2101 | else | 2101 | else |
2102 | set_bit(REISERFS_3_6, &sbi->s_properties); | 2102 | set_bit(REISERFS_3_6, &sbi->s_properties); |
2103 | 2103 | ||
2104 | if (!(s->s_flags & MS_RDONLY)) { | 2104 | if (!sb_rdonly(s)) { |
2105 | 2105 | ||
2106 | errval = journal_begin(&th, s, 1); | 2106 | errval = journal_begin(&th, s, 1); |
2107 | if (errval) { | 2107 | if (errval) { |
diff --git a/fs/super.c b/fs/super.c index 6bc3352adcf3..7321958d81d8 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -820,7 +820,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
820 | return -EACCES; | 820 | return -EACCES; |
821 | #endif | 821 | #endif |
822 | 822 | ||
823 | remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 823 | remount_ro = (flags & MS_RDONLY) && !sb_rdonly(sb); |
824 | 824 | ||
825 | if (remount_ro) { | 825 | if (remount_ro) { |
826 | if (!hlist_empty(&sb->s_pins)) { | 826 | if (!hlist_empty(&sb->s_pins)) { |
@@ -831,7 +831,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
831 | return 0; | 831 | return 0; |
832 | if (sb->s_writers.frozen != SB_UNFROZEN) | 832 | if (sb->s_writers.frozen != SB_UNFROZEN) |
833 | return -EBUSY; | 833 | return -EBUSY; |
834 | remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 834 | remount_ro = (flags & MS_RDONLY) && !sb_rdonly(sb); |
835 | } | 835 | } |
836 | } | 836 | } |
837 | shrink_dcache_sb(sb); | 837 | shrink_dcache_sb(sb); |
@@ -893,7 +893,7 @@ static void do_emergency_remount(struct work_struct *work) | |||
893 | spin_unlock(&sb_lock); | 893 | spin_unlock(&sb_lock); |
894 | down_write(&sb->s_umount); | 894 | down_write(&sb->s_umount); |
895 | if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) && | 895 | if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) && |
896 | !(sb->s_flags & MS_RDONLY)) { | 896 | !sb_rdonly(sb)) { |
897 | /* | 897 | /* |
898 | * What lock protects sb->s_flags?? | 898 | * What lock protects sb->s_flags?? |
899 | */ | 899 | */ |
@@ -1439,7 +1439,7 @@ int freeze_super(struct super_block *sb) | |||
1439 | return 0; /* sic - it's "nothing to do" */ | 1439 | return 0; /* sic - it's "nothing to do" */ |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | if (sb->s_flags & MS_RDONLY) { | 1442 | if (sb_rdonly(sb)) { |
1443 | /* Nothing to do really... */ | 1443 | /* Nothing to do really... */ |
1444 | sb->s_writers.frozen = SB_FREEZE_COMPLETE; | 1444 | sb->s_writers.frozen = SB_FREEZE_COMPLETE; |
1445 | up_write(&sb->s_umount); | 1445 | up_write(&sb->s_umount); |
@@ -1502,7 +1502,7 @@ int thaw_super(struct super_block *sb) | |||
1502 | return -EINVAL; | 1502 | return -EINVAL; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | if (sb->s_flags & MS_RDONLY) { | 1505 | if (sb_rdonly(sb)) { |
1506 | sb->s_writers.frozen = SB_UNFROZEN; | 1506 | sb->s_writers.frozen = SB_UNFROZEN; |
1507 | goto out; | 1507 | goto out; |
1508 | } | 1508 | } |
@@ -57,7 +57,7 @@ int sync_filesystem(struct super_block *sb) | |||
57 | /* | 57 | /* |
58 | * No point in syncing out anything if the filesystem is read-only. | 58 | * No point in syncing out anything if the filesystem is read-only. |
59 | */ | 59 | */ |
60 | if (sb->s_flags & MS_RDONLY) | 60 | if (sb_rdonly(sb)) |
61 | return 0; | 61 | return 0; |
62 | 62 | ||
63 | ret = __sync_filesystem(sb, 0); | 63 | ret = __sync_filesystem(sb, 0); |
@@ -69,13 +69,13 @@ EXPORT_SYMBOL(sync_filesystem); | |||
69 | 69 | ||
70 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) | 70 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) |
71 | { | 71 | { |
72 | if (!(sb->s_flags & MS_RDONLY)) | 72 | if (!sb_rdonly(sb)) |
73 | sync_inodes_sb(sb); | 73 | sync_inodes_sb(sb); |
74 | } | 74 | } |
75 | 75 | ||
76 | static void sync_fs_one_sb(struct super_block *sb, void *arg) | 76 | static void sync_fs_one_sb(struct super_block *sb, void *arg) |
77 | { | 77 | { |
78 | if (!(sb->s_flags & MS_RDONLY) && sb->s_op->sync_fs) | 78 | if (!sb_rdonly(sb) && sb->s_op->sync_fs) |
79 | sb->s_op->sync_fs(sb, *(int *)arg); | 79 | sb->s_op->sync_fs(sb, *(int *)arg); |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/fs/sysv/balloc.c b/fs/sysv/balloc.c index 921c053fc052..862c1f74a583 100644 --- a/fs/sysv/balloc.c +++ b/fs/sysv/balloc.c | |||
@@ -231,7 +231,7 @@ trust_sb: | |||
231 | Ecount: | 231 | Ecount: |
232 | printk("sysv_count_free_blocks: free block count was %d, " | 232 | printk("sysv_count_free_blocks: free block count was %d, " |
233 | "correcting to %d\n", sb_count, count); | 233 | "correcting to %d\n", sb_count, count); |
234 | if (!(sb->s_flags & MS_RDONLY)) { | 234 | if (!sb_rdonly(sb)) { |
235 | *sbi->s_free_blocks = cpu_to_fs32(sbi, count); | 235 | *sbi->s_free_blocks = cpu_to_fs32(sbi, count); |
236 | dirty_sb(sb); | 236 | dirty_sb(sb); |
237 | } | 237 | } |
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c index 53f1b78996dd..eb963fbb7903 100644 --- a/fs/sysv/ialloc.c +++ b/fs/sysv/ialloc.c | |||
@@ -220,7 +220,7 @@ Einval: | |||
220 | printk("sysv_count_free_inodes: " | 220 | printk("sysv_count_free_inodes: " |
221 | "free inode count was %d, correcting to %d\n", | 221 | "free inode count was %d, correcting to %d\n", |
222 | sb_count, count); | 222 | sb_count, count); |
223 | if (!(sb->s_flags & MS_RDONLY)) { | 223 | if (!sb_rdonly(sb)) { |
224 | *sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count); | 224 | *sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count); |
225 | dirty_sb(sb); | 225 | dirty_sb(sb); |
226 | } | 226 | } |
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 858fb72f9e0f..1c8bf9453a71 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -70,7 +70,7 @@ static void sysv_put_super(struct super_block *sb) | |||
70 | { | 70 | { |
71 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 71 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
72 | 72 | ||
73 | if (!(sb->s_flags & MS_RDONLY)) { | 73 | if (!sb_rdonly(sb)) { |
74 | /* XXX ext2 also updates the state here */ | 74 | /* XXX ext2 also updates the state here */ |
75 | mark_buffer_dirty(sbi->s_bh1); | 75 | mark_buffer_dirty(sbi->s_bh1); |
76 | if (sbi->s_bh1 != sbi->s_bh2) | 76 | if (sbi->s_bh1 != sbi->s_bh2) |
diff --git a/fs/sysv/super.c b/fs/sysv/super.c index eda10959714f..0d56e486b392 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c | |||
@@ -216,7 +216,7 @@ static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh) | |||
216 | if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) { | 216 | if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) { |
217 | sbi->s_type = FSTYPE_AFS; | 217 | sbi->s_type = FSTYPE_AFS; |
218 | sbi->s_forced_ro = 1; | 218 | sbi->s_forced_ro = 1; |
219 | if (!(sb->s_flags & MS_RDONLY)) { | 219 | if (!sb_rdonly(sb)) { |
220 | printk("SysV FS: SCO EAFS on %s detected, " | 220 | printk("SysV FS: SCO EAFS on %s detected, " |
221 | "forcing read-only mode.\n", | 221 | "forcing read-only mode.\n", |
222 | sb->s_id); | 222 | sb->s_id); |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index bffadbb67e47..5496b17b959c 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1159,7 +1159,7 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1159 | long long x, y; | 1159 | long long x, y; |
1160 | size_t sz; | 1160 | size_t sz; |
1161 | 1161 | ||
1162 | c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); | 1162 | c->ro_mount = !!sb_rdonly(c->vfs_sb); |
1163 | /* Suppress error messages while probing if MS_SILENT is set */ | 1163 | /* Suppress error messages while probing if MS_SILENT is set */ |
1164 | c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); | 1164 | c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); |
1165 | 1165 | ||
diff --git a/fs/udf/super.c b/fs/udf/super.c index 462ac2e9258c..28039923114b 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -675,7 +675,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) | |||
675 | sbi->s_dmode = uopt.dmode; | 675 | sbi->s_dmode = uopt.dmode; |
676 | write_unlock(&sbi->s_cred_lock); | 676 | write_unlock(&sbi->s_cred_lock); |
677 | 677 | ||
678 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 678 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
679 | goto out_unlock; | 679 | goto out_unlock; |
680 | 680 | ||
681 | if (*flags & MS_RDONLY) | 681 | if (*flags & MS_RDONLY) |
@@ -1019,7 +1019,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, | |||
1019 | 1019 | ||
1020 | fe = udf_iget_special(sb, &addr); | 1020 | fe = udf_iget_special(sb, &addr); |
1021 | if (IS_ERR(fe)) { | 1021 | if (IS_ERR(fe)) { |
1022 | if (sb->s_flags & MS_RDONLY) | 1022 | if (sb_rdonly(sb)) |
1023 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); | 1023 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); |
1024 | else { | 1024 | else { |
1025 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); | 1025 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); |
@@ -1343,7 +1343,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) | |||
1343 | * writing to it (we overwrite blocks instead of relocating | 1343 | * writing to it (we overwrite blocks instead of relocating |
1344 | * them). | 1344 | * them). |
1345 | */ | 1345 | */ |
1346 | if (!(sb->s_flags & MS_RDONLY)) { | 1346 | if (!sb_rdonly(sb)) { |
1347 | ret = -EACCES; | 1347 | ret = -EACCES; |
1348 | goto out_bh; | 1348 | goto out_bh; |
1349 | } | 1349 | } |
@@ -2207,7 +2207,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2207 | ret = -EINVAL; | 2207 | ret = -EINVAL; |
2208 | goto error_out; | 2208 | goto error_out; |
2209 | } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && | 2209 | } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && |
2210 | !(sb->s_flags & MS_RDONLY)) { | 2210 | !sb_rdonly(sb)) { |
2211 | ret = -EACCES; | 2211 | ret = -EACCES; |
2212 | goto error_out; | 2212 | goto error_out; |
2213 | } | 2213 | } |
@@ -2228,7 +2228,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2228 | 2228 | ||
2229 | if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & | 2229 | if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & |
2230 | UDF_PART_FLAG_READ_ONLY && | 2230 | UDF_PART_FLAG_READ_ONLY && |
2231 | !(sb->s_flags & MS_RDONLY)) { | 2231 | !sb_rdonly(sb)) { |
2232 | ret = -EACCES; | 2232 | ret = -EACCES; |
2233 | goto error_out; | 2233 | goto error_out; |
2234 | } | 2234 | } |
@@ -2247,7 +2247,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2247 | le16_to_cpu(ts.year), ts.month, ts.day, | 2247 | le16_to_cpu(ts.year), ts.month, ts.day, |
2248 | ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); | 2248 | ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); |
2249 | } | 2249 | } |
2250 | if (!(sb->s_flags & MS_RDONLY)) { | 2250 | if (!sb_rdonly(sb)) { |
2251 | udf_open_lvid(sb); | 2251 | udf_open_lvid(sb); |
2252 | lvid_open = true; | 2252 | lvid_open = true; |
2253 | } | 2253 | } |
@@ -2334,7 +2334,7 @@ static void udf_put_super(struct super_block *sb) | |||
2334 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) | 2334 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) |
2335 | unload_nls(sbi->s_nls_map); | 2335 | unload_nls(sbi->s_nls_map); |
2336 | #endif | 2336 | #endif |
2337 | if (!(sb->s_flags & MS_RDONLY)) | 2337 | if (!sb_rdonly(sb)) |
2338 | udf_close_lvid(sb); | 2338 | udf_close_lvid(sb); |
2339 | brelse(sbi->s_lvid_bh); | 2339 | brelse(sbi->s_lvid_bh); |
2340 | udf_sb_free_partitions(sb); | 2340 | udf_sb_free_partitions(sb); |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 0a4f58a5073c..6440003f8ddc 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -278,7 +278,7 @@ void ufs_error (struct super_block * sb, const char * function, | |||
278 | uspi = UFS_SB(sb)->s_uspi; | 278 | uspi = UFS_SB(sb)->s_uspi; |
279 | usb1 = ubh_get_usb_first(uspi); | 279 | usb1 = ubh_get_usb_first(uspi); |
280 | 280 | ||
281 | if (!(sb->s_flags & MS_RDONLY)) { | 281 | if (!sb_rdonly(sb)) { |
282 | usb1->fs_clean = UFS_FSBAD; | 282 | usb1->fs_clean = UFS_FSBAD; |
283 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); | 283 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); |
284 | ufs_mark_sb_dirty(sb); | 284 | ufs_mark_sb_dirty(sb); |
@@ -312,7 +312,7 @@ void ufs_panic (struct super_block * sb, const char * function, | |||
312 | uspi = UFS_SB(sb)->s_uspi; | 312 | uspi = UFS_SB(sb)->s_uspi; |
313 | usb1 = ubh_get_usb_first(uspi); | 313 | usb1 = ubh_get_usb_first(uspi); |
314 | 314 | ||
315 | if (!(sb->s_flags & MS_RDONLY)) { | 315 | if (!sb_rdonly(sb)) { |
316 | usb1->fs_clean = UFS_FSBAD; | 316 | usb1->fs_clean = UFS_FSBAD; |
317 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); | 317 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); |
318 | ufs_mark_sb_dirty(sb); | 318 | ufs_mark_sb_dirty(sb); |
@@ -742,7 +742,7 @@ static void ufs_put_super(struct super_block *sb) | |||
742 | 742 | ||
743 | UFSD("ENTER\n"); | 743 | UFSD("ENTER\n"); |
744 | 744 | ||
745 | if (!(sb->s_flags & MS_RDONLY)) | 745 | if (!sb_rdonly(sb)) |
746 | ufs_put_super_internal(sb); | 746 | ufs_put_super_internal(sb); |
747 | cancel_delayed_work_sync(&sbi->sync_work); | 747 | cancel_delayed_work_sync(&sbi->sync_work); |
748 | 748 | ||
@@ -793,7 +793,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
793 | UFSD("ENTER\n"); | 793 | UFSD("ENTER\n"); |
794 | 794 | ||
795 | #ifndef CONFIG_UFS_FS_WRITE | 795 | #ifndef CONFIG_UFS_FS_WRITE |
796 | if (!(sb->s_flags & MS_RDONLY)) { | 796 | if (!sb_rdonly(sb)) { |
797 | pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); | 797 | pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); |
798 | return -EROFS; | 798 | return -EROFS; |
799 | } | 799 | } |
@@ -805,7 +805,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
805 | sb->s_fs_info = sbi; | 805 | sb->s_fs_info = sbi; |
806 | sbi->sb = sb; | 806 | sbi->sb = sb; |
807 | 807 | ||
808 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); | 808 | UFSD("flag %u\n", (int)(sb_rdonly(sb))); |
809 | 809 | ||
810 | mutex_init(&sbi->s_lock); | 810 | mutex_init(&sbi->s_lock); |
811 | spin_lock_init(&sbi->work_lock); | 811 | spin_lock_init(&sbi->work_lock); |
@@ -902,7 +902,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
902 | uspi->s_sbsize = super_block_size = 2048; | 902 | uspi->s_sbsize = super_block_size = 2048; |
903 | uspi->s_sbbase = 0; | 903 | uspi->s_sbbase = 0; |
904 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 904 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; |
905 | if (!(sb->s_flags & MS_RDONLY)) { | 905 | if (!sb_rdonly(sb)) { |
906 | if (!silent) | 906 | if (!silent) |
907 | pr_info("ufstype=old is supported read-only\n"); | 907 | pr_info("ufstype=old is supported read-only\n"); |
908 | sb->s_flags |= MS_RDONLY; | 908 | sb->s_flags |= MS_RDONLY; |
@@ -918,7 +918,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
918 | uspi->s_sbbase = 0; | 918 | uspi->s_sbbase = 0; |
919 | uspi->s_dirblksize = 1024; | 919 | uspi->s_dirblksize = 1024; |
920 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 920 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; |
921 | if (!(sb->s_flags & MS_RDONLY)) { | 921 | if (!sb_rdonly(sb)) { |
922 | if (!silent) | 922 | if (!silent) |
923 | pr_info("ufstype=nextstep is supported read-only\n"); | 923 | pr_info("ufstype=nextstep is supported read-only\n"); |
924 | sb->s_flags |= MS_RDONLY; | 924 | sb->s_flags |= MS_RDONLY; |
@@ -934,7 +934,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
934 | uspi->s_sbbase = 0; | 934 | uspi->s_sbbase = 0; |
935 | uspi->s_dirblksize = 1024; | 935 | uspi->s_dirblksize = 1024; |
936 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 936 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; |
937 | if (!(sb->s_flags & MS_RDONLY)) { | 937 | if (!sb_rdonly(sb)) { |
938 | if (!silent) | 938 | if (!silent) |
939 | pr_info("ufstype=nextstep-cd is supported read-only\n"); | 939 | pr_info("ufstype=nextstep-cd is supported read-only\n"); |
940 | sb->s_flags |= MS_RDONLY; | 940 | sb->s_flags |= MS_RDONLY; |
@@ -950,7 +950,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
950 | uspi->s_sbbase = 0; | 950 | uspi->s_sbbase = 0; |
951 | uspi->s_dirblksize = 1024; | 951 | uspi->s_dirblksize = 1024; |
952 | flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; | 952 | flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; |
953 | if (!(sb->s_flags & MS_RDONLY)) { | 953 | if (!sb_rdonly(sb)) { |
954 | if (!silent) | 954 | if (!silent) |
955 | pr_info("ufstype=openstep is supported read-only\n"); | 955 | pr_info("ufstype=openstep is supported read-only\n"); |
956 | sb->s_flags |= MS_RDONLY; | 956 | sb->s_flags |= MS_RDONLY; |
@@ -965,7 +965,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
965 | uspi->s_sbsize = super_block_size = 2048; | 965 | uspi->s_sbsize = super_block_size = 2048; |
966 | uspi->s_sbbase = 0; | 966 | uspi->s_sbbase = 0; |
967 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 967 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; |
968 | if (!(sb->s_flags & MS_RDONLY)) { | 968 | if (!sb_rdonly(sb)) { |
969 | if (!silent) | 969 | if (!silent) |
970 | pr_info("ufstype=hp is supported read-only\n"); | 970 | pr_info("ufstype=hp is supported read-only\n"); |
971 | sb->s_flags |= MS_RDONLY; | 971 | sb->s_flags |= MS_RDONLY; |
@@ -1273,7 +1273,7 @@ magic_found: | |||
1273 | /* | 1273 | /* |
1274 | * Read cylinder group structures | 1274 | * Read cylinder group structures |
1275 | */ | 1275 | */ |
1276 | if (!(sb->s_flags & MS_RDONLY)) | 1276 | if (!sb_rdonly(sb)) |
1277 | if (!ufs_read_cylinder_structures(sb)) | 1277 | if (!ufs_read_cylinder_structures(sb)) |
1278 | goto failed; | 1278 | goto failed; |
1279 | 1279 | ||
@@ -1328,7 +1328,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1328 | return -EINVAL; | 1328 | return -EINVAL; |
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1331 | if ((bool)(*mount_flags & MS_RDONLY) == sb_rdonly(sb)) { |
1332 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1332 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1333 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1333 | mutex_unlock(&UFS_SB(sb)->s_lock); |
1334 | return 0; | 1334 | return 0; |
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c index de9493253edf..a65108594a07 100644 --- a/fs/xfs/xfs_quotaops.c +++ b/fs/xfs/xfs_quotaops.c | |||
@@ -125,7 +125,7 @@ xfs_fs_set_info( | |||
125 | struct xfs_mount *mp = XFS_M(sb); | 125 | struct xfs_mount *mp = XFS_M(sb); |
126 | struct qc_dqblk newlim; | 126 | struct qc_dqblk newlim; |
127 | 127 | ||
128 | if (sb->s_flags & MS_RDONLY) | 128 | if (sb_rdonly(sb)) |
129 | return -EROFS; | 129 | return -EROFS; |
130 | if (!XFS_IS_QUOTA_RUNNING(mp)) | 130 | if (!XFS_IS_QUOTA_RUNNING(mp)) |
131 | return -ENOSYS; | 131 | return -ENOSYS; |
@@ -175,7 +175,7 @@ xfs_quota_enable( | |||
175 | { | 175 | { |
176 | struct xfs_mount *mp = XFS_M(sb); | 176 | struct xfs_mount *mp = XFS_M(sb); |
177 | 177 | ||
178 | if (sb->s_flags & MS_RDONLY) | 178 | if (sb_rdonly(sb)) |
179 | return -EROFS; | 179 | return -EROFS; |
180 | if (!XFS_IS_QUOTA_RUNNING(mp)) | 180 | if (!XFS_IS_QUOTA_RUNNING(mp)) |
181 | return -ENOSYS; | 181 | return -ENOSYS; |
@@ -190,7 +190,7 @@ xfs_quota_disable( | |||
190 | { | 190 | { |
191 | struct xfs_mount *mp = XFS_M(sb); | 191 | struct xfs_mount *mp = XFS_M(sb); |
192 | 192 | ||
193 | if (sb->s_flags & MS_RDONLY) | 193 | if (sb_rdonly(sb)) |
194 | return -EROFS; | 194 | return -EROFS; |
195 | if (!XFS_IS_QUOTA_RUNNING(mp)) | 195 | if (!XFS_IS_QUOTA_RUNNING(mp)) |
196 | return -ENOSYS; | 196 | return -ENOSYS; |
@@ -208,7 +208,7 @@ xfs_fs_rm_xquota( | |||
208 | struct xfs_mount *mp = XFS_M(sb); | 208 | struct xfs_mount *mp = XFS_M(sb); |
209 | unsigned int flags = 0; | 209 | unsigned int flags = 0; |
210 | 210 | ||
211 | if (sb->s_flags & MS_RDONLY) | 211 | if (sb_rdonly(sb)) |
212 | return -EROFS; | 212 | return -EROFS; |
213 | 213 | ||
214 | if (XFS_IS_QUOTA_ON(mp)) | 214 | if (XFS_IS_QUOTA_ON(mp)) |
@@ -279,7 +279,7 @@ xfs_fs_set_dqblk( | |||
279 | { | 279 | { |
280 | struct xfs_mount *mp = XFS_M(sb); | 280 | struct xfs_mount *mp = XFS_M(sb); |
281 | 281 | ||
282 | if (sb->s_flags & MS_RDONLY) | 282 | if (sb_rdonly(sb)) |
283 | return -EROFS; | 283 | return -EROFS; |
284 | if (!XFS_IS_QUOTA_RUNNING(mp)) | 284 | if (!XFS_IS_QUOTA_RUNNING(mp)) |
285 | return -ENOSYS; | 285 | return -ENOSYS; |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 38aaacdbb8b3..7bc25d62cdc6 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -210,7 +210,7 @@ xfs_parseargs( | |||
210 | /* | 210 | /* |
211 | * Copy binary VFS mount flags we are interested in. | 211 | * Copy binary VFS mount flags we are interested in. |
212 | */ | 212 | */ |
213 | if (sb->s_flags & MS_RDONLY) | 213 | if (sb_rdonly(sb)) |
214 | mp->m_flags |= XFS_MOUNT_RDONLY; | 214 | mp->m_flags |= XFS_MOUNT_RDONLY; |
215 | if (sb->s_flags & MS_DIRSYNC) | 215 | if (sb->s_flags & MS_DIRSYNC) |
216 | mp->m_flags |= XFS_MOUNT_DIRSYNC; | 216 | mp->m_flags |= XFS_MOUNT_DIRSYNC; |
diff --git a/init/do_mounts.c b/init/do_mounts.c index c2de5104aad2..bf7ea36ca286 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -373,7 +373,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data) | |||
373 | printk(KERN_INFO | 373 | printk(KERN_INFO |
374 | "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", | 374 | "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", |
375 | s->s_type->name, | 375 | s->s_type->name, |
376 | s->s_flags & MS_RDONLY ? " readonly" : "", | 376 | sb_rdonly(s) ? " readonly" : "", |
377 | MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); | 377 | MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); |
378 | return 0; | 378 | return 0; |
379 | } | 379 | } |