Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3617784pxb; Mon, 24 Jan 2022 13:37:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5hDiOx+5JlzXSMwGV4Vzl3iNiVyKdHaT5LkebEfplH5+C6vnnvLL1SaqLVICcuIPUMTo6 X-Received: by 2002:a17:902:b414:b0:142:431f:3d1c with SMTP id x20-20020a170902b41400b00142431f3d1cmr16261669plr.32.1643060266052; Mon, 24 Jan 2022 13:37:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060266; cv=none; d=google.com; s=arc-20160816; b=GMZs3YsKQNUNeVShVhboHoyS2au4iHHvf6yy5x8htLyNcQsLs8uYEVuCbC69P1xq4h 5AJQX/GNH+YkYJBlnZeHAu3obFbNpkGfrcQ1xIToB15AIdPdWyY9dujjyj1F7KnjrOgn cZQDKmXnKFITqXD8UYeaRJI//ixxBngu9ZoaBwhG7n3Wrf6SxqcOs13pYTq46C1dhBo6 TwHHPNqaXg1OzTXhoiY0LH2hhOv+2EV1VhXPoiG210WY2w32aVSpl5QpWhTjMgVYJiUF ff5FP4+F2pHKWXZUfZDi3xiH3yVlCb1ASMfSgHJBJAQ8+o/HuQprxnxYc5/RYQGZYOLR qjSA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kjbJYle0UAYr42QAwU9vlvL6ZwNiSnz4M55cRNUKgfw=; b=IwNrzVsu04VUIs+6pZhqoWmiun5n3/sAfhRMIgtDFdg7alhPocnmouK3o0d+3rKPaU z2B6rENpk22z0I9HRTeGKSJO5lkM+YsmwtPagQaHb2yxw0UrESXyf9VfzhEQ01OEW3lw SUYsSeLHGE0dnPWTQwLB8WN4yzuW1TJrCU8aTOeZgUZSy2xCjJH1MgSon4Pxgm4/XsBB /TAFtNZDxF0DNp/XVfAzF9vNp/QJ+wrbWKmLUyIP8hsfUswu5QIkFmaY3GHiXN0K5W/7 bnONfGuZgqEauchcsLqFmnSfx/mTIXRGlWiugwtj+6x6Mw3baTyLlGdm+zlM5WQjbWFv gY/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sYwbJp9A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si14742576plt.595.2022.01.24.13.37.33; Mon, 24 Jan 2022 13:37:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=sYwbJp9A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449617AbiAXVPx (ORCPT + 99 others); Mon, 24 Jan 2022 16:15:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48374 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351590AbiAXUtM (ORCPT ); Mon, 24 Jan 2022 15:49:12 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95405B81061; Mon, 24 Jan 2022 20:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A56B5C340E7; Mon, 24 Jan 2022 20:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057349; bh=XmiM38+z9vU9eF+cGw0W1GcTqYfEXX41IXLFTK4g0Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sYwbJp9AzgJxP5KO++iyjLFtltdC7Tnm+tmuS+wvPMWNbQ0thEzoeuNuWTp7X9nUA hBV6bSeRfJ6zYOgjN79IBeZubAVrmBu/AxY0SxT8hVh7dg9Nq/9rKfoieUudwsqPeb x6aa66xAJpU2picwLt8cj3KRZlwlXRsV8/XwKzto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.15 782/846] f2fs: fix to check available space of CP area correctly in update_ckpt_flags() Date: Mon, 24 Jan 2022 19:44:59 +0100 Message-Id: <20220124184127.931729694@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu commit b702c83e2eaa2fa2d72e957c55c0321535cc8b9f upstream. Otherwise, nat_bit area may be persisted across boundary of CP area during nat_bit rebuilding. Fixes: 94c821fb286b ("f2fs: rebuild nat_bits during umount") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1305,8 +1305,8 @@ static void update_ckpt_flags(struct f2f unsigned long flags; if (cpc->reason & CP_UMOUNT) { - if (le32_to_cpu(ckpt->cp_pack_total_block_count) > - sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) { + if (le32_to_cpu(ckpt->cp_pack_total_block_count) + + NM_I(sbi)->nat_bits_blocks > sbi->blocks_per_seg) { clear_ckpt_flags(sbi, CP_NAT_BITS_FLAG); f2fs_notice(sbi, "Disable nat_bits due to no space"); } else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) &&