summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-11 18:40:08 +0200
committerDavid Sterba <dsterba@suse.com>2016-05-06 15:22:49 +0200
commitc03d01f3404282712b9fd280297f133860c91c93 (patch)
treec07d38ccd656a1d4e380642e8207d7a0fbbaecab /fs/btrfs/send.c
parente55d1153dbf48485a74eb4bf4eefeaedcf1486a9 (diff)
downloadlinux-c03d01f3404282712b9fd280297f133860c91c93.tar.bz2
btrfs: send: use vmalloc only as fallback for clone_roots
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 4f85a47c2f55..5a5d37b37150 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6053,10 +6053,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
alloc_size = sizeof(struct clone_root) * (arg->clone_sources_count + 1);
- sctx->clone_roots = vzalloc(alloc_size);
+ sctx->clone_roots = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN);
if (!sctx->clone_roots) {
- ret = -ENOMEM;
- goto out;
+ sctx->clone_roots = vzalloc(alloc_size);
+ if (!sctx->clone_roots) {
+ ret = -ENOMEM;
+ goto out;
+ }
}
alloc_size = arg->clone_sources_count * sizeof(*arg->clone_sources);
@@ -6227,7 +6230,7 @@ out:
if (sctx->send_filp)
fput(sctx->send_filp);
- vfree(sctx->clone_roots);
+ kvfree(sctx->clone_roots);
kvfree(sctx->send_buf);
kvfree(sctx->read_buf);