* [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
@ 2015-12-21 7:32 Wenwei Tao
2015-12-21 7:34 ` Wenwei Tao
2015-12-21 11:22 ` Matias Bjørling
0 siblings, 2 replies; 5+ messages in thread
From: Wenwei Tao @ 2015-12-21 7:32 UTC (permalink / raw)
To: mb; +Cc: linux-kernel, linux-block
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
2015-12-21 7:32 [PATCH] lightnvm: unlock rq and free ppa_list after submission failed Wenwei Tao
@ 2015-12-21 7:34 ` Wenwei Tao
2015-12-21 11:22 ` Matias Bjørling
1 sibling, 0 replies; 5+ messages in thread
From: Wenwei Tao @ 2015-12-21 7:34 UTC (permalink / raw)
To: Matias; +Cc: linux-kernel, linux-block
This patch is based on [PATCH] lightnvm: fix bio submission issue
https://lkml.org/lkml/2015/12/9/394
2015-12-21 15:32 GMT+08:00 Wenwei Tao <ww.tao0320@gmail.com>:
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
2015-12-21 7:32 [PATCH] lightnvm: unlock rq and free ppa_list after submission failed Wenwei Tao
2015-12-21 7:34 ` Wenwei Tao
@ 2015-12-21 11:22 ` Matias Bjørling
2015-12-21 14:25 ` Wenwei Tao
1 sibling, 1 reply; 5+ messages in thread
From: Matias Bjørling @ 2015-12-21 11:22 UTC (permalink / raw)
To: Wenwei Tao; +Cc: linux-kernel, linux-block
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?
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
2015-12-21 11:22 ` Matias Bjørling
@ 2015-12-21 14:25 ` Wenwei Tao
2015-12-22 12:43 ` Matias Bjørling
0 siblings, 1 reply; 5+ messages in thread
From: Wenwei Tao @ 2015-12-21 14:25 UTC (permalink / raw)
To: Matias Bjørling; +Cc: linux-kernel, linux-block
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?
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] lightnvm: unlock rq and free ppa_list after submission failed
2015-12-21 14:25 ` Wenwei Tao
@ 2015-12-22 12:43 ` Matias Bjørling
0 siblings, 0 replies; 5+ messages in thread
From: Matias Bjørling @ 2015-12-22 12:43 UTC (permalink / raw)
To: Wenwei Tao; +Cc: linux-kernel, linux-block
> 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).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-22 12:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-21 7:32 [PATCH] lightnvm: unlock rq and free ppa_list after submission failed Wenwei Tao
2015-12-21 7:34 ` Wenwei Tao
2015-12-21 11:22 ` Matias Bjørling
2015-12-21 14:25 ` Wenwei Tao
2015-12-22 12:43 ` Matias Bjørling
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox