Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp745763pxm; Fri, 25 Feb 2022 19:02:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN2k7I7gxKTLATmP2AFcd7s3ktMLphnx5keFk5a0qdcofLMxsjWc5so16NPl0LHCYAkfip X-Received: by 2002:a17:906:fb8a:b0:6b5:d269:bb48 with SMTP id lr10-20020a170906fb8a00b006b5d269bb48mr8408917ejb.91.1645844550871; Fri, 25 Feb 2022 19:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645844550; cv=none; d=google.com; s=arc-20160816; b=zajrAo70qMk2y1SoJ07cg8mc24OTFOOuUZTTXC9JarYBbk5Aef+4cmsqTUVWM5Ohuv UCJ1+LiYR4c0CYWx/PKHyOZLAZ4ZCZ1VZbm9Mi8+O5PHOLtnmTISj2pgJtSlrSfUa5Dd DwhDXlSA/2Gh8fjaeb02vIpcCo2vijoQeOumanhlNJ/04YErGJ4NhRoiPPolzsDoHo/5 hhal34jF3+lfDZSeGV/K6D2NwIPEsbiMWe2JOtQod1gIrXTwKZvgXXkYjngWUVb9q6L1 LG0cHBQ1VAITIx9dMDaa9hxoGyENXFwRHf3bCeNdEhpiZr7F4CP3Zd0BWsAz78OdSFC7 I90g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=7RBBubQndNvzLmflXjiW8idtyTEmg/MT81ZkTwk2o9k=; b=TsjSsNWOJf3Rg8kfY71eJg+6cXJcF5n9T31PvzTo/g2LejCUMjkZNimBzK6EqvDtC0 0ZExVFO/ZQghw5Ez6vcHF6On5DyBcSgrVVAiIxMXlU/kDW+t8AKsz5ghAqrGEI/bBen5 RyJmaX4DeVQ9S9ypSim68DW+Zs3N6aUQMseKsjzd5bO6DxdGozaV2Hl0Kpt2AhKPxjRq lca3FdruaSzYl6rIwn8EsiM4taXM0SmoMN+JiXrn/d+rlZ56ReTPjdtQxxWcAI7Lip+x txoeqeIK58NVdS3S5gf6YHMkXsOgFEMdX9RYZw63uY/pvWatedQcQG6s9iup49BR0W6s IxWQ== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170906970c00b006cc47e9beabsi2310155ejx.739.2022.02.25.19.02.07; Fri, 25 Feb 2022 19:02:30 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbiBZC5G (ORCPT + 99 others); Fri, 25 Feb 2022 21:57:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiBZC5E (ORCPT ); Fri, 25 Feb 2022 21:57:04 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7827B5939F; Fri, 25 Feb 2022 18:56:30 -0800 (PST) Received: from canpemm500010.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K5B4T61Mczbbsw; Sat, 26 Feb 2022 10:51:53 +0800 (CST) Received: from [10.174.178.185] (10.174.178.185) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sat, 26 Feb 2022 10:56:27 +0800 Subject: Re: [PATCH -next v2] ext4:fix file system corrupted when rmdir non empty directory with IO error To: Theodore Ts'o References: <20220211093527.3335518-1-yebin10@huawei.com> CC: , , , , , , , From: yebin Message-ID: <621996DB.1030501@huawei.com> Date: Sat, 26 Feb 2022 10:56:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.185] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500010.china.huawei.com (7.192.105.118) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,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 2022/2/26 10:23, Theodore Ts'o wrote: > 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 > . In fact, I only modified ext4 as you suggested in my v1 patch. [-next] ext4:fix file system corrupted when rmdir non empty directory with IO error : https://patchwork.ozlabs.org/project/linux-ext4/patch/20220209112819.3072220-1-yebin10@huawei.com/ >