Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3361553pxj; Mon, 7 Jun 2021 08:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6bN6qme+fWY9y5HFS44DQTa521yFTUEGy6Rrfc+ICudoHRraqEflQSPszX2OeZnVPUFVh X-Received: by 2002:a17:906:85da:: with SMTP id i26mr18546438ejy.185.1623080869288; Mon, 07 Jun 2021 08:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623080869; cv=none; d=google.com; s=arc-20160816; b=Dgsn46CHIShJmCfOwkggG9arnuuG0g/rJBD7hzWESEm/Q1Ipq4a2DXzsN/hnZH9W3d SHAL66EOMftEj5/bL21HCu9KXvmam1Oq6BdVSm8AsbKocJSXajEoCCLbrIZUbDlZwOav I3essu45g+AU3I09oTgN1BgqELbYgpkgRpxdVQ3MbAMFwrGEwRlhJlP3890fGt9cYBPO MkkoRl60vF2O9Woe8uYl5A+GGFuIwgvjX/m/4ewcgJcmtKXLGbQeaFDuehw01y9x2ksM KAbBPevtV7W9/oSniTdhVlFu5rKo4Be+Tn11F5o2rnNA9dVD2P4gy71V3HsKddByiD2F q3cA== 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=kTZ19QygUjzcyRhJnuoAa19uWrcYYUjZeVEx+bz1/SA=; b=ofCEsVJdNh/zeYKUfL6HjYfK4Lk2YMv5QPedC1Fv2waUEGnQ+CQbVj3dolN0xaTM9Z haZ73Q20CrZyYWc5Lyvrb+FvZL90O+5bkkny8UM9aT4SWvWEKwEQoiN7PKyusDJB0Vzn 8xkjo69wQzXGw1gOfGg9yBYVumA3DzIXmcNn2uj//8KT7W4BBrtBw1tLVyzL/mVeelUh lvPbrzzR1ijbYwiJvR18cxtbSEZx/3jFeVxgHHOIP9NtYSJ3vm8mnlN+PJtaSEBodEIQ zyS3KaO/J+AOR3uancr7+lYP4zYeJjnSnJEk/VhEsHyLVEE3RiFVdcLZdl2LZHDdzAaw r6YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=M41HLKMh; dkim=neutral (no key) header.i=@suse.cz; 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 t23si12442246ejr.435.2021.06.07.08.47.24; Mon, 07 Jun 2021 08:47:49 -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=M41HLKMh; dkim=neutral (no key) header.i=@suse.cz; 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 S230250AbhFGPrk (ORCPT + 99 others); Mon, 7 Jun 2021 11:47:40 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:38952 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbhFGPrj (ORCPT ); Mon, 7 Jun 2021 11:47:39 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CDBAF21A8A; Mon, 7 Jun 2021 15:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623080747; 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=kTZ19QygUjzcyRhJnuoAa19uWrcYYUjZeVEx+bz1/SA=; b=M41HLKMhZmTqquZ7q4wn2MDBGke0OQIHmHdHY30x+SXuozn1BKXJC0LDja9nVTKyq3LiSp tiOmspPITRn1GEKX8ItNamsqVVA8caiILrtREy8TNB2lC9fgTEyFOCuyLzk8SIHZ5Rzgid /+Knc4cDcXTWluTEZvwiNurMSuNMKO4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623080747; 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=kTZ19QygUjzcyRhJnuoAa19uWrcYYUjZeVEx+bz1/SA=; b=C+lwuUenKm0nBvEpxaLzqwQaADRSH3byvsEBpLGkMVMUCEgFxAHuWEqHfbtFhbnfDV8Mid BLG15jIoqXdiUAAQ== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 4B319A3B85; Mon, 7 Jun 2021 15:45:47 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 0FD561F2CA8; Mon, 7 Jun 2021 17:45:47 +0200 (CEST) Date: Mon, 7 Jun 2021 17:45:47 +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 5/8] jbd2,ext4: add a shrinker to release checkpointed buffers Message-ID: <20210607154547.GA29326@quack2.suse.cz> References: <20210527135641.420514-1-yi.zhang@huawei.com> <20210527135641.420514-6-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210527135641.420514-6-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:38, 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 Looks good. Feel free to add: Reviewed-by: Jan Kara Honza -- Jan Kara SUSE Labs, CR