Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp724964pxm; Fri, 25 Feb 2022 18:24:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfAuDCHbrHEPdNOoYTDDEIc9kkI3+BYu2ThmGvEmfdF1xgzj8y9Xytqhkxsq+VjuQdQkbk X-Received: by 2002:a05:6a00:15d5:b0:4f0:fbeb:6007 with SMTP id o21-20020a056a0015d500b004f0fbeb6007mr10790232pfu.17.1645842285206; Fri, 25 Feb 2022 18:24:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645842285; cv=none; d=google.com; s=arc-20160816; b=aqN2S4mhA6aFui0rQREcjPVNWnQoj5bGncd1BUDRp0e6jRR1dPg02Ro/YeZWS7Dj0o JtMMTZMjBMTC1zVvnjYz0lUe7yy3wf8n4NFWxSJ3YpBrgOYF/88evfrcLYlUBVqHXv0s Bkq8zu9/2/F6R/DZpzMJm+Nc1HqX7FcWJCVpEbT1iBkKeukn01d31y9aa3qQg8UBGoyQ blugDbUYruxB49BcE+iUwMr8TzPfegCgmToymmyj7FrID387XaIV8KzEvS0MPryGBtTV Se6CPO9iWi7gGqeWr29x9Q6JzCnNBo1NqAGjRi5jhi8JrU8ym8XHM97MEppm/KeZ6yTa yV3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=05WAiqmnzFxjhjzsmoqGa+1UgtTxRSthDkK/9Z3FCdE=; b=X/S2NTIrqBU0GMRqNs/Fpm4jSfwWdHl8ogwhF2+PnW1abTN2taw3bRDKQYRCkyXp33 55w6JDZtzaN/4a7mONjJVXMbME48B5qceYljEI02FwezMsBh8NpX+WbUtXsOfB9qGCu2 ko0W93p/9PZhhTYnxHnJWphRGedYQbBvnciTMCzfyxJapJ4RpHAwgv3i3skgcwq+AvmS tOLN6lyaSt4hAWrLUVuXOAxemAVVvHJu5356+McGB/hSihtF4wVZFODPjt6EovLpBAJ/ SH6GDm2XGCfnbpB6RJEtsrw/v7y9TRXkNaG5Y7DSFfaJPSPKr/a5Dl796LyWDti0v+uJ zKbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d190-20020a6368c7000000b003756d19ac0dsi3344746pgc.296.2022.02.25.18.24.29; Fri, 25 Feb 2022 18:24:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbiBZCYs (ORCPT + 99 others); Fri, 25 Feb 2022 21:24:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbiBZCYs (ORCPT ); Fri, 25 Feb 2022 21:24:48 -0500 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B9426570; Fri, 25 Feb 2022 18:24:14 -0800 (PST) Received: from cwcc.thunk.org (pool-108-7-220-252.bstnma.fios.verizon.net [108.7.220.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 21Q2NcRB000816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Feb 2022 21:23:40 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id EE27A15C0038; Fri, 25 Feb 2022 21:23:37 -0500 (EST) Date: Fri, 25 Feb 2022 21:23:37 -0500 From: "Theodore Ts'o" To: Ye Bin Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, jack@suse.cz, lczerner@redhat.com Subject: Re: [PATCH -next v2] ext4:fix file system corrupted when rmdir non empty directory with IO error Message-ID: References: <20220211093527.3335518-1-yebin10@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220211093527.3335518-1-yebin10@huawei.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 11, 2022 at 05:35:27PM +0800, Ye Bin wrote: > Now if read directory block failed, 'ext4_empty_dir' will return true, assume > directory is empty. Obviously, it will lead to above issue. > To solve this issue, if read directory block failed 'ext4_empty_dir' just assume > directory isn't empty. To avoid making things worse when file system is already > corrupted, 'ext4_empty_dir' also assume directory isn't empty. > To distinguish the error type, return the exact error code to the caller. > Does the same issue exist for f2fs and ubifs? We could solve the specific bug much more simply by having ext4_empty_dir() return FALSE if we aren't able to read the directory block. Yes, it means that we don't return as specific an error code in the case of an I/O error --- although I believe we do syslog a warning --- but it makes for a much simpler patch that doesn't requiring getting acked-by's from the fscrypt, f2fs and ubifs folks. - Ted