Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp436248ybb; Wed, 8 Apr 2020 02:56:31 -0700 (PDT) X-Google-Smtp-Source: APiQypJF4Yx7ID2X+Qn4q3MvsbBjyyZ2zJPVss/LGmndpJMrf2mHEupNsV2DZEb3NlNtL7HB8gtJ X-Received: by 2002:aca:598a:: with SMTP id n132mr407244oib.111.1586339791585; Wed, 08 Apr 2020 02:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586339791; cv=none; d=google.com; s=arc-20160816; b=uvK/K9SR2JrQGWyydC09Mf2zGUKjN1Pig2SeOw65jwZ3GHsdlRgrk2/SAA0vLWl152 uZMeeAyasjSZjBwNr+Jq8UyPixwsSN3UXLPoz3zfn33Y4ETWwgMoiX5WuOzXbCNbBT78 UZwuR6CRaiOvWW3OduNI1pUMxT6uX94y3McJ24XHqDNw155Dbf36hDqByg+yhM7Jkt41 d3+UqUrY9MJz7f86ldY4luwr+suv1SXxItnwCfMzRx/PChzDqPNhuQ7aJOuNnEMZUX8s SDVEshcbhnbI4aE9O6MqdLDxd6JrFf4by1Nf/HQZHZ/Up/KXzgaGhs/PL8TNujOn9Vrq Dylg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aTXS8Cyuik7+NE0TaIO4cuvelpFTlgOZ+u8AYNik8vU=; b=1AB2v0SonCENf1RGHLR3S92+rf8L8l2Sxs9vw79Xz5+WmHFsE40CBT56eQin+EDkMG ba7/pcg7giSmx62Mfz8VBJGDWgD38WR9uaMBdiwMOS8pMEyJEwV5WhQq1KdDJ7ZtVD6h GygMc0PuD+cvQAuBC7DyeY/ZNBTvPg25vAwVt2gc/RCkPqqBE12o2Vb09uch9/dEZQ+h vcENSFZ205jeYMzcU6Pp4mLoBlTLep4Ww8PEG4z0GE/rVsKFEEfrzVTkWqgiAUaYUKdY 8NlX/9D9ZYw4n1wbyYJczrhPygCV8caZHD6J8ws8aCydhHp+86lc1S6l7Rr3g8rhKQcU 32PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si2388586otq.133.2020.04.08.02.56.05; Wed, 08 Apr 2020 02:56:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727749AbgDHJbx (ORCPT + 99 others); Wed, 8 Apr 2020 05:31:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:48252 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbgDHJbx (ORCPT ); Wed, 8 Apr 2020 05:31:53 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5F3CCAF0D; Wed, 8 Apr 2020 09:31:51 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 356481E1239; Wed, 8 Apr 2020 11:31:51 +0200 (CEST) Date: Wed, 8 Apr 2020 11:31:51 +0200 From: Jan Kara To: Andreas Dilger Cc: Harshad Shirwadkar , Jan Kara , linux-ext4@vger.kernel.org Subject: Re: [PATCH v2 3/3] ext4: reimplement ext4_empty_dir() using is_dirent_block_empty Message-ID: <20200408093151.GA30172@quack2.suse.cz> References: <20200407064616.221459-1-harshadshirwadkar@gmail.com> <20200407064616.221459-3-harshadshirwadkar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue 07-04-20 11:21:01, Andreas Dilger wrote: > While looking at this code, I noticed that ext4_empty_dir() considers a > directory without a "." or ".." entry to be empty. I see this was changed > in 64d4ce8923 ("ext4: fix ext4_empty_dir() for directories with holes"). > I can understand that we want to not die on corrupted leaf blocks, but it > isn't clear to me that it is a good idea to allow deleting an entire > directory tree if the first block has an error (missing "." or ".." as the > first and second entries) but is otherwise valid. There were definitely > bugs in the past that made "." or ".." not be the first and second entries. That's a good question. I'd just say that ext4_empty_dir() generally returns true when there's some problem with the directory. In commit 64d4ce8923 I just followed that convention. This behavior of ext4_empty_dir() (and empty_dir() before in ext3) dates back at least to the beginning of git history... I guess we could err on the safer side and disallow directory deletion if there is any problem with it but I guess there was some motivation for this behavior in the past? Maybe somebody remembers? Honza -- Jan Kara SUSE Labs, CR