From: Hans Holmberg <[email protected]>
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
From: Hans Holmberg <[email protected]>
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 <[email protected]>
---
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
From: Hans Holmberg <[email protected]>
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 <[email protected]>
---
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
On 02/21/2018 09:02 AM, [email protected] wrote:
> From: Hans Holmberg <[email protected]>
>
> 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.
> On 21 Feb 2018, at 09.09, Matias Bjørling <[email protected]> wrote:
>
> On 02/21/2018 09:02 AM, [email protected] wrote:
>> From: Hans Holmberg <[email protected]>
>> 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 <[email protected]>
From: Hans Holmberg <[email protected]>
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 <[email protected]>
---
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