All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] pblk bugfixes
@ 2018-02-21  8:02 hans.ml.holmberg
  2018-02-21  8:02 ` [PATCH 1/3] lightnvm: pblk: delete writer kick timer before stopping thread hans.ml.holmberg
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: hans.ml.holmberg @ 2018-02-21  8:02 UTC (permalink / raw)
  To: Matias Bjørling
  Cc: Javier González, linux-block, linux-kernel, Hans Holmberg

From: Hans Holmberg <hans.holmberg@cnexlabs.com>

This is a slew of generic bugfixes to pblk

The patches apply on top of:
https://github.com/OpenChannelSSD/linux branch for-4.17/core

Hans Holmberg (3):
  lightnvm: pblk: delete writer kick timer before stopping thread
  lightnvm: pblk: allow allocation of new lines during shutdown
  lightnvm: pblk: prevent race in pblk_rb_flush_point_set

 drivers/lightnvm/pblk-core.c | 7 -------
 drivers/lightnvm/pblk-init.c | 2 +-
 drivers/lightnvm/pblk-rb.c   | 7 ++++---
 3 files changed, 5 insertions(+), 11 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] lightnvm: pblk: delete writer kick timer before stopping thread
  2018-02-21  8:02 [PATCH 0/3] pblk bugfixes hans.ml.holmberg
@ 2018-02-21  8:02 ` hans.ml.holmberg
  2018-02-21  8:03 ` [PATCH 2/3] lightnvm: pblk: allow allocation of new lines during shutdown hans.ml.holmberg
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: hans.ml.holmberg @ 2018-02-21  8:02 UTC (permalink / raw)
  To: Matias Bjørling
  Cc: Javier González, linux-block, linux-kernel, Hans Holmberg

From: Hans Holmberg <hans.holmberg@cnexlabs.com>

Unless we delete the timer that wakes up the write thread
before we stop the thread we risk re-starting the thread, so
delete the timer first.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
---
 drivers/lightnvm/pblk-init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index a2b54a8..862ac4e 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -923,9 +923,9 @@ static void pblk_writer_stop(struct pblk *pblk)
 	WARN(pblk_rb_sync_count(&pblk->rwb),
 			"Stopping not fully synced write buffer\n");
 
+	del_timer_sync(&pblk->wtimer);
 	if (pblk->writer_ts)
 		kthread_stop(pblk->writer_ts);
-	del_timer(&pblk->wtimer);
 }
 
 static void pblk_free(struct pblk *pblk)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] lightnvm: pblk: allow allocation of new lines during shutdown
  2018-02-21  8:02 [PATCH 0/3] pblk bugfixes hans.ml.holmberg
  2018-02-21  8:02 ` [PATCH 1/3] lightnvm: pblk: delete writer kick timer before stopping thread hans.ml.holmberg
@ 2018-02-21  8:03 ` hans.ml.holmberg
  2018-02-21  8:03 ` [PATCH 3/3] lightnvm: pblk: prevent race in pblk_rb_flush_point_set hans.ml.holmberg
  2018-02-21  8:09 ` [PATCH 0/3] pblk bugfixes Matias Bjørling
  3 siblings, 0 replies; 6+ messages in thread
From: hans.ml.holmberg @ 2018-02-21  8:03 UTC (permalink / raw)
  To: Matias Bjørling
  Cc: Javier González, linux-block, linux-kernel, Hans Holmberg

From: Hans Holmberg <hans.holmberg@cnexlabs.com>

When shutting down pblk the write buffer is flushed and if the
current line can't fit the data in the write buffer we need
to allocate a new line, so remove the check that prevents this.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
---
 drivers/lightnvm/pblk-core.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 22e61cd..8848443 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1407,13 +1407,6 @@ struct pblk_line *pblk_line_replace_data(struct pblk *pblk)
 	l_mg->data_line = new;
 
 	spin_lock(&l_mg->free_lock);
-	if (pblk->state != PBLK_STATE_RUNNING) {
-		l_mg->data_line = NULL;
-		l_mg->data_next = NULL;
-		spin_unlock(&l_mg->free_lock);
-		goto out;
-	}
-
 	pblk_line_setup_metadata(new, l_mg, &pblk->lm);
 	spin_unlock(&l_mg->free_lock);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] lightnvm: pblk: prevent race in pblk_rb_flush_point_set
  2018-02-21  8:02 [PATCH 0/3] pblk bugfixes hans.ml.holmberg
  2018-02-21  8:02 ` [PATCH 1/3] lightnvm: pblk: delete writer kick timer before stopping thread hans.ml.holmberg
  2018-02-21  8:03 ` [PATCH 2/3] lightnvm: pblk: allow allocation of new lines during shutdown hans.ml.holmberg
@ 2018-02-21  8:03 ` hans.ml.holmberg
  2018-02-21  8:09 ` [PATCH 0/3] pblk bugfixes Matias Bjørling
  3 siblings, 0 replies; 6+ messages in thread
From: hans.ml.holmberg @ 2018-02-21  8:03 UTC (permalink / raw)
  To: Matias Bjørling
  Cc: Javier González, linux-block, linux-kernel, Hans Holmberg

From: Hans Holmberg <hans.holmberg@cnexlabs.com>

Make sure that we are not advancing the sync pointer while
we're adding bios to the write buffer entry completion list.

This race condition results in bios not completing and was identified
by a hang when running xfstest generic/113.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
---
 drivers/lightnvm/pblk-rb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c
index 8b14340..52fdd85 100644
--- a/drivers/lightnvm/pblk-rb.c
+++ b/drivers/lightnvm/pblk-rb.c
@@ -355,10 +355,13 @@ static int pblk_rb_flush_point_set(struct pblk_rb *rb, struct bio *bio,
 	struct pblk_rb_entry *entry;
 	unsigned int sync, flush_point;
 
+	pblk_rb_sync_init(rb, NULL);
 	sync = READ_ONCE(rb->sync);
 
-	if (pos == sync)
+	if (pos == sync) {
+		pblk_rb_sync_end(rb, NULL);
 		return 0;
+	}
 
 #ifdef CONFIG_NVM_DEBUG
 	atomic_inc(&rb->inflight_flush_point);
@@ -367,8 +370,6 @@ static int pblk_rb_flush_point_set(struct pblk_rb *rb, struct bio *bio,
 	flush_point = (pos == 0) ? (rb->nr_entries - 1) : (pos - 1);
 	entry = &rb->entries[flush_point];
 
-	pblk_rb_sync_init(rb, NULL);
-
 	/* Protect flush points */
 	smp_store_release(&rb->flush_point, flush_point);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] pblk bugfixes
  2018-02-21  8:02 [PATCH 0/3] pblk bugfixes hans.ml.holmberg
                   ` (2 preceding siblings ...)
  2018-02-21  8:03 ` [PATCH 3/3] lightnvm: pblk: prevent race in pblk_rb_flush_point_set hans.ml.holmberg
@ 2018-02-21  8:09 ` Matias Bjørling
  2018-02-21  8:12   ` Javier González
  3 siblings, 1 reply; 6+ messages in thread
From: Matias Bjørling @ 2018-02-21  8:09 UTC (permalink / raw)
  To: hans.ml.holmberg
  Cc: Javier González, linux-block, linux-kernel, Hans Holmberg

On 02/21/2018 09:02 AM, hans.ml.holmberg@owltronix.com wrote:
> From: Hans Holmberg <hans.holmberg@cnexlabs.com>
> 
> This is a slew of generic bugfixes to pblk
> 
> The patches apply on top of:
> https://github.com/OpenChannelSSD/linux branch for-4.17/core
> 
> Hans Holmberg (3):
>    lightnvm: pblk: delete writer kick timer before stopping thread
>    lightnvm: pblk: allow allocation of new lines during shutdown
>    lightnvm: pblk: prevent race in pblk_rb_flush_point_set
> 
>   drivers/lightnvm/pblk-core.c | 7 -------
>   drivers/lightnvm/pblk-init.c | 2 +-
>   drivers/lightnvm/pblk-rb.c   | 7 ++++---
>   3 files changed, 5 insertions(+), 11 deletions(-)
> 

Thanks Hans. Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] pblk bugfixes
  2018-02-21  8:09 ` [PATCH 0/3] pblk bugfixes Matias Bjørling
@ 2018-02-21  8:12   ` Javier González
  0 siblings, 0 replies; 6+ messages in thread
From: Javier González @ 2018-02-21  8:12 UTC (permalink / raw)
  To: Matias Bjørling; +Cc: Hans Holmberg, linux-block, LKML, Hans Holmberg

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

> On 21 Feb 2018, at 09.09, Matias Bjørling <mb@lightnvm.io> wrote:
> 
> On 02/21/2018 09:02 AM, hans.ml.holmberg@owltronix.com wrote:
>> From: Hans Holmberg <hans.holmberg@cnexlabs.com>
>> This is a slew of generic bugfixes to pblk
>> The patches apply on top of:
>> https://github.com/OpenChannelSSD/linux branch for-4.17/core
>> Hans Holmberg (3):
>>   lightnvm: pblk: delete writer kick timer before stopping thread
>>   lightnvm: pblk: allow allocation of new lines during shutdown
>>   lightnvm: pblk: prevent race in pblk_rb_flush_point_set
>>  drivers/lightnvm/pblk-core.c | 7 -------
>>  drivers/lightnvm/pblk-init.c | 2 +-
>>  drivers/lightnvm/pblk-rb.c   | 7 ++++---
>>  3 files changed, 5 insertions(+), 11 deletions(-)
> 
> Thanks Hans. Applied.

You can add

Reviewed-by: Javier González <javier@cnexlabs.com>


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-21  8:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21  8:02 [PATCH 0/3] pblk bugfixes hans.ml.holmberg
2018-02-21  8:02 ` [PATCH 1/3] lightnvm: pblk: delete writer kick timer before stopping thread hans.ml.holmberg
2018-02-21  8:03 ` [PATCH 2/3] lightnvm: pblk: allow allocation of new lines during shutdown hans.ml.holmberg
2018-02-21  8:03 ` [PATCH 3/3] lightnvm: pblk: prevent race in pblk_rb_flush_point_set hans.ml.holmberg
2018-02-21  8:09 ` [PATCH 0/3] pblk bugfixes Matias Bjørling
2018-02-21  8:12   ` Javier González

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.