Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751503AbbLUOZp (ORCPT ); Mon, 21 Dec 2015 09:25:45 -0500 Received: from mail-io0-f174.google.com ([209.85.223.174]:35554 "EHLO mail-io0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbbLUOZk convert rfc822-to-8bit (ORCPT ); Mon, 21 Dec 2015 09:25:40 -0500 MIME-Version: 1.0 In-Reply-To: <5677E0F8.3020008@lightnvm.io> References: <1450683132-355-1-git-send-email-ww.tao0320@gmail.com> <5677E0F8.3020008@lightnvm.io> Date: Mon, 21 Dec 2015 22:25:39 +0800 Message-ID: Subject: Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed From: Wenwei Tao To: =?UTF-8?Q?Matias_Bj=C3=B8rling?= Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 44 When rrpc_write_ppalist_rq and rrpc_read_ppalist_rq succeed, we setup rq correctly, but nvm_submit_io failed due to cannot allocate request or nvme_nvm_command, we return error but forget to do the cleanup job this patch mentioned. 2015-12-21 19:22 GMT+08:00 Matias Bjørling : > On 12/21/2015 08:32 AM, Wenwei Tao wrote: >> >> 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; >> } >> >> > > I can't seem to find the bug. nvm_dev_dma_free is called when > rrpc_write_ppalist_rq and rrpc_read_ppalist_rq fails. Where is it missing? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/