From patchwork Mon May 28 08:58:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10430131 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 0F7E3602CC for ; Mon, 28 May 2018 09:02:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F406628AD9 for ; Mon, 28 May 2018 09:02:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E754F28BDC; Mon, 28 May 2018 09:02:51 +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 8ECE728AD9 for ; Mon, 28 May 2018 09:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754359AbeE1JCr (ORCPT ); Mon, 28 May 2018 05:02:47 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:51940 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754159AbeE1I7M (ORCPT ); Mon, 28 May 2018 04:59:12 -0400 Received: by mail-wm0-f47.google.com with SMTP id r15-v6so2613088wmc.1 for ; Mon, 28 May 2018 01:59:12 -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=LL7J3Iqm5T8+zNm4nvWG5gfwcu7is2JnYlZnefMfHthdbktbNBRYm4o1OldW7hdh+l kw5jql1RiUD8ZLm8is6AyaetIwwSVpG6CCSLkgMTxGOM+A1tCFINrHBR3s8NOE5I2rak R6Wg9Pi83/BdCHM7eLA5mHu7wshyMDn3A5n67cDR1SicX+Zz0Z6/f5xgsycMu5aRWjxh rWXUeAY5CbV4TIzfZhYbLWLs5xMD2Ob31dF3K06B5vuvCKqR532PSl8P+vA5AI14R6V4 wiRUhOVGYAvoJn4M9iKNfZStqT0EaOseQw6kz8D0h5W6MiveCtkcdkgMUanrQ+2J5aCY dFVA== 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=G0RZuBSNwoUyihO75awuaIXii74jXxUV0XZ8487VkmqG+p0AwObEX7TwzvlOn043Mb Bj9wzQhG2pJ3Di7qHJTSkWggNZYxS2xN1e1/stUlB9e/DWtCux5HRwKMPcHd7Dmxd9gt xVQzjTdgV5OorDk3eYOgRU3GDmegqS+gikkCVa+oiUrmL1qVffuIYOmHhImoPSa6YJxU cFYmEJceMacSVAhv75BV1x1kMeUtqYv+ib9z1x/sku6XSJbt5w9NTtOtd/E5yvkMj8Zh czAw9Mkf+ssTXCeMzQ26iUHuJko4+3ZWDviRpVz8LdqULGQa4iVQ601xlo4GAFTbIWAu 6UfA== X-Gm-Message-State: ALKqPwdyXALH9rfP6C4j7TvSjR4f3ZLJhEO/U8F9+7Fo8wW0kW3gZ5BO gQ/CmfrZM/NzOgTn+a5CDnXI2w== X-Google-Smtp-Source: ADUXVKLyFlCu7yUUKdkUaUF+oD8cP149XFVwj/aPN3R98TcwKGeE0XYUmspedl2RtE6EosCHK/GvKw== X-Received: by 2002:a2e:8693:: with SMTP id l19-v6mr7804505lji.91.1527497951675; Mon, 28 May 2018 01:59:11 -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 u2-v6sm5777848lji.4.2018.05.28.01.59.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 01:59:10 -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, Igor Konopko , Marcin Dziegielewski , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 17/20] lightnvm: fix partial read error path Date: Mon, 28 May 2018 10:58:38 +0200 Message-Id: <20180528085841.26684-18-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180528085841.26684-1-mb@lightnvm.io> References: <20180528085841.26684-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; }