lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <09010E2F-1E25-47AC-AD4D-06644F0A750C@lightnvm.io>
Date:   Tue, 3 Oct 2017 12:38:43 +0200
From:   Javier González <jg@...htnvm.io>
To:     Hans Holmberg <hans.ml.holmberg@...tronix.com>
Cc:     Matias Bjørling <mb@...htnvm.io>,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        Hans Holmberg <hans.holmberg@...xlabs.com>
Subject: Re: [PATCH 6/9] lightnvm: pblk: shut down gc gracefully during exit

> On 3 Oct 2017, at 12.05, Hans Holmberg <hans.ml.holmberg@...tronix.com> wrote:
> 
> From: Hans Holmberg <hans.holmberg@...xlabs.com>
> 
> Shut down the GC workqueues and tasks in the right order.
> 
> Signed-off-by: Hans Holmberg <hans.holmberg@...xlabs.com>
> ---
> drivers/lightnvm/pblk-gc.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
> index 374089f..f343f90 100644
> --- a/drivers/lightnvm/pblk-gc.c
> +++ b/drivers/lightnvm/pblk-gc.c
> @@ -422,10 +422,15 @@ void pblk_gc_kick(struct pblk *pblk)
> {
> 	struct pblk_gc *gc = &pblk->gc;
> 
> -	wake_up_process(gc->gc_ts);
> 	pblk_gc_writer_kick(gc);
> 	pblk_gc_reader_kick(gc);
> -	mod_timer(&gc->gc_timer, jiffies + msecs_to_jiffies(GC_TIME_MSECS));
> +
> +	/* If we're shutting down GC, let's not start it up again */
> +	if (gc->gc_enabled) {
> +		wake_up_process(gc->gc_ts);
> +		mod_timer(&gc->gc_timer,
> +			  jiffies + msecs_to_jiffies(GC_TIME_MSECS));
> +	}
> }
> 
> static void pblk_gc_timer(unsigned long data)
> @@ -625,9 +630,6 @@ void pblk_gc_exit(struct pblk *pblk)
> {
> 	struct pblk_gc *gc = &pblk->gc;
> 
> -	flush_workqueue(gc->gc_reader_wq);
> -	flush_workqueue(gc->gc_line_reader_wq);
> -
> 	gc->gc_enabled = 0;
> 	del_timer_sync(&gc->gc_timer);
> 	pblk_gc_stop(pblk, 1);
> @@ -635,15 +637,17 @@ void pblk_gc_exit(struct pblk *pblk)
> 	if (gc->gc_ts)
> 		kthread_stop(gc->gc_ts);
> 
> +	if (gc->gc_reader_ts)
> +		kthread_stop(gc->gc_reader_ts);
> +
> +	flush_workqueue(gc->gc_reader_wq);
> 	if (gc->gc_reader_wq)
> 		destroy_workqueue(gc->gc_reader_wq);
> 
> +	flush_workqueue(gc->gc_line_reader_wq);
> 	if (gc->gc_line_reader_wq)
> 		destroy_workqueue(gc->gc_line_reader_wq);
> 
> 	if (gc->gc_writer_ts)
> 		kthread_stop(gc->gc_writer_ts);
> -
> -	if (gc->gc_reader_ts)
> -		kthread_stop(gc->gc_reader_ts);
> }
> --
> 2.7.4

LGTM.

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

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ