From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE138C47082 for ; Mon, 7 Jun 2021 08:48:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6AAF360E08 for ; Mon, 7 Jun 2021 08:48:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AAF360E08 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E4D206B006C; Mon, 7 Jun 2021 04:48:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFD096B006E; Mon, 7 Jun 2021 04:48:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9E026B0070; Mon, 7 Jun 2021 04:48:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id 9989F6B006C for ; Mon, 7 Jun 2021 04:48:34 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 31F52181AEF00 for ; Mon, 7 Jun 2021 08:48:34 +0000 (UTC) X-FDA: 78226301748.22.180146D Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf20.hostedemail.com (Postfix) with ESMTP id 0CAD9420 for ; Mon, 7 Jun 2021 08:48:30 +0000 (UTC) Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4BB2021A86; Mon, 7 Jun 2021 08:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623055712; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2naVyNld0ZhkvsKE1x+NGtELQ4K5HYayJF8p+hq+SbA=; b=tlwLnyGH7VawMI7TcGGozb5AZI4f7IC46ovtT2AQ/LyWGYibtVAvNF61Pouzn6rmQe9dnK XB60/c9yqXN5aYWMOfzBtQqDArsCUjRLtBa9BYxnUdt+gGzSHAfHj4zcmH3Tls8GUWaGSZ NKxENUvyEJ91B0t2QNZlD3DoWNZyw+I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623055712; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2naVyNld0ZhkvsKE1x+NGtELQ4K5HYayJF8p+hq+SbA=; b=VO25FqWanA88lV8Aezh36mNO3tBqzGfACUq9loSFJ3S7BQUk14Om3e22ixlhnFVZDCMHfi 2L0GG4lBbKUVk4DQ== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 31231A3B81; Mon, 7 Jun 2021 08:48:32 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E41891F2CA8; Mon, 7 Jun 2021 10:48:31 +0200 (CEST) Date: Mon, 7 Jun 2021 10:48:31 +0200 From: Jan Kara To: Roman Gushchin Cc: Jan Kara , Tejun Heo , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro , Dennis Zhou , Dave Chinner , cgroups@vger.kernel.org Subject: Re: [PATCH v7 1/6] writeback, cgroup: do not switch inodes with I_WILL_FREE flag Message-ID: <20210607084831.GA30275@quack2.suse.cz> References: <20210604013159.3126180-1-guro@fb.com> <20210604013159.3126180-2-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604013159.3126180-2-guro@fb.com> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=tlwLnyGH; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=VO25FqWa; dmarc=none; spf=pass (imf20.hostedemail.com: domain of jack@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=jack@suse.cz X-Stat-Signature: myu6f4g7m3367t49rbstm4kr8h1akn8j X-Rspamd-Queue-Id: 0CAD9420 X-Rspamd-Server: rspam02 X-HE-Tag: 1623055710-523289 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 03-06-21 18:31:54, Roman Gushchin wrote: > If an inode's state has I_WILL_FREE flag set, the inode will be > freed soon, so there is no point in trying to switch the inode > to a different cgwb. > > I_WILL_FREE was ignored since the introduction of the inode switching, > so it looks like it doesn't lead to any noticeable issues for a user. > This is why the patch is not intended for a stable backport. > > Suggested-by: Jan Kara > Signed-off-by: Roman Gushchin Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/fs-writeback.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index e91980f49388..bd99890599e0 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -389,10 +389,10 @@ static void inode_switch_wbs_work_fn(struct work_struct *work) > xa_lock_irq(&mapping->i_pages); > > /* > - * Once I_FREEING is visible under i_lock, the eviction path owns > - * the inode and we shouldn't modify ->i_io_list. > + * Once I_FREEING or I_WILL_FREE are visible under i_lock, the eviction > + * path owns the inode and we shouldn't modify ->i_io_list. > */ > - if (unlikely(inode->i_state & I_FREEING)) > + if (unlikely(inode->i_state & (I_FREEING | I_WILL_FREE))) > goto skip_switch; > > trace_inode_switch_wbs(inode, old_wb, new_wb); > @@ -517,7 +517,7 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id) > /* while holding I_WB_SWITCH, no one else can update the association */ > spin_lock(&inode->i_lock); > if (!(inode->i_sb->s_flags & SB_ACTIVE) || > - inode->i_state & (I_WB_SWITCH | I_FREEING) || > + inode->i_state & (I_WB_SWITCH | I_FREEING | I_WILL_FREE) || > inode_to_wb(inode) == isw->new_wb) { > spin_unlock(&inode->i_lock); > goto out_free; > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR