Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp796773pxb; Tue, 3 Nov 2020 12:47:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeyZZkfrVlF1/A2oZSGsvShiWiXU2lRqbaHjJnLTbAvwRwzTPy780QRfj07gXyrDZKi5mV X-Received: by 2002:a17:906:170f:: with SMTP id c15mr22717262eje.347.1604436467656; Tue, 03 Nov 2020 12:47:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604436467; cv=none; d=google.com; s=arc-20160816; b=Edew5j7Yd7kgDyu2VX8gZC0ux6MOT1dhJkVwlq6o/w4I6cdenLSaulyZC3aPSn/U+h nZak7SH5LLcsa5Ckb5RtJsr0MWce9CBWVoVQ75f/XVLShvIuBl14gqBx4TQ9ojWC5Dl2 TzE3ZOacWEcnPZqIR76sqWvoWE9RkFRqY1DSzPXfvqz5VGQBW2Cq2HSdWfLPTuc5d9Uv fdf4KyURPLYNulQgUznayMmJD7nN5KVEJ0DOmPGrfhQeClaH1IE3+P6q4iXecOnWD/CW oOroVAGe2u9xePsmxOPf6rVhsPpaYPmlMI9ILyslPdItwcakTAz803MaoEcFcyVd8Tn1 SbTA== 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=Gxze8pJ678Z16XeH9g6ShxV1H7b90wldI6Ah9xsqNJs=; b=DK3d4AQg/Uodunfu2OojovekcNNgcG05tVjSlfk0cwSnDb/1cQ2hgUqFRazaavlZdY ZMikasvYazDCyJe/VCNG+v0JJME6Tq59/Gd/w32ep9PzBkqmEWZAGfei2j0ROqiVYbhi 2eIFl84gZtKdDRw0PtLL44hm8XBsIzB1aIfHsBYS8f23H0WjCIYLiKAC5wMR+/qguAKL cPRdRf76ECYE+zBGlNiEkvEe8Fjp6Mhn/ZjA/irzNWrQbcZqeK5NIOf6TsFolcwlZn21 bgQI5V1x8Jlkm3utXVvcZ5u5srXw3qp45rmlWYE3riDbL3eb5mPgav5gRCoChwvQoAjt 3bzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pk+qqiHI; 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=fail (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 z61si14660354ede.133.2020.11.03.12.47.24; Tue, 03 Nov 2020 12:47:47 -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=@kernel.org header.s=default header.b=pk+qqiHI; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730939AbgKCUos (ORCPT + 99 others); Tue, 3 Nov 2020 15:44:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:60240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730920AbgKCUol (ORCPT ); Tue, 3 Nov 2020 15:44:41 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 61451223BF; Tue, 3 Nov 2020 20:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436280; bh=AgOgal3Yb3eN6Y9FrB9H497p9EXkPl6YCHZNi7+bxjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pk+qqiHIii5XUnn9U2Qqw4GV0T3EOqkvH27YeYB6km9g6IgPO4iFVqbT+Dex/UAIa Zb813djMsavuHkg4NcNyYeRk42Kj8eOHIYMCI0KbS+gPZaOcAKqbG5JwCBXk8HOrjo 9kn1Juz+uaBjH6fmjdOiNEiIIhCShO0yCri+Nh4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.9 144/391] f2fs: fix to set SBI_NEED_FSCK flag for inconsistent inode Date: Tue, 3 Nov 2020 21:33:15 +0100 Message-Id: <20201103203356.547641214@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@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 [ Upstream commit d662fad143c0470ad7f46ea7b02da539f613d7d7 ] If compressed inode has inconsistent fields on i_compress_algorithm, i_compr_blocks and i_log_cluster_size, we missed to set SBI_NEED_FSCK to notice fsck to repair the inode, fix it. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 5195e083fc1e6..12c7fa1631935 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -299,6 +299,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) F2FS_FITS_IN_INODE(ri, fi->i_extra_isize, i_log_cluster_size)) { if (ri->i_compress_algorithm >= COMPRESS_MAX) { + set_sbi_flag(sbi, SBI_NEED_FSCK); f2fs_warn(sbi, "%s: inode (ino=%lx) has unsupported " "compress algorithm: %u, run fsck to fix", __func__, inode->i_ino, @@ -307,6 +308,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) } if (le64_to_cpu(ri->i_compr_blocks) > SECTOR_TO_BLOCK(inode->i_blocks)) { + set_sbi_flag(sbi, SBI_NEED_FSCK); f2fs_warn(sbi, "%s: inode (ino=%lx) has inconsistent " "i_compr_blocks:%llu, i_blocks:%llu, run fsck to fix", __func__, inode->i_ino, @@ -316,6 +318,7 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page) } if (ri->i_log_cluster_size < MIN_COMPRESS_LOG_SIZE || ri->i_log_cluster_size > MAX_COMPRESS_LOG_SIZE) { + set_sbi_flag(sbi, SBI_NEED_FSCK); f2fs_warn(sbi, "%s: inode (ino=%lx) has unsupported " "log cluster size: %u, run fsck to fix", __func__, inode->i_ino, -- 2.27.0