mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: Javier Gonzalez <javier@cnexlabs.com>, Hua Su <suhua.tanke@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lightnvm: pblk: add lock protection to list operations
Date: Fri, 30 Nov 2018 09:36:11 +0100	[thread overview]
Message-ID: <ad41a638-4c59-e079-e272-9ebd98ab929b@lightnvm.io> (raw)
In-Reply-To: <930717BD-D32A-4BE2-AEE6-579594E70842@cnexlabs.com>

On 11/28/2018 10:16 AM, Javier Gonzalez wrote:
>> On 28 Nov 2018, at 10.13, Hua Su <suhua.tanke@gmail.com> wrote:
>>
>> Protect the list_add on the pblk_line_init_bb() error
>> path in case this code is used for some other purpose
>> in the future.
>>
>> Signed-off-by: Hua Su <suhua.tanke@gmail.com>
>> ---
>> drivers/lightnvm/pblk-core.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>> index 6944aac43b01..247112e1db94 100644
>> --- a/drivers/lightnvm/pblk-core.c
>> +++ b/drivers/lightnvm/pblk-core.c
>> @@ -1295,15 +1295,22 @@ int pblk_line_recov_alloc(struct pblk *pblk, struct pblk_line *line)
>>
>> 	ret = pblk_line_alloc_bitmaps(pblk, line);
>> 	if (ret)
>> -		return ret;
>> +		goto fail;
>>
>> 	if (!pblk_line_init_bb(pblk, line, 0)) {
>> -		list_add(&line->list, &l_mg->free_list);
>> -		return -EINTR;
>> +		ret = -EINTR;
>> +		goto fail;
>> 	}
>>
>> 	pblk_rl_free_lines_dec(&pblk->rl, line, true);
>> 	return 0;
>> +
>> +fail:
>> +	spin_lock(&l_mg->free_lock);
>> +	list_add(&line->list, &l_mg->free_list);
>> +	spin_unlock(&l_mg->free_lock);
>> +
>> +	return ret;
>> }
>>
>> void pblk_line_recov_close(struct pblk *pblk, struct pblk_line *line)
>> --
>> 2.19.1
> 
> Looks good to me.
> 
> Reviewed-by: Javier González <javier@cnexlabs.com>
> 

Picked up for 4.21.

      reply	other threads:[~2018-11-30  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  9:13 Hua Su
2018-11-28  9:16 ` Javier Gonzalez
2018-11-30  8:36   ` Matias Bjørling [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad41a638-4c59-e079-e272-9ebd98ab929b@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=axboe@kernel.dk \
    --cc=javier@cnexlabs.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suhua.tanke@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®