summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-ioctl.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-06-30 16:35:37 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2022-10-14 04:59:38 -0400
commit29f20baecf850c6381a48ceb57dcefac8e15bd5b (patch)
tree0436e075bd8499e67ae70887e3b7b1ee6f823394 /fs/bcachefs/fs-ioctl.c
parentd91a7b6ebca99e6140c913038614f153bc4d4610 (diff)
bcachefs: Fixes for 4.19bcachefs-v4.19-backport-2.0
Diffstat (limited to 'fs/bcachefs/fs-ioctl.c')
-rw-r--r--fs/bcachefs/fs-ioctl.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index 2bb680827b44..2ff9e344e2d6 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -93,7 +93,7 @@ static int bch2_ioc_setflags(struct bch_fs *c,
return ret;
inode_lock(&inode->v);
- if (!inode_owner_or_capable(file_mnt_user_ns(file), &inode->v)) {
+ if (!inode_owner_or_capable(&inode->v)) {
ret = -EACCES;
goto setflags_out;
}
@@ -172,7 +172,7 @@ static int bch2_ioc_fssetxattr(struct bch_fs *c,
return ret;
inode_lock(&inode->v);
- if (!inode_owner_or_capable(file_mnt_user_ns(file), &inode->v)) {
+ if (!inode_owner_or_capable(&inode->v)) {
ret = -EACCES;
goto err;
}
@@ -284,20 +284,22 @@ static int bch2_ioc_goingdown(struct bch_fs *c, u32 __user *arg)
down_write(&c->vfs_sb->s_umount);
switch (flags) {
- case FSOP_GOING_FLAGS_DEFAULT:
- ret = freeze_bdev(c->vfs_sb->s_bdev);
+ case FSOP_GOING_FLAGS_DEFAULT: {
+ struct super_block *sb = freeze_bdev(c->vfs_sb->s_bdev);
if (ret)
goto err;
- bch2_journal_flush(&c->journal);
- c->vfs_sb->s_flags |= SB_RDONLY;
- bch2_fs_emergency_read_only(c);
- thaw_bdev(c->vfs_sb->s_bdev);
+ if (sb && !IS_ERR(sb)) {
+ bch2_journal_flush(&c->journal);
+ c->vfs_sb->s_flags |= SB_RDONLY;
+ bch2_fs_emergency_read_only(c);
+ thaw_bdev(c->vfs_sb->s_bdev, sb);
+ }
break;
+ }
case FSOP_GOING_FLAGS_LOGFLUSH:
bch2_journal_flush(&c->journal);
- fallthrough;
case FSOP_GOING_FLAGS_NOLOGFLUSH:
c->vfs_sb->s_flags |= SB_RDONLY;
@@ -393,8 +395,7 @@ retry:
goto err3;
}
- error = inode_permission(file_mnt_user_ns(filp),
- dir, MAY_WRITE | MAY_EXEC);
+ error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
if (error)
goto err3;
@@ -409,7 +410,7 @@ retry:
!arg.src_ptr)
snapshot_src.subvol = to_bch_ei(dir)->ei_inode.bi_subvol;
- inode = __bch2_create(file_mnt_user_ns(filp), to_bch_ei(dir),
+ inode = __bch2_create(NULL, to_bch_ei(dir),
dst_dentry, arg.mode|S_IFDIR,
0, snapshot_src, create_flags);
error = PTR_ERR_OR_ZERO(inode);
@@ -458,10 +459,8 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
dir = path.dentry->d_parent->d_inode;
ret = __bch2_unlink(dir, path.dentry, true);
- if (!ret) {
- fsnotify_rmdir(dir, path.dentry);
+ if (!ret)
d_delete(path.dentry);
- }
path_put(&path);
return ret;