提交 768e9dfe 编写于 作者: L Liu Bo 提交者: Chris Mason

Btrfs: remove redundant r/o check for superblock

mnt_want_write() and mnt_want_write_file() will check sb->s_flags with
MS_RDONLY, and we don't need to do it ourselves.
Signed-off-by: NLiu Bo <liubo2009@cn.fujitsu.com>
上级 a874a63e
...@@ -1381,14 +1381,10 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file, ...@@ -1381,14 +1381,10 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
u64 *transid, u64 *transid,
bool readonly) bool readonly)
{ {
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
struct file *src_file; struct file *src_file;
int namelen; int namelen;
int ret = 0; int ret = 0;
if (root->fs_info->sb->s_flags & MS_RDONLY)
return -EROFS;
ret = mnt_want_write_file(file); ret = mnt_want_write_file(file);
if (ret) if (ret)
goto out; goto out;
...@@ -3269,9 +3265,6 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) ...@@ -3269,9 +3265,6 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (fs_info->sb->s_flags & MS_RDONLY)
return -EROFS;
ret = mnt_want_write(file->f_path.mnt); ret = mnt_want_write(file->f_path.mnt);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册