Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3433412pxv; Sun, 4 Jul 2021 19:18:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcJ1nVwsyWHiVUyhOTNxEyoeDHGmwjGXtAeSiHhKzqpKgd/iBxRJdO3e1V/7qXjdQieTXh X-Received: by 2002:a5e:d70e:: with SMTP id v14mr9821246iom.33.1625451486986; Sun, 04 Jul 2021 19:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625451486; cv=none; d=google.com; s=arc-20160816; b=dqeub8VyWKzxP8q54xGlJciKVd9EgfyBnTfjlf28MsnL7EOBtus3JH/XsfavKhLdFp t/soL1k/WiIUhO4gng0RHYyMEy2OitcEqxPX5ct6bjV6zCRZMlMemBEzrVDuz+XUZrgA j4CmdsJcuS92C0jWPGxSBquA21xNi4ZwRTZC6nQOU5ebQ2dKHp8cq4fT8thJPiCmP9ql gl/w6dB1xMyYNf53AxPfdZy9EqT2P29gg0crWoHUOcZIxNvt8h4o290mZw6GXcAInjV5 7COG5XFkQG2Y2sHsNdd5wmOmvEHbOnzJxDBxKkUCo+qBNAY0sQbEmpjs6a31Ck8CnURU Tcow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=fmckWtdblAXv2qs/NuEqm7UFZ1EvXTUM9r6OozRci9w=; b=LfWcAmTGfD6eIqBMeoN6VXx+GR/Ft3UvG3smVXu71j/YtdiiEwO5mpthNvtyUG91sT G1/aOLpvUmjkqno7MJLkn4qDQgL9upselLdoic73VeYvUiG0gWropTbQybs/3TJeUq0z Uzkdrq/UkoMJoxfpeGXtQEszzw+qmw0eVb1PtwrLTnuTYjnNAE7cO+TXDy/io2rhY16H FYa/eSl9SbSQl1R5ItfrGaUg7ocMZ4jBWCD3lVupXRmzR+3JJ1DmtklBCJSam3GNtQ8Y vGbgdkBxlIOW6IUQNCMZvapo9Z8v214ut2FFgwzxIUmmUrQInk6Ba93LUzfy8due68ED F3SQ== 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 w14si15801313iov.43.2021.07.04.19.17.46; Sun, 04 Jul 2021 19:18:06 -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 S229681AbhGECUJ (ORCPT + 99 others); Sun, 4 Jul 2021 22:20:09 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:9348 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhGECUI (ORCPT ); Sun, 4 Jul 2021 22:20:08 -0400 Received: from dggeme752-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GJ8Nm0Fdkz75XX; Mon, 5 Jul 2021 10:13:12 +0800 (CST) Received: from [10.174.178.134] (10.174.178.134) 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; Mon, 5 Jul 2021 10:17:30 +0800 Subject: Re: [powerpc][5.13.0-next-20210701] Kernel crash while running ltp(chdir01) tests To: Theodore Ts'o CC: Jan Kara , , Guoqing Jiang , Sachin Sant , Ext4 Developers List , "linux-fsdevel@vger.kernel.org" References: <26ACA75D-E13D-405B-9BFC-691B5FB64243@linux.vnet.ibm.com> <4cc87ab3-aaa6-ed87-b690-5e5b99de8380@huawei.com> <03f734bd-f36e-f55b-0448-485b8a0d5b75@huawei.com> <36778615-86fd-9a19-9bc9-f93a6f2d5817@huawei.com> <66fb56cd-f1ff-c592-0202-0691372e32f5@huawei.com> From: Zhang Yi Message-ID: <3acc3ee6-3a3d-3b26-7580-b20955270913@huawei.com> Date: Mon, 5 Jul 2021 10:17:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.134] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 On 2021/7/4 22:04, Theodore Ts'o wrote: > On Sat, Jul 03, 2021 at 12:55:09PM +0800, Zhang Yi wrote: >> Yeah, it sounds good to me. Do you want me to send the fix patch, or you >> modify your commit 8f9e16badb8fd in another email directly? > > I've gone ahead and made the changes; what do you think? > > I like how it also removes 40 lines of code. :-) > Thanks for the fix, this patch looks good to me besides one error handling below. > >>From ef3130d1b0b8ca769252d6a722a2e59a00141383 Mon Sep 17 00:00:00 2001 > From: Theodore Ts'o > Date: Fri, 2 Jul 2021 18:05:03 -0400 > Subject: [PATCH] ext4: inline jbd2_journal_[un]register_shrinker() > > The function jbd2_journal_unregister_shrinker() was getting called > twice when the file system was getting unmounted. On Power and ARM > platforms this was causing kernel crash when unmounting the file > system, when a percpu_counter was destroyed twice. > > Fix this by removing jbd2_journal_[un]register_shrinker() functions, > and inlining the shrinker setup and teardown into > journal_init_common() and jbd2_journal_destroy(). This means that > ext4 and ocfs2 now no longer need to know about registering and > unregistering jbd2's shrinker. > > Also, while we're at it, rename the percpu counter from > j_jh_shrink_count to j_checkpoint_jh_count, since this makes it > clearer what this counter is intended to track. > > Fixes: 4ba3fcdde7e3 ("jbd2,ext4: add a shrinker to release checkpointed buffers") > Reported-by: Sachin Sant > Reported-by: Jon Hunter > Signed-off-by: Theodore Ts'o > --- > fs/ext4/super.c | 8 --- > fs/jbd2/checkpoint.c | 4 +- > fs/jbd2/journal.c | 148 +++++++++++++++++-------------------------- > include/linux/jbd2.h | 6 +- > 4 files changed, 63 insertions(+), 103 deletions(-) > [..] > diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c > index 152880c298ca..8a9c94dd3599 100644 > --- a/fs/jbd2/journal.c > +++ b/fs/jbd2/journal.c [..] > /* > * Management for journal control blocks: functions to create and > * destroy journal_t structures, and to initialise and read existing > @@ -1361,6 +1403,19 @@ static journal_t *journal_init_common(struct block_device *bdev, > journal->j_sb_buffer = bh; > journal->j_superblock = (journal_superblock_t *)bh->b_data; > > + journal->j_shrink_transaction = NULL; > + journal->j_shrinker.scan_objects = jbd2_journal_shrink_scan; > + journal->j_shrinker.count_objects = jbd2_journal_shrink_count; > + journal->j_shrinker.seeks = DEFAULT_SEEKS; > + journal->j_shrinker.batch = journal->j_max_transaction_buffers; > + > + if (percpu_counter_init(&journal->j_checkpoint_jh_count, 0, GFP_KERNEL)) > + goto err_cleanup; > + > + if (register_shrinker(&journal->j_shrinker)) { > + percpu_counter_destroy(&journal->j_checkpoint_jh_count); > + goto err_cleanup; > + } Need to release j_sb_buffer in above two error path. Thanks, Yi.