diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-14 21:54:01 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-14 21:54:01 -0400 |
| commit | 0f0d12728e56c94d3289c6831243b6faeae8a19d (patch) | |
| tree | bd52fd4ed6fba2a0d8bb95e7fc33f51ac299001d /fs | |
| parent | 581bfce969cbfc7ce43ee92273be9cb7c3fdfa61 (diff) | |
| parent | e462ec50cb5fad19f6003a3d8087f4a0945dd2b1 (diff) | |
Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull mount flag updates from Al Viro:
"Another chunk of fmount preparations from dhowells; only trivial
conflicts for that part. It separates MS_... bits (very grotty
mount(2) ABI) from the struct super_block ->s_flags (kernel-internal,
only a small subset of MS_... stuff).
This does *not* convert the filesystems to new constants; only the
infrastructure is done here. The next step in that series is where the
conflicts would be; that's the conversion of filesystems. It's purely
mechanical and it's better done after the merge, so if you could run
something like
list=$(for i in MS_RDONLY MS_NOSUID MS_NODEV MS_NOEXEC MS_SYNCHRONOUS MS_MANDLOCK MS_DIRSYNC MS_NOATIME MS_NODIRATIME MS_SILENT MS_POSIXACL MS_KERNMOUNT MS_I_VERSION MS_LAZYTIME; do git grep -l $i fs drivers/staging/lustre drivers/mtd ipc mm include/linux; done|sort|uniq|grep -v '^fs/namespace.c$')
sed -i -e 's/\<MS_RDONLY\>/SB_RDONLY/g' \
-e 's/\<MS_NOSUID\>/SB_NOSUID/g' \
-e 's/\<MS_NODEV\>/SB_NODEV/g' \
-e 's/\<MS_NOEXEC\>/SB_NOEXEC/g' \
-e 's/\<MS_SYNCHRONOUS\>/SB_SYNCHRONOUS/g' \
-e 's/\<MS_MANDLOCK\>/SB_MANDLOCK/g' \
-e 's/\<MS_DIRSYNC\>/SB_DIRSYNC/g' \
-e 's/\<MS_NOATIME\>/SB_NOATIME/g' \
-e 's/\<MS_NODIRATIME\>/SB_NODIRATIME/g' \
-e 's/\<MS_SILENT\>/SB_SILENT/g' \
-e 's/\<MS_POSIXACL\>/SB_POSIXACL/g' \
-e 's/\<MS_KERNMOUNT\>/SB_KERNMOUNT/g' \
-e 's/\<MS_I_VERSION\>/SB_I_VERSION/g' \
-e 's/\<MS_LAZYTIME\>/SB_LAZYTIME/g' \
$list
and commit it with something along the lines of 'convert filesystems
away from use of MS_... constants' as commit message, it would save a
quite a bit of headache next cycle"
* 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
VFS: Differentiate mount flags (MS_*) from internal superblock flags
VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb)
vfs: Add sb_rdonly(sb) to query the MS_RDONLY flag on s_flags
Diffstat (limited to 'fs')
71 files changed, 269 insertions, 278 deletions
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 7a93a3e1a847..7c655f9a7a50 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
| @@ -704,7 +704,7 @@ static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) | |||
| 704 | u64 result; | 704 | u64 result; |
| 705 | int ret; | 705 | int ret; |
| 706 | 706 | ||
| 707 | if (fs_info->sb->s_flags & MS_RDONLY) | 707 | if (sb_rdonly(fs_info->sb)) |
| 708 | return -EROFS; | 708 | return -EROFS; |
| 709 | 709 | ||
| 710 | mutex_lock(&dev_replace->lock_finishing_cancel_unmount); | 710 | mutex_lock(&dev_replace->lock_finishing_cancel_unmount); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b6dc1d179d23..487bbe4fb3c6 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; |
| @@ -2876,7 +2876,7 @@ int open_ctree(struct super_block *sb, | |||
| 2876 | 2876 | ||
| 2877 | features = btrfs_super_compat_ro_flags(disk_super) & | 2877 | features = btrfs_super_compat_ro_flags(disk_super) & |
| 2878 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; | 2878 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; |
| 2879 | if (!(sb->s_flags & MS_RDONLY) && features) { | 2879 | if (!sb_rdonly(sb) && features) { |
| 2880 | btrfs_err(fs_info, | 2880 | btrfs_err(fs_info, |
| 2881 | "cannot mount read-write because of unsupported optional features (%llx)", | 2881 | "cannot mount read-write because of unsupported optional features (%llx)", |
| 2882 | features); | 2882 | features); |
| @@ -3038,7 +3038,7 @@ retry_root_backup: | |||
| 3038 | goto fail_sysfs; | 3038 | goto fail_sysfs; |
| 3039 | } | 3039 | } |
| 3040 | 3040 | ||
| 3041 | if (!(sb->s_flags & MS_RDONLY) && !btrfs_check_rw_degradable(fs_info)) { | 3041 | if (!sb_rdonly(sb) && !btrfs_check_rw_degradable(fs_info)) { |
| 3042 | btrfs_warn(fs_info, | 3042 | btrfs_warn(fs_info, |
| 3043 | "writeable mount is not allowed due to too many missing devices"); | 3043 | "writeable mount is not allowed due to too many missing devices"); |
| 3044 | goto fail_sysfs; | 3044 | goto fail_sysfs; |
| @@ -3097,7 +3097,7 @@ retry_root_backup: | |||
| 3097 | if (ret) | 3097 | if (ret) |
| 3098 | goto fail_qgroup; | 3098 | goto fail_qgroup; |
| 3099 | 3099 | ||
| 3100 | if (!(sb->s_flags & MS_RDONLY)) { | 3100 | if (!sb_rdonly(sb)) { |
| 3101 | ret = btrfs_cleanup_fs_roots(fs_info); | 3101 | ret = btrfs_cleanup_fs_roots(fs_info); |
| 3102 | if (ret) | 3102 | if (ret) |
| 3103 | goto fail_qgroup; | 3103 | goto fail_qgroup; |
| @@ -3123,7 +3123,7 @@ retry_root_backup: | |||
| 3123 | goto fail_qgroup; | 3123 | goto fail_qgroup; |
| 3124 | } | 3124 | } |
| 3125 | 3125 | ||
| 3126 | if (sb->s_flags & MS_RDONLY) | 3126 | if (sb_rdonly(sb)) |
| 3127 | return 0; | 3127 | return 0; |
| 3128 | 3128 | ||
| 3129 | if (btrfs_test_opt(fs_info, CLEAR_CACHE) && | 3129 | if (btrfs_test_opt(fs_info, CLEAR_CACHE) && |
| @@ -3878,7 +3878,7 @@ void close_ctree(struct btrfs_fs_info *fs_info) | |||
| 3878 | 3878 | ||
| 3879 | cancel_work_sync(&fs_info->async_reclaim_work); | 3879 | cancel_work_sync(&fs_info->async_reclaim_work); |
| 3880 | 3880 | ||
| 3881 | if (!(fs_info->sb->s_flags & MS_RDONLY)) { | 3881 | if (!sb_rdonly(fs_info->sb)) { |
| 3882 | /* | 3882 | /* |
| 3883 | * If the cleaner thread is stopped and there are | 3883 | * If the cleaner thread is stopped and there are |
| 3884 | * block groups queued for removal, the deletion will be | 3884 | * block groups queued for removal, the deletion will be |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 0f077c5db58e..3e5bb0cdd3cd 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -2060,7 +2060,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, | |||
| 2060 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); | 2060 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); |
| 2061 | int ret = 0; | 2061 | int ret = 0; |
| 2062 | 2062 | ||
| 2063 | if (fs_info->sb->s_flags & MS_RDONLY) | 2063 | if (sb_rdonly(fs_info->sb)) |
| 2064 | return -EROFS; | 2064 | return -EROFS; |
| 2065 | 2065 | ||
| 2066 | for (i = 0; i < num_pages; i++) { | 2066 | for (i = 0; i < num_pages; i++) { |
| @@ -2110,7 +2110,7 @@ int clean_io_failure(struct btrfs_fs_info *fs_info, | |||
| 2110 | failrec->start); | 2110 | failrec->start); |
| 2111 | goto out; | 2111 | goto out; |
| 2112 | } | 2112 | } |
| 2113 | if (fs_info->sb->s_flags & MS_RDONLY) | 2113 | if (sb_rdonly(fs_info->sb)) |
| 2114 | goto out; | 2114 | goto out; |
| 2115 | 2115 | ||
| 2116 | spin_lock(&io_tree->lock); | 2116 | spin_lock(&io_tree->lock); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 17ad018da0a2..128f3e58634f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -5821,7 +5821,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
| 5821 | 5821 | ||
| 5822 | if (!IS_ERR(inode) && root != sub_root) { | 5822 | if (!IS_ERR(inode) && root != sub_root) { |
| 5823 | down_read(&fs_info->cleanup_work_sem); | 5823 | down_read(&fs_info->cleanup_work_sem); |
| 5824 | if (!(inode->i_sb->s_flags & MS_RDONLY)) | 5824 | if (!sb_rdonly(inode->i_sb)) |
| 5825 | ret = btrfs_orphan_cleanup(sub_root); | 5825 | ret = btrfs_orphan_cleanup(sub_root); |
| 5826 | up_read(&fs_info->cleanup_work_sem); | 5826 | up_read(&fs_info->cleanup_work_sem); |
| 5827 | if (ret) { | 5827 | if (ret) { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0ebaf5d116bc..d6715c2bcdc4 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -4426,7 +4426,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info, | |||
| 4426 | 4426 | ||
| 4427 | switch (p->cmd) { | 4427 | switch (p->cmd) { |
| 4428 | case BTRFS_IOCTL_DEV_REPLACE_CMD_START: | 4428 | case BTRFS_IOCTL_DEV_REPLACE_CMD_START: |
| 4429 | if (fs_info->sb->s_flags & MS_RDONLY) { | 4429 | if (sb_rdonly(fs_info->sb)) { |
| 4430 | ret = -EROFS; | 4430 | ret = -EROFS; |
| 4431 | goto out; | 4431 | goto out; |
| 4432 | } | 4432 | } |
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 9fb9896610e0..95bcc3cce78f 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 2b13d1a69f0b..35a128acfbd1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -103,7 +103,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info) | |||
| 103 | { | 103 | { |
| 104 | struct super_block *sb = fs_info->sb; | 104 | struct super_block *sb = fs_info->sb; |
| 105 | 105 | ||
| 106 | if (sb->s_flags & MS_RDONLY) | 106 | if (sb_rdonly(sb)) |
| 107 | return; | 107 | return; |
| 108 | 108 | ||
| 109 | if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { | 109 | if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { |
| @@ -139,7 +139,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function | |||
| 139 | * Special case: if the error is EROFS, and we're already | 139 | * Special case: if the error is EROFS, and we're already |
| 140 | * under MS_RDONLY, then it is safe here. | 140 | * under MS_RDONLY, then it is safe here. |
| 141 | */ | 141 | */ |
| 142 | if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) | 142 | if (errno == -EROFS && sb_rdonly(sb)) |
| 143 | return; | 143 | return; |
| 144 | 144 | ||
| 145 | #ifdef CONFIG_PRINTK | 145 | #ifdef CONFIG_PRINTK |
| @@ -1701,8 +1701,7 @@ static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, | |||
| 1701 | * close or the filesystem is read only. | 1701 | * close or the filesystem is read only. |
| 1702 | */ | 1702 | */ |
| 1703 | if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && | 1703 | if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && |
| 1704 | (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || | 1704 | (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { |
| 1705 | (fs_info->sb->s_flags & MS_RDONLY))) { | ||
| 1706 | btrfs_cleanup_defrag_inodes(fs_info); | 1705 | btrfs_cleanup_defrag_inodes(fs_info); |
| 1707 | } | 1706 | } |
| 1708 | 1707 | ||
| @@ -1749,7 +1748,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 1749 | btrfs_resize_thread_pool(fs_info, | 1748 | btrfs_resize_thread_pool(fs_info, |
| 1750 | fs_info->thread_pool_size, old_thread_pool_size); | 1749 | fs_info->thread_pool_size, old_thread_pool_size); |
| 1751 | 1750 | ||
| 1752 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 1751 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
| 1753 | goto out; | 1752 | goto out; |
| 1754 | 1753 | ||
| 1755 | if (*flags & MS_RDONLY) { | 1754 | if (*flags & MS_RDONLY) { |
| @@ -1850,7 +1849,7 @@ out: | |||
| 1850 | 1849 | ||
| 1851 | restore: | 1850 | restore: |
| 1852 | /* We've hit an error - don't reset MS_RDONLY */ | 1851 | /* We've hit an error - don't reset MS_RDONLY */ |
| 1853 | if (sb->s_flags & MS_RDONLY) | 1852 | if (sb_rdonly(sb)) |
| 1854 | old_flags |= MS_RDONLY; | 1853 | old_flags |= MS_RDONLY; |
| 1855 | sb->s_flags = old_flags; | 1854 | sb->s_flags = old_flags; |
| 1856 | fs_info->mount_opt = old_opts; | 1855 | fs_info->mount_opt = old_opts; |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 2b6d37c09a81..883881b16c86 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); |
| @@ -390,7 +390,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj, | |||
| 390 | if (!fs_info) | 390 | if (!fs_info) |
| 391 | return -EPERM; | 391 | return -EPERM; |
| 392 | 392 | ||
| 393 | if (fs_info->sb->s_flags & MS_RDONLY) | 393 | if (sb_rdonly(fs_info->sb)) |
| 394 | return -EROFS; | 394 | return -EROFS; |
| 395 | 395 | ||
| 396 | /* | 396 | /* |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c188256a367c..0e8f16c305df 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -2324,7 +2324,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path | |||
| 2324 | int seeding_dev = 0; | 2324 | int seeding_dev = 0; |
| 2325 | int ret = 0; | 2325 | int ret = 0; |
| 2326 | 2326 | ||
| 2327 | if ((sb->s_flags & MS_RDONLY) && !fs_info->fs_devices->seeding) | 2327 | if (sb_rdonly(sb) && !fs_info->fs_devices->seeding) |
| 2328 | return -EROFS; | 2328 | return -EROFS; |
| 2329 | 2329 | ||
| 2330 | bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, | 2330 | bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, |
| @@ -4053,7 +4053,7 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info) | |||
| 4053 | 4053 | ||
| 4054 | int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) | 4054 | int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) |
| 4055 | { | 4055 | { |
| 4056 | if (fs_info->sb->s_flags & MS_RDONLY) | 4056 | if (sb_rdonly(fs_info->sb)) |
| 4057 | return -EROFS; | 4057 | return -EROFS; |
| 4058 | 4058 | ||
| 4059 | mutex_lock(&fs_info->balance_mutex); | 4059 | 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 fc18edd81815..1458706bd2ec 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); |
| @@ -943,8 +943,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
| 943 | le32_to_cpu(features)); | 943 | le32_to_cpu(features)); |
| 944 | goto failed_mount; | 944 | goto failed_mount; |
| 945 | } | 945 | } |
| 946 | if (!(sb->s_flags & MS_RDONLY) && | 946 | if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ |
| 947 | (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ | ||
| 948 | ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " | 947 | ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " |
| 949 | "unsupported optional features (%x)", | 948 | "unsupported optional features (%x)", |
| 950 | le32_to_cpu(features)); | 949 | le32_to_cpu(features)); |
| @@ -1173,7 +1172,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
| 1173 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 1172 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) |
| 1174 | ext2_msg(sb, KERN_WARNING, | 1173 | ext2_msg(sb, KERN_WARNING, |
| 1175 | "warning: mounting ext3 filesystem as ext2"); | 1174 | "warning: mounting ext3 filesystem as ext2"); |
| 1176 | if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) | 1175 | if (ext2_setup_super (sb, es, sb_rdonly(sb))) |
| 1177 | sb->s_flags |= MS_RDONLY; | 1176 | sb->s_flags |= MS_RDONLY; |
| 1178 | ext2_write_super(sb); | 1177 | ext2_write_super(sb); |
| 1179 | return 0; | 1178 | return 0; |
| @@ -1305,7 +1304,7 @@ static int ext2_unfreeze(struct super_block *sb) | |||
| 1305 | 1304 | ||
| 1306 | static void ext2_write_super(struct super_block *sb) | 1305 | static void ext2_write_super(struct super_block *sb) |
| 1307 | { | 1306 | { |
| 1308 | if (!(sb->s_flags & MS_RDONLY)) | 1307 | if (!sb_rdonly(sb)) |
| 1309 | ext2_sync_fs(sb, 1); | 1308 | ext2_sync_fs(sb, 1); |
| 1310 | } | 1309 | } |
| 1311 | 1310 | ||
| @@ -1343,7 +1342,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
| 1343 | "dax flag with busy inodes while remounting"); | 1342 | "dax flag with busy inodes while remounting"); |
| 1344 | sbi->s_mount_opt ^= EXT2_MOUNT_DAX; | 1343 | sbi->s_mount_opt ^= EXT2_MOUNT_DAX; |
| 1345 | } | 1344 | } |
| 1346 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1345 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) { |
| 1347 | spin_unlock(&sbi->s_lock); | 1346 | spin_unlock(&sbi->s_lock); |
| 1348 | return 0; | 1347 | return 0; |
| 1349 | } | 1348 | } |
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 57dcaea762c3..da9c6948ad25 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
| @@ -371,7 +371,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
| 371 | return -EIO; | 371 | return -EIO; |
| 372 | 372 | ||
| 373 | if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && | 373 | if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && |
| 374 | !(sb->s_flags & MS_RDONLY))) { | 374 | !sb_rdonly(sb))) { |
| 375 | sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; | 375 | sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; |
| 376 | /* | 376 | /* |
| 377 | * Sample where the filesystem has been mounted and | 377 | * 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 71e93a23cec3..ee823022aa34 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -1382,7 +1382,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, | |||
| 1382 | int num, ret = 0, used_blks = 0; | 1382 | int num, ret = 0, used_blks = 0; |
| 1383 | 1383 | ||
| 1384 | /* This should not happen, but just to be sure check this */ | 1384 | /* This should not happen, but just to be sure check this */ |
| 1385 | if (sb->s_flags & MS_RDONLY) { | 1385 | if (sb_rdonly(sb)) { |
| 1386 | ret = 1; | 1386 | ret = 1; |
| 1387 | goto out; | 1387 | goto out; |
| 1388 | } | 1388 | } |
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index 77cdce1f17ce..84c54f15f1dd 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 71b9a667e1bc..b104096fce9e 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++) |
| @@ -2100,7 +2099,7 @@ int ext4_seq_options_show(struct seq_file *seq, void *offset) | |||
| 2100 | struct super_block *sb = seq->private; | 2099 | struct super_block *sb = seq->private; |
| 2101 | int rc; | 2100 | int rc; |
| 2102 | 2101 | ||
| 2103 | seq_puts(seq, (sb->s_flags & MS_RDONLY) ? "ro" : "rw"); | 2102 | seq_puts(seq, sb_rdonly(sb) ? "ro" : "rw"); |
| 2104 | rc = _ext4_show_options(seq, sb, 1); | 2103 | rc = _ext4_show_options(seq, sb, 1); |
| 2105 | seq_puts(seq, "\n"); | 2104 | seq_puts(seq, "\n"); |
| 2106 | return rc; | 2105 | return rc; |
| @@ -2368,7 +2367,7 @@ static int ext4_check_descriptors(struct super_block *sb, | |||
| 2368 | "Checksum for group %u failed (%u!=%u)", | 2367 | "Checksum for group %u failed (%u!=%u)", |
| 2369 | i, le16_to_cpu(ext4_group_desc_csum(sb, i, | 2368 | i, le16_to_cpu(ext4_group_desc_csum(sb, i, |
| 2370 | gdp)), le16_to_cpu(gdp->bg_checksum)); | 2369 | gdp)), le16_to_cpu(gdp->bg_checksum)); |
| 2371 | if (!(sb->s_flags & MS_RDONLY)) { | 2370 | if (!sb_rdonly(sb)) { |
| 2372 | ext4_unlock_group(sb, i); | 2371 | ext4_unlock_group(sb, i); |
| 2373 | return 0; | 2372 | return 0; |
| 2374 | } | 2373 | } |
| @@ -3136,8 +3135,7 @@ int ext4_register_li_request(struct super_block *sb, | |||
| 3136 | goto out; | 3135 | goto out; |
| 3137 | } | 3136 | } |
| 3138 | 3137 | ||
| 3139 | if (first_not_zeroed == ngroups || | 3138 | if (first_not_zeroed == ngroups || sb_rdonly(sb) || |
| 3140 | (sb->s_flags & MS_RDONLY) || | ||
| 3141 | !test_opt(sb, INIT_INODE_TABLE)) | 3139 | !test_opt(sb, INIT_INODE_TABLE)) |
| 3142 | goto out; | 3140 | goto out; |
| 3143 | 3141 | ||
| @@ -3683,7 +3681,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3683 | * previously didn't change the revision level when setting the flags, | 3681 | * previously didn't change the revision level when setting the flags, |
| 3684 | * so there is a chance incompat flags are set on a rev 0 filesystem. | 3682 | * so there is a chance incompat flags are set on a rev 0 filesystem. |
| 3685 | */ | 3683 | */ |
| 3686 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | 3684 | if (!ext4_feature_set_ok(sb, (sb_rdonly(sb)))) |
| 3687 | goto failed_mount; | 3685 | goto failed_mount; |
| 3688 | 3686 | ||
| 3689 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | 3687 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); |
| @@ -3812,12 +3810,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3812 | sbi->s_hash_unsigned = 3; | 3810 | sbi->s_hash_unsigned = 3; |
| 3813 | else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { | 3811 | else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { |
| 3814 | #ifdef __CHAR_UNSIGNED__ | 3812 | #ifdef __CHAR_UNSIGNED__ |
| 3815 | if (!(sb->s_flags & MS_RDONLY)) | 3813 | if (!sb_rdonly(sb)) |
| 3816 | es->s_flags |= | 3814 | es->s_flags |= |
| 3817 | cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); | 3815 | cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); |
| 3818 | sbi->s_hash_unsigned = 3; | 3816 | sbi->s_hash_unsigned = 3; |
| 3819 | #else | 3817 | #else |
| 3820 | if (!(sb->s_flags & MS_RDONLY)) | 3818 | if (!sb_rdonly(sb)) |
| 3821 | es->s_flags |= | 3819 | es->s_flags |= |
| 3822 | cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | 3820 | cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); |
| 3823 | #endif | 3821 | #endif |
| @@ -4017,7 +4015,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 4017 | needs_recovery = (es->s_last_orphan != 0 || | 4015 | needs_recovery = (es->s_last_orphan != 0 || |
| 4018 | ext4_has_feature_journal_needs_recovery(sb)); | 4016 | ext4_has_feature_journal_needs_recovery(sb)); |
| 4019 | 4017 | ||
| 4020 | if (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY)) | 4018 | if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) |
| 4021 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | 4019 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) |
| 4022 | goto failed_mount3a; | 4020 | goto failed_mount3a; |
| 4023 | 4021 | ||
| @@ -4029,7 +4027,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 4029 | err = ext4_load_journal(sb, es, journal_devnum); | 4027 | err = ext4_load_journal(sb, es, journal_devnum); |
| 4030 | if (err) | 4028 | if (err) |
| 4031 | goto failed_mount3a; | 4029 | goto failed_mount3a; |
| 4032 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && | 4030 | } else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) && |
| 4033 | ext4_has_feature_journal_needs_recovery(sb)) { | 4031 | ext4_has_feature_journal_needs_recovery(sb)) { |
| 4034 | ext4_msg(sb, KERN_ERR, "required journal recovery " | 4032 | ext4_msg(sb, KERN_ERR, "required journal recovery " |
| 4035 | "suppressed and not mounted read-only"); | 4033 | "suppressed and not mounted read-only"); |
| @@ -4143,7 +4141,7 @@ no_journal: | |||
| 4143 | goto failed_mount_wq; | 4141 | goto failed_mount_wq; |
| 4144 | } | 4142 | } |
| 4145 | 4143 | ||
| 4146 | if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) && | 4144 | if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) && |
| 4147 | !ext4_has_feature_encrypt(sb)) { | 4145 | !ext4_has_feature_encrypt(sb)) { |
| 4148 | ext4_set_feature_encrypt(sb); | 4146 | ext4_set_feature_encrypt(sb); |
| 4149 | ext4_commit_super(sb, 1); | 4147 | ext4_commit_super(sb, 1); |
| @@ -4197,7 +4195,7 @@ no_journal: | |||
| 4197 | goto failed_mount4; | 4195 | goto failed_mount4; |
| 4198 | } | 4196 | } |
| 4199 | 4197 | ||
| 4200 | if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) | 4198 | if (ext4_setup_super(sb, es, sb_rdonly(sb))) |
| 4201 | sb->s_flags |= MS_RDONLY; | 4199 | sb->s_flags |= MS_RDONLY; |
| 4202 | 4200 | ||
| 4203 | /* determine the minimum size of new large inodes, if present */ | 4201 | /* determine the minimum size of new large inodes, if present */ |
| @@ -4285,7 +4283,7 @@ no_journal: | |||
| 4285 | 4283 | ||
| 4286 | #ifdef CONFIG_QUOTA | 4284 | #ifdef CONFIG_QUOTA |
| 4287 | /* Enable quota usage during mount. */ | 4285 | /* Enable quota usage during mount. */ |
| 4288 | if (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) { | 4286 | if (ext4_has_feature_quota(sb) && !sb_rdonly(sb)) { |
| 4289 | err = ext4_enable_quotas(sb); | 4287 | err = ext4_enable_quotas(sb); |
| 4290 | if (err) | 4288 | if (err) |
| 4291 | goto failed_mount8; | 4289 | goto failed_mount8; |
| @@ -4609,7 +4607,7 @@ static int ext4_load_journal(struct super_block *sb, | |||
| 4609 | * can get read-write access to the device. | 4607 | * can get read-write access to the device. |
| 4610 | */ | 4608 | */ |
| 4611 | if (ext4_has_feature_journal_needs_recovery(sb)) { | 4609 | if (ext4_has_feature_journal_needs_recovery(sb)) { |
| 4612 | if (sb->s_flags & MS_RDONLY) { | 4610 | if (sb_rdonly(sb)) { |
| 4613 | ext4_msg(sb, KERN_INFO, "INFO: recovery " | 4611 | ext4_msg(sb, KERN_INFO, "INFO: recovery " |
| 4614 | "required on readonly filesystem"); | 4612 | "required on readonly filesystem"); |
| 4615 | if (really_read_only) { | 4613 | if (really_read_only) { |
| @@ -4764,8 +4762,7 @@ static void ext4_mark_recovery_complete(struct super_block *sb, | |||
| 4764 | if (jbd2_journal_flush(journal) < 0) | 4762 | if (jbd2_journal_flush(journal) < 0) |
| 4765 | goto out; | 4763 | goto out; |
| 4766 | 4764 | ||
| 4767 | if (ext4_has_feature_journal_needs_recovery(sb) && | 4765 | if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { |
| 4768 | sb->s_flags & MS_RDONLY) { | ||
| 4769 | ext4_clear_feature_journal_needs_recovery(sb); | 4766 | ext4_clear_feature_journal_needs_recovery(sb); |
| 4770 | ext4_commit_super(sb, 1); | 4767 | ext4_commit_super(sb, 1); |
| 4771 | } | 4768 | } |
| @@ -4821,7 +4818,7 @@ int ext4_force_commit(struct super_block *sb) | |||
| 4821 | { | 4818 | { |
| 4822 | journal_t *journal; | 4819 | journal_t *journal; |
| 4823 | 4820 | ||
| 4824 | if (sb->s_flags & MS_RDONLY) | 4821 | if (sb_rdonly(sb)) |
| 4825 | return 0; | 4822 | return 0; |
| 4826 | 4823 | ||
| 4827 | journal = EXT4_SB(sb)->s_journal; | 4824 | journal = EXT4_SB(sb)->s_journal; |
| @@ -4886,7 +4883,7 @@ static int ext4_freeze(struct super_block *sb) | |||
| 4886 | int error = 0; | 4883 | int error = 0; |
| 4887 | journal_t *journal; | 4884 | journal_t *journal; |
| 4888 | 4885 | ||
| 4889 | if (sb->s_flags & MS_RDONLY) | 4886 | if (sb_rdonly(sb)) |
| 4890 | return 0; | 4887 | return 0; |
| 4891 | 4888 | ||
| 4892 | journal = EXT4_SB(sb)->s_journal; | 4889 | journal = EXT4_SB(sb)->s_journal; |
| @@ -4921,7 +4918,7 @@ out: | |||
| 4921 | */ | 4918 | */ |
| 4922 | static int ext4_unfreeze(struct super_block *sb) | 4919 | static int ext4_unfreeze(struct super_block *sb) |
| 4923 | { | 4920 | { |
| 4924 | if ((sb->s_flags & MS_RDONLY) || ext4_forced_shutdown(EXT4_SB(sb))) | 4921 | if (sb_rdonly(sb) || ext4_forced_shutdown(EXT4_SB(sb))) |
| 4925 | return 0; | 4922 | return 0; |
| 4926 | 4923 | ||
| 4927 | if (EXT4_SB(sb)->s_journal) { | 4924 | if (EXT4_SB(sb)->s_journal) { |
| @@ -5059,7 +5056,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 5059 | if (*flags & MS_LAZYTIME) | 5056 | if (*flags & MS_LAZYTIME) |
| 5060 | sb->s_flags |= MS_LAZYTIME; | 5057 | sb->s_flags |= MS_LAZYTIME; |
| 5061 | 5058 | ||
| 5062 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 5059 | if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { |
| 5063 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { | 5060 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { |
| 5064 | err = -EROFS; | 5061 | err = -EROFS; |
| 5065 | goto restore_opts; | 5062 | goto restore_opts; |
| @@ -5154,7 +5151,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 5154 | * Reinitialize lazy itable initialization thread based on | 5151 | * Reinitialize lazy itable initialization thread based on |
| 5155 | * current settings | 5152 | * current settings |
| 5156 | */ | 5153 | */ |
| 5157 | if ((sb->s_flags & MS_RDONLY) || !test_opt(sb, INIT_INODE_TABLE)) | 5154 | if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE)) |
| 5158 | ext4_unregister_li_request(sb); | 5155 | ext4_unregister_li_request(sb); |
| 5159 | else { | 5156 | else { |
| 5160 | ext4_group_t first_not_zeroed; | 5157 | ext4_group_t first_not_zeroed; |
| @@ -5731,7 +5728,7 @@ static inline int ext2_feature_set_ok(struct super_block *sb) | |||
| 5731 | { | 5728 | { |
| 5732 | if (ext4_has_unknown_ext2_incompat_features(sb)) | 5729 | if (ext4_has_unknown_ext2_incompat_features(sb)) |
| 5733 | return 0; | 5730 | return 0; |
| 5734 | if (sb->s_flags & MS_RDONLY) | 5731 | if (sb_rdonly(sb)) |
| 5735 | return 1; | 5732 | return 1; |
| 5736 | if (ext4_has_unknown_ext2_ro_compat_features(sb)) | 5733 | if (ext4_has_unknown_ext2_ro_compat_features(sb)) |
| 5737 | return 0; | 5734 | return 0; |
| @@ -5762,7 +5759,7 @@ static inline int ext3_feature_set_ok(struct super_block *sb) | |||
| 5762 | return 0; | 5759 | return 0; |
| 5763 | if (!ext4_has_feature_journal(sb)) | 5760 | if (!ext4_has_feature_journal(sb)) |
| 5764 | return 0; | 5761 | return 0; |
| 5765 | if (sb->s_flags & MS_RDONLY) | 5762 | if (sb_rdonly(sb)) |
| 5766 | return 1; | 5763 | return 1; |
| 5767 | if (ext4_has_unknown_ext3_ro_compat_features(sb)) | 5764 | if (ext4_has_unknown_ext3_ro_compat_features(sb)) |
| 5768 | return 0; | 5765 | 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 dac6559e2195..cdd1c5f06f45 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
| @@ -554,7 +554,7 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote) | |||
| 554 | struct gfs2_inode *ip = gl->gl_object; | 554 | struct gfs2_inode *ip = gl->gl_object; |
| 555 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | 555 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
| 556 | 556 | ||
| 557 | if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY)) | 557 | if (!remote || sb_rdonly(sdp->sd_vfs)) |
| 558 | return; | 558 | return; |
| 559 | 559 | ||
| 560 | if (gl->gl_demote_state == LM_ST_UNLOCKED && | 560 | if (gl->gl_demote_state == LM_ST_UNLOCKED && |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 84593587691d..a3711f543405 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 e647938432bd..e700fb162664 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 769841185ce5..8e54f2e3a304 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); |
| @@ -1569,7 +1569,7 @@ static void gfs2_evict_inode(struct inode *inode) | |||
| 1569 | return; | 1569 | return; |
| 1570 | } | 1570 | } |
| 1571 | 1571 | ||
| 1572 | if (inode->i_nlink || (sb->s_flags & MS_RDONLY)) | 1572 | if (inode->i_nlink || sb_rdonly(sb)) |
| 1573 | goto out; | 1573 | goto out; |
| 1574 | 1574 | ||
| 1575 | if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) { | 1575 | 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 f1ed935322db..db692f554158 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
| @@ -737,7 +737,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | |||
| 737 | 737 | ||
| 738 | root_found: | 738 | root_found: |
| 739 | /* We don't support read-write mounts */ | 739 | /* We don't support read-write mounts */ |
| 740 | if (!(s->s_flags & MS_RDONLY)) { | 740 | if (!sb_rdonly(s)) { |
| 741 | error = -EACCES; | 741 | error = -EACCES; |
| 742 | goto out_freebh; | 742 | goto out_freebh; |
| 743 | } | 743 | } |
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 48d9522e209c..2cfe487708e0 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 60726ae7cf26..2f14677169c3 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); |
| @@ -652,7 +652,7 @@ static int jfs_freeze(struct super_block *sb) | |||
| 652 | struct jfs_log *log = sbi->log; | 652 | struct jfs_log *log = sbi->log; |
| 653 | int rc = 0; | 653 | int rc = 0; |
| 654 | 654 | ||
| 655 | if (!(sb->s_flags & MS_RDONLY)) { | 655 | if (!sb_rdonly(sb)) { |
| 656 | txQuiesce(sb); | 656 | txQuiesce(sb); |
| 657 | rc = lmLogShutdown(log); | 657 | rc = lmLogShutdown(log); |
| 658 | if (rc) { | 658 | if (rc) { |
| @@ -682,7 +682,7 @@ static int jfs_unfreeze(struct super_block *sb) | |||
| 682 | struct jfs_log *log = sbi->log; | 682 | struct jfs_log *log = sbi->log; |
| 683 | int rc = 0; | 683 | int rc = 0; |
| 684 | 684 | ||
| 685 | if (!(sb->s_flags & MS_RDONLY)) { | 685 | if (!sb_rdonly(sb)) { |
| 686 | rc = updateSuper(sb, FM_MOUNT); | 686 | rc = updateSuper(sb, FM_MOUNT); |
| 687 | if (rc) { | 687 | if (rc) { |
| 688 | jfs_error(sb, "updateSuper failed\n"); | 688 | 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 1180f9c58093..c75ea03ca147 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 df0f7521979a..e48ad0192d81 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 | } |
| @@ -1029,7 +1029,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | |||
| 1029 | if (!mnt) | 1029 | if (!mnt) |
| 1030 | return ERR_PTR(-ENOMEM); | 1030 | return ERR_PTR(-ENOMEM); |
| 1031 | 1031 | ||
| 1032 | if (flags & MS_KERNMOUNT) | 1032 | if (flags & SB_KERNMOUNT) |
| 1033 | mnt->mnt.mnt_flags = MNT_INTERNAL; | 1033 | mnt->mnt.mnt_flags = MNT_INTERNAL; |
| 1034 | 1034 | ||
| 1035 | root = mount_fs(type, flags, name, data); | 1035 | root = mount_fs(type, flags, name, data); |
| @@ -1061,7 +1061,7 @@ vfs_submount(const struct dentry *mountpoint, struct file_system_type *type, | |||
| 1061 | if (mountpoint->d_sb->s_user_ns != &init_user_ns) | 1061 | if (mountpoint->d_sb->s_user_ns != &init_user_ns) |
| 1062 | return ERR_PTR(-EPERM); | 1062 | return ERR_PTR(-EPERM); |
| 1063 | 1063 | ||
| 1064 | return vfs_kern_mount(type, MS_SUBMOUNT, name, data); | 1064 | return vfs_kern_mount(type, SB_SUBMOUNT, name, data); |
| 1065 | } | 1065 | } |
| 1066 | EXPORT_SYMBOL_GPL(vfs_submount); | 1066 | EXPORT_SYMBOL_GPL(vfs_submount); |
| 1067 | 1067 | ||
| @@ -1592,8 +1592,8 @@ static int do_umount(struct mount *mnt, int flags) | |||
| 1592 | if (!capable(CAP_SYS_ADMIN)) | 1592 | if (!capable(CAP_SYS_ADMIN)) |
| 1593 | return -EPERM; | 1593 | return -EPERM; |
| 1594 | down_write(&sb->s_umount); | 1594 | down_write(&sb->s_umount); |
| 1595 | if (!(sb->s_flags & MS_RDONLY)) | 1595 | if (!sb_rdonly(sb)) |
| 1596 | retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); | 1596 | retval = do_remount_sb(sb, SB_RDONLY, NULL, 0); |
| 1597 | up_write(&sb->s_umount); | 1597 | up_write(&sb->s_umount); |
| 1598 | return retval; | 1598 | return retval; |
| 1599 | } | 1599 | } |
| @@ -2117,7 +2117,7 @@ static void unlock_mount(struct mountpoint *where) | |||
| 2117 | 2117 | ||
| 2118 | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) | 2118 | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) |
| 2119 | { | 2119 | { |
| 2120 | if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER) | 2120 | if (mnt->mnt.mnt_sb->s_flags & SB_NOUSER) |
| 2121 | return -EINVAL; | 2121 | return -EINVAL; |
| 2122 | 2122 | ||
| 2123 | if (d_is_dir(mp->m_dentry) != | 2123 | if (d_is_dir(mp->m_dentry) != |
| @@ -2131,9 +2131,9 @@ static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) | |||
| 2131 | * Sanity check the flags to change_mnt_propagation. | 2131 | * Sanity check the flags to change_mnt_propagation. |
| 2132 | */ | 2132 | */ |
| 2133 | 2133 | ||
| 2134 | static int flags_to_propagation_type(int flags) | 2134 | static int flags_to_propagation_type(int ms_flags) |
| 2135 | { | 2135 | { |
| 2136 | int type = flags & ~(MS_REC | MS_SILENT); | 2136 | int type = ms_flags & ~(MS_REC | MS_SILENT); |
| 2137 | 2137 | ||
| 2138 | /* Fail if any non-propagation flags are set */ | 2138 | /* Fail if any non-propagation flags are set */ |
| 2139 | if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) | 2139 | if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) |
| @@ -2147,18 +2147,18 @@ static int flags_to_propagation_type(int flags) | |||
| 2147 | /* | 2147 | /* |
| 2148 | * recursively change the type of the mountpoint. | 2148 | * recursively change the type of the mountpoint. |
| 2149 | */ | 2149 | */ |
| 2150 | static int do_change_type(struct path *path, int flag) | 2150 | static int do_change_type(struct path *path, int ms_flags) |
| 2151 | { | 2151 | { |
| 2152 | struct mount *m; | 2152 | struct mount *m; |
| 2153 | struct mount *mnt = real_mount(path->mnt); | 2153 | struct mount *mnt = real_mount(path->mnt); |
| 2154 | int recurse = flag & MS_REC; | 2154 | int recurse = ms_flags & MS_REC; |
| 2155 | int type; | 2155 | int type; |
| 2156 | int err = 0; | 2156 | int err = 0; |
| 2157 | 2157 | ||
| 2158 | if (path->dentry != path->mnt->mnt_root) | 2158 | if (path->dentry != path->mnt->mnt_root) |
| 2159 | return -EINVAL; | 2159 | return -EINVAL; |
| 2160 | 2160 | ||
| 2161 | type = flags_to_propagation_type(flag); | 2161 | type = flags_to_propagation_type(ms_flags); |
| 2162 | if (!type) | 2162 | if (!type) |
| 2163 | return -EINVAL; | 2163 | return -EINVAL; |
| 2164 | 2164 | ||
| @@ -2280,8 +2280,8 @@ static int change_mount_flags(struct vfsmount *mnt, int ms_flags) | |||
| 2280 | * If you've mounted a non-root directory somewhere and want to do remount | 2280 | * If you've mounted a non-root directory somewhere and want to do remount |
| 2281 | * on it - tough luck. | 2281 | * on it - tough luck. |
| 2282 | */ | 2282 | */ |
| 2283 | static int do_remount(struct path *path, int flags, int mnt_flags, | 2283 | static int do_remount(struct path *path, int ms_flags, int sb_flags, |
| 2284 | void *data) | 2284 | int mnt_flags, void *data) |
| 2285 | { | 2285 | { |
| 2286 | int err; | 2286 | int err; |
| 2287 | struct super_block *sb = path->mnt->mnt_sb; | 2287 | struct super_block *sb = path->mnt->mnt_sb; |
| @@ -2325,12 +2325,12 @@ static int do_remount(struct path *path, int flags, int mnt_flags, | |||
| 2325 | return err; | 2325 | return err; |
| 2326 | 2326 | ||
| 2327 | down_write(&sb->s_umount); | 2327 | down_write(&sb->s_umount); |
| 2328 | if (flags & MS_BIND) | 2328 | if (ms_flags & MS_BIND) |
| 2329 | err = change_mount_flags(path->mnt, flags); | 2329 | err = change_mount_flags(path->mnt, ms_flags); |
| 2330 | else if (!capable(CAP_SYS_ADMIN)) | 2330 | else if (!capable(CAP_SYS_ADMIN)) |
| 2331 | err = -EPERM; | 2331 | err = -EPERM; |
| 2332 | else | 2332 | else |
| 2333 | err = do_remount_sb(sb, flags, data, 0); | 2333 | err = do_remount_sb(sb, sb_flags, data, 0); |
| 2334 | if (!err) { | 2334 | if (!err) { |
| 2335 | lock_mount_hash(); | 2335 | lock_mount_hash(); |
| 2336 | mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK; | 2336 | mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK; |
| @@ -2495,7 +2495,7 @@ static bool mount_too_revealing(struct vfsmount *mnt, int *new_mnt_flags); | |||
| 2495 | * create a new mount for userspace and request it to be added into the | 2495 | * create a new mount for userspace and request it to be added into the |
| 2496 | * namespace's tree | 2496 | * namespace's tree |
| 2497 | */ | 2497 | */ |
| 2498 | static int do_new_mount(struct path *path, const char *fstype, int flags, | 2498 | static int do_new_mount(struct path *path, const char *fstype, int sb_flags, |
| 2499 | int mnt_flags, const char *name, void *data) | 2499 | int mnt_flags, const char *name, void *data) |
| 2500 | { | 2500 | { |
| 2501 | struct file_system_type *type; | 2501 | struct file_system_type *type; |
| @@ -2509,7 +2509,7 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, | |||
| 2509 | if (!type) | 2509 | if (!type) |
| 2510 | return -ENODEV; | 2510 | return -ENODEV; |
| 2511 | 2511 | ||
| 2512 | mnt = vfs_kern_mount(type, flags, name, data); | 2512 | mnt = vfs_kern_mount(type, sb_flags, name, data); |
| 2513 | if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) && | 2513 | if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) && |
| 2514 | !mnt->mnt_sb->s_subtype) | 2514 | !mnt->mnt_sb->s_subtype) |
| 2515 | mnt = fs_set_subtype(mnt, fstype); | 2515 | mnt = fs_set_subtype(mnt, fstype); |
| @@ -2764,8 +2764,8 @@ long do_mount(const char *dev_name, const char __user *dir_name, | |||
| 2764 | const char *type_page, unsigned long flags, void *data_page) | 2764 | const char *type_page, unsigned long flags, void *data_page) |
| 2765 | { | 2765 | { |
| 2766 | struct path path; | 2766 | struct path path; |
| 2767 | unsigned int mnt_flags = 0, sb_flags; | ||
| 2767 | int retval = 0; | 2768 | int retval = 0; |
| 2768 | int mnt_flags = 0; | ||
| 2769 | 2769 | ||
| 2770 | /* Discard magic */ | 2770 | /* Discard magic */ |
| 2771 | if ((flags & MS_MGC_MSK) == MS_MGC_VAL) | 2771 | if ((flags & MS_MGC_MSK) == MS_MGC_VAL) |
| @@ -2775,6 +2775,9 @@ long do_mount(const char *dev_name, const char __user *dir_name, | |||
| 2775 | if (data_page) | 2775 | if (data_page) |
| 2776 | ((char *)data_page)[PAGE_SIZE - 1] = 0; | 2776 | ((char *)data_page)[PAGE_SIZE - 1] = 0; |
| 2777 | 2777 | ||
| 2778 | if (flags & MS_NOUSER) | ||
| 2779 | return -EINVAL; | ||
| 2780 | |||
| 2778 | /* ... and get the mountpoint */ | 2781 | /* ... and get the mountpoint */ |
| 2779 | retval = user_path(dir_name, &path); | 2782 | retval = user_path(dir_name, &path); |
| 2780 | if (retval) | 2783 | if (retval) |
| @@ -2784,7 +2787,7 @@ long do_mount(const char *dev_name, const char __user *dir_name, | |||
| 2784 | type_page, flags, data_page); | 2787 | type_page, flags, data_page); |
| 2785 | if (!retval && !may_mount()) | 2788 | if (!retval && !may_mount()) |
| 2786 | retval = -EPERM; | 2789 | retval = -EPERM; |
| 2787 | if (!retval && (flags & MS_MANDLOCK) && !may_mandlock()) | 2790 | if (!retval && (flags & SB_MANDLOCK) && !may_mandlock()) |
| 2788 | retval = -EPERM; | 2791 | retval = -EPERM; |
| 2789 | if (retval) | 2792 | if (retval) |
| 2790 | goto dput_out; | 2793 | goto dput_out; |
| @@ -2806,7 +2809,7 @@ long do_mount(const char *dev_name, const char __user *dir_name, | |||
| 2806 | mnt_flags |= MNT_NODIRATIME; | 2809 | mnt_flags |= MNT_NODIRATIME; |
| 2807 | if (flags & MS_STRICTATIME) | 2810 | if (flags & MS_STRICTATIME) |
| 2808 | mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); | 2811 | mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); |
| 2809 | if (flags & MS_RDONLY) | 2812 | if (flags & SB_RDONLY) |
| 2810 | mnt_flags |= MNT_READONLY; | 2813 | mnt_flags |= MNT_READONLY; |
| 2811 | 2814 | ||
| 2812 | /* The default atime for remount is preservation */ | 2815 | /* The default atime for remount is preservation */ |
| @@ -2817,12 +2820,15 @@ long do_mount(const char *dev_name, const char __user *dir_name, | |||
| 2817 | mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK; | 2820 | mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK; |
| 2818 | } | 2821 | } |
| 2819 | 2822 | ||
| 2820 | flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN | | 2823 | sb_flags = flags & (SB_RDONLY | |
| 2821 | MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | | 2824 | SB_SYNCHRONOUS | |
| 2822 | MS_STRICTATIME | MS_NOREMOTELOCK | MS_SUBMOUNT); | 2825 | SB_MANDLOCK | |
| 2826 | SB_DIRSYNC | | ||
| 2827 | SB_SILENT | | ||
| 2828 | SB_POSIXACL); | ||
| 2823 | 2829 | ||
| 2824 | if (flags & MS_REMOUNT) | 2830 | if (flags & MS_REMOUNT) |
| 2825 | retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, | 2831 | retval = do_remount(&path, flags, sb_flags, mnt_flags, |
| 2826 | data_page); | 2832 | data_page); |
| 2827 | else if (flags & MS_BIND) | 2833 | else if (flags & MS_BIND) |
| 2828 | retval = do_loopback(&path, dev_name, flags & MS_REC); | 2834 | retval = do_loopback(&path, dev_name, flags & MS_REC); |
| @@ -2831,7 +2837,7 @@ long do_mount(const char *dev_name, const char __user *dir_name, | |||
| 2831 | else if (flags & MS_MOVE) | 2837 | else if (flags & MS_MOVE) |
| 2832 | retval = do_move_mount(&path, dev_name); | 2838 | retval = do_move_mount(&path, dev_name); |
| 2833 | else | 2839 | else |
| 2834 | retval = do_new_mount(&path, type_page, flags, mnt_flags, | 2840 | retval = do_new_mount(&path, type_page, sb_flags, mnt_flags, |
| 2835 | dev_name, data_page); | 2841 | dev_name, data_page); |
| 2836 | dput_out: | 2842 | dput_out: |
| 2837 | path_put(&path); | 2843 | path_put(&path); |
| @@ -3281,7 +3287,7 @@ void put_mnt_ns(struct mnt_namespace *ns) | |||
| 3281 | struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) | 3287 | struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) |
| 3282 | { | 3288 | { |
| 3283 | struct vfsmount *mnt; | 3289 | struct vfsmount *mnt; |
| 3284 | mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data); | 3290 | mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, data); |
| 3285 | if (!IS_ERR(mnt)) { | 3291 | if (!IS_ERR(mnt)) { |
| 3286 | /* | 3292 | /* |
| 3287 | * it is a longterm mount, don't release mnt until | 3293 | * it is a longterm mount, don't release mnt until |
| @@ -3358,7 +3364,7 @@ static bool mnt_already_visible(struct mnt_namespace *ns, struct vfsmount *new, | |||
| 3358 | mnt_flags = mnt->mnt.mnt_flags; | 3364 | mnt_flags = mnt->mnt.mnt_flags; |
| 3359 | 3365 | ||
| 3360 | /* Don't miss readonly hidden in the superblock flags */ | 3366 | /* Don't miss readonly hidden in the superblock flags */ |
| 3361 | if (mnt->mnt.mnt_sb->s_flags & MS_RDONLY) | 3367 | if (sb_rdonly(mnt->mnt.mnt_sb)) |
| 3362 | mnt_flags |= MNT_LOCK_READONLY; | 3368 | mnt_flags |= MNT_LOCK_READONLY; |
| 3363 | 3369 | ||
| 3364 | /* Verify the mount flags are equal to or more permissive | 3370 | /* Verify the mount flags are equal to or more permissive |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 6b179af59b92..c9d24bae3025 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 3f936be379a9..80733496b22a 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; |
| @@ -2567,9 +2566,7 @@ static int ocfs2_handle_error(struct super_block *sb) | |||
| 2567 | rv = -EIO; | 2566 | rv = -EIO; |
| 2568 | } else { /* default option */ | 2567 | } else { /* default option */ |
| 2569 | rv = -EROFS; | 2568 | rv = -EROFS; |
| 2570 | if (sb->s_flags & MS_RDONLY && | 2569 | if (sb_rdonly(sb) && (ocfs2_is_soft_readonly(osb) || ocfs2_is_hard_readonly(osb))) |
| 2571 | (ocfs2_is_soft_readonly(osb) || | ||
| 2572 | ocfs2_is_hard_readonly(osb))) | ||
| 2573 | return rv; | 2570 | return rv; |
| 2574 | 2571 | ||
| 2575 | pr_crit("OCFS2: File system is now read-only.\n"); | 2572 | pr_crit("OCFS2: File system is now read-only.\n"); |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index cd49c0298ddf..fd5ea4facc62 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
| @@ -870,7 +870,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
| 870 | goto out_free_config; | 870 | goto out_free_config; |
| 871 | 871 | ||
| 872 | /* Upper fs should not be r/o */ | 872 | /* Upper fs should not be r/o */ |
| 873 | if (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY) { | 873 | if (sb_rdonly(upperpath.mnt->mnt_sb)) { |
| 874 | pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); | 874 | pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); |
| 875 | err = -EINVAL; | 875 | err = -EINVAL; |
| 876 | goto out_put_upperpath; | 876 | 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 0c882a0e2a6e..f59c667df15b 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 221cfa1f4e92..166c4ee0d0ed 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -360,7 +360,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock) | |||
| 360 | s->s_count++; | 360 | s->s_count++; |
| 361 | spin_unlock(&sb_lock); | 361 | spin_unlock(&sb_lock); |
| 362 | down_write(&s->s_umount); | 362 | down_write(&s->s_umount); |
| 363 | if ((s->s_flags & MS_BORN) && atomic_inc_not_zero(&s->s_active)) { | 363 | if ((s->s_flags & SB_BORN) && atomic_inc_not_zero(&s->s_active)) { |
| 364 | put_super(s); | 364 | put_super(s); |
| 365 | return 1; | 365 | return 1; |
| 366 | } | 366 | } |
| @@ -390,7 +390,7 @@ bool trylock_super(struct super_block *sb) | |||
| 390 | { | 390 | { |
| 391 | if (down_read_trylock(&sb->s_umount)) { | 391 | if (down_read_trylock(&sb->s_umount)) { |
| 392 | if (!hlist_unhashed(&sb->s_instances) && | 392 | if (!hlist_unhashed(&sb->s_instances) && |
| 393 | sb->s_root && (sb->s_flags & MS_BORN)) | 393 | sb->s_root && (sb->s_flags & SB_BORN)) |
| 394 | return true; | 394 | return true; |
| 395 | up_read(&sb->s_umount); | 395 | up_read(&sb->s_umount); |
| 396 | } | 396 | } |
| @@ -419,7 +419,7 @@ void generic_shutdown_super(struct super_block *sb) | |||
| 419 | if (sb->s_root) { | 419 | if (sb->s_root) { |
| 420 | shrink_dcache_for_umount(sb); | 420 | shrink_dcache_for_umount(sb); |
| 421 | sync_filesystem(sb); | 421 | sync_filesystem(sb); |
| 422 | sb->s_flags &= ~MS_ACTIVE; | 422 | sb->s_flags &= ~SB_ACTIVE; |
| 423 | 423 | ||
| 424 | fsnotify_unmount_inodes(sb); | 424 | fsnotify_unmount_inodes(sb); |
| 425 | cgroup_writeback_umount(); | 425 | cgroup_writeback_umount(); |
| @@ -472,7 +472,7 @@ struct super_block *sget_userns(struct file_system_type *type, | |||
| 472 | struct super_block *old; | 472 | struct super_block *old; |
| 473 | int err; | 473 | int err; |
| 474 | 474 | ||
| 475 | if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && | 475 | if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && |
| 476 | !(type->fs_flags & FS_USERNS_MOUNT) && | 476 | !(type->fs_flags & FS_USERNS_MOUNT) && |
| 477 | !capable(CAP_SYS_ADMIN)) | 477 | !capable(CAP_SYS_ADMIN)) |
| 478 | return ERR_PTR(-EPERM); | 478 | return ERR_PTR(-EPERM); |
| @@ -502,7 +502,7 @@ retry: | |||
| 502 | } | 502 | } |
| 503 | if (!s) { | 503 | if (!s) { |
| 504 | spin_unlock(&sb_lock); | 504 | spin_unlock(&sb_lock); |
| 505 | s = alloc_super(type, (flags & ~MS_SUBMOUNT), user_ns); | 505 | s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns); |
| 506 | if (!s) | 506 | if (!s) |
| 507 | return ERR_PTR(-ENOMEM); | 507 | return ERR_PTR(-ENOMEM); |
| 508 | goto retry; | 508 | goto retry; |
| @@ -547,11 +547,11 @@ struct super_block *sget(struct file_system_type *type, | |||
| 547 | * mount through to here so always use &init_user_ns | 547 | * mount through to here so always use &init_user_ns |
| 548 | * until that changes. | 548 | * until that changes. |
| 549 | */ | 549 | */ |
| 550 | if (flags & MS_SUBMOUNT) | 550 | if (flags & SB_SUBMOUNT) |
| 551 | user_ns = &init_user_ns; | 551 | user_ns = &init_user_ns; |
| 552 | 552 | ||
| 553 | /* Ensure the requestor has permissions over the target filesystem */ | 553 | /* Ensure the requestor has permissions over the target filesystem */ |
| 554 | if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && !ns_capable(user_ns, CAP_SYS_ADMIN)) | 554 | if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && !ns_capable(user_ns, CAP_SYS_ADMIN)) |
| 555 | return ERR_PTR(-EPERM); | 555 | return ERR_PTR(-EPERM); |
| 556 | 556 | ||
| 557 | return sget_userns(type, test, set, flags, user_ns, data); | 557 | return sget_userns(type, test, set, flags, user_ns, data); |
| @@ -594,7 +594,7 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) | |||
| 594 | spin_unlock(&sb_lock); | 594 | spin_unlock(&sb_lock); |
| 595 | 595 | ||
| 596 | down_read(&sb->s_umount); | 596 | down_read(&sb->s_umount); |
| 597 | if (sb->s_root && (sb->s_flags & MS_BORN)) | 597 | if (sb->s_root && (sb->s_flags & SB_BORN)) |
| 598 | f(sb, arg); | 598 | f(sb, arg); |
| 599 | up_read(&sb->s_umount); | 599 | up_read(&sb->s_umount); |
| 600 | 600 | ||
| @@ -628,7 +628,7 @@ void iterate_supers_type(struct file_system_type *type, | |||
| 628 | spin_unlock(&sb_lock); | 628 | spin_unlock(&sb_lock); |
| 629 | 629 | ||
| 630 | down_read(&sb->s_umount); | 630 | down_read(&sb->s_umount); |
| 631 | if (sb->s_root && (sb->s_flags & MS_BORN)) | 631 | if (sb->s_root && (sb->s_flags & SB_BORN)) |
| 632 | f(sb, arg); | 632 | f(sb, arg); |
| 633 | up_read(&sb->s_umount); | 633 | up_read(&sb->s_umount); |
| 634 | 634 | ||
| @@ -664,7 +664,7 @@ rescan: | |||
| 664 | else | 664 | else |
| 665 | down_write(&sb->s_umount); | 665 | down_write(&sb->s_umount); |
| 666 | /* still alive? */ | 666 | /* still alive? */ |
| 667 | if (sb->s_root && (sb->s_flags & MS_BORN)) | 667 | if (sb->s_root && (sb->s_flags & SB_BORN)) |
| 668 | return sb; | 668 | return sb; |
| 669 | if (!excl) | 669 | if (!excl) |
| 670 | up_read(&sb->s_umount); | 670 | up_read(&sb->s_umount); |
| @@ -785,7 +785,7 @@ rescan: | |||
| 785 | spin_unlock(&sb_lock); | 785 | spin_unlock(&sb_lock); |
| 786 | down_read(&sb->s_umount); | 786 | down_read(&sb->s_umount); |
| 787 | /* still alive? */ | 787 | /* still alive? */ |
| 788 | if (sb->s_root && (sb->s_flags & MS_BORN)) | 788 | if (sb->s_root && (sb->s_flags & SB_BORN)) |
| 789 | return sb; | 789 | return sb; |
| 790 | up_read(&sb->s_umount); | 790 | up_read(&sb->s_umount); |
| 791 | /* nope, got unmounted */ | 791 | /* nope, got unmounted */ |
| @@ -801,13 +801,13 @@ rescan: | |||
| 801 | /** | 801 | /** |
| 802 | * do_remount_sb - asks filesystem to change mount options. | 802 | * do_remount_sb - asks filesystem to change mount options. |
| 803 | * @sb: superblock in question | 803 | * @sb: superblock in question |
| 804 | * @flags: numeric part of options | 804 | * @sb_flags: revised superblock flags |
| 805 | * @data: the rest of options | 805 | * @data: the rest of options |
| 806 | * @force: whether or not to force the change | 806 | * @force: whether or not to force the change |
| 807 | * | 807 | * |
| 808 | * Alters the mount options of a mounted file system. | 808 | * Alters the mount options of a mounted file system. |
| 809 | */ | 809 | */ |
| 810 | int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | 810 | int do_remount_sb(struct super_block *sb, int sb_flags, void *data, int force) |
| 811 | { | 811 | { |
| 812 | int retval; | 812 | int retval; |
| 813 | int remount_ro; | 813 | int remount_ro; |
| @@ -816,11 +816,11 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
| 816 | return -EBUSY; | 816 | return -EBUSY; |
| 817 | 817 | ||
| 818 | #ifdef CONFIG_BLOCK | 818 | #ifdef CONFIG_BLOCK |
| 819 | if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) | 819 | if (!(sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev)) |
| 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 = (sb_flags & SB_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 = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); |
| 835 | } | 835 | } |
| 836 | } | 836 | } |
| 837 | shrink_dcache_sb(sb); | 837 | shrink_dcache_sb(sb); |
| @@ -850,7 +850,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
| 850 | } | 850 | } |
| 851 | 851 | ||
| 852 | if (sb->s_op->remount_fs) { | 852 | if (sb->s_op->remount_fs) { |
| 853 | retval = sb->s_op->remount_fs(sb, &flags, data); | 853 | retval = sb->s_op->remount_fs(sb, &sb_flags, data); |
| 854 | if (retval) { | 854 | if (retval) { |
| 855 | if (!force) | 855 | if (!force) |
| 856 | goto cancel_readonly; | 856 | goto cancel_readonly; |
| @@ -859,7 +859,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
| 859 | sb->s_type->name, retval); | 859 | sb->s_type->name, retval); |
| 860 | } | 860 | } |
| 861 | } | 861 | } |
| 862 | sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); | 862 | sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (sb_flags & MS_RMT_MASK); |
| 863 | /* Needs to be ordered wrt mnt_is_readonly() */ | 863 | /* Needs to be ordered wrt mnt_is_readonly() */ |
| 864 | smp_wmb(); | 864 | smp_wmb(); |
| 865 | sb->s_readonly_remount = 0; | 865 | sb->s_readonly_remount = 0; |
| @@ -892,12 +892,12 @@ static void do_emergency_remount(struct work_struct *work) | |||
| 892 | sb->s_count++; | 892 | sb->s_count++; |
| 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 & SB_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 | */ |
| 900 | do_remount_sb(sb, MS_RDONLY, NULL, 1); | 900 | do_remount_sb(sb, SB_RDONLY, NULL, 1); |
| 901 | } | 901 | } |
| 902 | up_write(&sb->s_umount); | 902 | up_write(&sb->s_umount); |
| 903 | spin_lock(&sb_lock); | 903 | spin_lock(&sb_lock); |
| @@ -1023,7 +1023,7 @@ struct dentry *mount_ns(struct file_system_type *fs_type, | |||
| 1023 | /* Don't allow mounting unless the caller has CAP_SYS_ADMIN | 1023 | /* Don't allow mounting unless the caller has CAP_SYS_ADMIN |
| 1024 | * over the namespace. | 1024 | * over the namespace. |
| 1025 | */ | 1025 | */ |
| 1026 | if (!(flags & MS_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) | 1026 | if (!(flags & SB_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) |
| 1027 | return ERR_PTR(-EPERM); | 1027 | return ERR_PTR(-EPERM); |
| 1028 | 1028 | ||
| 1029 | sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, | 1029 | sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, |
| @@ -1033,13 +1033,13 @@ struct dentry *mount_ns(struct file_system_type *fs_type, | |||
| 1033 | 1033 | ||
| 1034 | if (!sb->s_root) { | 1034 | if (!sb->s_root) { |
| 1035 | int err; | 1035 | int err; |
| 1036 | err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 1036 | err = fill_super(sb, data, flags & SB_SILENT ? 1 : 0); |
| 1037 | if (err) { | 1037 | if (err) { |
| 1038 | deactivate_locked_super(sb); | 1038 | deactivate_locked_super(sb); |
| 1039 | return ERR_PTR(err); | 1039 | return ERR_PTR(err); |
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | sb->s_flags |= MS_ACTIVE; | 1042 | sb->s_flags |= SB_ACTIVE; |
| 1043 | } | 1043 | } |
| 1044 | 1044 | ||
| 1045 | return dget(sb->s_root); | 1045 | return dget(sb->s_root); |
| @@ -1071,7 +1071,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
| 1071 | fmode_t mode = FMODE_READ | FMODE_EXCL; | 1071 | fmode_t mode = FMODE_READ | FMODE_EXCL; |
| 1072 | int error = 0; | 1072 | int error = 0; |
| 1073 | 1073 | ||
| 1074 | if (!(flags & MS_RDONLY)) | 1074 | if (!(flags & SB_RDONLY)) |
| 1075 | mode |= FMODE_WRITE; | 1075 | mode |= FMODE_WRITE; |
| 1076 | 1076 | ||
| 1077 | bdev = blkdev_get_by_path(dev_name, mode, fs_type); | 1077 | bdev = blkdev_get_by_path(dev_name, mode, fs_type); |
| @@ -1089,14 +1089,14 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
| 1089 | error = -EBUSY; | 1089 | error = -EBUSY; |
| 1090 | goto error_bdev; | 1090 | goto error_bdev; |
| 1091 | } | 1091 | } |
| 1092 | s = sget(fs_type, test_bdev_super, set_bdev_super, flags | MS_NOSEC, | 1092 | s = sget(fs_type, test_bdev_super, set_bdev_super, flags | SB_NOSEC, |
| 1093 | bdev); | 1093 | bdev); |
| 1094 | mutex_unlock(&bdev->bd_fsfreeze_mutex); | 1094 | mutex_unlock(&bdev->bd_fsfreeze_mutex); |
| 1095 | if (IS_ERR(s)) | 1095 | if (IS_ERR(s)) |
| 1096 | goto error_s; | 1096 | goto error_s; |
| 1097 | 1097 | ||
| 1098 | if (s->s_root) { | 1098 | if (s->s_root) { |
| 1099 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 1099 | if ((flags ^ s->s_flags) & SB_RDONLY) { |
| 1100 | deactivate_locked_super(s); | 1100 | deactivate_locked_super(s); |
| 1101 | error = -EBUSY; | 1101 | error = -EBUSY; |
| 1102 | goto error_bdev; | 1102 | goto error_bdev; |
| @@ -1116,13 +1116,13 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
| 1116 | s->s_mode = mode; | 1116 | s->s_mode = mode; |
| 1117 | snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); | 1117 | snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); |
| 1118 | sb_set_blocksize(s, block_size(bdev)); | 1118 | sb_set_blocksize(s, block_size(bdev)); |
| 1119 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 1119 | error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); |
| 1120 | if (error) { | 1120 | if (error) { |
| 1121 | deactivate_locked_super(s); | 1121 | deactivate_locked_super(s); |
| 1122 | goto error; | 1122 | goto error; |
| 1123 | } | 1123 | } |
| 1124 | 1124 | ||
| 1125 | s->s_flags |= MS_ACTIVE; | 1125 | s->s_flags |= SB_ACTIVE; |
| 1126 | bdev->bd_super = s; | 1126 | bdev->bd_super = s; |
| 1127 | } | 1127 | } |
| 1128 | 1128 | ||
| @@ -1162,12 +1162,12 @@ struct dentry *mount_nodev(struct file_system_type *fs_type, | |||
| 1162 | if (IS_ERR(s)) | 1162 | if (IS_ERR(s)) |
| 1163 | return ERR_CAST(s); | 1163 | return ERR_CAST(s); |
| 1164 | 1164 | ||
| 1165 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 1165 | error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); |
| 1166 | if (error) { | 1166 | if (error) { |
| 1167 | deactivate_locked_super(s); | 1167 | deactivate_locked_super(s); |
| 1168 | return ERR_PTR(error); | 1168 | return ERR_PTR(error); |
| 1169 | } | 1169 | } |
| 1170 | s->s_flags |= MS_ACTIVE; | 1170 | s->s_flags |= SB_ACTIVE; |
| 1171 | return dget(s->s_root); | 1171 | return dget(s->s_root); |
| 1172 | } | 1172 | } |
| 1173 | EXPORT_SYMBOL(mount_nodev); | 1173 | EXPORT_SYMBOL(mount_nodev); |
| @@ -1188,12 +1188,12 @@ struct dentry *mount_single(struct file_system_type *fs_type, | |||
| 1188 | if (IS_ERR(s)) | 1188 | if (IS_ERR(s)) |
| 1189 | return ERR_CAST(s); | 1189 | return ERR_CAST(s); |
| 1190 | if (!s->s_root) { | 1190 | if (!s->s_root) { |
| 1191 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 1191 | error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); |
| 1192 | if (error) { | 1192 | if (error) { |
| 1193 | deactivate_locked_super(s); | 1193 | deactivate_locked_super(s); |
| 1194 | return ERR_PTR(error); | 1194 | return ERR_PTR(error); |
| 1195 | } | 1195 | } |
| 1196 | s->s_flags |= MS_ACTIVE; | 1196 | s->s_flags |= SB_ACTIVE; |
| 1197 | } else { | 1197 | } else { |
| 1198 | do_remount_sb(s, flags, data, 0); | 1198 | do_remount_sb(s, flags, data, 0); |
| 1199 | } | 1199 | } |
| @@ -1227,7 +1227,7 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data) | |||
| 1227 | sb = root->d_sb; | 1227 | sb = root->d_sb; |
| 1228 | BUG_ON(!sb); | 1228 | BUG_ON(!sb); |
| 1229 | WARN_ON(!sb->s_bdi); | 1229 | WARN_ON(!sb->s_bdi); |
| 1230 | sb->s_flags |= MS_BORN; | 1230 | sb->s_flags |= SB_BORN; |
| 1231 | 1231 | ||
| 1232 | error = security_sb_kern_mount(sb, flags, secdata); | 1232 | error = security_sb_kern_mount(sb, flags, secdata); |
| 1233 | if (error) | 1233 | if (error) |
| @@ -1434,12 +1434,12 @@ int freeze_super(struct super_block *sb) | |||
| 1434 | return -EBUSY; | 1434 | return -EBUSY; |
| 1435 | } | 1435 | } |
| 1436 | 1436 | ||
| 1437 | if (!(sb->s_flags & MS_BORN)) { | 1437 | if (!(sb->s_flags & SB_BORN)) { |
| 1438 | up_write(&sb->s_umount); | 1438 | up_write(&sb->s_umount); |
| 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 93c59630512b..99cb81d0077f 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
| @@ -673,7 +673,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) | |||
| 673 | sbi->s_dmode = uopt.dmode; | 673 | sbi->s_dmode = uopt.dmode; |
| 674 | write_unlock(&sbi->s_cred_lock); | 674 | write_unlock(&sbi->s_cred_lock); |
| 675 | 675 | ||
| 676 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 676 | if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) |
| 677 | goto out_unlock; | 677 | goto out_unlock; |
| 678 | 678 | ||
| 679 | if (*flags & MS_RDONLY) | 679 | if (*flags & MS_RDONLY) |
| @@ -1017,7 +1017,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, | |||
| 1017 | 1017 | ||
| 1018 | fe = udf_iget_special(sb, &addr); | 1018 | fe = udf_iget_special(sb, &addr); |
| 1019 | if (IS_ERR(fe)) { | 1019 | if (IS_ERR(fe)) { |
| 1020 | if (sb->s_flags & MS_RDONLY) | 1020 | if (sb_rdonly(sb)) |
| 1021 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); | 1021 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); |
| 1022 | else { | 1022 | else { |
| 1023 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); | 1023 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); |
| @@ -1341,7 +1341,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) | |||
| 1341 | * writing to it (we overwrite blocks instead of relocating | 1341 | * writing to it (we overwrite blocks instead of relocating |
| 1342 | * them). | 1342 | * them). |
| 1343 | */ | 1343 | */ |
| 1344 | if (!(sb->s_flags & MS_RDONLY)) { | 1344 | if (!sb_rdonly(sb)) { |
| 1345 | ret = -EACCES; | 1345 | ret = -EACCES; |
| 1346 | goto out_bh; | 1346 | goto out_bh; |
| 1347 | } | 1347 | } |
| @@ -2205,7 +2205,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 2205 | ret = -EINVAL; | 2205 | ret = -EINVAL; |
| 2206 | goto error_out; | 2206 | goto error_out; |
| 2207 | } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && | 2207 | } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && |
| 2208 | !(sb->s_flags & MS_RDONLY)) { | 2208 | !sb_rdonly(sb)) { |
| 2209 | ret = -EACCES; | 2209 | ret = -EACCES; |
| 2210 | goto error_out; | 2210 | goto error_out; |
| 2211 | } | 2211 | } |
| @@ -2226,7 +2226,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 2226 | 2226 | ||
| 2227 | if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & | 2227 | if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & |
| 2228 | UDF_PART_FLAG_READ_ONLY && | 2228 | UDF_PART_FLAG_READ_ONLY && |
| 2229 | !(sb->s_flags & MS_RDONLY)) { | 2229 | !sb_rdonly(sb)) { |
| 2230 | ret = -EACCES; | 2230 | ret = -EACCES; |
| 2231 | goto error_out; | 2231 | goto error_out; |
| 2232 | } | 2232 | } |
| @@ -2245,7 +2245,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 2245 | le16_to_cpu(ts.year), ts.month, ts.day, | 2245 | le16_to_cpu(ts.year), ts.month, ts.day, |
| 2246 | ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); | 2246 | ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); |
| 2247 | } | 2247 | } |
| 2248 | if (!(sb->s_flags & MS_RDONLY)) { | 2248 | if (!sb_rdonly(sb)) { |
| 2249 | udf_open_lvid(sb); | 2249 | udf_open_lvid(sb); |
| 2250 | lvid_open = true; | 2250 | lvid_open = true; |
| 2251 | } | 2251 | } |
| @@ -2332,7 +2332,7 @@ static void udf_put_super(struct super_block *sb) | |||
| 2332 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) | 2332 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) |
| 2333 | unload_nls(sbi->s_nls_map); | 2333 | unload_nls(sbi->s_nls_map); |
| 2334 | #endif | 2334 | #endif |
| 2335 | if (!(sb->s_flags & MS_RDONLY)) | 2335 | if (!sb_rdonly(sb)) |
| 2336 | udf_close_lvid(sb); | 2336 | udf_close_lvid(sb); |
| 2337 | brelse(sbi->s_lvid_bh); | 2337 | brelse(sbi->s_lvid_bh); |
| 2338 | udf_sb_free_partitions(sb); | 2338 | 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 3008f31753df..c996f4ae4a5f 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; |
