Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp423127pxj; Thu, 10 Jun 2021 04:17:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwooVEa2NDK6VunK+KTX6D6QwJpkXP6rpFoVPxlUa/pde/q7y4v104sC4mDWVMqz9uSs3gX X-Received: by 2002:a17:906:1815:: with SMTP id v21mr3949975eje.376.1623323831527; Thu, 10 Jun 2021 04:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623323831; cv=none; d=google.com; s=arc-20160816; b=CoImimyLIuz5NeVM1JQ+XzQzE6UnHnrZLWCgDCQOkQ21Bl8uODCLLucICEKLCBRAui LqTC9XFQutGEN+ebWEJTGv9zgpt6BvJAakACYrNO69KFRIOj7Rxb0SAk8ZWsNazQTTT2 Os4v6M78If8Q/XBViSJL3dGAwH4yaPlDmJhJBt95LTrsRJy63wlelI38ULGoyfu7sfuN p3NplnLm+lQwdd2KdIZi6ebdroC0C4iKJh6l/41hcpgCIE62X4ajxJC2/SDCDHkcYO+M qp2M39gSLPCk5n3TPY7olaaDqENC5Vtfmp3rikzPGYkSBXYNn1X4VQ3UUsADAhv0yrm+ p1dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2uYEOJAavR/7MZ0oeTOHKl6NegGEc0U5KPdYCI3ud3w=; b=qmLWQMEPrxgysTu1BwnNieaLx5NSfq9UygdiXc8mv30JTfnMb/DYkkm/HNv7sAAyQs utC0WYK9M1pmz0ppQtACK5Ub4AspEYfd0PdwjJ8+nY7tQa3+j+KkhtTbIoSETCrWAtB0 OceACxEFLRQWAf/zhG4ayTNCvzQOhTxA5Jkpr73m0TPskxl6Ivt70B5X2EKDq5F8H3Lo 3h9JKMCoMcBwpaUti1r6Ydy1H+GEMT1rBp0AmnhoMF5KeozgNCiRFTW9vGN7gVVHAFKd R+xIlvliLBTzNT+tk67WvfnuCecyG8WuITotd/Z6h6PX3PLhFda7eIbTAowFjFadatFG SMmg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si1808188edd.133.2021.06.10.04.16.48; Thu, 10 Jun 2021 04:17:11 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbhFJLR4 (ORCPT + 99 others); Thu, 10 Jun 2021 07:17:56 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:3830 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230051AbhFJLRv (ORCPT ); Thu, 10 Jun 2021 07:17:51 -0400 Received: from dggeme752-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G11Vr1GmtzWskH; Thu, 10 Jun 2021 19:11:00 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggeme752-chm.china.huawei.com (10.3.19.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 10 Jun 2021 19:15:53 +0800 From: Zhang Yi To: , , , CC: , , , Subject: [RFC PATCH v4 7/8] ext4: remove bdev_try_to_free_page() callback Date: Thu, 10 Jun 2021 19:24:39 +0800 Message-ID: <20210610112440.3438139-8-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610112440.3438139-1-yi.zhang@huawei.com> References: <20210610112440.3438139-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme752-chm.china.huawei.com (10.3.19.98) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Reviewed-by: Jan Kara --- fs/ext4/super.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 80064e566f56..cff882cf0847 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.31.1