Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp27166pxu; Tue, 1 Dec 2020 05:26:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdD+enndDw+YcN4jm3/Y3ip4kMUvg0iNai5gPJm+nBLrEAQGuQYN6kCnheJx7zzQfrNNsE X-Received: by 2002:aa7:cb02:: with SMTP id s2mr2950137edt.211.1606829204809; Tue, 01 Dec 2020 05:26:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606829204; cv=none; d=google.com; s=arc-20160816; b=ezhPgUaA5Z9H/sttj4W3sS2AfBvtUGNhDu94+LPyDOj1dsaZixQmFduBt3fwcYUzMD L+en8kE+fsL0brkqs2hiOXrKFaj8JnuOZJSMcC4GlMtMk+gyH1Gu0H32trPTKVHud+k4 iWnkYljZWB5Vbo9hbDQUDfFgsZDA/c8W2M3KS63qeg/fkRCgE7Nzn7xB5wTz1ZRQsGzP lApx8mllDdQx+AO6XWe0q9e4eITGCn5w1xchrPVLv3EJVXYCfsXQbKFSTTW79VLFEBo5 8ils18JamyUmptRTuwlsV7emlObVM5YCx4sAYVTlF/ZwmyrDAGvINBWy/169OfRTJlXi sgBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=uADe8pIjhPSuCRhZ6wL+nTegabcP2vd7po21w3/KsKc=; b=dGC8U6EPRdIeDhGmkPgePhJPrsfyELnsasSZRCbPlEOBgG09h3fmTWMXxYxxXYV9XK j8KLpvGeiRdsUapF4OLEpEc92z1vm9omHRK0IatQ9HQXtg8GCCmD414+4ND9SDGYgfUP mytKANpL8TKjC0qiFJq+DAuNMxeFU97sWRO4TwoOW0ToDsuaLHFyP5L6ozEbiGrvepbW ogh4rF1AX9V5D7HtaBrHru3csRPltEZPL1n/RT2UlVfQU3CSssgQz3HTVpXVTo3wDGDk mbp+GrCFBteRvV+TiCHE4heukHq4fnqYKKhdKQ/SqEYnmOYNfn/sFJbsZiw/LhjImCp3 9t6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=omjzs4OI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si913530ejk.164.2020.12.01.05.26.22; Tue, 01 Dec 2020 05:26:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=omjzs4OI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403764AbgLANXY (ORCPT + 99 others); Tue, 1 Dec 2020 08:23:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387439AbgLANXY (ORCPT ); Tue, 1 Dec 2020 08:23:24 -0500 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBB3CC0613CF; Tue, 1 Dec 2020 05:22:43 -0800 (PST) Received: by mail-ej1-x644.google.com with SMTP id lt17so4069712ejb.3; Tue, 01 Dec 2020 05:22:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uADe8pIjhPSuCRhZ6wL+nTegabcP2vd7po21w3/KsKc=; b=omjzs4OIh0H0sHYUNmwiXYUGGpzCAAS6J/sItDiufcNI3jka57fonKBcXPHYZ7EC3w AqLZcIzbTeNVW0c2I3+JFfvc8LbaA+N3OSA5kU5bLEsXHk7ey8xXeITb4y8BDGmkSuEX hnhkY9dSxfZLgLIQnczOR5S5HMKm+X7Jv0afzHvs4nlyr69ybrpO7EVWh6s6RZgB6Mkn lYmSW2uOOaAeRQOm0KA1q31X9cNYK3/WEn63GNDPTPmca1DLBuO2Blex+UBkVzSy+0K6 4Qu2amZVXcEhnwiECDLa3n03Q3H8ZM/P0xJKQl1pedcKaAHTPsyAzDhlUOPYREoTmZhq HEXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uADe8pIjhPSuCRhZ6wL+nTegabcP2vd7po21w3/KsKc=; b=He2rSKGBQeFPu0KqEoMcq2WddMQV9p2cfLqkjK8DzIkwPpadwUhXRsPyHKAdVAwKAB plkcwt2NuixdrpLmgCqMvUvcTU+GNehHaVzUZDL3ktF2ztHAl8Gud063KvVmpZyOdZjq yOXAYnTyKAh6RiL1OTt/fcl9ztjm6nvEX7p4Fl0k6LD2R5A7Lnn7FlgVB1BXfia7Wmmy BeGtEfMWUVce2K5dNL6rPj0Ll0W1/qqGfi7Kfe3+7ekHHWsYkC+RmUGpZBnf6akb0g8L Wefo9e7xDBQorurw7Q3E73ASbAYO0fnFKtTWD7Sl5WbutgNHEzvO3krcEkPw3lNbStPC 6Frw== X-Gm-Message-State: AOAM533vzThRWXU0145afIoblfXijkrlesvBCKzQnRvVVZqrNXjaD1rD oGy4+ILG0lRlRHPcBl6dYEJwuyAKOm2MLMIkTPU= X-Received: by 2002:a17:906:68d1:: with SMTP id y17mr2997597ejr.447.1606828962469; Tue, 01 Dec 2020 05:22:42 -0800 (PST) MIME-Version: 1.0 References: <20201201053949.143175-1-selvakuma.s1@samsung.com> <20201201053949.143175-2-selvakuma.s1@samsung.com> <942255077c7caf5a2b1983570e30c3bf06410f62.camel@mail.ru> In-Reply-To: <942255077c7caf5a2b1983570e30c3bf06410f62.camel@mail.ru> From: Selva Jove Date: Tue, 1 Dec 2020 18:52:28 +0530 Message-ID: Subject: Re: [RFC PATCH 1/2] block: add simple copy support To: Aleksei Marov Cc: SelvaKumar S , linux-nvme@lists.infradead.org, kbusch@kernel.org, axboe@kernel.dk, Damien Le Moal , hch@lst.de, sagi@grimberg.me, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, nj.shetty@samsung.com, joshi.k@samsung.com, javier.gonz@samsung.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for reporting the memory leak. Will add a fix. On Tue, Dec 1, 2020 at 3:58 PM Aleksei Marov wrote: > > On Tue, 2020-12-01 at 11:09 +0530, SelvaKumar S wrote: > > + ret = __blkdev_issue_copy(bdev, dest, nr_srcs, rlist, gfp_mask, flags, > > + &bio); > > + if (!ret && bio) { > > + ret = submit_bio_wait(bio); > > + if (ret == -EOPNOTSUPP) > > + ret = 0; > > + > > + kfree(page_address(bio_first_bvec_all(bio)->bv_page) + > > + bio_first_bvec_all(bio)->bv_offset); > > + bio_put(bio); > > + } > > + > > + return ret; > > +} > I think there is an issue here that if bio_add_page returns error in > __blkdev_issue_copy then ret is -ENOMEM and we never do bio_put for bio > allocated in __blkdev_issue_copy so it is small memory leak. > >