From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 673A5CD4F3B for ; Fri, 22 Sep 2023 09:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbjIVJYI (ORCPT ); Fri, 22 Sep 2023 05:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231180AbjIVJYH (ORCPT ); Fri, 22 Sep 2023 05:24:07 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EEF3195 for ; Fri, 22 Sep 2023 02:24:01 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAA32C433C7; Fri, 22 Sep 2023 09:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695374641; bh=DwZlnZLgXMNE+ZzleFxHPJhiKoucAi8CLZr5qGACYT0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XuEReGEy6/Fflv32/L1U+m1afbZOqvChX5fHEAAK03QFmA1nRDGs+lfwZfY9U83GT UfcTXROIP8itTGH8xpqrufbAZRPIGHR1cG97Mua1itShcTYu8XEa+AC6y0evCUcvLR oMZ4GD1p3XnUMHMoZY07mxaNF4mH8mAaUSAam5KI= Date: Fri, 22 Sep 2023 11:23:59 +0200 From: Greg KH To: zhangshida Cc: stable@vger.kernel.org, Shida Zhang , stable@kernel.org, Andreas Dilger , "Darrick J . Wong" , Theodore Ts'o Subject: Re: [PATCH] ext4: fix rec_len verify error Message-ID: <2023092232-squash-buggy-51c7@gregkh> References: <2023092057-company-unworried-210b@gregkh> <20230922053915.2176290-1-zhangshida@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922053915.2176290-1-zhangshida@kylinos.cn> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Fri, Sep 22, 2023 at 01:39:15PM +0800, zhangshida wrote: > From: Shida Zhang > > [ Upstream commit 7fda67e8c3ab6069f75888f67958a6d30454a9f6 ] > > With the configuration PAGE_SIZE 64k and filesystem blocksize 64k, > a problem occurred when more than 13 million files were directly created > under a directory: > > EXT4-fs error (device xx): ext4_dx_csum_set:492: inode #xxxx: comm xxxxx: dir seems corrupt? Run e2fsck -D. > EXT4-fs error (device xx): ext4_dx_csum_verify:463: inode #xxxx: comm xxxxx: dir seems corrupt? Run e2fsck -D. > EXT4-fs error (device xx): dx_probe:856: inode #xxxx: block 8188: comm xxxxx: Directory index failed checksum > > When enough files are created, the fake_dirent->reclen will be 0xffff. > it doesn't equal to the blocksize 65536, i.e. 0x10000. > > But it is not the same condition when blocksize equals to 4k. > when enough files are created, the fake_dirent->reclen will be 0x1000. > it equals to the blocksize 4k, i.e. 0x1000. > > The problem seems to be related to the limitation of the 16-bit field > when the blocksize is set to 64k. > To address this, helpers like ext4_rec_len_{from,to}_disk has already > been introduced to complete the conversion between the encoded and the > plain form of rec_len. > > So fix this one by using the helper, and all the other in this file too. > > Cc: stable@kernel.org > Fixes: dbe89444042a ("ext4: Calculate and verify checksums for htree nodes") > Suggested-by: Andreas Dilger > Suggested-by: Darrick J. Wong > Signed-off-by: Shida Zhang > Reviewed-by: Andreas Dilger > Reviewed-by: Darrick J. Wong > Link: https://lore.kernel.org/r/20230803060938.1929759-1-zhangshida@kylinos.cn > Signed-off-by: Theodore Ts'o > Signed-off-by: Shida Zhang > --- > fs/ext4/namei.c | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) What stable tree(s) are you asking this to be backported to? thanks, greg k-h