mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-01 00:58:39 +02:00 
			
		
		
		
	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
This commit is contained in:
		
						commit
						0f0d12728e
					
				
					 76 changed files with 314 additions and 296 deletions
				
			
		|  | @ -228,7 +228,7 @@ anything from oops to silent memory corruption. | ||||||
| --- | --- | ||||||
| [mandatory] | [mandatory] | ||||||
| 
 | 
 | ||||||
| 	FS_NOMOUNT is gone.  If you use it - just set MS_NOUSER in flags | 	FS_NOMOUNT is gone.  If you use it - just set SB_NOUSER in flags | ||||||
| (see rootfs for one kind of solution and bdev/socket/pipe for another). | (see rootfs for one kind of solution and bdev/socket/pipe for another). | ||||||
| 
 | 
 | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -210,7 +210,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, | ||||||
| 	data->ocd_ibits_known = MDS_INODELOCK_FULL; | 	data->ocd_ibits_known = MDS_INODELOCK_FULL; | ||||||
| 	data->ocd_version = LUSTRE_VERSION_CODE; | 	data->ocd_version = LUSTRE_VERSION_CODE; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		data->ocd_connect_flags |= OBD_CONNECT_RDONLY; | 		data->ocd_connect_flags |= OBD_CONNECT_RDONLY; | ||||||
| 	if (sbi->ll_flags & LL_SBI_USER_XATTR) | 	if (sbi->ll_flags & LL_SBI_USER_XATTR) | ||||||
| 		data->ocd_connect_flags |= OBD_CONNECT_XATTR; | 		data->ocd_connect_flags |= OBD_CONNECT_XATTR; | ||||||
|  | @ -2031,7 +2031,7 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data) | ||||||
| 	int err; | 	int err; | ||||||
| 	__u32 read_only; | 	__u32 read_only; | ||||||
| 
 | 
 | ||||||
| 	if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 	if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { | ||||||
| 		read_only = *flags & MS_RDONLY; | 		read_only = *flags & MS_RDONLY; | ||||||
| 		err = obd_set_info_async(NULL, sbi->ll_md_exp, | 		err = obd_set_info_async(NULL, sbi->ll_md_exp, | ||||||
| 					 sizeof(KEY_READ_ONLY), | 					 sizeof(KEY_READ_ONLY), | ||||||
|  |  | ||||||
|  | @ -561,8 +561,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && | 	if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && sb_rdonly(dentry->d_sb)) | ||||||
| 	    dentry->d_sb->s_flags & MS_RDONLY) |  | ||||||
| 		return ERR_PTR(-EROFS); | 		return ERR_PTR(-EROFS); | ||||||
| 
 | 
 | ||||||
| 	if (it->it_op & IT_CREAT) | 	if (it->it_op & IT_CREAT) | ||||||
|  |  | ||||||
|  | @ -450,7 +450,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...) | ||||||
| 	vaf.fmt = fmt; | 	vaf.fmt = fmt; | ||||||
| 	vaf.va = &args; | 	vaf.va = &args; | ||||||
| 	pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf); | 	pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf); | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		pr_warn("Remounting filesystem read-only\n"); | 		pr_warn("Remounting filesystem read-only\n"); | ||||||
| 	sb->s_flags |= MS_RDONLY; | 	sb->s_flags |= MS_RDONLY; | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ affs_count_free_blocks(struct super_block *sb) | ||||||
| 
 | 
 | ||||||
| 	pr_debug("%s()\n", __func__); | 	pr_debug("%s()\n", __func__); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	mutex_lock(&AFFS_SB(sb)->s_bmlock); | 	mutex_lock(&AFFS_SB(sb)->s_bmlock); | ||||||
|  |  | ||||||
|  | @ -80,7 +80,7 @@ void affs_mark_sb_dirty(struct super_block *sb) | ||||||
| 	struct affs_sb_info *sbi = AFFS_SB(sb); | 	struct affs_sb_info *sbi = AFFS_SB(sb); | ||||||
| 	unsigned long delay; | 	unsigned long delay; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 	       return; | 	       return; | ||||||
| 
 | 
 | ||||||
| 	spin_lock(&sbi->work_lock); | 	spin_lock(&sbi->work_lock); | ||||||
|  | @ -464,7 +464,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	 * not recommended. | 	 * not recommended. | ||||||
| 	 */ | 	 */ | ||||||
| 	if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS | 	if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS | ||||||
| 	     || chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) { | 	     || chksum == MUFS_DCOFS) && !sb_rdonly(sb)) { | ||||||
| 		pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); | 		pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 	} | 	} | ||||||
|  | @ -596,7 +596,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 	memcpy(sbi->s_volume, volume, 32); | 	memcpy(sbi->s_volume, volume, 32); | ||||||
| 	spin_unlock(&sbi->symlink_lock); | 	spin_unlock(&sbi->symlink_lock); | ||||||
| 
 | 
 | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	if (*flags & MS_RDONLY) | 	if (*flags & MS_RDONLY) | ||||||
|  |  | ||||||
|  | @ -838,7 +838,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 
 | 
 | ||||||
| 	befs_debug(sb, "---> %s", __func__); | 	befs_debug(sb, "---> %s", __func__); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		befs_warning(sb, | 		befs_warning(sb, | ||||||
| 			     "No write support. Marking filesystem read-only"); | 			     "No write support. Marking filesystem read-only"); | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
|  |  | ||||||
|  | @ -704,7 +704,7 @@ static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) | ||||||
| 	u64 result; | 	u64 result; | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	mutex_lock(&dev_replace->lock_finishing_cancel_unmount); | 	mutex_lock(&dev_replace->lock_finishing_cancel_unmount); | ||||||
|  |  | ||||||
|  | @ -2478,7 +2478,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info, | ||||||
| 		return ret; | 		return ret; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(fs_info->sb)) { | ||||||
| 		ret = btrfs_commit_super(fs_info); | 		ret = btrfs_commit_super(fs_info); | ||||||
| 		if (ret) | 		if (ret) | ||||||
| 			return ret; | 			return ret; | ||||||
|  | @ -2876,7 +2876,7 @@ int open_ctree(struct super_block *sb, | ||||||
| 
 | 
 | ||||||
| 	features = btrfs_super_compat_ro_flags(disk_super) & | 	features = btrfs_super_compat_ro_flags(disk_super) & | ||||||
| 		~BTRFS_FEATURE_COMPAT_RO_SUPP; | 		~BTRFS_FEATURE_COMPAT_RO_SUPP; | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && features) { | 	if (!sb_rdonly(sb) && features) { | ||||||
| 		btrfs_err(fs_info, | 		btrfs_err(fs_info, | ||||||
| 	"cannot mount read-write because of unsupported optional features (%llx)", | 	"cannot mount read-write because of unsupported optional features (%llx)", | ||||||
| 		       features); | 		       features); | ||||||
|  | @ -3038,7 +3038,7 @@ int open_ctree(struct super_block *sb, | ||||||
| 		goto fail_sysfs; | 		goto fail_sysfs; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && !btrfs_check_rw_degradable(fs_info)) { | 	if (!sb_rdonly(sb) && !btrfs_check_rw_degradable(fs_info)) { | ||||||
| 		btrfs_warn(fs_info, | 		btrfs_warn(fs_info, | ||||||
| 		"writeable mount is not allowed due to too many missing devices"); | 		"writeable mount is not allowed due to too many missing devices"); | ||||||
| 		goto fail_sysfs; | 		goto fail_sysfs; | ||||||
|  | @ -3097,7 +3097,7 @@ int open_ctree(struct super_block *sb, | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		goto fail_qgroup; | 		goto fail_qgroup; | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		ret = btrfs_cleanup_fs_roots(fs_info); | 		ret = btrfs_cleanup_fs_roots(fs_info); | ||||||
| 		if (ret) | 		if (ret) | ||||||
| 			goto fail_qgroup; | 			goto fail_qgroup; | ||||||
|  | @ -3123,7 +3123,7 @@ int open_ctree(struct super_block *sb, | ||||||
| 		goto fail_qgroup; | 		goto fail_qgroup; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	if (btrfs_test_opt(fs_info, CLEAR_CACHE) && | 	if (btrfs_test_opt(fs_info, CLEAR_CACHE) && | ||||||
|  | @ -3878,7 +3878,7 @@ void close_ctree(struct btrfs_fs_info *fs_info) | ||||||
| 
 | 
 | ||||||
| 	cancel_work_sync(&fs_info->async_reclaim_work); | 	cancel_work_sync(&fs_info->async_reclaim_work); | ||||||
| 
 | 
 | ||||||
| 	if (!(fs_info->sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(fs_info->sb)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * If the cleaner thread is stopped and there are | 		 * If the cleaner thread is stopped and there are | ||||||
| 		 * block groups queued for removal, the deletion will be | 		 * block groups queued for removal, the deletion will be | ||||||
|  |  | ||||||
|  | @ -2060,7 +2060,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, | ||||||
| 	unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); | 	unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); | ||||||
| 	int ret = 0; | 	int ret = 0; | ||||||
| 
 | 
 | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < num_pages; i++) { | 	for (i = 0; i < num_pages; i++) { | ||||||
|  | @ -2110,7 +2110,7 @@ int clean_io_failure(struct btrfs_fs_info *fs_info, | ||||||
| 			failrec->start); | 			failrec->start); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		goto out; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	spin_lock(&io_tree->lock); | 	spin_lock(&io_tree->lock); | ||||||
|  |  | ||||||
|  | @ -5821,7 +5821,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | ||||||
| 
 | 
 | ||||||
| 	if (!IS_ERR(inode) && root != sub_root) { | 	if (!IS_ERR(inode) && root != sub_root) { | ||||||
| 		down_read(&fs_info->cleanup_work_sem); | 		down_read(&fs_info->cleanup_work_sem); | ||||||
| 		if (!(inode->i_sb->s_flags & MS_RDONLY)) | 		if (!sb_rdonly(inode->i_sb)) | ||||||
| 			ret = btrfs_orphan_cleanup(sub_root); | 			ret = btrfs_orphan_cleanup(sub_root); | ||||||
| 		up_read(&fs_info->cleanup_work_sem); | 		up_read(&fs_info->cleanup_work_sem); | ||||||
| 		if (ret) { | 		if (ret) { | ||||||
|  |  | ||||||
|  | @ -4426,7 +4426,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info, | ||||||
| 
 | 
 | ||||||
| 	switch (p->cmd) { | 	switch (p->cmd) { | ||||||
| 	case BTRFS_IOCTL_DEV_REPLACE_CMD_START: | 	case BTRFS_IOCTL_DEV_REPLACE_CMD_START: | ||||||
| 		if (fs_info->sb->s_flags & MS_RDONLY) { | 		if (sb_rdonly(fs_info->sb)) { | ||||||
| 			ret = -EROFS; | 			ret = -EROFS; | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -228,7 +228,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) | ||||||
| 	int ret; | 	int ret; | ||||||
| 	bool can_recover = true; | 	bool can_recover = true; | ||||||
| 
 | 
 | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		can_recover = false; | 		can_recover = false; | ||||||
| 
 | 
 | ||||||
| 	path = btrfs_alloc_path(); | 	path = btrfs_alloc_path(); | ||||||
|  |  | ||||||
|  | @ -103,7 +103,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info) | ||||||
| { | { | ||||||
| 	struct super_block *sb = fs_info->sb; | 	struct super_block *sb = fs_info->sb; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { | 	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 | ||||||
| 	 * Special case: if the error is EROFS, and we're already | 	 * Special case: if the error is EROFS, and we're already | ||||||
| 	 * under MS_RDONLY, then it is safe here. | 	 * under MS_RDONLY, then it is safe here. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) | 	if (errno == -EROFS && sb_rdonly(sb)) | ||||||
|   		return; |   		return; | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_PRINTK | #ifdef CONFIG_PRINTK | ||||||
|  | @ -1701,8 +1701,7 @@ static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, | ||||||
| 	 * close or the filesystem is read only. | 	 * close or the filesystem is read only. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && | 	if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && | ||||||
| 	    (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || | 	    (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { | ||||||
| 	     (fs_info->sb->s_flags & MS_RDONLY))) { |  | ||||||
| 		btrfs_cleanup_defrag_inodes(fs_info); | 		btrfs_cleanup_defrag_inodes(fs_info); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1749,7 +1748,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 	btrfs_resize_thread_pool(fs_info, | 	btrfs_resize_thread_pool(fs_info, | ||||||
| 		fs_info->thread_pool_size, old_thread_pool_size); | 		fs_info->thread_pool_size, old_thread_pool_size); | ||||||
| 
 | 
 | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		goto out; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	if (*flags & MS_RDONLY) { | 	if (*flags & MS_RDONLY) { | ||||||
|  | @ -1850,7 +1849,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 
 | 
 | ||||||
| restore: | restore: | ||||||
| 	/* We've hit an error - don't reset MS_RDONLY */ | 	/* We've hit an error - don't reset MS_RDONLY */ | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		old_flags |= MS_RDONLY; | 		old_flags |= MS_RDONLY; | ||||||
| 	sb->s_flags = old_flags; | 	sb->s_flags = old_flags; | ||||||
| 	fs_info->mount_opt = old_opts; | 	fs_info->mount_opt = old_opts; | ||||||
|  |  | ||||||
|  | @ -120,7 +120,7 @@ static ssize_t btrfs_feature_attr_store(struct kobject *kobj, | ||||||
| 	if (!fs_info) | 	if (!fs_info) | ||||||
| 		return -EPERM; | 		return -EPERM; | ||||||
| 
 | 
 | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	ret = kstrtoul(skip_spaces(buf), 0, &val); | 	ret = kstrtoul(skip_spaces(buf), 0, &val); | ||||||
|  | @ -390,7 +390,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj, | ||||||
| 	if (!fs_info) | 	if (!fs_info) | ||||||
| 		return -EPERM; | 		return -EPERM; | ||||||
| 
 | 
 | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  |  | ||||||
|  | @ -2324,7 +2324,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path | ||||||
| 	int seeding_dev = 0; | 	int seeding_dev = 0; | ||||||
| 	int ret = 0; | 	int ret = 0; | ||||||
| 
 | 
 | ||||||
| 	if ((sb->s_flags & MS_RDONLY) && !fs_info->fs_devices->seeding) | 	if (sb_rdonly(sb) && !fs_info->fs_devices->seeding) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, | 	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) | ||||||
| 
 | 
 | ||||||
| int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) | int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) | ||||||
| { | { | ||||||
| 	if (fs_info->sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(fs_info->sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	mutex_lock(&fs_info->balance_mutex); | 	mutex_lock(&fs_info->balance_mutex); | ||||||
|  |  | ||||||
|  | @ -133,7 +133,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) | ||||||
| 		goto error_unsupported; | 		goto error_unsupported; | ||||||
| 
 | 
 | ||||||
| 	ret = -EROFS; | 	ret = -EROFS; | ||||||
| 	if (root->d_sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(root->d_sb)) | ||||||
| 		goto error_unsupported; | 		goto error_unsupported; | ||||||
| 
 | 
 | ||||||
| 	/* determine the security of the on-disk cache as this governs
 | 	/* determine the security of the on-disk cache as this governs
 | ||||||
|  |  | ||||||
|  | @ -568,8 +568,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | ||||||
| 	 *   1) The lower mount is ro | 	 *   1) The lower mount is ro | ||||||
| 	 *   2) The ecryptfs_encrypted_view mount option is specified | 	 *   2) The ecryptfs_encrypted_view mount option is specified | ||||||
| 	 */ | 	 */ | ||||||
| 	if (path.dentry->d_sb->s_flags & MS_RDONLY || | 	if (sb_rdonly(path.dentry->d_sb) || mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) | ||||||
| 	    mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) |  | ||||||
| 		s->s_flags |= MS_RDONLY; | 		s->s_flags |= MS_RDONLY; | ||||||
| 
 | 
 | ||||||
| 	s->s_maxbytes = path.dentry->d_sb->s_maxbytes; | 	s->s_maxbytes = path.dentry->d_sb->s_maxbytes; | ||||||
|  |  | ||||||
|  | @ -306,7 +306,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) | ||||||
| 	} | 	} | ||||||
| 	brelse(bh); | 	brelse(bh); | ||||||
| 
 | 
 | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
| 		pr_info("forcing read-only mode\n"); | 		pr_info("forcing read-only mode\n"); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -52,7 +52,7 @@ void ext2_error(struct super_block *sb, const char *function, | ||||||
| 	struct ext2_sb_info *sbi = EXT2_SB(sb); | 	struct ext2_sb_info *sbi = EXT2_SB(sb); | ||||||
| 	struct ext2_super_block *es = sbi->s_es; | 	struct ext2_super_block *es = sbi->s_es; | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		spin_lock(&sbi->s_lock); | 		spin_lock(&sbi->s_lock); | ||||||
| 		sbi->s_mount_state |= EXT2_ERROR_FS; | 		sbi->s_mount_state |= EXT2_ERROR_FS; | ||||||
| 		es->s_state |= cpu_to_le16(EXT2_ERROR_FS); | 		es->s_state |= cpu_to_le16(EXT2_ERROR_FS); | ||||||
|  | @ -151,7 +151,7 @@ static void ext2_put_super (struct super_block * sb) | ||||||
| 		ext2_xattr_destroy_cache(sbi->s_ea_block_cache); | 		ext2_xattr_destroy_cache(sbi->s_ea_block_cache); | ||||||
| 		sbi->s_ea_block_cache = NULL; | 		sbi->s_ea_block_cache = NULL; | ||||||
| 	} | 	} | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		struct ext2_super_block *es = sbi->s_es; | 		struct ext2_super_block *es = sbi->s_es; | ||||||
| 
 | 
 | ||||||
| 		spin_lock(&sbi->s_lock); | 		spin_lock(&sbi->s_lock); | ||||||
|  | @ -943,8 +943,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 			le32_to_cpu(features)); | 			le32_to_cpu(features)); | ||||||
| 		goto failed_mount; | 		goto failed_mount; | ||||||
| 	} | 	} | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && | 	if (!sb_rdonly(sb) && (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ | ||||||
| 	    (features = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){ |  | ||||||
| 		ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " | 		ext2_msg(sb, KERN_ERR, "error: couldn't mount RDWR because of " | ||||||
| 		       "unsupported optional features (%x)", | 		       "unsupported optional features (%x)", | ||||||
| 		       le32_to_cpu(features)); | 		       le32_to_cpu(features)); | ||||||
|  | @ -1173,7 +1172,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 	if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | ||||||
| 		ext2_msg(sb, KERN_WARNING, | 		ext2_msg(sb, KERN_WARNING, | ||||||
| 			"warning: mounting ext3 filesystem as ext2"); | 			"warning: mounting ext3 filesystem as ext2"); | ||||||
| 	if (ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY)) | 	if (ext2_setup_super (sb, es, sb_rdonly(sb))) | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 	ext2_write_super(sb); | 	ext2_write_super(sb); | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -1305,7 +1304,7 @@ static int ext2_unfreeze(struct super_block *sb) | ||||||
| 
 | 
 | ||||||
| static void ext2_write_super(struct super_block *sb) | static void ext2_write_super(struct super_block *sb) | ||||||
| { | { | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		ext2_sync_fs(sb, 1); | 		ext2_sync_fs(sb, 1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1343,7 +1342,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | ||||||
| 			 "dax flag with busy inodes while remounting"); | 			 "dax flag with busy inodes while remounting"); | ||||||
| 		sbi->s_mount_opt ^= EXT2_MOUNT_DAX; | 		sbi->s_mount_opt ^= EXT2_MOUNT_DAX; | ||||||
| 	} | 	} | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) { | ||||||
| 		spin_unlock(&sbi->s_lock); | 		spin_unlock(&sbi->s_lock); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ static int ext4_journal_check_start(struct super_block *sb) | ||||||
| 	if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) | 	if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) | ||||||
| 		return -EIO; | 		return -EIO; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE); | 	WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE); | ||||||
| 	journal = EXT4_SB(sb)->s_journal; | 	journal = EXT4_SB(sb)->s_journal; | ||||||
|  |  | ||||||
|  | @ -371,7 +371,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | ||||||
| 		return -EIO; | 		return -EIO; | ||||||
| 
 | 
 | ||||||
| 	if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && | 	if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) && | ||||||
| 		     !(sb->s_flags & MS_RDONLY))) { | 		     !sb_rdonly(sb))) { | ||||||
| 		sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; | 		sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * Sample where the filesystem has been mounted and | 		 * Sample where the filesystem has been mounted and | ||||||
|  |  | ||||||
|  | @ -107,7 +107,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | ||||||
| 
 | 
 | ||||||
| 	trace_ext4_sync_file_enter(file, datasync); | 	trace_ext4_sync_file_enter(file, datasync); | ||||||
| 
 | 
 | ||||||
| 	if (inode->i_sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(inode->i_sb)) { | ||||||
| 		/* Make sure that we read updated s_mount_flags value */ | 		/* Make sure that we read updated s_mount_flags value */ | ||||||
| 		smp_rmb(); | 		smp_rmb(); | ||||||
| 		if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED) | 		if (EXT4_SB(inode->i_sb)->s_mount_flags & EXT4_MF_FS_ABORTED) | ||||||
|  |  | ||||||
|  | @ -1382,7 +1382,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, | ||||||
| 	int num, ret = 0, used_blks = 0; | 	int num, ret = 0, used_blks = 0; | ||||||
| 
 | 
 | ||||||
| 	/* This should not happen, but just to be sure check this */ | 	/* This should not happen, but just to be sure check this */ | ||||||
| 	if (sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(sb)) { | ||||||
| 		ret = 1; | 		ret = 1; | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -185,7 +185,7 @@ static int kmmpd(void *data) | ||||||
| 			goto exit_thread; | 			goto exit_thread; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (sb->s_flags & MS_RDONLY) { | 		if (sb_rdonly(sb)) { | ||||||
| 			ext4_warning(sb, "kmmpd being stopped since filesystem " | 			ext4_warning(sb, "kmmpd being stopped since filesystem " | ||||||
| 				     "has been remounted as readonly."); | 				     "has been remounted as readonly."); | ||||||
| 			goto exit_thread; | 			goto exit_thread; | ||||||
|  |  | ||||||
|  | @ -405,7 +405,7 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn) | ||||||
| 
 | 
 | ||||||
| static void ext4_handle_error(struct super_block *sb) | static void ext4_handle_error(struct super_block *sb) | ||||||
| { | { | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	if (!test_opt(sb, ERRORS_CONT)) { | 	if (!test_opt(sb, ERRORS_CONT)) { | ||||||
|  | @ -587,8 +587,7 @@ void __ext4_std_error(struct super_block *sb, const char *function, | ||||||
| 	/* Special case: if the error is EROFS, and we're not already
 | 	/* Special case: if the error is EROFS, and we're not already
 | ||||||
| 	 * inside a transaction, then there's really no point in logging | 	 * inside a transaction, then there's really no point in logging | ||||||
| 	 * an error. */ | 	 * an error. */ | ||||||
| 	if (errno == -EROFS && journal_current_handle() == NULL && | 	if (errno == -EROFS && journal_current_handle() == NULL && sb_rdonly(sb)) | ||||||
| 	    (sb->s_flags & MS_RDONLY)) |  | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	if (ext4_error_ratelimit(sb)) { | 	if (ext4_error_ratelimit(sb)) { | ||||||
|  | @ -628,7 +627,7 @@ void __ext4_abort(struct super_block *sb, const char *function, | ||||||
| 	       sb->s_id, function, line, &vaf); | 	       sb->s_id, function, line, &vaf); | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
| 
 | 
 | ||||||
| 	if ((sb->s_flags & MS_RDONLY) == 0) { | 	if (sb_rdonly(sb) == 0) { | ||||||
| 		ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); | 		ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); | ||||||
| 		EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; | 		EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; | ||||||
| 		/*
 | 		/*
 | ||||||
|  | @ -889,11 +888,11 @@ static void ext4_put_super(struct super_block *sb) | ||||||
| 	ext4_mb_release(sb); | 	ext4_mb_release(sb); | ||||||
| 	ext4_ext_release(sb); | 	ext4_ext_release(sb); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && !aborted) { | 	if (!sb_rdonly(sb) && !aborted) { | ||||||
| 		ext4_clear_feature_journal_needs_recovery(sb); | 		ext4_clear_feature_journal_needs_recovery(sb); | ||||||
| 		es->s_state = cpu_to_le16(sbi->s_mount_state); | 		es->s_state = cpu_to_le16(sbi->s_mount_state); | ||||||
| 	} | 	} | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		ext4_commit_super(sb, 1); | 		ext4_commit_super(sb, 1); | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < sbi->s_gdb_count; i++) | 	for (i = 0; i < sbi->s_gdb_count; i++) | ||||||
|  | @ -2100,7 +2099,7 @@ int ext4_seq_options_show(struct seq_file *seq, void *offset) | ||||||
| 	struct super_block *sb = seq->private; | 	struct super_block *sb = seq->private; | ||||||
| 	int rc; | 	int rc; | ||||||
| 
 | 
 | ||||||
| 	seq_puts(seq, (sb->s_flags & MS_RDONLY) ? "ro" : "rw"); | 	seq_puts(seq, sb_rdonly(sb) ? "ro" : "rw"); | ||||||
| 	rc = _ext4_show_options(seq, sb, 1); | 	rc = _ext4_show_options(seq, sb, 1); | ||||||
| 	seq_puts(seq, "\n"); | 	seq_puts(seq, "\n"); | ||||||
| 	return rc; | 	return rc; | ||||||
|  | @ -2368,7 +2367,7 @@ static int ext4_check_descriptors(struct super_block *sb, | ||||||
| 				 "Checksum for group %u failed (%u!=%u)", | 				 "Checksum for group %u failed (%u!=%u)", | ||||||
| 				 i, le16_to_cpu(ext4_group_desc_csum(sb, i, | 				 i, le16_to_cpu(ext4_group_desc_csum(sb, i, | ||||||
| 				     gdp)), le16_to_cpu(gdp->bg_checksum)); | 				     gdp)), le16_to_cpu(gdp->bg_checksum)); | ||||||
| 			if (!(sb->s_flags & MS_RDONLY)) { | 			if (!sb_rdonly(sb)) { | ||||||
| 				ext4_unlock_group(sb, i); | 				ext4_unlock_group(sb, i); | ||||||
| 				return 0; | 				return 0; | ||||||
| 			} | 			} | ||||||
|  | @ -3136,8 +3135,7 @@ int ext4_register_li_request(struct super_block *sb, | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (first_not_zeroed == ngroups || | 	if (first_not_zeroed == ngroups || sb_rdonly(sb) || | ||||||
| 	    (sb->s_flags & MS_RDONLY) || |  | ||||||
| 	    !test_opt(sb, INIT_INODE_TABLE)) | 	    !test_opt(sb, INIT_INODE_TABLE)) | ||||||
| 		goto out; | 		goto out; | ||||||
| 
 | 
 | ||||||
|  | @ -3683,7 +3681,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	 * previously didn't change the revision level when setting the flags, | 	 * previously didn't change the revision level when setting the flags, | ||||||
| 	 * so there is a chance incompat flags are set on a rev 0 filesystem. | 	 * so there is a chance incompat flags are set on a rev 0 filesystem. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | 	if (!ext4_feature_set_ok(sb, (sb_rdonly(sb)))) | ||||||
| 		goto failed_mount; | 		goto failed_mount; | ||||||
| 
 | 
 | ||||||
| 	blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | 	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) | ||||||
| 			sbi->s_hash_unsigned = 3; | 			sbi->s_hash_unsigned = 3; | ||||||
| 		else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { | 		else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { | ||||||
| #ifdef __CHAR_UNSIGNED__ | #ifdef __CHAR_UNSIGNED__ | ||||||
| 			if (!(sb->s_flags & MS_RDONLY)) | 			if (!sb_rdonly(sb)) | ||||||
| 				es->s_flags |= | 				es->s_flags |= | ||||||
| 					cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); | 					cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); | ||||||
| 			sbi->s_hash_unsigned = 3; | 			sbi->s_hash_unsigned = 3; | ||||||
| #else | #else | ||||||
| 			if (!(sb->s_flags & MS_RDONLY)) | 			if (!sb_rdonly(sb)) | ||||||
| 				es->s_flags |= | 				es->s_flags |= | ||||||
| 					cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | 					cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | ||||||
| #endif | #endif | ||||||
|  | @ -4017,7 +4015,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	needs_recovery = (es->s_last_orphan != 0 || | 	needs_recovery = (es->s_last_orphan != 0 || | ||||||
| 			  ext4_has_feature_journal_needs_recovery(sb)); | 			  ext4_has_feature_journal_needs_recovery(sb)); | ||||||
| 
 | 
 | ||||||
| 	if (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY)) | 	if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) | ||||||
| 		if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | 		if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | ||||||
| 			goto failed_mount3a; | 			goto failed_mount3a; | ||||||
| 
 | 
 | ||||||
|  | @ -4029,7 +4027,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		err = ext4_load_journal(sb, es, journal_devnum); | 		err = ext4_load_journal(sb, es, journal_devnum); | ||||||
| 		if (err) | 		if (err) | ||||||
| 			goto failed_mount3a; | 			goto failed_mount3a; | ||||||
| 	} else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && | 	} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) && | ||||||
| 		   ext4_has_feature_journal_needs_recovery(sb)) { | 		   ext4_has_feature_journal_needs_recovery(sb)) { | ||||||
| 		ext4_msg(sb, KERN_ERR, "required journal recovery " | 		ext4_msg(sb, KERN_ERR, "required journal recovery " | ||||||
| 		       "suppressed and not mounted read-only"); | 		       "suppressed and not mounted read-only"); | ||||||
|  | @ -4143,7 +4141,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		goto failed_mount_wq; | 		goto failed_mount_wq; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) && | 	if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) && | ||||||
| 	    !ext4_has_feature_encrypt(sb)) { | 	    !ext4_has_feature_encrypt(sb)) { | ||||||
| 		ext4_set_feature_encrypt(sb); | 		ext4_set_feature_encrypt(sb); | ||||||
| 		ext4_commit_super(sb, 1); | 		ext4_commit_super(sb, 1); | ||||||
|  | @ -4197,7 +4195,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		goto failed_mount4; | 		goto failed_mount4; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) | 	if (ext4_setup_super(sb, es, sb_rdonly(sb))) | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 
 | 
 | ||||||
| 	/* determine the minimum size of new large inodes, if present */ | 	/* determine the minimum size of new large inodes, if present */ | ||||||
|  | @ -4285,7 +4283,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_QUOTA | #ifdef CONFIG_QUOTA | ||||||
| 	/* Enable quota usage during mount. */ | 	/* Enable quota usage during mount. */ | ||||||
| 	if (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) { | 	if (ext4_has_feature_quota(sb) && !sb_rdonly(sb)) { | ||||||
| 		err = ext4_enable_quotas(sb); | 		err = ext4_enable_quotas(sb); | ||||||
| 		if (err) | 		if (err) | ||||||
| 			goto failed_mount8; | 			goto failed_mount8; | ||||||
|  | @ -4609,7 +4607,7 @@ static int ext4_load_journal(struct super_block *sb, | ||||||
| 	 * can get read-write access to the device. | 	 * can get read-write access to the device. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (ext4_has_feature_journal_needs_recovery(sb)) { | 	if (ext4_has_feature_journal_needs_recovery(sb)) { | ||||||
| 		if (sb->s_flags & MS_RDONLY) { | 		if (sb_rdonly(sb)) { | ||||||
| 			ext4_msg(sb, KERN_INFO, "INFO: recovery " | 			ext4_msg(sb, KERN_INFO, "INFO: recovery " | ||||||
| 					"required on readonly filesystem"); | 					"required on readonly filesystem"); | ||||||
| 			if (really_read_only) { | 			if (really_read_only) { | ||||||
|  | @ -4764,8 +4762,7 @@ static void ext4_mark_recovery_complete(struct super_block *sb, | ||||||
| 	if (jbd2_journal_flush(journal) < 0) | 	if (jbd2_journal_flush(journal) < 0) | ||||||
| 		goto out; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	if (ext4_has_feature_journal_needs_recovery(sb) && | 	if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { | ||||||
| 	    sb->s_flags & MS_RDONLY) { |  | ||||||
| 		ext4_clear_feature_journal_needs_recovery(sb); | 		ext4_clear_feature_journal_needs_recovery(sb); | ||||||
| 		ext4_commit_super(sb, 1); | 		ext4_commit_super(sb, 1); | ||||||
| 	} | 	} | ||||||
|  | @ -4821,7 +4818,7 @@ int ext4_force_commit(struct super_block *sb) | ||||||
| { | { | ||||||
| 	journal_t *journal; | 	journal_t *journal; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	journal = EXT4_SB(sb)->s_journal; | 	journal = EXT4_SB(sb)->s_journal; | ||||||
|  | @ -4886,7 +4883,7 @@ static int ext4_freeze(struct super_block *sb) | ||||||
| 	int error = 0; | 	int error = 0; | ||||||
| 	journal_t *journal; | 	journal_t *journal; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	journal = EXT4_SB(sb)->s_journal; | 	journal = EXT4_SB(sb)->s_journal; | ||||||
|  | @ -4921,7 +4918,7 @@ static int ext4_freeze(struct super_block *sb) | ||||||
|  */ |  */ | ||||||
| static int ext4_unfreeze(struct super_block *sb) | static int ext4_unfreeze(struct super_block *sb) | ||||||
| { | { | ||||||
| 	if ((sb->s_flags & MS_RDONLY) || ext4_forced_shutdown(EXT4_SB(sb))) | 	if (sb_rdonly(sb) || ext4_forced_shutdown(EXT4_SB(sb))) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	if (EXT4_SB(sb)->s_journal) { | 	if (EXT4_SB(sb)->s_journal) { | ||||||
|  | @ -5059,7 +5056,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 	if (*flags & MS_LAZYTIME) | 	if (*flags & MS_LAZYTIME) | ||||||
| 		sb->s_flags |= MS_LAZYTIME; | 		sb->s_flags |= MS_LAZYTIME; | ||||||
| 
 | 
 | ||||||
| 	if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 	if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { | ||||||
| 		if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { | 		if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { | ||||||
| 			err = -EROFS; | 			err = -EROFS; | ||||||
| 			goto restore_opts; | 			goto restore_opts; | ||||||
|  | @ -5154,7 +5151,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 	 * Reinitialize lazy itable initialization thread based on | 	 * Reinitialize lazy itable initialization thread based on | ||||||
| 	 * current settings | 	 * current settings | ||||||
| 	 */ | 	 */ | ||||||
| 	if ((sb->s_flags & MS_RDONLY) || !test_opt(sb, INIT_INODE_TABLE)) | 	if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE)) | ||||||
| 		ext4_unregister_li_request(sb); | 		ext4_unregister_li_request(sb); | ||||||
| 	else { | 	else { | ||||||
| 		ext4_group_t first_not_zeroed; | 		ext4_group_t first_not_zeroed; | ||||||
|  | @ -5731,7 +5728,7 @@ static inline int ext2_feature_set_ok(struct super_block *sb) | ||||||
| { | { | ||||||
| 	if (ext4_has_unknown_ext2_incompat_features(sb)) | 	if (ext4_has_unknown_ext2_incompat_features(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 1; | 		return 1; | ||||||
| 	if (ext4_has_unknown_ext2_ro_compat_features(sb)) | 	if (ext4_has_unknown_ext2_ro_compat_features(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
|  | @ -5762,7 +5759,7 @@ static inline int ext3_feature_set_ok(struct super_block *sb) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (!ext4_has_feature_journal(sb)) | 	if (!ext4_has_feature_journal(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 1; | 		return 1; | ||||||
| 	if (ext4_has_unknown_ext3_ro_compat_features(sb)) | 	if (ext4_has_unknown_ext3_ro_compat_features(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | @ -309,7 +309,7 @@ static void mark_fsinfo_dirty(struct super_block *sb) | ||||||
| { | { | ||||||
| 	struct msdos_sb_info *sbi = MSDOS_SB(sb); | 	struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY || sbi->fat_bits != 32) | 	if (sb_rdonly(sb) || sbi->fat_bits != 32) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	__mark_inode_dirty(sbi->fsinfo_inode, I_DIRTY_SYNC); | 	__mark_inode_dirty(sbi->fsinfo_inode, I_DIRTY_SYNC); | ||||||
|  |  | ||||||
|  | @ -657,7 +657,7 @@ static void fat_set_state(struct super_block *sb, | ||||||
| 	struct msdos_sb_info *sbi = MSDOS_SB(sb); | 	struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||||||
| 
 | 
 | ||||||
| 	/* do not change any thing if mounted read only */ | 	/* do not change any thing if mounted read only */ | ||||||
| 	if ((sb->s_flags & MS_RDONLY) && !force) | 	if (sb_rdonly(sb) && !force) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	/* do not change state if fs was dirty */ | 	/* do not change state if fs was dirty */ | ||||||
|  | @ -787,7 +787,7 @@ static int fat_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 
 | 
 | ||||||
| 	/* make sure we update state on remount. */ | 	/* make sure we update state on remount. */ | ||||||
| 	new_rdonly = *flags & MS_RDONLY; | 	new_rdonly = *flags & MS_RDONLY; | ||||||
| 	if (new_rdonly != (sb->s_flags & MS_RDONLY)) { | 	if (new_rdonly != sb_rdonly(sb)) { | ||||||
| 		if (new_rdonly) | 		if (new_rdonly) | ||||||
| 			fat_set_state(sb, 0, 0); | 			fat_set_state(sb, 0, 0); | ||||||
| 		else | 		else | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...) | ||||||
| 
 | 
 | ||||||
| 	if (opts->errors == FAT_ERRORS_PANIC) | 	if (opts->errors == FAT_ERRORS_PANIC) | ||||||
| 		panic("FAT-fs (%s): fs panic from previous error\n", sb->s_id); | 		panic("FAT-fs (%s): fs panic from previous error\n", sb->s_id); | ||||||
| 	else if (opts->errors == FAT_ERRORS_RO && !(sb->s_flags & MS_RDONLY)) { | 	else if (opts->errors == FAT_ERRORS_RO && !sb_rdonly(sb)) { | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 		fat_msg(sb, KERN_ERR, "Filesystem has been set read-only"); | 		fat_msg(sb, KERN_ERR, "Filesystem has been set read-only"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -554,7 +554,7 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote) | ||||||
| 	struct gfs2_inode *ip = gl->gl_object; | 	struct gfs2_inode *ip = gl->gl_object; | ||||||
| 	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | 	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | ||||||
| 
 | 
 | ||||||
| 	if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY)) | 	if (!remote || sb_rdonly(sdp->sd_vfs)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	if (gl->gl_demote_state == LM_ST_UNLOCKED && | 	if (gl->gl_demote_state == LM_ST_UNLOCKED && | ||||||
|  |  | ||||||
|  | @ -1037,7 +1037,7 @@ void gfs2_online_uevent(struct gfs2_sbd *sdp) | ||||||
| 	char ro[20]; | 	char ro[20]; | ||||||
| 	char spectator[20]; | 	char spectator[20]; | ||||||
| 	char *envp[] = { ro, spectator, NULL }; | 	char *envp[] = { ro, spectator, NULL }; | ||||||
| 	sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); | 	sprintf(ro, "RDONLY=%d", sb_rdonly(sb)); | ||||||
| 	sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | 	sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | ||||||
| 	kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp); | 	kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp); | ||||||
| } | } | ||||||
|  | @ -1179,7 +1179,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent | ||||||
| 		goto fail_per_node; | 		goto fail_per_node; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		error = gfs2_make_fs_rw(sdp); | 		error = gfs2_make_fs_rw(sdp); | ||||||
| 		if (error) { | 		if (error) { | ||||||
| 			fs_err(sdp, "can't make FS RW: %d\n", error); | 			fs_err(sdp, "can't make FS RW: %d\n", error); | ||||||
|  |  | ||||||
|  | @ -452,7 +452,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp) | ||||||
| 
 | 
 | ||||||
| 	*qdp = NULL; | 	*qdp = NULL; | ||||||
| 
 | 
 | ||||||
| 	if (sdp->sd_vfs->s_flags & MS_RDONLY) | 	if (sb_rdonly(sdp->sd_vfs)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	spin_lock(&qd_lock); | 	spin_lock(&qd_lock); | ||||||
|  |  | ||||||
|  | @ -522,7 +522,7 @@ void gfs2_recover_func(struct work_struct *work) | ||||||
| 			if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) | 			if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) | ||||||
| 				ro = 1; | 				ro = 1; | ||||||
| 		} else { | 		} else { | ||||||
| 			if (sdp->sd_vfs->s_flags & MS_RDONLY) { | 			if (sb_rdonly(sdp->sd_vfs)) { | ||||||
| 				/* check if device itself is read-only */ | 				/* check if device itself is read-only */ | ||||||
| 				ro = bdev_read_only(sdp->sd_vfs->s_bdev); | 				ro = bdev_read_only(sdp->sd_vfs->s_bdev); | ||||||
| 				if (!ro) { | 				if (!ro) { | ||||||
|  |  | ||||||
|  | @ -893,7 +893,7 @@ static void gfs2_put_super(struct super_block *sb) | ||||||
| 	} | 	} | ||||||
| 	spin_unlock(&sdp->sd_jindex_spin); | 	spin_unlock(&sdp->sd_jindex_spin); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		error = gfs2_make_fs_ro(sdp); | 		error = gfs2_make_fs_ro(sdp); | ||||||
| 		if (error) | 		if (error) | ||||||
| 			gfs2_io_error(sdp); | 			gfs2_io_error(sdp); | ||||||
|  | @ -1569,7 +1569,7 @@ static void gfs2_evict_inode(struct inode *inode) | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (inode->i_nlink || (sb->s_flags & MS_RDONLY)) | 	if (inode->i_nlink || sb_rdonly(sb)) | ||||||
| 		goto out; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) { | 	if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) { | ||||||
|  |  | ||||||
|  | @ -645,7 +645,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | ||||||
| 	char *envp[] = { ro, spectator, NULL }; | 	char *envp[] = { ro, spectator, NULL }; | ||||||
| 	int sysfs_frees_sdp = 0; | 	int sysfs_frees_sdp = 0; | ||||||
| 
 | 
 | ||||||
| 	sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); | 	sprintf(ro, "RDONLY=%d", sb_rdonly(sb)); | ||||||
| 	sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | 	sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | ||||||
| 
 | 
 | ||||||
| 	sdp->sd_kobj.kset = gfs2_kset; | 	sdp->sd_kobj.kset = gfs2_kset; | ||||||
|  |  | ||||||
|  | @ -210,7 +210,7 @@ int hfs_mdb_get(struct super_block *sb) | ||||||
| 		pr_warn("filesystem is marked locked, mounting read-only.\n"); | 		pr_warn("filesystem is marked locked, mounting read-only.\n"); | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 	} | 	} | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		/* Mark the volume uncleanly unmounted in case we crash */ | 		/* Mark the volume uncleanly unmounted in case we crash */ | ||||||
| 		attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); | 		attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); | ||||||
| 		attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); | 		attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); | ||||||
|  | @ -259,7 +259,7 @@ void hfs_mdb_commit(struct super_block *sb) | ||||||
| { | { | ||||||
| 	struct hfs_mdb *mdb = HFS_SB(sb)->mdb; | 	struct hfs_mdb *mdb = HFS_SB(sb)->mdb; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	lock_buffer(HFS_SB(sb)->mdb_bh); | 	lock_buffer(HFS_SB(sb)->mdb_bh); | ||||||
|  | @ -334,7 +334,7 @@ void hfs_mdb_commit(struct super_block *sb) | ||||||
| void hfs_mdb_close(struct super_block *sb) | void hfs_mdb_close(struct super_block *sb) | ||||||
| { | { | ||||||
| 	/* update volume attributes */ | 	/* update volume attributes */ | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 	HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); | 	HFS_SB(sb)->mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); | ||||||
| 	HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); | 	HFS_SB(sb)->mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); | ||||||
|  |  | ||||||
|  | @ -71,7 +71,7 @@ void hfs_mark_mdb_dirty(struct super_block *sb) | ||||||
| 	struct hfs_sb_info *sbi = HFS_SB(sb); | 	struct hfs_sb_info *sbi = HFS_SB(sb); | ||||||
| 	unsigned long delay; | 	unsigned long delay; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	spin_lock(&sbi->work_lock); | 	spin_lock(&sbi->work_lock); | ||||||
|  | @ -115,7 +115,7 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| { | { | ||||||
| 	sync_filesystem(sb); | 	sync_filesystem(sb); | ||||||
| 	*flags |= MS_NODIRATIME; | 	*flags |= MS_NODIRATIME; | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (!(*flags & MS_RDONLY)) { | 	if (!(*flags & MS_RDONLY)) { | ||||||
| 		if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { | 		if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { | ||||||
|  |  | ||||||
|  | @ -264,7 +264,7 @@ void hfsplus_mark_mdb_dirty(struct super_block *sb) | ||||||
| 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||||||
| 	unsigned long delay; | 	unsigned long delay; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	spin_lock(&sbi->work_lock); | 	spin_lock(&sbi->work_lock); | ||||||
|  | @ -284,7 +284,7 @@ static void hfsplus_put_super(struct super_block *sb) | ||||||
| 
 | 
 | ||||||
| 	cancel_delayed_work_sync(&sbi->sync_work); | 	cancel_delayed_work_sync(&sbi->sync_work); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && sbi->s_vhdr) { | 	if (!sb_rdonly(sb) && sbi->s_vhdr) { | ||||||
| 		struct hfsplus_vh *vhdr = sbi->s_vhdr; | 		struct hfsplus_vh *vhdr = sbi->s_vhdr; | ||||||
| 
 | 
 | ||||||
| 		vhdr->modify_date = hfsp_now2mt(); | 		vhdr->modify_date = hfsp_now2mt(); | ||||||
|  | @ -329,7 +329,7 @@ static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) | ||||||
| static int hfsplus_remount(struct super_block *sb, int *flags, char *data) | static int hfsplus_remount(struct super_block *sb, int *flags, char *data) | ||||||
| { | { | ||||||
| 	sync_filesystem(sb); | 	sync_filesystem(sb); | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (!(*flags & MS_RDONLY)) { | 	if (!(*flags & MS_RDONLY)) { | ||||||
| 		struct hfsplus_vh *vhdr = HFSPLUS_SB(sb)->s_vhdr; | 		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) | ||||||
| 		pr_warn("Filesystem is marked locked, mounting read-only.\n"); | 		pr_warn("Filesystem is marked locked, mounting read-only.\n"); | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 	} else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && | 	} else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && | ||||||
| 			!(sb->s_flags & MS_RDONLY)) { | 			!sb_rdonly(sb)) { | ||||||
| 		pr_warn("write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.\n"); | 		pr_warn("write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.\n"); | ||||||
| 		sb->s_flags |= MS_RDONLY; | 		sb->s_flags |= MS_RDONLY; | ||||||
| 	} | 	} | ||||||
|  | @ -535,7 +535,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	} else | 	} else | ||||||
| 		hfs_find_exit(&fd); | 		hfs_find_exit(&fd); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * H+LX == hfsplusutils, H+Lx == this driver, H+lx is unused | 		 * H+LX == hfsplusutils, H+Lx == this driver, H+lx is unused | ||||||
| 		 * all three are registered with Apple for our use | 		 * all three are registered with Apple for our use | ||||||
|  |  | ||||||
|  | @ -538,7 +538,7 @@ int hpfs_trim_fs(struct super_block *s, u64 start, u64 end, u64 minlen, unsigned | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (start < sbi->sb_dirband_start + sbi->sb_dirband_size && end > sbi->sb_dirband_start) { | 	if (start < sbi->sb_dirband_start + sbi->sb_dirband_size && end > sbi->sb_dirband_start) { | ||||||
| 		hpfs_lock(s); | 		hpfs_lock(s); | ||||||
| 		if (s->s_flags & MS_RDONLY) { | 		if (sb_rdonly(s)) { | ||||||
| 			err = -EROFS; | 			err = -EROFS; | ||||||
| 			goto unlock_1; | 			goto unlock_1; | ||||||
| 		} | 		} | ||||||
|  | @ -559,7 +559,7 @@ int hpfs_trim_fs(struct super_block *s, u64 start, u64 end, u64 minlen, unsigned | ||||||
| 	end_bmp = (end + 0x3fff) >> 14; | 	end_bmp = (end + 0x3fff) >> 14; | ||||||
| 	while (start_bmp < end_bmp && !err) { | 	while (start_bmp < end_bmp && !err) { | ||||||
| 		hpfs_lock(s); | 		hpfs_lock(s); | ||||||
| 		if (s->s_flags & MS_RDONLY) { | 		if (sb_rdonly(s)) { | ||||||
| 			err = -EROFS; | 			err = -EROFS; | ||||||
| 			goto unlock_2; | 			goto unlock_2; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -264,7 +264,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in | ||||||
| 	hpfs_result = hpfs_i(result); | 	hpfs_result = hpfs_i(result); | ||||||
| 	if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; | 	if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; | ||||||
| 
 | 
 | ||||||
| 	if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { | 	if (de->has_acl || de->has_xtd_perm) if (!sb_rdonly(dir->i_sb)) { | ||||||
| 		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"); | 		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"); | ||||||
| 		goto bail1; | 		goto bail1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
| 
 | 
 | ||||||
| static void mark_dirty(struct super_block *s, int remount) | static void mark_dirty(struct super_block *s, int remount) | ||||||
| { | { | ||||||
| 	if (hpfs_sb(s)->sb_chkdsk && (remount || !(s->s_flags & MS_RDONLY))) { | 	if (hpfs_sb(s)->sb_chkdsk && (remount || !sb_rdonly(s))) { | ||||||
| 		struct buffer_head *bh; | 		struct buffer_head *bh; | ||||||
| 		struct hpfs_spare_block *sb; | 		struct hpfs_spare_block *sb; | ||||||
| 		if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | 		if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | ||||||
|  | @ -41,7 +41,7 @@ static void unmark_dirty(struct super_block *s) | ||||||
| { | { | ||||||
| 	struct buffer_head *bh; | 	struct buffer_head *bh; | ||||||
| 	struct hpfs_spare_block *sb; | 	struct hpfs_spare_block *sb; | ||||||
| 	if (s->s_flags & MS_RDONLY) return; | 	if (sb_rdonly(s)) return; | ||||||
| 	sync_blockdev(s->s_bdev); | 	sync_blockdev(s->s_bdev); | ||||||
| 	if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | 	if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | ||||||
| 		sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; | 		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, ...) | ||||||
| 			mark_dirty(s, 0); | 			mark_dirty(s, 0); | ||||||
| 			panic("HPFS panic"); | 			panic("HPFS panic"); | ||||||
| 		} else if (hpfs_sb(s)->sb_err == 1) { | 		} else if (hpfs_sb(s)->sb_err == 1) { | ||||||
| 			if (s->s_flags & MS_RDONLY) | 			if (sb_rdonly(s)) | ||||||
| 				pr_cont("; already mounted read-only\n"); | 				pr_cont("; already mounted read-only\n"); | ||||||
| 			else { | 			else { | ||||||
| 				pr_cont("; remounting read-only\n"); | 				pr_cont("; remounting read-only\n"); | ||||||
| 				mark_dirty(s, 0); | 				mark_dirty(s, 0); | ||||||
| 				s->s_flags |= MS_RDONLY; | 				s->s_flags |= MS_RDONLY; | ||||||
| 			} | 			} | ||||||
| 		} else if (s->s_flags & MS_RDONLY) | 		} else if (sb_rdonly(s)) | ||||||
| 				pr_cont("; going on - but anything won't be destroyed because it's read-only\n"); | 				pr_cont("; going on - but anything won't be destroyed because it's read-only\n"); | ||||||
| 		else | 		else | ||||||
| 			pr_cont("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); | 			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) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Check version */ | 	/* Check version */ | ||||||
| 	if (!(s->s_flags & MS_RDONLY) && | 	if (!sb_rdonly(s) && superblock->funcversion != 2 && superblock->funcversion != 3) { | ||||||
| 	      superblock->funcversion != 2 && superblock->funcversion != 3) { |  | ||||||
| 		pr_err("Bad version %d,%d. Mount readonly to go around\n", | 		pr_err("Bad version %d,%d. Mount readonly to go around\n", | ||||||
| 			(int)superblock->version, (int)superblock->funcversion); | 			(int)superblock->version, (int)superblock->funcversion); | ||||||
| 		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"); | 		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) | ||||||
| 		hpfs_error(s, "improperly stopped"); | 		hpfs_error(s, "improperly stopped"); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| 		spareblock->dirty = 1; | 		spareblock->dirty = 1; | ||||||
| 		spareblock->old_wrote = 0; | 		spareblock->old_wrote = 0; | ||||||
| 		mark_buffer_dirty(bh2); | 		mark_buffer_dirty(bh2); | ||||||
|  |  | ||||||
|  | @ -737,7 +737,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | ||||||
| 
 | 
 | ||||||
| root_found: | root_found: | ||||||
| 	/* We don't support read-write mounts */ | 	/* We don't support read-write mounts */ | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| 		error = -EACCES; | 		error = -EACCES; | ||||||
| 		goto out_freebh; | 		goto out_freebh; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -395,14 +395,14 @@ int jffs2_do_remount_fs(struct super_block *sb, int *flags, char *data) | ||||||
| { | { | ||||||
| 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | ||||||
| 
 | 
 | ||||||
| 	if (c->flags & JFFS2_SB_FLAG_RO && !(sb->s_flags & MS_RDONLY)) | 	if (c->flags & JFFS2_SB_FLAG_RO && !sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	/* We stop if it was running, then restart if it needs to.
 | 	/* We stop if it was running, then restart if it needs to.
 | ||||||
| 	   This also catches the case where it was stopped and this | 	   This also catches the case where it was stopped and this | ||||||
| 	   is just a remount to restart it. | 	   is just a remount to restart it. | ||||||
| 	   Flush the writebuffer, if neccecary, else we loose it */ | 	   Flush the writebuffer, if neccecary, else we loose it */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		jffs2_stop_garbage_collect_thread(c); | 		jffs2_stop_garbage_collect_thread(c); | ||||||
| 		mutex_lock(&c->alloc_sem); | 		mutex_lock(&c->alloc_sem); | ||||||
| 		jffs2_flush_wbuf_pad(c); | 		jffs2_flush_wbuf_pad(c); | ||||||
|  | @ -590,7 +590,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	sb->s_blocksize = PAGE_SIZE; | 	sb->s_blocksize = PAGE_SIZE; | ||||||
| 	sb->s_blocksize_bits = PAGE_SHIFT; | 	sb->s_blocksize_bits = PAGE_SHIFT; | ||||||
| 	sb->s_magic = JFFS2_SUPER_MAGIC; | 	sb->s_magic = JFFS2_SUPER_MAGIC; | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		jffs2_start_garbage_collect_thread(c); | 		jffs2_start_garbage_collect_thread(c); | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -342,7 +342,7 @@ static void jffs2_put_super (struct super_block *sb) | ||||||
| static void jffs2_kill_sb(struct super_block *sb) | static void jffs2_kill_sb(struct super_block *sb) | ||||||
| { | { | ||||||
| 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		jffs2_stop_garbage_collect_thread(c); | 		jffs2_stop_garbage_collect_thread(c); | ||||||
| 	kill_mtd_super(sb); | 	kill_mtd_super(sb); | ||||||
| 	kfree(c); | 	kfree(c); | ||||||
|  |  | ||||||
|  | @ -1162,7 +1162,7 @@ static void delayed_wbuf_sync(struct work_struct *work) | ||||||
| 	struct jffs2_sb_info *c = work_to_sb(work); | 	struct jffs2_sb_info *c = work_to_sb(work); | ||||||
| 	struct super_block *sb = OFNI_BS_2SFFJ(c); | 	struct super_block *sb = OFNI_BS_2SFFJ(c); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		jffs2_dbg(1, "%s()\n", __func__); | 		jffs2_dbg(1, "%s()\n", __func__); | ||||||
| 		jffs2_flush_wbuf_gc(c, 0); | 		jffs2_flush_wbuf_gc(c, 0); | ||||||
| 	} | 	} | ||||||
|  | @ -1173,7 +1173,7 @@ void jffs2_dirty_trigger(struct jffs2_sb_info *c) | ||||||
| 	struct super_block *sb = OFNI_BS_2SFFJ(c); | 	struct super_block *sb = OFNI_BS_2SFFJ(c); | ||||||
| 	unsigned long delay; | 	unsigned long delay; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	delay = msecs_to_jiffies(dirty_writeback_interval * 10); | 	delay = msecs_to_jiffies(dirty_writeback_interval * 10); | ||||||
|  |  | ||||||
|  | @ -362,7 +362,7 @@ static int chkSuper(struct super_block *sb) | ||||||
| 
 | 
 | ||||||
| 	/* validate fs state */ | 	/* validate fs state */ | ||||||
| 	if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && | 	if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && | ||||||
| 	    !(sb->s_flags & MS_RDONLY)) { | 	    !sb_rdonly(sb)) { | ||||||
| 		jfs_err("jfs_mount: Mount Failure: File System Dirty."); | 		jfs_err("jfs_mount: Mount Failure: File System Dirty."); | ||||||
| 		rc = -EINVAL; | 		rc = -EINVAL; | ||||||
| 		goto out; | 		goto out; | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ static void jfs_handle_error(struct super_block *sb) | ||||||
| { | { | ||||||
| 	struct jfs_sb_info *sbi = JFS_SBI(sb); | 	struct jfs_sb_info *sbi = JFS_SBI(sb); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	updateSuper(sb, FM_DIRTY); | 	updateSuper(sb, FM_DIRTY); | ||||||
|  | @ -468,7 +468,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
| 	if (newLVSize) { | 	if (newLVSize) { | ||||||
| 		if (sb->s_flags & MS_RDONLY) { | 		if (sb_rdonly(sb)) { | ||||||
| 			pr_err("JFS: resize requires volume to be mounted read-write\n"); | 			pr_err("JFS: resize requires volume to be mounted read-write\n"); | ||||||
| 			return -EROFS; | 			return -EROFS; | ||||||
| 		} | 		} | ||||||
|  | @ -477,7 +477,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 			return rc; | 			return rc; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 	if (sb_rdonly(sb) && !(*flags & MS_RDONLY)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * Invalidate any previously read metadata.  fsck may have | 		 * Invalidate any previously read metadata.  fsck may have | ||||||
| 		 * changed the on-disk data since we mounted r/o | 		 * 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) | ||||||
| 		dquot_resume(sb, -1); | 		dquot_resume(sb, -1); | ||||||
| 		return ret; | 		return ret; | ||||||
| 	} | 	} | ||||||
| 	if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb) && (*flags & MS_RDONLY)) { | ||||||
| 		rc = dquot_suspend(sb, -1); | 		rc = dquot_suspend(sb, -1); | ||||||
| 		if (rc < 0) | 		if (rc < 0) | ||||||
| 			return rc; | 			return rc; | ||||||
|  | @ -502,7 +502,7 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 		return rc; | 		return rc; | ||||||
| 	} | 	} | ||||||
| 	if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) | 	if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY)) | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			rc = jfs_umount_rw(sb); | 			rc = jfs_umount_rw(sb); | ||||||
| 			if (rc) | 			if (rc) | ||||||
| 				return rc; | 				return rc; | ||||||
|  | @ -592,7 +592,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 			jfs_err("jfs_mount failed w/return code = %d", rc); | 			jfs_err("jfs_mount failed w/return code = %d", rc); | ||||||
| 		goto out_mount_failed; | 		goto out_mount_failed; | ||||||
| 	} | 	} | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		sbi->log = NULL; | 		sbi->log = NULL; | ||||||
| 	else { | 	else { | ||||||
| 		rc = jfs_mount_rw(sb, 0); | 		rc = jfs_mount_rw(sb, 0); | ||||||
|  | @ -652,7 +652,7 @@ static int jfs_freeze(struct super_block *sb) | ||||||
| 	struct jfs_log *log = sbi->log; | 	struct jfs_log *log = sbi->log; | ||||||
| 	int rc = 0; | 	int rc = 0; | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		txQuiesce(sb); | 		txQuiesce(sb); | ||||||
| 		rc = lmLogShutdown(log); | 		rc = lmLogShutdown(log); | ||||||
| 		if (rc) { | 		if (rc) { | ||||||
|  | @ -682,7 +682,7 @@ static int jfs_unfreeze(struct super_block *sb) | ||||||
| 	struct jfs_log *log = sbi->log; | 	struct jfs_log *log = sbi->log; | ||||||
| 	int rc = 0; | 	int rc = 0; | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		rc = updateSuper(sb, FM_MOUNT); | 		rc = updateSuper(sb, FM_MOUNT); | ||||||
| 		if (rc) { | 		if (rc) { | ||||||
| 			jfs_error(sb, "updateSuper failed\n"); | 			jfs_error(sb, "updateSuper failed\n"); | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ static void minix_put_super(struct super_block *sb) | ||||||
| 	int i; | 	int i; | ||||||
| 	struct minix_sb_info *sbi = minix_sb(sb); | 	struct minix_sb_info *sbi = minix_sb(sb); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		if (sbi->s_version != MINIX_V3)	 /* s_state is now out from V3 sb */ | 		if (sbi->s_version != MINIX_V3)	 /* s_state is now out from V3 sb */ | ||||||
| 			sbi->s_ms->s_state = sbi->s_mount_state; | 			sbi->s_ms->s_state = sbi->s_mount_state; | ||||||
| 		mark_buffer_dirty(sbi->s_sbh); | 		mark_buffer_dirty(sbi->s_sbh); | ||||||
|  | @ -125,7 +125,7 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) | ||||||
| 
 | 
 | ||||||
| 	sync_filesystem(sb); | 	sync_filesystem(sb); | ||||||
| 	ms = sbi->s_ms; | 	ms = sbi->s_ms; | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if (*flags & MS_RDONLY) { | 	if (*flags & MS_RDONLY) { | ||||||
| 		if (ms->s_state & MINIX_VALID_FS || | 		if (ms->s_state & MINIX_VALID_FS || | ||||||
|  | @ -293,7 +293,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | ||||||
| 	if (!s->s_root) | 	if (!s->s_root) | ||||||
| 		goto out_no_root; | 		goto out_no_root; | ||||||
| 
 | 
 | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| 		if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | 		if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ | ||||||
| 			ms->s_state &= ~MINIX_VALID_FS; | 			ms->s_state &= ~MINIX_VALID_FS; | ||||||
| 		mark_buffer_dirty(bh); | 		mark_buffer_dirty(bh); | ||||||
|  |  | ||||||
|  | @ -447,8 +447,7 @@ static int sb_permission(struct super_block *sb, struct inode *inode, int mask) | ||||||
| 		umode_t mode = inode->i_mode; | 		umode_t mode = inode->i_mode; | ||||||
| 
 | 
 | ||||||
| 		/* Nobody gets write access to a read-only fs. */ | 		/* Nobody gets write access to a read-only fs. */ | ||||||
| 		if ((sb->s_flags & MS_RDONLY) && | 		if (sb_rdonly(sb) && (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) | ||||||
| 		    (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) |  | ||||||
| 			return -EROFS; | 			return -EROFS; | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
|  |  | ||||||
|  | @ -275,7 +275,7 @@ int __mnt_is_readonly(struct vfsmount *mnt) | ||||||
| { | { | ||||||
| 	if (mnt->mnt_flags & MNT_READONLY) | 	if (mnt->mnt_flags & MNT_READONLY) | ||||||
| 		return 1; | 		return 1; | ||||||
| 	if (mnt->mnt_sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(mnt->mnt_sb)) | ||||||
| 		return 1; | 		return 1; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -1029,7 +1029,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | ||||||
| 	if (!mnt) | 	if (!mnt) | ||||||
| 		return ERR_PTR(-ENOMEM); | 		return ERR_PTR(-ENOMEM); | ||||||
| 
 | 
 | ||||||
| 	if (flags & MS_KERNMOUNT) | 	if (flags & SB_KERNMOUNT) | ||||||
| 		mnt->mnt.mnt_flags = MNT_INTERNAL; | 		mnt->mnt.mnt_flags = MNT_INTERNAL; | ||||||
| 
 | 
 | ||||||
| 	root = mount_fs(type, flags, name, data); | 	root = mount_fs(type, flags, name, data); | ||||||
|  | @ -1061,7 +1061,7 @@ vfs_submount(const struct dentry *mountpoint, struct file_system_type *type, | ||||||
| 	if (mountpoint->d_sb->s_user_ns != &init_user_ns) | 	if (mountpoint->d_sb->s_user_ns != &init_user_ns) | ||||||
| 		return ERR_PTR(-EPERM); | 		return ERR_PTR(-EPERM); | ||||||
| 
 | 
 | ||||||
| 	return vfs_kern_mount(type, MS_SUBMOUNT, name, data); | 	return vfs_kern_mount(type, SB_SUBMOUNT, name, data); | ||||||
| } | } | ||||||
| EXPORT_SYMBOL_GPL(vfs_submount); | EXPORT_SYMBOL_GPL(vfs_submount); | ||||||
| 
 | 
 | ||||||
|  | @ -1592,8 +1592,8 @@ static int do_umount(struct mount *mnt, int flags) | ||||||
| 		if (!capable(CAP_SYS_ADMIN)) | 		if (!capable(CAP_SYS_ADMIN)) | ||||||
| 			return -EPERM; | 			return -EPERM; | ||||||
| 		down_write(&sb->s_umount); | 		down_write(&sb->s_umount); | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) | 		if (!sb_rdonly(sb)) | ||||||
| 			retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); | 			retval = do_remount_sb(sb, SB_RDONLY, NULL, 0); | ||||||
| 		up_write(&sb->s_umount); | 		up_write(&sb->s_umount); | ||||||
| 		return retval; | 		return retval; | ||||||
| 	} | 	} | ||||||
|  | @ -2117,7 +2117,7 @@ static void unlock_mount(struct mountpoint *where) | ||||||
| 
 | 
 | ||||||
| static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) | ||||||
| { | { | ||||||
| 	if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER) | 	if (mnt->mnt.mnt_sb->s_flags & SB_NOUSER) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
| 	if (d_is_dir(mp->m_dentry) != | 	if (d_is_dir(mp->m_dentry) != | ||||||
|  | @ -2131,9 +2131,9 @@ static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) | ||||||
|  * Sanity check the flags to change_mnt_propagation. |  * Sanity check the flags to change_mnt_propagation. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| static int flags_to_propagation_type(int flags) | static int flags_to_propagation_type(int ms_flags) | ||||||
| { | { | ||||||
| 	int type = flags & ~(MS_REC | MS_SILENT); | 	int type = ms_flags & ~(MS_REC | MS_SILENT); | ||||||
| 
 | 
 | ||||||
| 	/* Fail if any non-propagation flags are set */ | 	/* Fail if any non-propagation flags are set */ | ||||||
| 	if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) | 	if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) | ||||||
|  | @ -2147,18 +2147,18 @@ static int flags_to_propagation_type(int flags) | ||||||
| /*
 | /*
 | ||||||
|  * recursively change the type of the mountpoint. |  * recursively change the type of the mountpoint. | ||||||
|  */ |  */ | ||||||
| static int do_change_type(struct path *path, int flag) | static int do_change_type(struct path *path, int ms_flags) | ||||||
| { | { | ||||||
| 	struct mount *m; | 	struct mount *m; | ||||||
| 	struct mount *mnt = real_mount(path->mnt); | 	struct mount *mnt = real_mount(path->mnt); | ||||||
| 	int recurse = flag & MS_REC; | 	int recurse = ms_flags & MS_REC; | ||||||
| 	int type; | 	int type; | ||||||
| 	int err = 0; | 	int err = 0; | ||||||
| 
 | 
 | ||||||
| 	if (path->dentry != path->mnt->mnt_root) | 	if (path->dentry != path->mnt->mnt_root) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
| 	type = flags_to_propagation_type(flag); | 	type = flags_to_propagation_type(ms_flags); | ||||||
| 	if (!type) | 	if (!type) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
|  | @ -2280,8 +2280,8 @@ static int change_mount_flags(struct vfsmount *mnt, int ms_flags) | ||||||
|  * If you've mounted a non-root directory somewhere and want to do remount |  * If you've mounted a non-root directory somewhere and want to do remount | ||||||
|  * on it - tough luck. |  * on it - tough luck. | ||||||
|  */ |  */ | ||||||
| static int do_remount(struct path *path, int flags, int mnt_flags, | static int do_remount(struct path *path, int ms_flags, int sb_flags, | ||||||
| 		      void *data) | 		      int mnt_flags, void *data) | ||||||
| { | { | ||||||
| 	int err; | 	int err; | ||||||
| 	struct super_block *sb = path->mnt->mnt_sb; | 	struct super_block *sb = path->mnt->mnt_sb; | ||||||
|  | @ -2325,12 +2325,12 @@ static int do_remount(struct path *path, int flags, int mnt_flags, | ||||||
| 		return err; | 		return err; | ||||||
| 
 | 
 | ||||||
| 	down_write(&sb->s_umount); | 	down_write(&sb->s_umount); | ||||||
| 	if (flags & MS_BIND) | 	if (ms_flags & MS_BIND) | ||||||
| 		err = change_mount_flags(path->mnt, flags); | 		err = change_mount_flags(path->mnt, ms_flags); | ||||||
| 	else if (!capable(CAP_SYS_ADMIN)) | 	else if (!capable(CAP_SYS_ADMIN)) | ||||||
| 		err = -EPERM; | 		err = -EPERM; | ||||||
| 	else | 	else | ||||||
| 		err = do_remount_sb(sb, flags, data, 0); | 		err = do_remount_sb(sb, sb_flags, data, 0); | ||||||
| 	if (!err) { | 	if (!err) { | ||||||
| 		lock_mount_hash(); | 		lock_mount_hash(); | ||||||
| 		mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK; | 		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); | ||||||
|  * create a new mount for userspace and request it to be added into the |  * create a new mount for userspace and request it to be added into the | ||||||
|  * namespace's tree |  * namespace's tree | ||||||
|  */ |  */ | ||||||
| static int do_new_mount(struct path *path, const char *fstype, int flags, | static int do_new_mount(struct path *path, const char *fstype, int sb_flags, | ||||||
| 			int mnt_flags, const char *name, void *data) | 			int mnt_flags, const char *name, void *data) | ||||||
| { | { | ||||||
| 	struct file_system_type *type; | 	struct file_system_type *type; | ||||||
|  | @ -2509,7 +2509,7 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, | ||||||
| 	if (!type) | 	if (!type) | ||||||
| 		return -ENODEV; | 		return -ENODEV; | ||||||
| 
 | 
 | ||||||
| 	mnt = vfs_kern_mount(type, flags, name, data); | 	mnt = vfs_kern_mount(type, sb_flags, name, data); | ||||||
| 	if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) && | 	if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) && | ||||||
| 	    !mnt->mnt_sb->s_subtype) | 	    !mnt->mnt_sb->s_subtype) | ||||||
| 		mnt = fs_set_subtype(mnt, fstype); | 		mnt = fs_set_subtype(mnt, fstype); | ||||||
|  | @ -2764,8 +2764,8 @@ long do_mount(const char *dev_name, const char __user *dir_name, | ||||||
| 		const char *type_page, unsigned long flags, void *data_page) | 		const char *type_page, unsigned long flags, void *data_page) | ||||||
| { | { | ||||||
| 	struct path path; | 	struct path path; | ||||||
|  | 	unsigned int mnt_flags = 0, sb_flags; | ||||||
| 	int retval = 0; | 	int retval = 0; | ||||||
| 	int mnt_flags = 0; |  | ||||||
| 
 | 
 | ||||||
| 	/* Discard magic */ | 	/* Discard magic */ | ||||||
| 	if ((flags & MS_MGC_MSK) == MS_MGC_VAL) | 	if ((flags & MS_MGC_MSK) == MS_MGC_VAL) | ||||||
|  | @ -2775,6 +2775,9 @@ long do_mount(const char *dev_name, const char __user *dir_name, | ||||||
| 	if (data_page) | 	if (data_page) | ||||||
| 		((char *)data_page)[PAGE_SIZE - 1] = 0; | 		((char *)data_page)[PAGE_SIZE - 1] = 0; | ||||||
| 
 | 
 | ||||||
|  | 	if (flags & MS_NOUSER) | ||||||
|  | 		return -EINVAL; | ||||||
|  | 
 | ||||||
| 	/* ... and get the mountpoint */ | 	/* ... and get the mountpoint */ | ||||||
| 	retval = user_path(dir_name, &path); | 	retval = user_path(dir_name, &path); | ||||||
| 	if (retval) | 	if (retval) | ||||||
|  | @ -2784,7 +2787,7 @@ long do_mount(const char *dev_name, const char __user *dir_name, | ||||||
| 				   type_page, flags, data_page); | 				   type_page, flags, data_page); | ||||||
| 	if (!retval && !may_mount()) | 	if (!retval && !may_mount()) | ||||||
| 		retval = -EPERM; | 		retval = -EPERM; | ||||||
| 	if (!retval && (flags & MS_MANDLOCK) && !may_mandlock()) | 	if (!retval && (flags & SB_MANDLOCK) && !may_mandlock()) | ||||||
| 		retval = -EPERM; | 		retval = -EPERM; | ||||||
| 	if (retval) | 	if (retval) | ||||||
| 		goto dput_out; | 		goto dput_out; | ||||||
|  | @ -2806,7 +2809,7 @@ long do_mount(const char *dev_name, const char __user *dir_name, | ||||||
| 		mnt_flags |= MNT_NODIRATIME; | 		mnt_flags |= MNT_NODIRATIME; | ||||||
| 	if (flags & MS_STRICTATIME) | 	if (flags & MS_STRICTATIME) | ||||||
| 		mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); | 		mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); | ||||||
| 	if (flags & MS_RDONLY) | 	if (flags & SB_RDONLY) | ||||||
| 		mnt_flags |= MNT_READONLY; | 		mnt_flags |= MNT_READONLY; | ||||||
| 
 | 
 | ||||||
| 	/* The default atime for remount is preservation */ | 	/* The default atime for remount is preservation */ | ||||||
|  | @ -2817,12 +2820,15 @@ long do_mount(const char *dev_name, const char __user *dir_name, | ||||||
| 		mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK; | 		mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN | | 	sb_flags = flags & (SB_RDONLY | | ||||||
| 		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | | 			    SB_SYNCHRONOUS | | ||||||
| 		   MS_STRICTATIME | MS_NOREMOTELOCK | MS_SUBMOUNT); | 			    SB_MANDLOCK | | ||||||
|  | 			    SB_DIRSYNC | | ||||||
|  | 			    SB_SILENT | | ||||||
|  | 			    SB_POSIXACL); | ||||||
| 
 | 
 | ||||||
| 	if (flags & MS_REMOUNT) | 	if (flags & MS_REMOUNT) | ||||||
| 		retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, | 		retval = do_remount(&path, flags, sb_flags, mnt_flags, | ||||||
| 				    data_page); | 				    data_page); | ||||||
| 	else if (flags & MS_BIND) | 	else if (flags & MS_BIND) | ||||||
| 		retval = do_loopback(&path, dev_name, flags & MS_REC); | 		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, | ||||||
| 	else if (flags & MS_MOVE) | 	else if (flags & MS_MOVE) | ||||||
| 		retval = do_move_mount(&path, dev_name); | 		retval = do_move_mount(&path, dev_name); | ||||||
| 	else | 	else | ||||||
| 		retval = do_new_mount(&path, type_page, flags, mnt_flags, | 		retval = do_new_mount(&path, type_page, sb_flags, mnt_flags, | ||||||
| 				      dev_name, data_page); | 				      dev_name, data_page); | ||||||
| dput_out: | dput_out: | ||||||
| 	path_put(&path); | 	path_put(&path); | ||||||
|  | @ -3281,7 +3287,7 @@ void put_mnt_ns(struct mnt_namespace *ns) | ||||||
| struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) | struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) | ||||||
| { | { | ||||||
| 	struct vfsmount *mnt; | 	struct vfsmount *mnt; | ||||||
| 	mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data); | 	mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, data); | ||||||
| 	if (!IS_ERR(mnt)) { | 	if (!IS_ERR(mnt)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * it is a longterm mount, don't release mnt until | 		 * 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, | ||||||
| 		mnt_flags = mnt->mnt.mnt_flags; | 		mnt_flags = mnt->mnt.mnt_flags; | ||||||
| 
 | 
 | ||||||
| 		/* Don't miss readonly hidden in the superblock flags */ | 		/* Don't miss readonly hidden in the superblock flags */ | ||||||
| 		if (mnt->mnt.mnt_sb->s_flags & MS_RDONLY) | 		if (sb_rdonly(mnt->mnt.mnt_sb)) | ||||||
| 			mnt_flags |= MNT_LOCK_READONLY; | 			mnt_flags |= MNT_LOCK_READONLY; | ||||||
| 
 | 
 | ||||||
| 		/* Verify the mount flags are equal to or more permissive
 | 		/* Verify the mount flags are equal to or more permissive
 | ||||||
|  |  | ||||||
|  | @ -812,7 +812,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root) | ||||||
| 	 * Display all mount option settings | 	 * Display all mount option settings | ||||||
| 	 */ | 	 */ | ||||||
| 	seq_printf(m, "\n\topts:\t"); | 	seq_printf(m, "\n\topts:\t"); | ||||||
| 	seq_puts(m, root->d_sb->s_flags & MS_RDONLY ? "ro" : "rw"); | 	seq_puts(m, sb_rdonly(root->d_sb) ? "ro" : "rw"); | ||||||
| 	seq_puts(m, root->d_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : ""); | 	seq_puts(m, root->d_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : ""); | ||||||
| 	seq_puts(m, root->d_sb->s_flags & MS_NOATIME ? ",noatime" : ""); | 	seq_puts(m, root->d_sb->s_flags & MS_NOATIME ? ",noatime" : ""); | ||||||
| 	seq_puts(m, root->d_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : ""); | 	seq_puts(m, root->d_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : ""); | ||||||
|  |  | ||||||
|  | @ -174,7 +174,7 @@ static int nilfs_writepages(struct address_space *mapping, | ||||||
| 	struct inode *inode = mapping->host; | 	struct inode *inode = mapping->host; | ||||||
| 	int err = 0; | 	int err = 0; | ||||||
| 
 | 
 | ||||||
| 	if (inode->i_sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(inode->i_sb)) { | ||||||
| 		nilfs_clear_dirty_pages(mapping, false); | 		nilfs_clear_dirty_pages(mapping, false); | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	} | 	} | ||||||
|  | @ -191,7 +191,7 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc) | ||||||
| 	struct inode *inode = page->mapping->host; | 	struct inode *inode = page->mapping->host; | ||||||
| 	int err; | 	int err; | ||||||
| 
 | 
 | ||||||
| 	if (inode->i_sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(inode->i_sb)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * It means that filesystem was remounted in read-only | 		 * It means that filesystem was remounted in read-only | ||||||
| 		 * mode because of error or metadata corruption. But we | 		 * mode because of error or metadata corruption. But we | ||||||
|  |  | ||||||
|  | @ -413,7 +413,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc) | ||||||
| 	struct super_block *sb; | 	struct super_block *sb; | ||||||
| 	int err = 0; | 	int err = 0; | ||||||
| 
 | 
 | ||||||
| 	if (inode && (inode->i_sb->s_flags & MS_RDONLY)) { | 	if (inode && sb_rdonly(inode->i_sb)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * It means that filesystem was remounted in read-only | 		 * It means that filesystem was remounted in read-only | ||||||
| 		 * mode because of error or metadata corruption. But we | 		 * mode because of error or metadata corruption. But we | ||||||
|  |  | ||||||
|  | @ -136,7 +136,7 @@ void __nilfs_error(struct super_block *sb, const char *function, | ||||||
| 
 | 
 | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		nilfs_set_error(sb); | 		nilfs_set_error(sb); | ||||||
| 
 | 
 | ||||||
| 		if (nilfs_test_opt(nilfs, ERRORS_RO)) { | 		if (nilfs_test_opt(nilfs, ERRORS_RO)) { | ||||||
|  | @ -478,7 +478,7 @@ static void nilfs_put_super(struct super_block *sb) | ||||||
| 
 | 
 | ||||||
| 	nilfs_detach_log_writer(sb); | 	nilfs_detach_log_writer(sb); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		down_write(&nilfs->ns_sem); | 		down_write(&nilfs->ns_sem); | ||||||
| 		nilfs_cleanup_super(sb); | 		nilfs_cleanup_super(sb); | ||||||
| 		up_write(&nilfs->ns_sem); | 		up_write(&nilfs->ns_sem); | ||||||
|  | @ -578,7 +578,7 @@ static int nilfs_freeze(struct super_block *sb) | ||||||
| 	struct the_nilfs *nilfs = sb->s_fs_info; | 	struct the_nilfs *nilfs = sb->s_fs_info; | ||||||
| 	int err; | 	int err; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	/* Mark super block clean */ | 	/* Mark super block clean */ | ||||||
|  | @ -592,7 +592,7 @@ static int nilfs_unfreeze(struct super_block *sb) | ||||||
| { | { | ||||||
| 	struct the_nilfs *nilfs = sb->s_fs_info; | 	struct the_nilfs *nilfs = sb->s_fs_info; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	down_write(&nilfs->ns_sem); | 	down_write(&nilfs->ns_sem); | ||||||
|  | @ -898,7 +898,7 @@ int nilfs_check_feature_compatibility(struct super_block *sb, | ||||||
| 	} | 	} | ||||||
| 	features = le64_to_cpu(sbp->s_feature_compat_ro) & | 	features = le64_to_cpu(sbp->s_feature_compat_ro) & | ||||||
| 		~NILFS_FEATURE_COMPAT_RO_SUPP; | 		~NILFS_FEATURE_COMPAT_RO_SUPP; | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && features) { | 	if (!sb_rdonly(sb) && features) { | ||||||
| 		nilfs_msg(sb, KERN_ERR, | 		nilfs_msg(sb, KERN_ERR, | ||||||
| 			  "couldn't mount RDWR because of unsupported optional features (%llx)", | 			  "couldn't mount RDWR because of unsupported optional features (%llx)", | ||||||
| 			  (unsigned long long)features); | 			  (unsigned long long)features); | ||||||
|  | @ -1083,7 +1083,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		goto failed_unload; | 		goto failed_unload; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		err = nilfs_attach_log_writer(sb, fsroot); | 		err = nilfs_attach_log_writer(sb, fsroot); | ||||||
| 		if (err) | 		if (err) | ||||||
| 			goto failed_checkpoint; | 			goto failed_checkpoint; | ||||||
|  | @ -1095,7 +1095,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 
 | 
 | ||||||
| 	nilfs_put_root(fsroot); | 	nilfs_put_root(fsroot); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		down_write(&nilfs->ns_sem); | 		down_write(&nilfs->ns_sem); | ||||||
| 		nilfs_setup_super(sb, true); | 		nilfs_setup_super(sb, true); | ||||||
| 		up_write(&nilfs->ns_sem); | 		up_write(&nilfs->ns_sem); | ||||||
|  | @ -1144,7 +1144,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 		goto restore_opts; | 		goto restore_opts; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	if (*flags & MS_RDONLY) { | 	if (*flags & MS_RDONLY) { | ||||||
| 		/* Shutting down log writer */ | 		/* Shutting down log writer */ | ||||||
|  | @ -1338,8 +1338,7 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | ||||||
| 			if ((flags ^ s->s_flags) & MS_RDONLY) { | 			if ((flags ^ s->s_flags) & MS_RDONLY) { | ||||||
| 				nilfs_msg(s, KERN_ERR, | 				nilfs_msg(s, KERN_ERR, | ||||||
| 					  "the device already has a %s mount.", | 					  "the device already has a %s mount.", | ||||||
| 					  (s->s_flags & MS_RDONLY) ? | 					  sb_rdonly(s) ? "read-only" : "read/write"); | ||||||
| 					  "read-only" : "read/write"); |  | ||||||
| 				err = -EBUSY; | 				err = -EBUSY; | ||||||
| 				goto failed_super; | 				goto failed_super; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -487,7 +487,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | ||||||
| 	 * When remounting read-only, mark the volume clean if no volume errors | 	 * When remounting read-only, mark the volume clean if no volume errors | ||||||
| 	 * have occurred. | 	 * have occurred. | ||||||
| 	 */ | 	 */ | ||||||
| 	if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 	if (sb_rdonly(sb) && !(*flags & MS_RDONLY)) { | ||||||
| 		static const char *es = ".  Cannot remount read-write."; | 		static const char *es = ".  Cannot remount read-write."; | ||||||
| 
 | 
 | ||||||
| 		/* Remounting read-write. */ | 		/* Remounting read-write. */ | ||||||
|  | @ -548,7 +548,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | ||||||
| 			NVolSetErrors(vol); | 			NVolSetErrors(vol); | ||||||
| 			return -EROFS; | 			return -EROFS; | ||||||
| 		} | 		} | ||||||
| 	} else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { | 	} else if (!sb_rdonly(sb) && (*flags & MS_RDONLY)) { | ||||||
| 		/* Remounting read-only. */ | 		/* Remounting read-only. */ | ||||||
| 		if (!NVolErrors(vol)) { | 		if (!NVolErrors(vol)) { | ||||||
| 			if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) | 			if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) | ||||||
|  | @ -732,7 +732,7 @@ static struct buffer_head *read_ntfs_boot_sector(struct super_block *sb, | ||||||
| 		 * on a large sector device contains the whole boot loader or | 		 * on a large sector device contains the whole boot loader or | ||||||
| 		 * just the first 512 bytes). | 		 * just the first 512 bytes). | ||||||
| 		 */ | 		 */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			ntfs_warning(sb, "Hot-fix: Recovering invalid primary " | 			ntfs_warning(sb, "Hot-fix: Recovering invalid primary " | ||||||
| 					"boot sector from backup copy."); | 					"boot sector from backup copy."); | ||||||
| 			memcpy(bh_primary->b_data, bh_backup->b_data, | 			memcpy(bh_primary->b_data, bh_backup->b_data, | ||||||
|  | @ -1789,7 +1789,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 		static const char *es3 = ".  Run ntfsfix and/or chkdsk."; | 		static const char *es3 = ".  Run ntfsfix and/or chkdsk."; | ||||||
| 
 | 
 | ||||||
| 		/* If a read-write mount, convert it to a read-only mount. */ | 		/* If a read-write mount, convert it to a read-only mount. */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | ||||||
| 					ON_ERRORS_CONTINUE))) { | 					ON_ERRORS_CONTINUE))) { | ||||||
| 				ntfs_error(sb, "%s and neither on_errors=" | 				ntfs_error(sb, "%s and neither on_errors=" | ||||||
|  | @ -1928,7 +1928,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 					(unsigned)le16_to_cpu(vol->vol_flags)); | 					(unsigned)le16_to_cpu(vol->vol_flags)); | ||||||
| 		} | 		} | ||||||
| 		/* If a read-write mount, convert it to a read-only mount. */ | 		/* If a read-write mount, convert it to a read-only mount. */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | ||||||
| 					ON_ERRORS_CONTINUE))) { | 					ON_ERRORS_CONTINUE))) { | ||||||
| 				ntfs_error(sb, "%s and neither on_errors=" | 				ntfs_error(sb, "%s and neither on_errors=" | ||||||
|  | @ -1961,7 +1961,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 
 | 
 | ||||||
| 		es1 = !vol->logfile_ino ? es1a : es1b; | 		es1 = !vol->logfile_ino ? es1a : es1b; | ||||||
| 		/* If a read-write mount, convert it to a read-only mount. */ | 		/* If a read-write mount, convert it to a read-only mount. */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | ||||||
| 					ON_ERRORS_CONTINUE))) { | 					ON_ERRORS_CONTINUE))) { | ||||||
| 				ntfs_error(sb, "%s and neither on_errors=" | 				ntfs_error(sb, "%s and neither on_errors=" | ||||||
|  | @ -2010,7 +2010,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 
 | 
 | ||||||
| 		es1 = err < 0 ? es1a : es1b; | 		es1 = err < 0 ? es1a : es1b; | ||||||
| 		/* If a read-write mount, convert it to a read-only mount. */ | 		/* If a read-write mount, convert it to a read-only mount. */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | ||||||
| 					ON_ERRORS_CONTINUE))) { | 					ON_ERRORS_CONTINUE))) { | ||||||
| 				ntfs_error(sb, "%s and neither on_errors=" | 				ntfs_error(sb, "%s and neither on_errors=" | ||||||
|  | @ -2028,8 +2028,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 		NVolSetErrors(vol); | 		NVolSetErrors(vol); | ||||||
| 	} | 	} | ||||||
| 	/* If (still) a read-write mount, mark the volume dirty. */ | 	/* If (still) a read-write mount, mark the volume dirty. */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && | 	if (!sb_rdonly(sb) && ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { | ||||||
| 			ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { |  | ||||||
| 		static const char *es1 = "Failed to set dirty bit in volume " | 		static const char *es1 = "Failed to set dirty bit in volume " | ||||||
| 				"information flags"; | 				"information flags"; | ||||||
| 		static const char *es2 = ".  Run chkdsk."; | 		static const char *es2 = ".  Run chkdsk."; | ||||||
|  | @ -2075,8 +2074,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 	/* If (still) a read-write mount, empty the logfile. */ | 	/* If (still) a read-write mount, empty the logfile. */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && | 	if (!sb_rdonly(sb) && !ntfs_empty_logfile(vol->logfile_ino)) { | ||||||
| 			!ntfs_empty_logfile(vol->logfile_ino)) { |  | ||||||
| 		static const char *es1 = "Failed to empty $LogFile"; | 		static const char *es1 = "Failed to empty $LogFile"; | ||||||
| 		static const char *es2 = ".  Mount in Windows."; | 		static const char *es2 = ".  Mount in Windows."; | ||||||
| 
 | 
 | ||||||
|  | @ -2121,7 +2119,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 		static const char *es2 = ".  Run chkdsk."; | 		static const char *es2 = ".  Run chkdsk."; | ||||||
| 
 | 
 | ||||||
| 		/* If a read-write mount, convert it to a read-only mount. */ | 		/* If a read-write mount, convert it to a read-only mount. */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | ||||||
| 					ON_ERRORS_CONTINUE))) { | 					ON_ERRORS_CONTINUE))) { | ||||||
| 				ntfs_error(sb, "%s and neither on_errors=" | 				ntfs_error(sb, "%s and neither on_errors=" | ||||||
|  | @ -2139,8 +2137,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 		NVolSetErrors(vol); | 		NVolSetErrors(vol); | ||||||
| 	} | 	} | ||||||
| 	/* If (still) a read-write mount, mark the quotas out of date. */ | 	/* If (still) a read-write mount, mark the quotas out of date. */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && | 	if (!sb_rdonly(sb) && !ntfs_mark_quotas_out_of_date(vol)) { | ||||||
| 			!ntfs_mark_quotas_out_of_date(vol)) { |  | ||||||
| 		static const char *es1 = "Failed to mark quotas out of date"; | 		static const char *es1 = "Failed to mark quotas out of date"; | ||||||
| 		static const char *es2 = ".  Run chkdsk."; | 		static const char *es2 = ".  Run chkdsk."; | ||||||
| 
 | 
 | ||||||
|  | @ -2165,7 +2162,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 		static const char *es2 = ".  Run chkdsk."; | 		static const char *es2 = ".  Run chkdsk."; | ||||||
| 
 | 
 | ||||||
| 		/* If a read-write mount, convert it to a read-only mount. */ | 		/* If a read-write mount, convert it to a read-only mount. */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | | ||||||
| 					ON_ERRORS_CONTINUE))) { | 					ON_ERRORS_CONTINUE))) { | ||||||
| 				ntfs_error(sb, "%s and neither on_errors=" | 				ntfs_error(sb, "%s and neither on_errors=" | ||||||
|  | @ -2183,7 +2180,7 @@ static bool load_system_files(ntfs_volume *vol) | ||||||
| 		NVolSetErrors(vol); | 		NVolSetErrors(vol); | ||||||
| 	} | 	} | ||||||
| 	/* If (still) a read-write mount, stamp the transaction log. */ | 	/* If (still) a read-write mount, stamp the transaction log. */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && !ntfs_stamp_usnjrnl(vol)) { | 	if (!sb_rdonly(sb) && !ntfs_stamp_usnjrnl(vol)) { | ||||||
| 		static const char *es1 = "Failed to stamp transaction log " | 		static const char *es1 = "Failed to stamp transaction log " | ||||||
| 				"($UsnJrnl)"; | 				"($UsnJrnl)"; | ||||||
| 		static const char *es2 = ".  Run chkdsk."; | 		static const char *es2 = ".  Run chkdsk."; | ||||||
|  | @ -2314,7 +2311,7 @@ static void ntfs_put_super(struct super_block *sb) | ||||||
| 	 * If a read-write mount and no volume errors have occurred, mark the | 	 * If a read-write mount and no volume errors have occurred, mark the | ||||||
| 	 * volume clean.  Also, re-commit all affected inodes. | 	 * volume clean.  Also, re-commit all affected inodes. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		if (!NVolErrors(vol)) { | 		if (!NVolErrors(vol)) { | ||||||
| 			if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) | 			if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) | ||||||
| 				ntfs_warning(sb, "Failed to clear dirty bit " | 				ntfs_warning(sb, "Failed to clear dirty bit " | ||||||
|  |  | ||||||
|  | @ -675,7 +675,7 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* We're going to/from readonly mode. */ | 	/* We're going to/from readonly mode. */ | ||||||
| 	if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { | 	if ((bool)(*flags & MS_RDONLY) != sb_rdonly(sb)) { | ||||||
| 		/* Disable quota accounting before remounting RO */ | 		/* Disable quota accounting before remounting RO */ | ||||||
| 		if (*flags & MS_RDONLY) { | 		if (*flags & MS_RDONLY) { | ||||||
| 			ret = ocfs2_susp_quotas(osb, 0); | 			ret = ocfs2_susp_quotas(osb, 0); | ||||||
|  | @ -1063,7 +1063,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	/* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
 | 	/* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
 | ||||||
| 	 * heartbeat=none */ | 	 * heartbeat=none */ | ||||||
| 	if (bdev_read_only(sb->s_bdev)) { | 	if (bdev_read_only(sb->s_bdev)) { | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			status = -EACCES; | 			status = -EACCES; | ||||||
| 			mlog(ML_ERROR, "Readonly device detected but readonly " | 			mlog(ML_ERROR, "Readonly device detected but readonly " | ||||||
| 			     "mount was not specified.\n"); | 			     "mount was not specified.\n"); | ||||||
|  | @ -1098,7 +1098,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!ocfs2_is_hard_readonly(osb)) { | 	if (!ocfs2_is_hard_readonly(osb)) { | ||||||
| 		if (sb->s_flags & MS_RDONLY) | 		if (sb_rdonly(sb)) | ||||||
| 			ocfs2_set_ro_flag(osb, 0); | 			ocfs2_set_ro_flag(osb, 0); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1179,7 +1179,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	/* Now we can initialize quotas because we can afford to wait
 | 	/* Now we can initialize quotas because we can afford to wait
 | ||||||
| 	 * for cluster locks recovery now. That also means that truncation | 	 * for cluster locks recovery now. That also means that truncation | ||||||
| 	 * log recovery can happen but that waits for proper quota setup */ | 	 * log recovery can happen but that waits for proper quota setup */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		status = ocfs2_enable_quotas(osb); | 		status = ocfs2_enable_quotas(osb); | ||||||
| 		if (status < 0) { | 		if (status < 0) { | ||||||
| 			/* We have to err-out specially here because
 | 			/* We have to err-out specially here because
 | ||||||
|  | @ -2180,8 +2180,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | ||||||
| 		status = -EINVAL; | 		status = -EINVAL; | ||||||
| 		goto bail; | 		goto bail; | ||||||
| 	} | 	} | ||||||
| 	if (!(osb->sb->s_flags & MS_RDONLY) && | 	if (!sb_rdonly(osb->sb) && (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { | ||||||
| 	    (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { |  | ||||||
| 		mlog(ML_ERROR, "couldn't mount RDWR because of " | 		mlog(ML_ERROR, "couldn't mount RDWR because of " | ||||||
| 		     "unsupported optional features (%x).\n", i); | 		     "unsupported optional features (%x).\n", i); | ||||||
| 		status = -EINVAL; | 		status = -EINVAL; | ||||||
|  | @ -2567,9 +2566,7 @@ static int ocfs2_handle_error(struct super_block *sb) | ||||||
| 		rv = -EIO; | 		rv = -EIO; | ||||||
| 	} else { /* default option */ | 	} else { /* default option */ | ||||||
| 		rv = -EROFS; | 		rv = -EROFS; | ||||||
| 		if (sb->s_flags & MS_RDONLY && | 		if (sb_rdonly(sb) && (ocfs2_is_soft_readonly(osb) || ocfs2_is_hard_readonly(osb))) | ||||||
| 				(ocfs2_is_soft_readonly(osb) || |  | ||||||
| 				 ocfs2_is_hard_readonly(osb))) |  | ||||||
| 			return rv; | 			return rv; | ||||||
| 
 | 
 | ||||||
| 		pr_crit("OCFS2: File system is now read-only.\n"); | 		pr_crit("OCFS2: File system is now read-only.\n"); | ||||||
|  |  | ||||||
|  | @ -870,7 +870,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 			goto out_free_config; | 			goto out_free_config; | ||||||
| 
 | 
 | ||||||
| 		/* Upper fs should not be r/o */ | 		/* Upper fs should not be r/o */ | ||||||
| 		if (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY) { | 		if (sb_rdonly(upperpath.mnt->mnt_sb)) { | ||||||
| 			pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); | 			pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); | ||||||
| 			err = -EINVAL; | 			err = -EINVAL; | ||||||
| 			goto out_put_upperpath; | 			goto out_put_upperpath; | ||||||
|  |  | ||||||
|  | @ -178,7 +178,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt) | ||||||
| 	} else { | 	} else { | ||||||
| 		mangle(m, r->mnt_devname ? r->mnt_devname : "none"); | 		mangle(m, r->mnt_devname ? r->mnt_devname : "none"); | ||||||
| 	} | 	} | ||||||
| 	seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw"); | 	seq_puts(m, sb_rdonly(sb) ? " ro" : " rw"); | ||||||
| 	err = show_sb_opts(m, sb); | 	err = show_sb_opts(m, sb); | ||||||
| 	if (err) | 	if (err) | ||||||
| 		goto out; | 		goto out; | ||||||
|  |  | ||||||
|  | @ -753,7 +753,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, | ||||||
| 	case Q_XGETNEXTQUOTA: | 	case Q_XGETNEXTQUOTA: | ||||||
| 		return quota_getnextxquota(sb, type, id, addr); | 		return quota_getnextxquota(sb, type, id, addr); | ||||||
| 	case Q_XQUOTASYNC: | 	case Q_XQUOTASYNC: | ||||||
| 		if (sb->s_flags & MS_RDONLY) | 		if (sb_rdonly(sb)) | ||||||
| 			return -EROFS; | 			return -EROFS; | ||||||
| 		/* XFS quotas are fully coherent now, making this call a noop */ | 		/* XFS quotas are fully coherent now, making this call a noop */ | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | @ -1776,7 +1776,7 @@ int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc) | ||||||
| 	struct reiserfs_transaction_handle th; | 	struct reiserfs_transaction_handle th; | ||||||
| 	int jbegin_count = 1; | 	int jbegin_count = 1; | ||||||
| 
 | 
 | ||||||
| 	if (inode->i_sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(inode->i_sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * memory pressure can sometimes initiate write_inode calls with | 	 * memory pressure can sometimes initiate write_inode calls with | ||||||
|  |  | ||||||
|  | @ -1918,7 +1918,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th, | ||||||
| 	 * we only want to flush out transactions if we were | 	 * we only want to flush out transactions if we were | ||||||
| 	 * called with error == 0 | 	 * called with error == 0 | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!error && !(sb->s_flags & MS_RDONLY)) { | 	if (!error && !sb_rdonly(sb)) { | ||||||
| 		/* end the current trans */ | 		/* end the current trans */ | ||||||
| 		BUG_ON(!th->t_trans_id); | 		BUG_ON(!th->t_trans_id); | ||||||
| 		do_journal_end(th, FLUSH_ALL); | 		do_journal_end(th, FLUSH_ALL); | ||||||
|  |  | ||||||
|  | @ -386,7 +386,7 @@ void __reiserfs_error(struct super_block *sb, const char *id, | ||||||
| 		printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n", | 		printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n", | ||||||
| 		       sb->s_id, function, error_buf); | 		       sb->s_id, function, error_buf); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	reiserfs_info(sb, "Remounting filesystem read-only\n"); | 	reiserfs_info(sb, "Remounting filesystem read-only\n"); | ||||||
|  |  | ||||||
|  | @ -121,7 +121,7 @@ void reiserfs_schedule_old_flush(struct super_block *s) | ||||||
| 	 * Avoid scheduling flush when sb is being shut down. It can race | 	 * Avoid scheduling flush when sb is being shut down. It can race | ||||||
| 	 * with journal shutdown and free still queued delayed work. | 	 * with journal shutdown and free still queued delayed work. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (s->s_flags & MS_RDONLY || !(s->s_flags & MS_ACTIVE)) | 	if (sb_rdonly(s) || !(s->s_flags & MS_ACTIVE)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	spin_lock(&sbi->old_work_lock); | 	spin_lock(&sbi->old_work_lock); | ||||||
|  | @ -151,7 +151,7 @@ static int reiserfs_freeze(struct super_block *s) | ||||||
| 	reiserfs_cancel_old_flush(s); | 	reiserfs_cancel_old_flush(s); | ||||||
| 
 | 
 | ||||||
| 	reiserfs_write_lock(s); | 	reiserfs_write_lock(s); | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| 		int err = journal_begin(&th, s, 1); | 		int err = journal_begin(&th, s, 1); | ||||||
| 		if (err) { | 		if (err) { | ||||||
| 			reiserfs_block_writes(&th); | 			reiserfs_block_writes(&th); | ||||||
|  | @ -599,7 +599,7 @@ static void reiserfs_put_super(struct super_block *s) | ||||||
| 	 * change file system state to current state if it was mounted | 	 * change file system state to current state if it was mounted | ||||||
| 	 * with read-write permissions | 	 * with read-write permissions | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| 		if (!journal_begin(&th, s, 10)) { | 		if (!journal_begin(&th, s, 10)) { | ||||||
| 			reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), | 			reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), | ||||||
| 						     1); | 						     1); | ||||||
|  | @ -700,7 +700,7 @@ static void reiserfs_dirty_inode(struct inode *inode, int flags) | ||||||
| 
 | 
 | ||||||
| 	int err = 0; | 	int err = 0; | ||||||
| 
 | 
 | ||||||
| 	if (inode->i_sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(inode->i_sb)) { | ||||||
| 		reiserfs_warning(inode->i_sb, "clm-6006", | 		reiserfs_warning(inode->i_sb, "clm-6006", | ||||||
| 				 "writing inode %lu on readonly FS", | 				 "writing inode %lu on readonly FS", | ||||||
| 				 inode->i_ino); | 				 inode->i_ino); | ||||||
|  | @ -1525,7 +1525,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | ||||||
| 		reiserfs_write_unlock(s); | 		reiserfs_write_unlock(s); | ||||||
| 		reiserfs_xattr_init(s, *mount_flags); | 		reiserfs_xattr_init(s, *mount_flags); | ||||||
| 		/* remount read-only */ | 		/* remount read-only */ | ||||||
| 		if (s->s_flags & MS_RDONLY) | 		if (sb_rdonly(s)) | ||||||
| 			/* it is read-only already */ | 			/* it is read-only already */ | ||||||
| 			goto out_ok_unlocked; | 			goto out_ok_unlocked; | ||||||
| 
 | 
 | ||||||
|  | @ -1551,7 +1551,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | ||||||
| 		journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s)); | 		journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s)); | ||||||
| 	} else { | 	} else { | ||||||
| 		/* remount read-write */ | 		/* remount read-write */ | ||||||
| 		if (!(s->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(s)) { | ||||||
| 			reiserfs_write_unlock(s); | 			reiserfs_write_unlock(s); | ||||||
| 			reiserfs_xattr_init(s, *mount_flags); | 			reiserfs_xattr_init(s, *mount_flags); | ||||||
| 			goto out_ok_unlocked;	/* We are read-write already */ | 			goto out_ok_unlocked;	/* We are read-write already */ | ||||||
|  | @ -1855,7 +1855,7 @@ static int what_hash(struct super_block *s) | ||||||
| 	 * the super | 	 * the super | ||||||
| 	 */ | 	 */ | ||||||
| 	if (code != UNSET_HASH && | 	if (code != UNSET_HASH && | ||||||
| 	    !(s->s_flags & MS_RDONLY) && | 	    !sb_rdonly(s) && | ||||||
| 	    code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { | 	    code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { | ||||||
| 		set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); | 		set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); | ||||||
| 	} | 	} | ||||||
|  | @ -2052,7 +2052,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | ||||||
| 	if (replay_only(s)) | 	if (replay_only(s)) | ||||||
| 		goto error_unlocked; | 		goto error_unlocked; | ||||||
| 
 | 
 | ||||||
| 	if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { | 	if (bdev_read_only(s->s_bdev) && !sb_rdonly(s)) { | ||||||
| 		SWARN(silent, s, "clm-7000", | 		SWARN(silent, s, "clm-7000", | ||||||
| 		      "Detected readonly device, marking FS readonly"); | 		      "Detected readonly device, marking FS readonly"); | ||||||
| 		s->s_flags |= MS_RDONLY; | 		s->s_flags |= MS_RDONLY; | ||||||
|  | @ -2101,7 +2101,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | ||||||
| 	else | 	else | ||||||
| 		set_bit(REISERFS_3_6, &sbi->s_properties); | 		set_bit(REISERFS_3_6, &sbi->s_properties); | ||||||
| 
 | 
 | ||||||
| 	if (!(s->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(s)) { | ||||||
| 
 | 
 | ||||||
| 		errval = journal_begin(&th, s, 1); | 		errval = journal_begin(&th, s, 1); | ||||||
| 		if (errval) { | 		if (errval) { | ||||||
|  |  | ||||||
							
								
								
									
										74
									
								
								fs/super.c
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								fs/super.c
									
									
									
									
									
								
							|  | @ -360,7 +360,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock) | ||||||
| 	s->s_count++; | 	s->s_count++; | ||||||
| 	spin_unlock(&sb_lock); | 	spin_unlock(&sb_lock); | ||||||
| 	down_write(&s->s_umount); | 	down_write(&s->s_umount); | ||||||
| 	if ((s->s_flags & MS_BORN) && atomic_inc_not_zero(&s->s_active)) { | 	if ((s->s_flags & SB_BORN) && atomic_inc_not_zero(&s->s_active)) { | ||||||
| 		put_super(s); | 		put_super(s); | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
|  | @ -390,7 +390,7 @@ bool trylock_super(struct super_block *sb) | ||||||
| { | { | ||||||
| 	if (down_read_trylock(&sb->s_umount)) { | 	if (down_read_trylock(&sb->s_umount)) { | ||||||
| 		if (!hlist_unhashed(&sb->s_instances) && | 		if (!hlist_unhashed(&sb->s_instances) && | ||||||
| 		    sb->s_root && (sb->s_flags & MS_BORN)) | 		    sb->s_root && (sb->s_flags & SB_BORN)) | ||||||
| 			return true; | 			return true; | ||||||
| 		up_read(&sb->s_umount); | 		up_read(&sb->s_umount); | ||||||
| 	} | 	} | ||||||
|  | @ -419,7 +419,7 @@ void generic_shutdown_super(struct super_block *sb) | ||||||
| 	if (sb->s_root) { | 	if (sb->s_root) { | ||||||
| 		shrink_dcache_for_umount(sb); | 		shrink_dcache_for_umount(sb); | ||||||
| 		sync_filesystem(sb); | 		sync_filesystem(sb); | ||||||
| 		sb->s_flags &= ~MS_ACTIVE; | 		sb->s_flags &= ~SB_ACTIVE; | ||||||
| 
 | 
 | ||||||
| 		fsnotify_unmount_inodes(sb); | 		fsnotify_unmount_inodes(sb); | ||||||
| 		cgroup_writeback_umount(); | 		cgroup_writeback_umount(); | ||||||
|  | @ -472,7 +472,7 @@ struct super_block *sget_userns(struct file_system_type *type, | ||||||
| 	struct super_block *old; | 	struct super_block *old; | ||||||
| 	int err; | 	int err; | ||||||
| 
 | 
 | ||||||
| 	if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && | 	if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && | ||||||
| 	    !(type->fs_flags & FS_USERNS_MOUNT) && | 	    !(type->fs_flags & FS_USERNS_MOUNT) && | ||||||
| 	    !capable(CAP_SYS_ADMIN)) | 	    !capable(CAP_SYS_ADMIN)) | ||||||
| 		return ERR_PTR(-EPERM); | 		return ERR_PTR(-EPERM); | ||||||
|  | @ -502,7 +502,7 @@ struct super_block *sget_userns(struct file_system_type *type, | ||||||
| 	} | 	} | ||||||
| 	if (!s) { | 	if (!s) { | ||||||
| 		spin_unlock(&sb_lock); | 		spin_unlock(&sb_lock); | ||||||
| 		s = alloc_super(type, (flags & ~MS_SUBMOUNT), user_ns); | 		s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns); | ||||||
| 		if (!s) | 		if (!s) | ||||||
| 			return ERR_PTR(-ENOMEM); | 			return ERR_PTR(-ENOMEM); | ||||||
| 		goto retry; | 		goto retry; | ||||||
|  | @ -547,11 +547,11 @@ struct super_block *sget(struct file_system_type *type, | ||||||
| 	 * mount through to here so always use &init_user_ns | 	 * mount through to here so always use &init_user_ns | ||||||
| 	 * until that changes. | 	 * until that changes. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (flags & MS_SUBMOUNT) | 	if (flags & SB_SUBMOUNT) | ||||||
| 		user_ns = &init_user_ns; | 		user_ns = &init_user_ns; | ||||||
| 
 | 
 | ||||||
| 	/* Ensure the requestor has permissions over the target filesystem */ | 	/* Ensure the requestor has permissions over the target filesystem */ | ||||||
| 	if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && !ns_capable(user_ns, CAP_SYS_ADMIN)) | 	if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && !ns_capable(user_ns, CAP_SYS_ADMIN)) | ||||||
| 		return ERR_PTR(-EPERM); | 		return ERR_PTR(-EPERM); | ||||||
| 
 | 
 | ||||||
| 	return sget_userns(type, test, set, flags, user_ns, data); | 	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) | ||||||
| 		spin_unlock(&sb_lock); | 		spin_unlock(&sb_lock); | ||||||
| 
 | 
 | ||||||
| 		down_read(&sb->s_umount); | 		down_read(&sb->s_umount); | ||||||
| 		if (sb->s_root && (sb->s_flags & MS_BORN)) | 		if (sb->s_root && (sb->s_flags & SB_BORN)) | ||||||
| 			f(sb, arg); | 			f(sb, arg); | ||||||
| 		up_read(&sb->s_umount); | 		up_read(&sb->s_umount); | ||||||
| 
 | 
 | ||||||
|  | @ -628,7 +628,7 @@ void iterate_supers_type(struct file_system_type *type, | ||||||
| 		spin_unlock(&sb_lock); | 		spin_unlock(&sb_lock); | ||||||
| 
 | 
 | ||||||
| 		down_read(&sb->s_umount); | 		down_read(&sb->s_umount); | ||||||
| 		if (sb->s_root && (sb->s_flags & MS_BORN)) | 		if (sb->s_root && (sb->s_flags & SB_BORN)) | ||||||
| 			f(sb, arg); | 			f(sb, arg); | ||||||
| 		up_read(&sb->s_umount); | 		up_read(&sb->s_umount); | ||||||
| 
 | 
 | ||||||
|  | @ -664,7 +664,7 @@ static struct super_block *__get_super(struct block_device *bdev, bool excl) | ||||||
| 			else | 			else | ||||||
| 				down_write(&sb->s_umount); | 				down_write(&sb->s_umount); | ||||||
| 			/* still alive? */ | 			/* still alive? */ | ||||||
| 			if (sb->s_root && (sb->s_flags & MS_BORN)) | 			if (sb->s_root && (sb->s_flags & SB_BORN)) | ||||||
| 				return sb; | 				return sb; | ||||||
| 			if (!excl) | 			if (!excl) | ||||||
| 				up_read(&sb->s_umount); | 				up_read(&sb->s_umount); | ||||||
|  | @ -785,7 +785,7 @@ struct super_block *user_get_super(dev_t dev) | ||||||
| 			spin_unlock(&sb_lock); | 			spin_unlock(&sb_lock); | ||||||
| 			down_read(&sb->s_umount); | 			down_read(&sb->s_umount); | ||||||
| 			/* still alive? */ | 			/* still alive? */ | ||||||
| 			if (sb->s_root && (sb->s_flags & MS_BORN)) | 			if (sb->s_root && (sb->s_flags & SB_BORN)) | ||||||
| 				return sb; | 				return sb; | ||||||
| 			up_read(&sb->s_umount); | 			up_read(&sb->s_umount); | ||||||
| 			/* nope, got unmounted */ | 			/* nope, got unmounted */ | ||||||
|  | @ -801,13 +801,13 @@ struct super_block *user_get_super(dev_t dev) | ||||||
| /**
 | /**
 | ||||||
|  *	do_remount_sb - asks filesystem to change mount options. |  *	do_remount_sb - asks filesystem to change mount options. | ||||||
|  *	@sb:	superblock in question |  *	@sb:	superblock in question | ||||||
|  *	@flags:	numeric part of options |  *	@sb_flags: revised superblock flags | ||||||
|  *	@data:	the rest of options |  *	@data:	the rest of options | ||||||
|  *      @force: whether or not to force the change |  *      @force: whether or not to force the change | ||||||
|  * |  * | ||||||
|  *	Alters the mount options of a mounted file system. |  *	Alters the mount options of a mounted file system. | ||||||
|  */ |  */ | ||||||
| int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | int do_remount_sb(struct super_block *sb, int sb_flags, void *data, int force) | ||||||
| { | { | ||||||
| 	int retval; | 	int retval; | ||||||
| 	int remount_ro; | 	int remount_ro; | ||||||
|  | @ -816,11 +816,11 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | ||||||
| 		return -EBUSY; | 		return -EBUSY; | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_BLOCK | #ifdef CONFIG_BLOCK | ||||||
| 	if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) | 	if (!(sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev)) | ||||||
| 		return -EACCES; | 		return -EACCES; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 	remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 	remount_ro = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); | ||||||
| 
 | 
 | ||||||
| 	if (remount_ro) { | 	if (remount_ro) { | ||||||
| 		if (!hlist_empty(&sb->s_pins)) { | 		if (!hlist_empty(&sb->s_pins)) { | ||||||
|  | @ -831,7 +831,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | ||||||
| 				return 0; | 				return 0; | ||||||
| 			if (sb->s_writers.frozen != SB_UNFROZEN) | 			if (sb->s_writers.frozen != SB_UNFROZEN) | ||||||
| 				return -EBUSY; | 				return -EBUSY; | ||||||
| 			remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 			remount_ro = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	shrink_dcache_sb(sb); | 	shrink_dcache_sb(sb); | ||||||
|  | @ -850,7 +850,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_op->remount_fs) { | 	if (sb->s_op->remount_fs) { | ||||||
| 		retval = sb->s_op->remount_fs(sb, &flags, data); | 		retval = sb->s_op->remount_fs(sb, &sb_flags, data); | ||||||
| 		if (retval) { | 		if (retval) { | ||||||
| 			if (!force) | 			if (!force) | ||||||
| 				goto cancel_readonly; | 				goto cancel_readonly; | ||||||
|  | @ -859,7 +859,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | ||||||
| 			     sb->s_type->name, retval); | 			     sb->s_type->name, retval); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); | 	sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (sb_flags & MS_RMT_MASK); | ||||||
| 	/* Needs to be ordered wrt mnt_is_readonly() */ | 	/* Needs to be ordered wrt mnt_is_readonly() */ | ||||||
| 	smp_wmb(); | 	smp_wmb(); | ||||||
| 	sb->s_readonly_remount = 0; | 	sb->s_readonly_remount = 0; | ||||||
|  | @ -892,12 +892,12 @@ static void do_emergency_remount(struct work_struct *work) | ||||||
| 		sb->s_count++; | 		sb->s_count++; | ||||||
| 		spin_unlock(&sb_lock); | 		spin_unlock(&sb_lock); | ||||||
| 		down_write(&sb->s_umount); | 		down_write(&sb->s_umount); | ||||||
| 		if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) && | 		if (sb->s_root && sb->s_bdev && (sb->s_flags & SB_BORN) && | ||||||
| 		    !(sb->s_flags & MS_RDONLY)) { | 		    !sb_rdonly(sb)) { | ||||||
| 			/*
 | 			/*
 | ||||||
| 			 * What lock protects sb->s_flags?? | 			 * What lock protects sb->s_flags?? | ||||||
| 			 */ | 			 */ | ||||||
| 			do_remount_sb(sb, MS_RDONLY, NULL, 1); | 			do_remount_sb(sb, SB_RDONLY, NULL, 1); | ||||||
| 		} | 		} | ||||||
| 		up_write(&sb->s_umount); | 		up_write(&sb->s_umount); | ||||||
| 		spin_lock(&sb_lock); | 		spin_lock(&sb_lock); | ||||||
|  | @ -1023,7 +1023,7 @@ struct dentry *mount_ns(struct file_system_type *fs_type, | ||||||
| 	/* Don't allow mounting unless the caller has CAP_SYS_ADMIN
 | 	/* Don't allow mounting unless the caller has CAP_SYS_ADMIN
 | ||||||
| 	 * over the namespace. | 	 * over the namespace. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!(flags & MS_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) | 	if (!(flags & SB_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) | ||||||
| 		return ERR_PTR(-EPERM); | 		return ERR_PTR(-EPERM); | ||||||
| 
 | 
 | ||||||
| 	sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, | 	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, | ||||||
| 
 | 
 | ||||||
| 	if (!sb->s_root) { | 	if (!sb->s_root) { | ||||||
| 		int err; | 		int err; | ||||||
| 		err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 		err = fill_super(sb, data, flags & SB_SILENT ? 1 : 0); | ||||||
| 		if (err) { | 		if (err) { | ||||||
| 			deactivate_locked_super(sb); | 			deactivate_locked_super(sb); | ||||||
| 			return ERR_PTR(err); | 			return ERR_PTR(err); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		sb->s_flags |= MS_ACTIVE; | 		sb->s_flags |= SB_ACTIVE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return dget(sb->s_root); | 	return dget(sb->s_root); | ||||||
|  | @ -1071,7 +1071,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | ||||||
| 	fmode_t mode = FMODE_READ | FMODE_EXCL; | 	fmode_t mode = FMODE_READ | FMODE_EXCL; | ||||||
| 	int error = 0; | 	int error = 0; | ||||||
| 
 | 
 | ||||||
| 	if (!(flags & MS_RDONLY)) | 	if (!(flags & SB_RDONLY)) | ||||||
| 		mode |= FMODE_WRITE; | 		mode |= FMODE_WRITE; | ||||||
| 
 | 
 | ||||||
| 	bdev = blkdev_get_by_path(dev_name, mode, fs_type); | 	bdev = blkdev_get_by_path(dev_name, mode, fs_type); | ||||||
|  | @ -1089,14 +1089,14 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | ||||||
| 		error = -EBUSY; | 		error = -EBUSY; | ||||||
| 		goto error_bdev; | 		goto error_bdev; | ||||||
| 	} | 	} | ||||||
| 	s = sget(fs_type, test_bdev_super, set_bdev_super, flags | MS_NOSEC, | 	s = sget(fs_type, test_bdev_super, set_bdev_super, flags | SB_NOSEC, | ||||||
| 		 bdev); | 		 bdev); | ||||||
| 	mutex_unlock(&bdev->bd_fsfreeze_mutex); | 	mutex_unlock(&bdev->bd_fsfreeze_mutex); | ||||||
| 	if (IS_ERR(s)) | 	if (IS_ERR(s)) | ||||||
| 		goto error_s; | 		goto error_s; | ||||||
| 
 | 
 | ||||||
| 	if (s->s_root) { | 	if (s->s_root) { | ||||||
| 		if ((flags ^ s->s_flags) & MS_RDONLY) { | 		if ((flags ^ s->s_flags) & SB_RDONLY) { | ||||||
| 			deactivate_locked_super(s); | 			deactivate_locked_super(s); | ||||||
| 			error = -EBUSY; | 			error = -EBUSY; | ||||||
| 			goto error_bdev; | 			goto error_bdev; | ||||||
|  | @ -1116,13 +1116,13 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | ||||||
| 		s->s_mode = mode; | 		s->s_mode = mode; | ||||||
| 		snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); | 		snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); | ||||||
| 		sb_set_blocksize(s, block_size(bdev)); | 		sb_set_blocksize(s, block_size(bdev)); | ||||||
| 		error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 		error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); | ||||||
| 		if (error) { | 		if (error) { | ||||||
| 			deactivate_locked_super(s); | 			deactivate_locked_super(s); | ||||||
| 			goto error; | 			goto error; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		s->s_flags |= MS_ACTIVE; | 		s->s_flags |= SB_ACTIVE; | ||||||
| 		bdev->bd_super = s; | 		bdev->bd_super = s; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1162,12 +1162,12 @@ struct dentry *mount_nodev(struct file_system_type *fs_type, | ||||||
| 	if (IS_ERR(s)) | 	if (IS_ERR(s)) | ||||||
| 		return ERR_CAST(s); | 		return ERR_CAST(s); | ||||||
| 
 | 
 | ||||||
| 	error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 	error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); | ||||||
| 	if (error) { | 	if (error) { | ||||||
| 		deactivate_locked_super(s); | 		deactivate_locked_super(s); | ||||||
| 		return ERR_PTR(error); | 		return ERR_PTR(error); | ||||||
| 	} | 	} | ||||||
| 	s->s_flags |= MS_ACTIVE; | 	s->s_flags |= SB_ACTIVE; | ||||||
| 	return dget(s->s_root); | 	return dget(s->s_root); | ||||||
| } | } | ||||||
| EXPORT_SYMBOL(mount_nodev); | EXPORT_SYMBOL(mount_nodev); | ||||||
|  | @ -1188,12 +1188,12 @@ struct dentry *mount_single(struct file_system_type *fs_type, | ||||||
| 	if (IS_ERR(s)) | 	if (IS_ERR(s)) | ||||||
| 		return ERR_CAST(s); | 		return ERR_CAST(s); | ||||||
| 	if (!s->s_root) { | 	if (!s->s_root) { | ||||||
| 		error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 		error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); | ||||||
| 		if (error) { | 		if (error) { | ||||||
| 			deactivate_locked_super(s); | 			deactivate_locked_super(s); | ||||||
| 			return ERR_PTR(error); | 			return ERR_PTR(error); | ||||||
| 		} | 		} | ||||||
| 		s->s_flags |= MS_ACTIVE; | 		s->s_flags |= SB_ACTIVE; | ||||||
| 	} else { | 	} else { | ||||||
| 		do_remount_sb(s, flags, data, 0); | 		do_remount_sb(s, flags, data, 0); | ||||||
| 	} | 	} | ||||||
|  | @ -1227,7 +1227,7 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data) | ||||||
| 	sb = root->d_sb; | 	sb = root->d_sb; | ||||||
| 	BUG_ON(!sb); | 	BUG_ON(!sb); | ||||||
| 	WARN_ON(!sb->s_bdi); | 	WARN_ON(!sb->s_bdi); | ||||||
| 	sb->s_flags |= MS_BORN; | 	sb->s_flags |= SB_BORN; | ||||||
| 
 | 
 | ||||||
| 	error = security_sb_kern_mount(sb, flags, secdata); | 	error = security_sb_kern_mount(sb, flags, secdata); | ||||||
| 	if (error) | 	if (error) | ||||||
|  | @ -1434,12 +1434,12 @@ int freeze_super(struct super_block *sb) | ||||||
| 		return -EBUSY; | 		return -EBUSY; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_BORN)) { | 	if (!(sb->s_flags & SB_BORN)) { | ||||||
| 		up_write(&sb->s_umount); | 		up_write(&sb->s_umount); | ||||||
| 		return 0;	/* sic - it's "nothing to do" */ | 		return 0;	/* sic - it's "nothing to do" */ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(sb)) { | ||||||
| 		/* Nothing to do really... */ | 		/* Nothing to do really... */ | ||||||
| 		sb->s_writers.frozen = SB_FREEZE_COMPLETE; | 		sb->s_writers.frozen = SB_FREEZE_COMPLETE; | ||||||
| 		up_write(&sb->s_umount); | 		up_write(&sb->s_umount); | ||||||
|  | @ -1502,7 +1502,7 @@ int thaw_super(struct super_block *sb) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) { | 	if (sb_rdonly(sb)) { | ||||||
| 		sb->s_writers.frozen = SB_UNFROZEN; | 		sb->s_writers.frozen = SB_UNFROZEN; | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ int sync_filesystem(struct super_block *sb) | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * No point in syncing out anything if the filesystem is read-only. | 	 * No point in syncing out anything if the filesystem is read-only. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	ret = __sync_filesystem(sb, 0); | 	ret = __sync_filesystem(sb, 0); | ||||||
|  | @ -69,13 +69,13 @@ EXPORT_SYMBOL(sync_filesystem); | ||||||
| 
 | 
 | ||||||
| static void sync_inodes_one_sb(struct super_block *sb, void *arg) | static void sync_inodes_one_sb(struct super_block *sb, void *arg) | ||||||
| { | { | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		sync_inodes_sb(sb); | 		sync_inodes_sb(sb); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void sync_fs_one_sb(struct super_block *sb, void *arg) | static void sync_fs_one_sb(struct super_block *sb, void *arg) | ||||||
| { | { | ||||||
| 	if (!(sb->s_flags & MS_RDONLY) && sb->s_op->sync_fs) | 	if (!sb_rdonly(sb) && sb->s_op->sync_fs) | ||||||
| 		sb->s_op->sync_fs(sb, *(int *)arg); | 		sb->s_op->sync_fs(sb, *(int *)arg); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -231,7 +231,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb) | ||||||
| Ecount: | Ecount: | ||||||
| 	printk("sysv_count_free_blocks: free block count was %d, " | 	printk("sysv_count_free_blocks: free block count was %d, " | ||||||
| 		"correcting to %d\n", sb_count, count); | 		"correcting to %d\n", sb_count, count); | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		*sbi->s_free_blocks = cpu_to_fs32(sbi, count); | 		*sbi->s_free_blocks = cpu_to_fs32(sbi, count); | ||||||
| 		dirty_sb(sb); | 		dirty_sb(sb); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -220,7 +220,7 @@ unsigned long sysv_count_free_inodes(struct super_block * sb) | ||||||
| 	printk("sysv_count_free_inodes: " | 	printk("sysv_count_free_inodes: " | ||||||
| 		"free inode count was %d, correcting to %d\n", | 		"free inode count was %d, correcting to %d\n", | ||||||
| 		sb_count, count); | 		sb_count, count); | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		*sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count); | 		*sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count); | ||||||
| 		dirty_sb(sb); | 		dirty_sb(sb); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -70,7 +70,7 @@ static void sysv_put_super(struct super_block *sb) | ||||||
| { | { | ||||||
| 	struct sysv_sb_info *sbi = SYSV_SB(sb); | 	struct sysv_sb_info *sbi = SYSV_SB(sb); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		/* XXX ext2 also updates the state here */ | 		/* XXX ext2 also updates the state here */ | ||||||
| 		mark_buffer_dirty(sbi->s_bh1); | 		mark_buffer_dirty(sbi->s_bh1); | ||||||
| 		if (sbi->s_bh1 != sbi->s_bh2) | 		if (sbi->s_bh1 != sbi->s_bh2) | ||||||
|  |  | ||||||
|  | @ -216,7 +216,7 @@ static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh) | ||||||
|  	if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) { |  	if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) { | ||||||
|  		sbi->s_type = FSTYPE_AFS; |  		sbi->s_type = FSTYPE_AFS; | ||||||
| 		sbi->s_forced_ro = 1; | 		sbi->s_forced_ro = 1; | ||||||
|  		if (!(sb->s_flags & MS_RDONLY)) { |  		if (!sb_rdonly(sb)) { | ||||||
|  			printk("SysV FS: SCO EAFS on %s detected, "  |  			printk("SysV FS: SCO EAFS on %s detected, "  | ||||||
|  				"forcing read-only mode.\n",  |  				"forcing read-only mode.\n",  | ||||||
|  				sb->s_id); |  				sb->s_id); | ||||||
|  |  | ||||||
|  | @ -1159,7 +1159,7 @@ static int mount_ubifs(struct ubifs_info *c) | ||||||
| 	long long x, y; | 	long long x, y; | ||||||
| 	size_t sz; | 	size_t sz; | ||||||
| 
 | 
 | ||||||
| 	c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); | 	c->ro_mount = !!sb_rdonly(c->vfs_sb); | ||||||
| 	/* Suppress error messages while probing if MS_SILENT is set */ | 	/* Suppress error messages while probing if MS_SILENT is set */ | ||||||
| 	c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); | 	c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -673,7 +673,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) | ||||||
| 	sbi->s_dmode = uopt.dmode; | 	sbi->s_dmode = uopt.dmode; | ||||||
| 	write_unlock(&sbi->s_cred_lock); | 	write_unlock(&sbi->s_cred_lock); | ||||||
| 
 | 
 | ||||||
| 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 	if ((bool)(*flags & MS_RDONLY) == sb_rdonly(sb)) | ||||||
| 		goto out_unlock; | 		goto out_unlock; | ||||||
| 
 | 
 | ||||||
| 	if (*flags & MS_RDONLY) | 	if (*flags & MS_RDONLY) | ||||||
|  | @ -1017,7 +1017,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, | ||||||
| 
 | 
 | ||||||
| 		fe = udf_iget_special(sb, &addr); | 		fe = udf_iget_special(sb, &addr); | ||||||
| 		if (IS_ERR(fe)) { | 		if (IS_ERR(fe)) { | ||||||
| 			if (sb->s_flags & MS_RDONLY) | 			if (sb_rdonly(sb)) | ||||||
| 				udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); | 				udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); | ||||||
| 			else { | 			else { | ||||||
| 				udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); | 				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) | ||||||
| 		 * writing to it (we overwrite blocks instead of relocating | 		 * writing to it (we overwrite blocks instead of relocating | ||||||
| 		 * them). | 		 * them). | ||||||
| 		 */ | 		 */ | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			ret = -EACCES; | 			ret = -EACCES; | ||||||
| 			goto out_bh; | 			goto out_bh; | ||||||
| 		} | 		} | ||||||
|  | @ -2205,7 +2205,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | ||||||
| 			ret = -EINVAL; | 			ret = -EINVAL; | ||||||
| 			goto error_out; | 			goto error_out; | ||||||
| 		} else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && | 		} else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && | ||||||
| 			   !(sb->s_flags & MS_RDONLY)) { | 			   !sb_rdonly(sb)) { | ||||||
| 			ret = -EACCES; | 			ret = -EACCES; | ||||||
| 			goto error_out; | 			goto error_out; | ||||||
| 		} | 		} | ||||||
|  | @ -2226,7 +2226,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | ||||||
| 
 | 
 | ||||||
| 	if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & | 	if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & | ||||||
| 			UDF_PART_FLAG_READ_ONLY && | 			UDF_PART_FLAG_READ_ONLY && | ||||||
| 	    !(sb->s_flags & MS_RDONLY)) { | 	    !sb_rdonly(sb)) { | ||||||
| 		ret = -EACCES; | 		ret = -EACCES; | ||||||
| 		goto error_out; | 		goto error_out; | ||||||
| 	} | 	} | ||||||
|  | @ -2245,7 +2245,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | ||||||
| 			 le16_to_cpu(ts.year), ts.month, ts.day, | 			 le16_to_cpu(ts.year), ts.month, ts.day, | ||||||
| 			 ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); | 			 ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); | ||||||
| 	} | 	} | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		udf_open_lvid(sb); | 		udf_open_lvid(sb); | ||||||
| 		lvid_open = true; | 		lvid_open = true; | ||||||
| 	} | 	} | ||||||
|  | @ -2332,7 +2332,7 @@ static void udf_put_super(struct super_block *sb) | ||||||
| 	if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) | 	if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) | ||||||
| 		unload_nls(sbi->s_nls_map); | 		unload_nls(sbi->s_nls_map); | ||||||
| #endif | #endif | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		udf_close_lvid(sb); | 		udf_close_lvid(sb); | ||||||
| 	brelse(sbi->s_lvid_bh); | 	brelse(sbi->s_lvid_bh); | ||||||
| 	udf_sb_free_partitions(sb); | 	udf_sb_free_partitions(sb); | ||||||
|  |  | ||||||
|  | @ -278,7 +278,7 @@ void ufs_error (struct super_block * sb, const char * function, | ||||||
| 	uspi = UFS_SB(sb)->s_uspi; | 	uspi = UFS_SB(sb)->s_uspi; | ||||||
| 	usb1 = ubh_get_usb_first(uspi); | 	usb1 = ubh_get_usb_first(uspi); | ||||||
| 	 | 	 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		usb1->fs_clean = UFS_FSBAD; | 		usb1->fs_clean = UFS_FSBAD; | ||||||
| 		ubh_mark_buffer_dirty(USPI_UBH(uspi)); | 		ubh_mark_buffer_dirty(USPI_UBH(uspi)); | ||||||
| 		ufs_mark_sb_dirty(sb); | 		ufs_mark_sb_dirty(sb); | ||||||
|  | @ -312,7 +312,7 @@ void ufs_panic (struct super_block * sb, const char * function, | ||||||
| 	uspi = UFS_SB(sb)->s_uspi; | 	uspi = UFS_SB(sb)->s_uspi; | ||||||
| 	usb1 = ubh_get_usb_first(uspi); | 	usb1 = ubh_get_usb_first(uspi); | ||||||
| 	 | 	 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		usb1->fs_clean = UFS_FSBAD; | 		usb1->fs_clean = UFS_FSBAD; | ||||||
| 		ubh_mark_buffer_dirty(USPI_UBH(uspi)); | 		ubh_mark_buffer_dirty(USPI_UBH(uspi)); | ||||||
| 		ufs_mark_sb_dirty(sb); | 		ufs_mark_sb_dirty(sb); | ||||||
|  | @ -742,7 +742,7 @@ static void ufs_put_super(struct super_block *sb) | ||||||
| 
 | 
 | ||||||
| 	UFSD("ENTER\n"); | 	UFSD("ENTER\n"); | ||||||
| 
 | 
 | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		ufs_put_super_internal(sb); | 		ufs_put_super_internal(sb); | ||||||
| 	cancel_delayed_work_sync(&sbi->sync_work); | 	cancel_delayed_work_sync(&sbi->sync_work); | ||||||
| 
 | 
 | ||||||
|  | @ -793,7 +793,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	UFSD("ENTER\n"); | 	UFSD("ENTER\n"); | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_UFS_FS_WRITE | #ifndef CONFIG_UFS_FS_WRITE | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) { | 	if (!sb_rdonly(sb)) { | ||||||
| 		pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); | 		pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	} | 	} | ||||||
|  | @ -805,7 +805,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	sb->s_fs_info = sbi; | 	sb->s_fs_info = sbi; | ||||||
| 	sbi->sb = sb; | 	sbi->sb = sb; | ||||||
| 
 | 
 | ||||||
| 	UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); | 	UFSD("flag %u\n", (int)(sb_rdonly(sb))); | ||||||
| 	 | 	 | ||||||
| 	mutex_init(&sbi->s_lock); | 	mutex_init(&sbi->s_lock); | ||||||
| 	spin_lock_init(&sbi->work_lock); | 	spin_lock_init(&sbi->work_lock); | ||||||
|  | @ -902,7 +902,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		uspi->s_sbsize = super_block_size = 2048; | 		uspi->s_sbsize = super_block_size = 2048; | ||||||
| 		uspi->s_sbbase = 0; | 		uspi->s_sbbase = 0; | ||||||
| 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!silent) | 			if (!silent) | ||||||
| 				pr_info("ufstype=old is supported read-only\n"); | 				pr_info("ufstype=old is supported read-only\n"); | ||||||
| 			sb->s_flags |= MS_RDONLY; | 			sb->s_flags |= MS_RDONLY; | ||||||
|  | @ -918,7 +918,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		uspi->s_sbbase = 0; | 		uspi->s_sbbase = 0; | ||||||
| 		uspi->s_dirblksize = 1024; | 		uspi->s_dirblksize = 1024; | ||||||
| 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!silent) | 			if (!silent) | ||||||
| 				pr_info("ufstype=nextstep is supported read-only\n"); | 				pr_info("ufstype=nextstep is supported read-only\n"); | ||||||
| 			sb->s_flags |= MS_RDONLY; | 			sb->s_flags |= MS_RDONLY; | ||||||
|  | @ -934,7 +934,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		uspi->s_sbbase = 0; | 		uspi->s_sbbase = 0; | ||||||
| 		uspi->s_dirblksize = 1024; | 		uspi->s_dirblksize = 1024; | ||||||
| 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!silent) | 			if (!silent) | ||||||
| 				pr_info("ufstype=nextstep-cd is supported read-only\n"); | 				pr_info("ufstype=nextstep-cd is supported read-only\n"); | ||||||
| 			sb->s_flags |= MS_RDONLY; | 			sb->s_flags |= MS_RDONLY; | ||||||
|  | @ -950,7 +950,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		uspi->s_sbbase = 0; | 		uspi->s_sbbase = 0; | ||||||
| 		uspi->s_dirblksize = 1024; | 		uspi->s_dirblksize = 1024; | ||||||
| 		flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; | 		flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!silent) | 			if (!silent) | ||||||
| 				pr_info("ufstype=openstep is supported read-only\n"); | 				pr_info("ufstype=openstep is supported read-only\n"); | ||||||
| 			sb->s_flags |= MS_RDONLY; | 			sb->s_flags |= MS_RDONLY; | ||||||
|  | @ -965,7 +965,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 		uspi->s_sbsize = super_block_size = 2048; | 		uspi->s_sbsize = super_block_size = 2048; | ||||||
| 		uspi->s_sbbase = 0; | 		uspi->s_sbbase = 0; | ||||||
| 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | 		flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; | ||||||
| 		if (!(sb->s_flags & MS_RDONLY)) { | 		if (!sb_rdonly(sb)) { | ||||||
| 			if (!silent) | 			if (!silent) | ||||||
| 				pr_info("ufstype=hp is supported read-only\n"); | 				pr_info("ufstype=hp is supported read-only\n"); | ||||||
| 			sb->s_flags |= MS_RDONLY; | 			sb->s_flags |= MS_RDONLY; | ||||||
|  | @ -1273,7 +1273,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Read cylinder group structures | 	 * Read cylinder group structures | ||||||
| 	 */ | 	 */ | ||||||
| 	if (!(sb->s_flags & MS_RDONLY)) | 	if (!sb_rdonly(sb)) | ||||||
| 		if (!ufs_read_cylinder_structures(sb)) | 		if (!ufs_read_cylinder_structures(sb)) | ||||||
| 			goto failed; | 			goto failed; | ||||||
| 
 | 
 | ||||||
|  | @ -1328,7 +1328,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 	if ((bool)(*mount_flags & MS_RDONLY) == sb_rdonly(sb)) { | ||||||
| 		UFS_SB(sb)->s_mount_opt = new_mount_opt; | 		UFS_SB(sb)->s_mount_opt = new_mount_opt; | ||||||
| 		mutex_unlock(&UFS_SB(sb)->s_lock); | 		mutex_unlock(&UFS_SB(sb)->s_lock); | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | @ -125,7 +125,7 @@ xfs_fs_set_info( | ||||||
| 	struct xfs_mount *mp = XFS_M(sb); | 	struct xfs_mount *mp = XFS_M(sb); | ||||||
| 	struct qc_dqblk newlim; | 	struct qc_dqblk newlim; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	if (!XFS_IS_QUOTA_RUNNING(mp)) | 	if (!XFS_IS_QUOTA_RUNNING(mp)) | ||||||
| 		return -ENOSYS; | 		return -ENOSYS; | ||||||
|  | @ -175,7 +175,7 @@ xfs_quota_enable( | ||||||
| { | { | ||||||
| 	struct xfs_mount	*mp = XFS_M(sb); | 	struct xfs_mount	*mp = XFS_M(sb); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	if (!XFS_IS_QUOTA_RUNNING(mp)) | 	if (!XFS_IS_QUOTA_RUNNING(mp)) | ||||||
| 		return -ENOSYS; | 		return -ENOSYS; | ||||||
|  | @ -190,7 +190,7 @@ xfs_quota_disable( | ||||||
| { | { | ||||||
| 	struct xfs_mount	*mp = XFS_M(sb); | 	struct xfs_mount	*mp = XFS_M(sb); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	if (!XFS_IS_QUOTA_RUNNING(mp)) | 	if (!XFS_IS_QUOTA_RUNNING(mp)) | ||||||
| 		return -ENOSYS; | 		return -ENOSYS; | ||||||
|  | @ -208,7 +208,7 @@ xfs_fs_rm_xquota( | ||||||
| 	struct xfs_mount	*mp = XFS_M(sb); | 	struct xfs_mount	*mp = XFS_M(sb); | ||||||
| 	unsigned int		flags = 0; | 	unsigned int		flags = 0; | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 
 | 
 | ||||||
| 	if (XFS_IS_QUOTA_ON(mp)) | 	if (XFS_IS_QUOTA_ON(mp)) | ||||||
|  | @ -279,7 +279,7 @@ xfs_fs_set_dqblk( | ||||||
| { | { | ||||||
| 	struct xfs_mount	*mp = XFS_M(sb); | 	struct xfs_mount	*mp = XFS_M(sb); | ||||||
| 
 | 
 | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		return -EROFS; | 		return -EROFS; | ||||||
| 	if (!XFS_IS_QUOTA_RUNNING(mp)) | 	if (!XFS_IS_QUOTA_RUNNING(mp)) | ||||||
| 		return -ENOSYS; | 		return -ENOSYS; | ||||||
|  |  | ||||||
|  | @ -210,7 +210,7 @@ xfs_parseargs( | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Copy binary VFS mount flags we are interested in. | 	 * Copy binary VFS mount flags we are interested in. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (sb->s_flags & MS_RDONLY) | 	if (sb_rdonly(sb)) | ||||||
| 		mp->m_flags |= XFS_MOUNT_RDONLY; | 		mp->m_flags |= XFS_MOUNT_RDONLY; | ||||||
| 	if (sb->s_flags & MS_DIRSYNC) | 	if (sb->s_flags & MS_DIRSYNC) | ||||||
| 		mp->m_flags |= XFS_MOUNT_DIRSYNC; | 		mp->m_flags |= XFS_MOUNT_DIRSYNC; | ||||||
|  |  | ||||||
|  | @ -1270,6 +1270,33 @@ extern void f_delown(struct file *filp); | ||||||
| extern pid_t f_getown(struct file *filp); | extern pid_t f_getown(struct file *filp); | ||||||
| extern int send_sigurg(struct fown_struct *fown); | extern int send_sigurg(struct fown_struct *fown); | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * sb->s_flags.  Note that these mirror the equivalent MS_* flags where | ||||||
|  |  * represented in both. | ||||||
|  |  */ | ||||||
|  | #define SB_RDONLY	 1	/* Mount read-only */ | ||||||
|  | #define SB_NOSUID	 2	/* Ignore suid and sgid bits */ | ||||||
|  | #define SB_NODEV	 4	/* Disallow access to device special files */ | ||||||
|  | #define SB_NOEXEC	 8	/* Disallow program execution */ | ||||||
|  | #define SB_SYNCHRONOUS	16	/* Writes are synced at once */ | ||||||
|  | #define SB_MANDLOCK	64	/* Allow mandatory locks on an FS */ | ||||||
|  | #define SB_DIRSYNC	128	/* Directory modifications are synchronous */ | ||||||
|  | #define SB_NOATIME	1024	/* Do not update access times. */ | ||||||
|  | #define SB_NODIRATIME	2048	/* Do not update directory access times */ | ||||||
|  | #define SB_SILENT	32768 | ||||||
|  | #define SB_POSIXACL	(1<<16)	/* VFS does not apply the umask */ | ||||||
|  | #define SB_KERNMOUNT	(1<<22) /* this is a kern_mount call */ | ||||||
|  | #define SB_I_VERSION	(1<<23) /* Update inode I_version field */ | ||||||
|  | #define SB_LAZYTIME	(1<<25) /* Update the on-disk [acm]times lazily */ | ||||||
|  | 
 | ||||||
|  | /* These sb flags are internal to the kernel */ | ||||||
|  | #define SB_SUBMOUNT     (1<<26) | ||||||
|  | #define SB_NOREMOTELOCK	(1<<27) | ||||||
|  | #define SB_NOSEC	(1<<28) | ||||||
|  | #define SB_BORN		(1<<29) | ||||||
|  | #define SB_ACTIVE	(1<<30) | ||||||
|  | #define SB_NOUSER	(1<<31) | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  *	Umount options |  *	Umount options | ||||||
|  */ |  */ | ||||||
|  | @ -1833,7 +1860,7 @@ struct super_operations { | ||||||
|  * possible to override it selectively if you really wanted to with some |  * possible to override it selectively if you really wanted to with some | ||||||
|  * ioctl() that is not currently implemented. |  * ioctl() that is not currently implemented. | ||||||
|  * |  * | ||||||
|  * Exception: MS_RDONLY is always applied to the entire file system. |  * Exception: SB_RDONLY is always applied to the entire file system. | ||||||
|  * |  * | ||||||
|  * Unfortunately, it is possible to change a filesystems flags with it mounted |  * Unfortunately, it is possible to change a filesystems flags with it mounted | ||||||
|  * with files in use.  This means that all of the inodes will not have their |  * with files in use.  This means that all of the inodes will not have their | ||||||
|  | @ -1842,19 +1869,20 @@ struct super_operations { | ||||||
|  */ |  */ | ||||||
| #define __IS_FLG(inode, flg)	((inode)->i_sb->s_flags & (flg)) | #define __IS_FLG(inode, flg)	((inode)->i_sb->s_flags & (flg)) | ||||||
| 
 | 
 | ||||||
| #define IS_RDONLY(inode)	((inode)->i_sb->s_flags & MS_RDONLY) | static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & MS_RDONLY; } | ||||||
| #define IS_SYNC(inode)		(__IS_FLG(inode, MS_SYNCHRONOUS) || \ | #define IS_RDONLY(inode)	sb_rdonly((inode)->i_sb) | ||||||
|  | #define IS_SYNC(inode)		(__IS_FLG(inode, SB_SYNCHRONOUS) || \ | ||||||
| 					((inode)->i_flags & S_SYNC)) | 					((inode)->i_flags & S_SYNC)) | ||||||
| #define IS_DIRSYNC(inode)	(__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ | #define IS_DIRSYNC(inode)	(__IS_FLG(inode, SB_SYNCHRONOUS|SB_DIRSYNC) || \ | ||||||
| 					((inode)->i_flags & (S_SYNC|S_DIRSYNC))) | 					((inode)->i_flags & (S_SYNC|S_DIRSYNC))) | ||||||
| #define IS_MANDLOCK(inode)	__IS_FLG(inode, MS_MANDLOCK) | #define IS_MANDLOCK(inode)	__IS_FLG(inode, SB_MANDLOCK) | ||||||
| #define IS_NOATIME(inode)	__IS_FLG(inode, MS_RDONLY|MS_NOATIME) | #define IS_NOATIME(inode)	__IS_FLG(inode, SB_RDONLY|SB_NOATIME) | ||||||
| #define IS_I_VERSION(inode)	__IS_FLG(inode, MS_I_VERSION) | #define IS_I_VERSION(inode)	__IS_FLG(inode, SB_I_VERSION) | ||||||
| 
 | 
 | ||||||
| #define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA) | #define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA) | ||||||
| #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND) | #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND) | ||||||
| #define IS_IMMUTABLE(inode)	((inode)->i_flags & S_IMMUTABLE) | #define IS_IMMUTABLE(inode)	((inode)->i_flags & S_IMMUTABLE) | ||||||
| #define IS_POSIXACL(inode)	__IS_FLG(inode, MS_POSIXACL) | #define IS_POSIXACL(inode)	__IS_FLG(inode, SB_POSIXACL) | ||||||
| 
 | 
 | ||||||
| #define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD) | #define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD) | ||||||
| #define IS_NOCMTIME(inode)	((inode)->i_flags & S_NOCMTIME) | #define IS_NOCMTIME(inode)	((inode)->i_flags & S_NOCMTIME) | ||||||
|  | @ -2175,7 +2203,7 @@ static inline int __mandatory_lock(struct inode *ino) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * ... and these candidates should be on MS_MANDLOCK mounted fs, |  * ... and these candidates should be on SB_MANDLOCK mounted fs, | ||||||
|  * otherwise these will be advisory locks |  * otherwise these will be advisory locks | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | @ -3291,7 +3319,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode) | ||||||
| 
 | 
 | ||||||
| static inline void inode_has_no_xattr(struct inode *inode) | static inline void inode_has_no_xattr(struct inode *inode) | ||||||
| { | { | ||||||
| 	if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) | 	if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & SB_NOSEC)) | ||||||
| 		inode->i_flags |= S_NOSEC; | 		inode->i_flags |= S_NOSEC; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -373,7 +373,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data) | ||||||
| 	printk(KERN_INFO | 	printk(KERN_INFO | ||||||
| 	       "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", | 	       "VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", | ||||||
| 	       s->s_type->name, | 	       s->s_type->name, | ||||||
| 	       s->s_flags & MS_RDONLY ?  " readonly" : "", | 	       sb_rdonly(s) ? " readonly" : "", | ||||||
| 	       MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); | 	       MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -420,8 +420,8 @@ void __init mount_block_root(char *name, int flags) | ||||||
| #endif | #endif | ||||||
| 		panic("VFS: Unable to mount root fs on %s", b); | 		panic("VFS: Unable to mount root fs on %s", b); | ||||||
| 	} | 	} | ||||||
| 	if (!(flags & MS_RDONLY)) { | 	if (!(flags & SB_RDONLY)) { | ||||||
| 		flags |= MS_RDONLY; | 		flags |= SB_RDONLY; | ||||||
| 		goto retry; | 		goto retry; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Linus Torvalds
						Linus Torvalds