Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3364717pxj; Mon, 7 Jun 2021 08:52:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0Um99gpbm+xTeixugv3W4l5UlKgk0tf+84CrXZ82qaG+w7L84Tv2+NXJKA63GBBUwLeey X-Received: by 2002:a17:906:869a:: with SMTP id g26mr18062621ejx.94.1623081150496; Mon, 07 Jun 2021 08:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623081150; cv=none; d=google.com; s=arc-20160816; b=K3roGPFc2KbOEflB1abNLBz53642k0Imxneqs5p5z8RVMC1AJ9g/2yLdJUmqsZxmeP keKD4MyffmgEdXDJEf8A5hro3lAs4n8tGgqIknbt5Y24t7V90qBdVajvG33HuqUuvxPw eItnfJTTUnpPIx0/IW4lumzEB4kl34YwoSvfBb3NX6Qna7NROEDTdwzp/v2cm4AxmzZR 0vK/LW4UWP/ro9sMFFjJ3ciie2kQ9T9TxXj6R+XhUnTnLbkOvP8egZvwlQK9hQaItxck DR/jH/1HriOBD/e/zxbXinEUUAlN+tKTGO/9f9N93PofaetPfSDwVPI6QyWx2CwNHFfi svGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=pMFhBY6RRNhXxQSZRdv9RWVO5yhAishy3HwwjhZR/FE=; b=Zpcpws9RTuU+GFeL5i/tpkgdby4eQhIr2XQlDv69jqJw9XHAOhBlg5Lyg2En2GTNT7 LHZat8HwnMj/7zptdeK5CBKrNMdD2Ytno5+9GTt30ZbjrAlSrDry5gsgCCYW8Rb3zKW+ tAtASeFN6W95amu94Y2kK0hpYQH1u/eJgRsVKMnmHavBqFJARoKPjADXspbaWBZUHuqJ arOQd5Hjs9fGlRg2g74Wa7gNMp3n/2IhVdxUqUyB+5rYN1Db07Hwp9p61TdBMdrCUlpC 5OfscJAB9TVGMw/El8QZyf/dT0NJPiIQRLuDAZ+aC2bWbx8/BKSxvX2p+4v9jCB/A67J Ki2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=BDNtVRYL; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=TuP9CamR; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yd19si12407377ejb.717.2021.06.07.08.52.06; Mon, 07 Jun 2021 08:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=BDNtVRYL; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=TuP9CamR; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230250AbhFGPwP (ORCPT + 99 others); Mon, 7 Jun 2021 11:52:15 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55888 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbhFGPwP (ORCPT ); Mon, 7 Jun 2021 11:52:15 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3D7B71FDA1; Mon, 7 Jun 2021 15:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623081023; 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=pMFhBY6RRNhXxQSZRdv9RWVO5yhAishy3HwwjhZR/FE=; b=BDNtVRYLzomvaEOToypRhXc/SUkghYU5YeT2X98PLJR/AewsB2Fi7rCgt4/5uXUQT3JIaY SoDUbSoxSSyYzeVyWIa0WTDG7kJ09GX9+pTMrbgozIeN455mlh+TdzGqyN05WFOL75sPnO u/ks2PkzHqhHvJZWYm2DfE/JHNXgJnU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623081023; 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=pMFhBY6RRNhXxQSZRdv9RWVO5yhAishy3HwwjhZR/FE=; b=TuP9CamROenxjmTrMupRrYB58tMV2/4Yiiyk2LvATjcCiUN6aFKOJjNkrJ0DOeww7ZR8g6 epvwoewElRp0uPAw== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 2FA35A3B89; Mon, 7 Jun 2021 15:50:23 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 172B11F2CA8; Mon, 7 Jun 2021 17:50:23 +0200 (CEST) Date: Mon, 7 Jun 2021 17:50:23 +0200 From: Jan Kara To: Zhang Yi Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yukuai3@huawei.com Subject: Re: [RFC PATCH v3 7/8] ext4: remove bdev_try_to_free_page() callback Message-ID: <20210607155023.GC29326@quack2.suse.cz> References: <20210527135641.420514-1-yi.zhang@huawei.com> <20210527135641.420514-8-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210527135641.420514-8-yi.zhang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 27-05-21 21:56:40, Zhang Yi wrote: > After we introduce a jbd2 shrinker to release checkpointed buffer's > journal head, we could free buffer without bdev_try_to_free_page() > under memory pressure. So this patch remove the whole > bdev_try_to_free_page() callback directly. It also remove many > use-after-free issues relate to it together. > > Signed-off-by: Zhang Yi Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/super.c | 21 --------------------- > 1 file changed, 21 deletions(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index bf6d0085e1b7..b778236d06e6 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1442,26 +1442,6 @@ static int ext4_nfs_commit_metadata(struct inode *inode) > return ext4_write_inode(inode, &wbc); > } > > -/* > - * Try to release metadata pages (indirect blocks, directories) which are > - * mapped via the block device. Since these pages could have journal heads > - * which would prevent try_to_free_buffers() from freeing them, we must use > - * jbd2 layer's try_to_free_buffers() function to release them. > - */ > -static int bdev_try_to_free_page(struct super_block *sb, struct page *page, > - gfp_t wait) > -{ > - journal_t *journal = EXT4_SB(sb)->s_journal; > - > - WARN_ON(PageChecked(page)); > - if (!page_has_buffers(page)) > - return 0; > - if (journal) > - return jbd2_journal_try_to_free_buffers(journal, page); > - > - return try_to_free_buffers(page); > -} > - > #ifdef CONFIG_FS_ENCRYPTION > static int ext4_get_context(struct inode *inode, void *ctx, size_t len) > { > @@ -1656,7 +1636,6 @@ static const struct super_operations ext4_sops = { > .quota_write = ext4_quota_write, > .get_dquots = ext4_get_dquots, > #endif > - .bdev_try_to_free_page = bdev_try_to_free_page, > }; > > static const struct export_operations ext4_export_ops = { > -- > 2.25.4 > -- Jan Kara SUSE Labs, CR