Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1260025pxx; Tue, 27 Oct 2020 12:04:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKz7HyBXm6nX+cdgKd35eTjDjC1QTxdvQWkvDvmQiG/FoJbym2APy+lFvLcRXTJjmblDt+ X-Received: by 2002:a17:906:4410:: with SMTP id x16mr3805272ejo.307.1603825475730; Tue, 27 Oct 2020 12:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603825475; cv=none; d=google.com; s=arc-20160816; b=HKCKVFw6P8sdBl+fAPH1adnsBpuhBRY+vN54Soo5lpZP8EtcyqfstlA4q3r/2zdEfJ MstN+3vaVQmgry7n7mASl18I5PI7bhUlEkexOuXbSu0sueotbrOl2LcXOVIeKy59yzqr tdoFoVMmV7flQQ2tHj504i/4lhcVK8RGIV3J219IYhQ1qYnmNXSdE5yUZ2KE+a9tiSbJ NriJ6tIIB+cK1g7FyluDj02290DYhcYgabPD8vzVet225LWkie6K5Fg9/0Z6Ym3XMRXL HzZtNwXsbTwf5V3YA7EFQfj08NEgQbIPSBa06vNVUUbeFNeJlUHL1wZDM1XyJygZwcdx lBlQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qHUdLXVErMbGelZOAuqWxxoRrWGEVMeU7Iw5vOUsBkc=; b=rjsMLOKfQYhJLR4G3+Bm6392D9Rv4AOjDKvj2oTCbPksrgxxB5ZkusQ/bPLwNvS9mv cXkh2p/UnLq/08RVExlqtH48twTxIJYS0n6J6siaiXokJSOyufq96WLpfVF28O5/MdGa 9+GNTinaGEelNAxxUKWIZE6tGWxKolpr017g2ktqQgThbd5Y5MQ/H/rx9cgkXP7WtH69 33I78rgZIluRqW7p/tMLK3P1oURBkE+9ATPzG78iIGstwwmnP8P2/TyXE7hTP4BUk3vZ SI3vNZUbUxsbudiYTlMJ3ua6npXfcffJKOw80c+CqVFOMeNpWp8Qs/hCOqIFivnpPSzd bKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k7QMhEoI; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si1639170ejk.683.2020.10.27.12.04.13; Tue, 27 Oct 2020 12:04:35 -0700 (PDT) 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=k7QMhEoI; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502099AbgJ0AjY (ORCPT + 99 others); Mon, 26 Oct 2020 20:39:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:51720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409348AbgJZXvP (ORCPT ); Mon, 26 Oct 2020 19:51:15 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB4FD221F7; Mon, 26 Oct 2020 23:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756274; bh=DriNn/C243SA7vKnjcnOtZOi+39F3FDPSQWb2qe5UWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k7QMhEoIUJL9ZBVBOGKlsdVTngbqoblQAJ2exMar1dYTc9obtWHS4cWxngSr0Vli5 AJy80mkRJGzRBCWAgVRf47b1tD+y2w6Usjpe18xbPZZatdAhYVZjFyLeSUAHdXWenh fZOQWUL126IO8TlmVGuNFbvoci6msEzcAxc0gy/0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chao Yu , Jaegeuk Kim , Sasha Levin , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH AUTOSEL 5.9 106/147] f2fs: fix to set SBI_NEED_FSCK flag for inconsistent inode Date: Mon, 26 Oct 2020 19:48:24 -0400 Message-Id: <20201026234905.1022767-106-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 66969ae852b97..84c67409b1c96 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -292,6 +292,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, @@ -300,6 +301,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, @@ -309,6 +311,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.25.1