Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp1658492imc; Fri, 22 Feb 2019 08:54:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IYj9HoPsh5zMdW+20gr9aYSW2+1O2vnMI+YxQmJgFY0Lg+MbG0JuXdnr4vSEmQ0yz7l+aw2 X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr5117272plp.201.1550854479947; Fri, 22 Feb 2019 08:54:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550854479; cv=none; d=google.com; s=arc-20160816; b=b6jkwoYINt8jDHDtY4ZW35X6vqVChDsQqAGK5+ZG6t9OiczguJeEtN5FivF0JvWN0N SMu6GMLPuckwfLlKLAEdwyRfcbDrjcVI0WQeSSmAvb/+EIeRxrKbVHh+0LiW/AnTkoCj rHKNpoKeX8TgdBybhjTjscMtF4SDmeHJw8+X0Zej/2yZOQ/hWgPLN5Xv0rbUT+KQ3Lf1 OxryRa5HHOEacAYZaQXtEeZdPuzw9/ZbnnrjtCtv0LVWTCIC34p4a4FSrAdofV2+L1EP usMZdW+bo/Qr/R49NqtQf6Q1fJY940SpBo0i3S8Fq26SOtp5M9DqPZKlRT/k4GPnvX3Q H1YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=kI5tGxDVTdGcYL9vJ2j2Cz6kTeDPn8/ovqZQNGlFT7g=; b=gf8dKpMbnuCMm6n7m00D/XVdSfCBajx7C+Usst8jDP303WBq9kCX8fnm7pRfadwJxI UR45+EyvGSelCR+3o1TO1McExoCqztAS5XqEw9QEzQQjNsRI28ypWl9EhJP3wAi4JC31 a0+mbin4ERgAUy6E29seBna0ONIzNrGXbDUejt8MZ9X26/v4gzLxXTUDJV3BdFUM729y pYHv1AZpkbadrsMkXMtq08/jC8s5lZ8vRzxyctHco6UJVn1Wq+l+zQa1ZTL8AXy0YJpg uawOPFVytKVuNe35m+VqDt5jHK/UvAqSlJQmpU1dpeLdT7AMkjpPiL8e4cF9mp2dacJL rVRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16si1702437pls.330.2019.02.22.08.54.24; Fri, 22 Feb 2019 08:54:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbfBVQyD (ORCPT + 99 others); Fri, 22 Feb 2019 11:54:03 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:40218 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfBVQyD (ORCPT ); Fri, 22 Feb 2019 11:54:03 -0500 Received: by mail-yw1-f65.google.com with SMTP id c67so1067337ywa.7; Fri, 22 Feb 2019 08:54:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=kI5tGxDVTdGcYL9vJ2j2Cz6kTeDPn8/ovqZQNGlFT7g=; b=TT1ByVQYKRHC2uU4yT02bUDmV5rnwOsz6rsjyqK08m/wb1PzyShZ1Jw+tlTGyq4eJR 0ICWjstDUjoZYouzmudmzSz7StmLOBF2kknmLXRtsjlMPOe4cti42UUsA4uwalxnFRb3 +GFFAsNMX0RG9cmhwhiNg5ZExX91QzwJ1bmnpRnYt/aLytaiUZQsFlVyIXpb5NIZfO9E IKqm0QbZS2J8UKx42HYVpDn7aYP1vVbbnf0DCLFey7vnAv1Jy8MgCxhEtkFR98ggRBsn tPafjZjaBfIKh6XTjLLYX1jkBU6Fchmh9Cjl4t7/scBsUlCCH9h7YhpFIukPcN7tMAUM xDsw== X-Gm-Message-State: AHQUAubRM5WsBTpYGeb1ujbYrGrgDUw0fn2nkSesDT4fU0MFZNG5uhAa BwIFgNKhSzkOLgbtKSludw/WQuMuQkc= X-Received: by 2002:a81:59d7:: with SMTP id n206mr3966473ywb.210.1550854442317; Fri, 22 Feb 2019 08:54:02 -0800 (PST) Received: from dennisz-mbp ([2620:10d:c091:200::2:3f98]) by smtp.gmail.com with ESMTPSA id s186sm760762yws.13.2019.02.22.08.54.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 08:54:00 -0800 (PST) Date: Fri, 22 Feb 2019 11:53:57 -0500 From: Dennis Zhou To: Nikolay Borisov Cc: Dennis Zhou , David Sterba , Josef Bacik , Chris Mason , Omar Sandoval , Nick Terrell , kernel-team@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] btrfs: zstd ensure reclaim timer is properly cleaned up Message-ID: <20190222165357.GA85619@dennisz-mbp> References: <20190221202556.42447-1-dennis@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 22, 2019 at 02:17:41PM +0200, Nikolay Borisov wrote: > > > On 21.02.19 г. 22:25 ч., Dennis Zhou wrote: > > The timer function, zstd_reclaim_timer_fn(), reschedules itself under > > certain conditions. Switch to del_timer_sync() to ensure that the timer > > function hasn't rescheduled itself. > > According to del_timer_sync it just waits for any concurrent invocation > to finish. But it's responsibility of the caller to ensure the timer > cannot really be restarted. It's not obvious how > zstd_cleanup_workspace_manager ensures that the timer won't be restared. > Looking at the timer function for it to not restart wsm.lru_list has to > be empty. And seeing that workspace->lru_list is deleted afterwards I'm > not sure this invariant holds. > Hmmm, I see. I misunderstood the invariant. I'll spin v2 and handle it another way. Thanks, Dennis > > > > Signed-off-by: Dennis Zhou > > --- > > fs/btrfs/zstd.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c > > index 3e418a3aeb11..62de9a211321 100644 > > --- a/fs/btrfs/zstd.c > > +++ b/fs/btrfs/zstd.c > > @@ -195,7 +195,7 @@ static void zstd_cleanup_workspace_manager(void) > > struct workspace *workspace; > > int i; > > > > - del_timer(&wsm.timer); > > + del_timer_sync(&wsm.timer); > > > > for (i = 0; i < ZSTD_BTRFS_MAX_LEVEL; i++) { > > while (!list_empty(&wsm.idle_ws[i])) { > >