]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
btrfs: Remove userspace transaction ioctls
authorNikolay Borisov <nborisov@suse.com>
Mon, 5 Feb 2018 08:41:13 +0000 (10:41 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Mar 2018 23:26:51 +0000 (01:26 +0200)
Commit 3558d4f88ec8 ("btrfs: Deprecate userspace transaction ioctls")
marked the beginning of the end of userspace transaction. This commit
finishes the job! There are no known users and ceph does not use the
ioctl anymore.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Acked-by: Sage Weil <sage@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/file.c
fs/btrfs/ioctl.c

index 15bf111cd5c5d4156923e4c1f54aef6c043a1458..f2396a13c0c23f0516f37efe197908293fa2078a 100644 (file)
@@ -3207,7 +3207,6 @@ void btrfs_destroy_inode(struct inode *inode);
 int btrfs_drop_inode(struct inode *inode);
 int __init btrfs_init_cachep(void);
 void __cold btrfs_destroy_cachep(void);
-long btrfs_ioctl_trans_end(struct file *file);
 struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
                         struct btrfs_root *root, int *was_new);
 struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
index 8cac40005e6c43cef43ecd94520565d76b99ed7a..6d878f1d1082ae5a9c88473d6b133194a483ac9d 100644 (file)
@@ -1997,8 +1997,6 @@ int btrfs_release_file(struct inode *inode, struct file *filp)
 {
        struct btrfs_file_private *private = filp->private_data;
 
-       if (private && private->trans)
-               btrfs_ioctl_trans_end(filp);
        if (private && private->filldir_buf)
                kfree(private->filldir_buf);
        kfree(private);
@@ -2189,12 +2187,6 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
                goto out;
        }
 
-       /*
-        * ok we haven't committed the transaction yet, lets do a commit
-        */
-       if (file->private_data)
-               btrfs_ioctl_trans_end(file);
-
        /*
         * We use start here because we will need to wait on the IO to complete
         * in btrfs_sync_log, which could require joining a transaction (for
index ba403c00982c73123e8a7e62439e5e1ecd9d9cc3..5011b6272cfa59efcf661f7becda13787d937db8 100644 (file)
@@ -3936,73 +3936,6 @@ int btrfs_clone_file_range(struct file *src_file, loff_t off,
        return btrfs_clone_files(dst_file, src_file, off, len, destoff);
 }
 
-/*
- * there are many ways the trans_start and trans_end ioctls can lead
- * to deadlocks.  They should only be used by applications that
- * basically own the machine, and have a very in depth understanding
- * of all the possible deadlocks and enospc problems.
- */
-static long btrfs_ioctl_trans_start(struct file *file)
-{
-       struct inode *inode = file_inode(file);
-       struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-       struct btrfs_root *root = BTRFS_I(inode)->root;
-       struct btrfs_trans_handle *trans;
-       struct btrfs_file_private *private;
-       int ret;
-       static bool warned = false;
-
-       ret = -EPERM;
-       if (!capable(CAP_SYS_ADMIN))
-               goto out;
-
-       if (!warned) {
-               btrfs_warn(fs_info,
-                       "Userspace transaction mechanism is considered "
-                       "deprecated and slated to be removed in 4.17. "
-                       "If you have a valid use case please "
-                       "speak up on the mailing list");
-               WARN_ON(1);
-               warned = true;
-       }
-
-       ret = -EINPROGRESS;
-       private = file->private_data;
-       if (private && private->trans)
-               goto out;
-       if (!private) {
-               private = kzalloc(sizeof(struct btrfs_file_private),
-                                 GFP_KERNEL);
-               if (!private)
-                       return -ENOMEM;
-               file->private_data = private;
-       }
-
-       ret = -EROFS;
-       if (btrfs_root_readonly(root))
-               goto out;
-
-       ret = mnt_want_write_file(file);
-       if (ret)
-               goto out;
-
-       atomic_inc(&fs_info->open_ioctl_trans);
-
-       ret = -ENOMEM;
-       trans = btrfs_start_ioctl_transaction(root);
-       if (IS_ERR(trans))
-               goto out_drop;
-
-       private->trans = trans;
-       return 0;
-
-out_drop:
-       atomic_dec(&fs_info->open_ioctl_trans);
-       mnt_drop_write_file(file);
-out:
-       return ret;
-}
-
 static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 {
        struct inode *inode = file_inode(file);
@@ -4244,30 +4177,6 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
        return ret;
 }
 
-/*
- * there are many ways the trans_start and trans_end ioctls can lead
- * to deadlocks.  They should only be used by applications that
- * basically own the machine, and have a very in depth understanding
- * of all the possible deadlocks and enospc problems.
- */
-long btrfs_ioctl_trans_end(struct file *file)
-{
-       struct inode *inode = file_inode(file);
-       struct btrfs_root *root = BTRFS_I(inode)->root;
-       struct btrfs_file_private *private = file->private_data;
-
-       if (!private || !private->trans)
-               return -EINVAL;
-
-       btrfs_end_transaction(private->trans);
-       private->trans = NULL;
-
-       atomic_dec(&root->fs_info->open_ioctl_trans);
-
-       mnt_drop_write_file(file);
-       return 0;
-}
-
 static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root,
                                            void __user *argp)
 {
@@ -5575,10 +5484,6 @@ long btrfs_ioctl(struct file *file, unsigned int
                return btrfs_ioctl_dev_info(fs_info, argp);
        case BTRFS_IOC_BALANCE:
                return btrfs_ioctl_balance(file, NULL);
-       case BTRFS_IOC_TRANS_START:
-               return btrfs_ioctl_trans_start(file);
-       case BTRFS_IOC_TRANS_END:
-               return btrfs_ioctl_trans_end(file);
        case BTRFS_IOC_TREE_SEARCH:
                return btrfs_ioctl_tree_search(file, argp);
        case BTRFS_IOC_TREE_SEARCH_V2: