From patchwork Mon Dec 21 07:32:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenwei Tao X-Patchwork-Id: 7893881 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37B15BEEE5 for ; Mon, 21 Dec 2015 07:32:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68F8D20390 for ; Mon, 21 Dec 2015 07:32:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92CDA2021F for ; Mon, 21 Dec 2015 07:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751142AbbLUHco (ORCPT ); Mon, 21 Dec 2015 02:32:44 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:33091 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbbLUHcn (ORCPT ); Mon, 21 Dec 2015 02:32:43 -0500 Received: by mail-pf0-f174.google.com with SMTP id n128so67574073pfn.0; Sun, 20 Dec 2015 23:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=q9wIkfN2TQCrLuRlqLxRippkJSr9GMFZBjguOZTtlYw=; b=XwLCtUbae5spGCLaEcljV92jv0b0YQJhKJpuXRZYzL+VNZiFf3yR5RWkTQ4kSAMHVz IlzWn6sSlz2FHdGbNmg3N8oL+vuhk9zu96rHCm0tdVxmDKf1oHaHCjBt1lHpOfoAcrQU +NBaFh451uUgmX4TkzIRyNdshX1askvca6atE5sG/GBmQVGh0IZXY6vwWZ9r0cP52gzb TSf6PWcESAU4C8KsCc+bZXQu5SvOkomNtxLpUZdn5wrjC6x7bYonvW+P5Zb0C1Ua6uLi 5k3bTekidrVgLlaxiOwU3w42WqpsszTM+97Lz7XRcRgtGk3Pm/zB9sByrBcIT5wpV0FW bmMw== X-Received: by 10.98.68.203 with SMTP id m72mr25011178pfi.153.1450683163093; Sun, 20 Dec 2015 23:32:43 -0800 (PST) Received: from localhost.localdomain.com ([111.204.49.2]) by smtp.gmail.com with ESMTPSA id v17sm12135461pfi.17.2015.12.20.23.32.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Dec 2015 23:32:42 -0800 (PST) From: Wenwei Tao To: mb@lightnvm.io Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed Date: Mon, 21 Dec 2015 15:32:12 +0800 Message-Id: <1450683132-355-1-git-send-email-ww.tao0320@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 after io submission failed, before free rq, delete rq from rrpc's inflight list, leave no bad item in the list. And free rq's ppa_list to avoid memory leak. Signed-off-by: Wenwei Tao --- drivers/lightnvm/rrpc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index a1e7488..c0886a8 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -843,6 +843,12 @@ static int rrpc_submit_io(struct rrpc *rrpc, struct bio *bio, if (err) { pr_err("rrpc: I/O submission failed: %d\n", err); bio_put(bio); + if (!(flags & NVM_IOTYPE_GC)) { + rrpc_unlock_rq(rrpc, rqd); + if (rqd->nr_pages > 1) + nvm_dev_dma_free(rrpc->dev, + rqd->ppa_list, rqd->dma_ppa_list); + } return NVM_IO_ERR; }