From patchwork Mon Apr 11 17:31:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 8804781 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 876DD9F3D1 for ; Mon, 11 Apr 2016 17:35:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD37B202AE for ; Mon, 11 Apr 2016 17:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D82232028D for ; Mon, 11 Apr 2016 17:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753542AbcDKRfU (ORCPT ); Mon, 11 Apr 2016 13:35:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:55539 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbcDKRfR (ORCPT ); Mon, 11 Apr 2016 13:35:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7F35FAC89 for ; Mon, 11 Apr 2016 17:35:15 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id E2420DAB68; Mon, 11 Apr 2016 19:31:40 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 4/6] btrfs: send: use vmalloc only as fallback for clone_roots Date: Mon, 11 Apr 2016 19:31:40 +0200 Message-Id: <2ea3965276a002936e1fb75ae8af51da384d705a.1460394967.git.dsterba@suse.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: David Sterba --- fs/btrfs/send.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index ab1b4d259836..02967374d0d9 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -6047,10 +6047,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); @@ -6221,7 +6224,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) if (sctx->send_filp) fput(sctx->send_filp); - vfree(sctx->clone_roots); + kvfree(sctx->clone_roots); kvfree(sctx->send_buf); kvfree(sctx->read_buf);