From patchwork Fri Jun 1 13:04:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBB90602BC for ; Fri, 1 Jun 2018 13:05:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE4A5289AE for ; Fri, 1 Jun 2018 13:05:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D326128D7B; Fri, 1 Jun 2018 13:05:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A342289AE for ; Fri, 1 Jun 2018 13:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbeFANFY (ORCPT ); Fri, 1 Jun 2018 09:05:24 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:42415 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbeFANFP (ORCPT ); Fri, 1 Jun 2018 09:05:15 -0400 Received: by mail-lf0-f51.google.com with SMTP id v135-v6so14745119lfa.9 for ; Fri, 01 Jun 2018 06:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZyHGm7+QJ+CWCENusb8S3y+WIBolnux4a6tdW0cHgHA=; b=TEAudmb7t7i5iiDyf7awvWDnJcauQE4anh4mtbxIAvpyoiKObmCDuEXeLMugNsWg0m CyntU0QfQ8p+BXTfPuvYGU+svm5G1LNCbDBw9wmB78DWkD2YSfUv1EBXj8GtyIiEwuig VwnYG8UWeWrZs2UNUyRzR6Cfquevput40vb+w6mHVbanqD/J7EjLJTDb0SicQ6vVZ6xI XAxtdkmqmgDcn/PTXTJHkVAuNNBakID1htYQbG3w7rGymGJnllP3DhM2Ul0Vgds+9rxB HJnxdwfs88dz+ADKaPIojwEk3ioF7Rb3ck1IpNyJD+1U26Xa+5HS4su8VDIIZ5eBxA5Q O79A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZyHGm7+QJ+CWCENusb8S3y+WIBolnux4a6tdW0cHgHA=; b=PzQ+ClFcXW/53TKvjNiwy6QUbVIqgoW7TIM/56D0zG3ZpeAfkPlqx6AZeuTi8Z/PTV Cmsy8Xs8yZUlCfWrbQhaMBQqD4WKhhJFitymkof0jZJI/PhfdSlbOxUbQ3CpbQ3YFUd+ bovTqeWW1qnYAOKulUBbHEYtqoMaO1FbbcQaNmCOKgaEkdQNstmDue9gml7qaNoKwSuR d+Cv/S6bK6U8x3HWOggNMgeIfZtMInSHL+nfP3io8MQNhwp+F4pRRgXZegnQxet5Of1T iSnYkC1KR3yHAuk2hX0P4/MU1ygMj6ujSULAEJQITJ6tfjEuuo+F3qj74mz3b5+AW78P Qy6g== X-Gm-Message-State: ALKqPwfWAHDejOTXhkORj1ax1tUFuUXMpt/4FAuglpRpZsDMidPSIBzJ 6P1qCGg4KMLHACnQej4lqoUB7A== X-Google-Smtp-Source: ADUXVKLXsuqO0322ZoT0y8ofANCEI5yV/dQCyzLqWEu23nXkf8fGT8qqrWLvuPa3PRW8IC7CvmjI+Q== X-Received: by 2002:a2e:80c1:: with SMTP id r1-v6mr8535273ljg.85.1527858313823; Fri, 01 Jun 2018 06:05:13 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id g5-v6sm303161lje.21.2018.06.01.06.05.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 06:05:12 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, javier@cnexlabs.com, igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 16/18] lightnvm: fix partial read error path Date: Fri, 1 Jun 2018 15:04:30 +0200 Message-Id: <20180601130432.30866-17-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601130432.30866-1-mb@lightnvm.io> References: <20180601130432.30866-1-mb@lightnvm.io> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Konopko When error occurs during bio_add_page on partial read path, pblk tries to free pages twice. Signed-off-by: Igor Konopko Signed-off-by: Marcin Dziegielewski Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-read.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index a2e678de428f..fa7b60f852d9 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -256,7 +256,7 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd, new_bio = bio_alloc(GFP_KERNEL, nr_holes); if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes)) - goto err; + goto err_add_pages; if (nr_holes != new_bio->bi_vcnt) { pr_err("pblk: malformed bio\n"); @@ -347,10 +347,10 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd, return NVM_IO_OK; err: - pr_err("pblk: failed to perform partial read\n"); - /* Free allocated pages in new bio */ - pblk_bio_free_pages(pblk, bio, 0, new_bio->bi_vcnt); + pblk_bio_free_pages(pblk, new_bio, 0, new_bio->bi_vcnt); +err_add_pages: + pr_err("pblk: failed to perform partial read\n"); __pblk_end_io_read(pblk, rqd, false); return NVM_IO_ERR; }