From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.99 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794226941; b=btFrCijHbaH1Sf0mvlOrKed1S/MzYieCoc0Yuqgf2FbUGbG0F8qYWEKM+MqaFNWhgx5w eGnV6UHRkxBDBmHjlOHYomXiLAw6dD1+0dor/Qs+3w/eEV0ukiOyvrriVC2A5qc7vs33y fhTfoTOmiIrRkd0MaOEVepmFzrSgSwZrZE0vNTvBy4YzJOEO3FCo00jvnm+JMFfR+ztAe aKD11QTgCjyfXJdgIYnNRbK9+lhb+NnIUuz7h614GeZQQGQrxcQ6M6YLTl0HkIIiKCOeM lu49R2vU+Gs/UUa4YUlotJxhTOXLqOit1e309/e2GxwfWNJlYUjHyjiZBFCLouri2Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794226941; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=Aafpolxy4G2IXnRkI9yBrWFY/qXCVvN/DDtZZv0gSZ8=; b=Lmq0+7F3FzOj5EyUA4uPaqfSwsasAQ32HdudsmixkUcihIsXy/1SA2OOaVo6cWLdrHjf OXVPi+zTb3EsOmr4Qfty7gsMn7SpTEIgMLLkgJiH2s436dgFoiQL1TgFIFC2V9KY2YBLd FbsrmDwIPAxs7LF8PwPIWrvvXA5a9UxgFsTBYD5HpNr6F59IT6+4Hz6KlaxeYMYuCuASb cxob4Wa0Ic+6GUX8PxVLiN5mtgX2tzRcBOc65Mra30phpWnoZOUSt6X9c6H9JsJ8I5osn lbqEQmWc1wzopKgcBtBDCw4n3zPeiOx1xuX2nu+V7wuFpVfN/1PBmMntienlMq+IzAw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=pHCKog1Z; arc=none smtp.remote-ip=115.124.30.99 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D13F360A262D for ; Mon, 9 Nov 2026 12:22:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D13F360A262D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=pHCKog1Z DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1794226936; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Aafpolxy4G2IXnRkI9yBrWFY/qXCVvN/DDtZZv0gSZ8=; b=pHCKog1ZEh5lLz4a+7Iab8CBwMA596ZI7Rw7Hzpc/mXyP0EV4dpQwzOC+AdBu0ZPa5LdflothAX1gs6+LBXHibG67iM4A3eOqhKy0SgTD0nrqgLt1GkWWqj1z4+ypibx+9gKNUP77tMqOL8cdYIUqqAGzGi6JJOkPJQUmHLoVGo= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R241e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0XEP8axI_1794226934; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0XEP8axI_1794226934 cluster:ay36) by smtp.aliyun-inc.com; Mon, 09 Nov 2026 20:22:14 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao Cc: Mark Fasheh , Joel Becker , ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Joseph Qi Subject: [PATCH v3 29/31] ocfs2: check chain list dinodes in online filecheck Date: Mon, 9 Nov 2026 20:21:19 +0800 Message-Id: <20261109122121.21473-30-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20261109122121.21473-1-joseph.qi@linux.alibaba.com> References: <20261109122121.21473-1-joseph.qi@linux.alibaba.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Wire the chain-list guard and its three sub-checks into the filecheck validator: cl_count against ocfs2_chain_recs_per_inode(), cl_next_free_rec against cl_count, and cl_bpc against the cluster to block size ratio. The bits-per-cluster predicate keeps the two bitmap_blkno conditions, so the global bitmap inode itself remains exempt. Signed-off-by: Joseph Qi --- fs/ocfs2/inode.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 132864f860fa..7e299b2dc8c0 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -2165,6 +2165,37 @@ static int ocfs2_filecheck_validate_inode_block(struct super_block *sb, } } + if (ocfs2_dinode_has_chain_list(di)) { + struct ocfs2_chain_list *cl = &di->id2.i_chain; + + if (ocfs2_dinode_has_bad_chain_count(sb, di)) { + mlog(ML_ERROR, + "Filecheck: invalid dinode #%llu: chain list count %u\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(cl->cl_count)); + rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } + + if (ocfs2_dinode_has_bad_chain_next_free(di)) { + mlog(ML_ERROR, + "Filecheck: invalid dinode #%llu: chain list index %u\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(cl->cl_next_free_rec)); + rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } + + if (ocfs2_dinode_has_bad_chain_bpc(sb, di)) { + mlog(ML_ERROR, + "Filecheck: invalid dinode #%llu: bits per cluster %u\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(cl->cl_bpc)); + rc = -OCFS2_FILECHECK_ERR_INVALIDINO; + goto bail; + } + } + bail: return rc; } -- 2.39.3