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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F3AEC31E5B for ; Wed, 19 Jun 2019 19:00:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 337DF214AF for ; Wed, 19 Jun 2019 19:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730168AbfFSTAg (ORCPT ); Wed, 19 Jun 2019 15:00:36 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:42071 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726449AbfFSTAf (ORCPT ); Wed, 19 Jun 2019 15:00:35 -0400 Received: from callcc.thunk.org (guestnat-104-133-0-109.corp.google.com [104.133.0.109] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x5JJ0U1h016837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2019 15:00:31 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id EE544420484; Wed, 19 Jun 2019 15:00:29 -0400 (EDT) Date: Wed, 19 Jun 2019 15:00:29 -0400 From: "Theodore Ts'o" To: Artem Blagodarenko Cc: linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, linux@rasmusvillemoes.dk Subject: Re: [PATCH] e2fsck: process empty directory if large_dir and inline_data set Message-ID: <20190619190029.GA3383@mit.edu> References: <20190614144237.6010-1-c17828@cray.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190614144237.6010-1-c17828@cray.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Jun 14, 2019 at 05:42:37PM +0300, Artem Blagodarenko wrote: > Doing a forced check on an ext4 file system with inline_data and > large_dir results in lots of fsck messages. To reproduce: > ... > > Rootcause of this issue is large_dir optimization that is not > appropriate for inline_data. > > Let's not optimize it if inline_data is set. > > Reported-by: Rasmus Villemoes > Signed-off-by: Artem Blagodarenko Thanks, applied, although I corrected the commit description. The initial description now reads: e2fsck: correctly handle inline directories when large_dir is enabled. Historically, e2fsck has required that directories not contain holes. (In fact, as of this writing, ext4 still requires this to be the case.) Commit ae9efd05a98 ("e2fsck: 3 level hash tree directory optimization") removed this requirement if the large_dir feature is enabled; however, the way it was done caused it to incorrectly handle inline directories. To reproduce the problem fixed by this commit: ... BTW, Removing the directory hole check in commit ae9efd05a98 for file systems with the large_dir feature enabled was a wee bit optimistic, since the kernel will still mark the file system as corrupted. Fixing the kernel so that it doesn't complain about directories with holes is going to be a bit more complicated than just removing the check in __ext4_read_dirblock(): if (!bh) { ext4_error_inode(inode, func, line, block, "Directory hole found"); return ERR_PTR(-EFSCORRUPTED); } (That's because we have to fix all of the callers of ext4_read_dirblock() to handle the case where it returns NULL if there is no directory block at that specified location.) I should have caught that when reviewing the e2fsprogs commit; my bad. At this point, we should just fix the kernel so it can handle directories with holes (both for large_dir and non-large_dir directories). - Ted