From patchwork Wed Apr 22 09:56:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98904C55185 for ; Wed, 22 Apr 2020 10:59:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DC7920787 for ; Wed, 22 Apr 2020 10:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587553162; bh=j4AQH5rvNz6DRK8i9x9rJX+agLWx9idbtMpnE/p1QUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0gU6cHqzd9VSPDNF0mqAZHN0LkA0DisjKmDaD29X+PFQfAF0Cm87hwybH1RGq9of1 wSd4fUX1irkjPU/NOGblg1EZcMaKpimdx/VgSywNsWQzClAOjLsyfWy3Ogge/wJo6v o+42mZIfGjWtWhX6XYDredy1APeyPVlx0IPkiHDI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726563AbgDVKDL (ORCPT ); Wed, 22 Apr 2020 06:03:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:52744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbgDVKDL (ORCPT ); Wed, 22 Apr 2020 06:03:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EFF120784; Wed, 22 Apr 2020 10:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587549790; bh=j4AQH5rvNz6DRK8i9x9rJX+agLWx9idbtMpnE/p1QUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MesT86zC/v6FajqCis2lrnPp1vGQsRi+aj4b0PHfV1N7cS/nDJIyCtTtli9/b5cw4 f4k9nW9WRhdMQkGaX2aHqiAI6u1s+EYdjEjbsJetirZ3T6aI+07YCm4JayNIDpYk9g gK98/lQBbwULQIDP18w4mMUBQjRoyuVcx6i4qRKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , "zhangyi (F)" , Theodore Tso Subject: [PATCH 4.4 059/100] jbd2: improve comments about freeing data buffers whose page mapping is NULL Date: Wed, 22 Apr 2020 11:56:29 +0200 Message-Id: <20200422095033.685771979@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095022.476101261@linuxfoundation.org> References: <20200422095022.476101261@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: zhangyi (F) commit 780f66e59231fcf882f36c63f287252ee47cc75a upstream. Improve comments in jbd2_journal_commit_transaction() to describe why we don't need to clear the buffer_mapped bit for freeing file mapping buffers whose page mapping is NULL. Link: https://lore.kernel.org/r/20200217112706.20085-1-yi.zhang@huawei.com Fixes: c96dceeabf76 ("jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer") Suggested-by: Jan Kara Reviewed-by: Jan Kara Signed-off-by: zhangyi (F) Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/commit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -1008,9 +1008,10 @@ restart_loop: * journalled data) we need to unmap buffer and clear * more bits. We also need to be careful about the check * because the data page mapping can get cleared under - * out hands, which alse need not to clear more bits - * because the page and buffers will be freed and can - * never be reused once we are done with them. + * our hands. Note that if mapping == NULL, we don't + * need to make buffer unmapped because the page is + * already detached from the mapping and buffers cannot + * get reused. */ mapping = READ_ONCE(bh->b_page->mapping); if (mapping && !sb_is_blkdev_sb(mapping->host->i_sb)) {