Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1628683 > unrolled thread
| Started by | "Javier González" <jg@lightnvm.io> |
|---|---|
| First post | 2017-04-22 01:40 +0200 |
| Last post | 2017-04-22 11:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/5] lightnvm: pblk: fix race condition on line retry "Javier González" <jg@lightnvm.io> - 2017-04-22 01:40 +0200
Re: [PATCH 1/5] lightnvm: pblk: fix race condition on line retry Matias Bjørling <mb@lightnvm.io> - 2017-04-22 11:00 +0200
| From | "Javier González" <jg@lightnvm.io> |
|---|---|
| Date | 2017-04-22 01:40 +0200 |
| Subject | [PATCH 1/5] lightnvm: pblk: fix race condition on line retry |
| Message-ID | <tyQjD-3De-1@gated-at.bofh.it> |
When a pblk line fails (or is recovered), make sure to take the line
management lock.
Fixes: a4bd217b4326 "lightnvm: physical block device (pblk) target"
Signed-off-by: Javier González <javier@cnexlabs.com>
---
drivers/lightnvm/pblk-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index a2bcd09..7065658 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1050,13 +1050,14 @@ int pblk_line_recov_alloc(struct pblk *pblk, struct pblk_line *line)
spin_lock(&l_mg->free_lock);
l_mg->data_line = line;
list_del(&line->list);
- spin_unlock(&l_mg->free_lock);
ret = pblk_line_prepare(pblk, line);
if (ret) {
list_add(&line->list, &l_mg->free_list);
+ spin_unlock(&l_mg->free_lock);
return ret;
}
+ spin_unlock(&l_mg->free_lock);
pblk_rl_free_lines_dec(&pblk->rl, line);
@@ -1140,6 +1141,7 @@ static struct pblk_line *pblk_line_retry(struct pblk *pblk,
line->invalid_bitmap = NULL;
line->smeta = NULL;
line->emeta = NULL;
+ l_mg->data_line = retry_line;
spin_unlock(&l_mg->free_lock);
if (pblk_line_erase(pblk, retry_line))
@@ -1147,8 +1149,6 @@ static struct pblk_line *pblk_line_retry(struct pblk *pblk,
pblk_rl_free_lines_dec(&pblk->rl, retry_line);
- l_mg->data_line = retry_line;
-
return retry_line;
}
--
2.7.4
[toc] | [next] | [standalone]
| From | Matias Bjørling <mb@lightnvm.io> |
|---|---|
| Date | 2017-04-22 11:00 +0200 |
| Message-ID | <tyZ3z-DT-15@gated-at.bofh.it> |
| In reply to | #1628683 |
On 04/22/2017 01:32 AM, Javier González wrote:
> When a pblk line fails (or is recovered), make sure to take the line
> management lock.
>
> Fixes: a4bd217b4326 "lightnvm: physical block device (pblk) target"
>
> Signed-off-by: Javier González <javier@cnexlabs.com>
> ---
> drivers/lightnvm/pblk-core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
> index a2bcd09..7065658 100644
> --- a/drivers/lightnvm/pblk-core.c
> +++ b/drivers/lightnvm/pblk-core.c
> @@ -1050,13 +1050,14 @@ int pblk_line_recov_alloc(struct pblk *pblk, struct pblk_line *line)
> spin_lock(&l_mg->free_lock);
> l_mg->data_line = line;
> list_del(&line->list);
> - spin_unlock(&l_mg->free_lock);
>
> ret = pblk_line_prepare(pblk, line);
> if (ret) {
> list_add(&line->list, &l_mg->free_list);
> + spin_unlock(&l_mg->free_lock);
> return ret;
> }
> + spin_unlock(&l_mg->free_lock);
>
> pblk_rl_free_lines_dec(&pblk->rl, line);
>
> @@ -1140,6 +1141,7 @@ static struct pblk_line *pblk_line_retry(struct pblk *pblk,
> line->invalid_bitmap = NULL;
> line->smeta = NULL;
> line->emeta = NULL;
> + l_mg->data_line = retry_line;
> spin_unlock(&l_mg->free_lock);
>
> if (pblk_line_erase(pblk, retry_line))
> @@ -1147,8 +1149,6 @@ static struct pblk_line *pblk_line_retry(struct pblk *pblk,
>
> pblk_rl_free_lines_dec(&pblk->rl, retry_line);
>
> - l_mg->data_line = retry_line;
> -
> return retry_line;
> }
>
>
Reviewed-by: Matias Bjørling <matias@cnexlabs.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web