Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1295801 > unrolled thread

[PATCH] lightnvm: unlock rq and free ppa_list after submission failed

Started byWenwei Tao <ww.tao0320@gmail.com>
First post2015-12-21 08:40 +0100
Last post2015-12-22 13:50 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] lightnvm: unlock rq and free ppa_list after submission failed Wenwei Tao <ww.tao0320@gmail.com> - 2015-12-21 08:40 +0100
    Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission  failed Matias Bjørling <mb@lightnvm.io> - 2015-12-21 12:30 +0100
      Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed Wenwei Tao <ww.tao0320@gmail.com> - 2015-12-21 15:30 +0100
        Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission  failed Matias Bjørling <mb@lightnvm.io> - 2015-12-22 13:50 +0100

#1295801 — [PATCH] lightnvm: unlock rq and free ppa_list after submission failed

FromWenwei Tao <ww.tao0320@gmail.com>
Date2015-12-21 08:40 +0100
Subject[PATCH] lightnvm: unlock rq and free ppa_list after submission failed
Message-ID<qI3ex-3xA-15@gated-at.bofh.it>
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 <ww.tao0320@gmail.com>
---
 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;
 	}
 
-- 
1.8.3.1

--
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/

[toc] | [next] | [standalone]


#1295912 — Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed

FromMatias Bjørling <mb@lightnvm.io>
Date2015-12-21 12:30 +0100
SubjectRe: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
Message-ID<qI6P7-5Pb-5@gated-at.bofh.it>
In reply to#1295801
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 <ww.tao0320@gmail.com>
> ---
>   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/

[toc] | [prev] | [next] | [standalone]


#1296003

FromWenwei Tao <ww.tao0320@gmail.com>
Date2015-12-21 15:30 +0100
Message-ID<qI9Dj-7AS-9@gated-at.bofh.it>
In reply to#1295912
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 <mb@lightnvm.io>:
> 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 <ww.tao0320@gmail.com>
>> ---
>>   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/

[toc] | [prev] | [next] | [standalone]


#1296766 — Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed

FromMatias Bjørling <mb@lightnvm.io>
Date2015-12-22 13:50 +0100
SubjectRe: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
Message-ID<qIuy6-41F-5@gated-at.bofh.it>
In reply to#1296003
> 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.

Thanks. I've included that explanation instead for the commit message. 
I've applied it for 4.5 (together with your previous patch).

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web