diff mbox series

lightnvm: pblk: set propper line as data_line after gc

Message ID 1552922879-14075-1-git-send-email-marcin.dziegielewski@intel.com (mailing list archive)
State New, archived
Headers show
Series lightnvm: pblk: set propper line as data_line after gc | expand

Commit Message

Marcin Dziegielewski March 18, 2019, 3:27 p.m. UTC
In current implementation of l2p recovery, when we are after
gc and we have open line, we are not setting current data line
properly (we set last line from the device instead of last line
ordered by seq_nr) and in consequence, kernel panic and
data corruption. This patch fixes that issue.

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
---
 drivers/lightnvm/pblk-recovery.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Javier González March 18, 2019, 7:12 p.m. UTC | #1
> On 18 Mar 2019, at 16.27, Marcin Dziegielewski <marcin.dziegielewski@intel.com> wrote:
> 
> In current implementation of l2p recovery, when we are after
> gc and we have open line, we are not setting current data line
> properly (we set last line from the device instead of last line
> ordered by seq_nr) and in consequence, kernel panic and
> data corruption. This patch fixes that issue.
> 
> Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
> ---
> drivers/lightnvm/pblk-recovery.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
> index 83b467b..017874e 100644
> --- a/drivers/lightnvm/pblk-recovery.c
> +++ b/drivers/lightnvm/pblk-recovery.c
> @@ -844,6 +844,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
> 		spin_unlock(&l_mg->free_lock);
> 	} else {
> 		spin_lock(&l_mg->free_lock);
> +		l_mg->data_line = data_line;
> 		/* Allocate next line for preparation */
> 		l_mg->data_next = pblk_line_get(pblk);
> 		if (l_mg->data_next) {
> --
> 1.8.3.1

I think you are right. Good catch.


Reviewed-by: Javier González <javier@javigon.com>
Matias Bjorling March 25, 2019, 10:54 a.m. UTC | #2
On 3/18/19 4:27 PM, Marcin Dziegielewski wrote:
> In current implementation of l2p recovery, when we are after
> gc and we have open line, we are not setting current data line
> properly (we set last line from the device instead of last line
> ordered by seq_nr) and in consequence, kernel panic and
> data corruption. This patch fixes that issue.
> 
> Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
> ---
>   drivers/lightnvm/pblk-recovery.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
> index 83b467b..017874e 100644
> --- a/drivers/lightnvm/pblk-recovery.c
> +++ b/drivers/lightnvm/pblk-recovery.c
> @@ -844,6 +844,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
>   		spin_unlock(&l_mg->free_lock);
>   	} else {
>   		spin_lock(&l_mg->free_lock);
> +		l_mg->data_line = data_line;
>   		/* Allocate next line for preparation */
>   		l_mg->data_next = pblk_line_get(pblk);
>   		if (l_mg->data_next) {
> 

Thanks Marcin.
diff mbox series

Patch

diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index 83b467b..017874e 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -844,6 +844,7 @@  struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
 		spin_unlock(&l_mg->free_lock);
 	} else {
 		spin_lock(&l_mg->free_lock);
+		l_mg->data_line = data_line;
 		/* Allocate next line for preparation */
 		l_mg->data_next = pblk_line_get(pblk);
 		if (l_mg->data_next) {