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: <20190227164441.GY24609@twin.jikos.cz>
Date:   Wed, 27 Feb 2019 17:44:41 +0100
From:   David Sterba <dsterba@...e.cz>
To:     Dennis Zhou <dennis@...nel.org>
Cc:     David Sterba <dsterba@...e.com>,
        Josef Bacik <josef@...icpanda.com>, Chris Mason <clm@...com>,
        Omar Sandoval <osandov@...ndov.com>,
        Nick Terrell <terrelln@...com>,
        Nikolay Borisov <nborisov@...e.com>, kernel-team@...com,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] btrfs: zstd ensure reclaim timer is properly cleaned
 up

On Fri, Feb 22, 2019 at 02:53:48PM -0500, Dennis Zhou wrote:
> The timer function, zstd_reclaim_timer_fn(), reschedules itself under
> certain conditions. When cleaning up, take the lock and remove all
> workspaces. This prevents the timer from rearming itself. Lastly, switch
> to del_timer_sync() to ensure that the timer function can't trigger as
> we're unloading.
> 
> Signed-off-by: Dennis Zhou <dennis@...nel.org>

Reviewed-by: David Sterba <dsterba@...e.com>

> ---
> v2:
> - cleanup workspaces and then disable the timer
> 
>  fs/btrfs/zstd.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c
> index 3e418a3aeb11..6b9e29d050f3 100644
> --- a/fs/btrfs/zstd.c
> +++ b/fs/btrfs/zstd.c
> @@ -195,8 +195,7 @@ static void zstd_cleanup_workspace_manager(void)
>  	struct workspace *workspace;
>  	int i;
>  
> -	del_timer(&wsm.timer);
> -
> +	spin_lock(&wsm.lock);
>  	for (i = 0; i < ZSTD_BTRFS_MAX_LEVEL; i++) {
>  		while (!list_empty(&wsm.idle_ws[i])) {
>  			workspace = container_of(wsm.idle_ws[i].next,
> @@ -206,6 +205,9 @@ static void zstd_cleanup_workspace_manager(void)
>  			wsm.ops->free_workspace(&workspace->list);

I've noticed while reading the code, why do you use the indirect call
here? The wsm.ops points to btrfs_zstd_compress so free_workspace is
always zstd_free_workspace.

The compiler is usually smart to replace such things by direct call if
the type has not escaped, but this is not true for btrfs_compress_op so
the indirect function call must be preserved.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ