diff options
author | David Sterba <dsterba@suse.com> | 2016-04-11 18:40:08 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-06 15:22:49 +0200 |
commit | 2f91306a37809907474a06c1defdb1ff50be06f0 (patch) | |
tree | d664fac63693e9cfe2fbe5339ec62eb3d4bc7fdb /fs/btrfs/send.c | |
parent | c03d01f3404282712b9fd280297f133860c91c93 (diff) |
btrfs: send: use vmalloc only as fallback for clone_sources_tmp
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 5a5d37b37150..6a8c86074aa4 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -6065,10 +6065,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) alloc_size = arg->clone_sources_count * sizeof(*arg->clone_sources); if (arg->clone_sources_count) { - clone_sources_tmp = vmalloc(alloc_size); + clone_sources_tmp = kmalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN); if (!clone_sources_tmp) { - ret = -ENOMEM; - goto out; + clone_sources_tmp = vmalloc(alloc_size); + if (!clone_sources_tmp) { + ret = -ENOMEM; + goto out; + } } ret = copy_from_user(clone_sources_tmp, arg->clone_sources, @@ -6106,7 +6109,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) sctx->clone_roots[i].root = clone_root; clone_sources_to_rollback = i + 1; } - vfree(clone_sources_tmp); + kvfree(clone_sources_tmp); clone_sources_tmp = NULL; } @@ -6224,7 +6227,7 @@ out: btrfs_root_dec_send_in_progress(sctx->parent_root); kfree(arg); - vfree(clone_sources_tmp); + kvfree(clone_sources_tmp); if (sctx) { if (sctx->send_filp) |