Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp286237pxv; Thu, 24 Jun 2021 07:57:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx1UoqG9Oc/1rgg9eVyc8TBNTrlvDEOtZ7KhuFlTlS65aH4dDdH44aiKp+Y1cdQQyvqpZ7 X-Received: by 2002:a92:ddc6:: with SMTP id d6mr3753834ilr.51.1624546622141; Thu, 24 Jun 2021 07:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624546622; cv=none; d=google.com; s=arc-20160816; b=VFyPR6+QKsie5REYTHqQWmN322csNM0x33RWSIsuGcfkLYW9JTyeWCEeBPDUnDtblM y2ZX3v9QoKf06kB2P1Udh8eCx3sL/JpdHIYYKwelg82qvIJU/KS6jbOnToU+xJyLHkGE jm7uMmjH26epCgPonlR44vyVdej3/4HtsBCo8oKCKQHm6T3ukY988Y2sLDoF0y6z/8/U qNKWFqpFsOmopwLbr7umpreWX49a0biFsdWSymOxwcZdlOyZ1KfBDqpsJunDP0TMIQ7E lTzO9Czq/i98J4zeM5bTasYDcv7ewAdq9zBYNMobrUHkQ3Mo4Zrbi6HJOW/G/YNJaCLL QOjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=AOL2Q8DqrRybf+sJ/XjAAtyvqfcczd/tk2h8w1br4pk=; b=C7TZKmV5E3Ta+bVH1ns5y1Dl6vI0Y07vVAbzHiCY+wtOSRDN2VhL86ceTEoc7A8NbS 5bN71y5I5lrkckZn8R1YclyeC+jYiYgrXlkoRpPWXrf8iA7DSHl308OQdMigEgXSQUxN 67A6ZykKdWAOE/v74Cwh3CeEpAVXoNHZjUatkrNS5rtQW6D7Si5iuw8UzBZI7ps+loTo WetfMG/LjzIn5d61KTb3V/jJmFO1xSjt4DhmgqVxcXy+edarmWtnrAi6XAS3mW1zBT40 7tVbryFqFnZyKzfJfCh1epP1f7xF0WqL8fVFsKgFgK3tU0i9oAQYf2X5uvoqF5vkIU/u dVcQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si3709270jap.92.2021.06.24.07.56.47; Thu, 24 Jun 2021 07:57:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbhFXO6x (ORCPT + 99 others); Thu, 24 Jun 2021 10:58:53 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:57075 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231250AbhFXO6w (ORCPT ); Thu, 24 Jun 2021 10:58:52 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 15OEuFGA016041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Jun 2021 10:56:15 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 3818D15C3CD7; Thu, 24 Jun 2021 10:56:15 -0400 (EDT) Date: Thu, 24 Jun 2021 10:56:15 -0400 From: "Theodore Ts'o" To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, jack@suse.cz, adilger.kernel@dilger.ca, david@fromorbit.com, hch@infradead.org Subject: Re: [RFC PATCH v4 5/8] jbd2,ext4: add a shrinker to release checkpointed buffers Message-ID: References: <20210610112440.3438139-1-yi.zhang@huawei.com> <20210610112440.3438139-6-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210610112440.3438139-6-yi.zhang@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Jun 10, 2021 at 07:24:37PM +0800, Zhang Yi wrote: > Current metadata buffer release logic in bdev_try_to_free_page() have > a lot of use-after-free issues when umount filesystem concurrently, and > it is difficult to fix directly because ext4 is the only user of > s_op->bdev_try_to_free_page callback and we may have to add more special > refcount or lock that is only used by ext4 into the common vfs layer, > which is unacceptable. > > One better solution is remove the bdev_try_to_free_page callback, but > the real problem is we cannot easily release journal_head on the > checkpointed buffer, so try_to_free_buffers() cannot release buffers and > page under memory pressure, which is more likely to trigger > out-of-memory. So we cannot remove the callback directly before we find > another way to release journal_head. > > This patch introduce a shrinker to free journal_head on the checkpointed > transaction. After the journal_head got freed, try_to_free_buffers() > could free buffer properly. > > Signed-off-by: Zhang Yi > Suggested-by: Jan Kara Applied, thanks. - Ted