summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-11 19:40:08 +0300
committerDavid Sterba <dsterba@suse.com>2016-05-06 16:22:49 +0300
commit6ff48ce06b07255a6459cd8b816a110971a81f00 (patch)
treefdc345c80afdd3a45d603b7b2d42c3a0ecc18a82 /fs
parent779bf3fefa835cb52a07457c8acac6f2f66f2493 (diff)
downloadlinux-6ff48ce06b07255a6459cd8b816a110971a81f00.tar.xz
btrfs: send: use vmalloc only as fallback for send_buf
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-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 ec433795fa71..b6e2c6ec4ee5 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6028,10 +6028,13 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
sctx->clone_roots_cnt = arg->clone_sources_count;
sctx->send_max_size = BTRFS_SEND_BUF_SIZE;
- sctx->send_buf = vmalloc(sctx->send_max_size);
+ sctx->send_buf = kmalloc(sctx->send_max_size, GFP_KERNEL | __GFP_NOWARN);
if (!sctx->send_buf) {
- ret = -ENOMEM;
- goto out;
+ sctx->send_buf = vmalloc(sctx->send_max_size);
+ if (!sctx->send_buf) {
+ ret = -ENOMEM;
+ goto out;
+ }
}
sctx->read_buf = vmalloc(BTRFS_SEND_READ_SIZE);
@@ -6220,7 +6223,7 @@ out:
fput(sctx->send_filp);
vfree(sctx->clone_roots);
- vfree(sctx->send_buf);
+ kvfree(sctx->send_buf);
vfree(sctx->read_buf);
name_cache_free(sctx);