Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp383945ybg; Fri, 12 Jun 2020 04:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx535VH0yE2mUvbgltRp57AdLj4ZpI0pPB5bqyWWdorMCnDxnpdGI2WalssibuVUVvIk4Nb X-Received: by 2002:aa7:cd12:: with SMTP id b18mr11299954edw.195.1591960469104; Fri, 12 Jun 2020 04:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591960468; cv=none; d=google.com; s=arc-20160816; b=DJgzR5abXYqWvplbVLG69lyihcWLEdnTBxsfXCcOOcuP5A7v9NXQMni9Av7F+Tv9Rf qY7zPQwt4zPBYn9ImQhS1/80kQuLmuKZykxt6HeTh+Zgq3Yz1OQBZYRXYfBsK6zh9om/ s3GDGcEKguU3oBiJrypESHCGTN0fEGNAqsRyRY4DzRmnBhpEcELLDRX4Hh4qK60aLln4 YOZugVPJrxE+HxeD6xUAK8Q5p6TWs4vehAFXEqqkK8ypyW30Zt2IImG75Agdlx76JTyo hkZI/tX3n/jrAEawJ8nMN9uRm5oo3hCEvbacOM61r75ZEa8rCr28wmk3tpBof8pPcNv2 yAew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=QWikYXauLHlVHSVpxDdsacodb1wIS1Iyk1aNbAxKjfQ=; b=vDECbrDfTHbsN4uvzGEKa0ejOYHjwNkNGX0tJg+k/8P/MXScDU/ePlbHe7ynyPEE8v T2IvSWzIEJhVJ5VFhuVrdaVX5Xo8bLVMoo99KkaZfFh2BSA39g5piTFMFVuU6QSXiiP8 Vx5rhqESjebnVTmAAHKTaUXDcJXtcK5x9Uvur0jl45eTT7wVXM7BzbaPQ+uviwnREsUn GeP2jUii4fO0VQ7AhcbI61cmLJF3WHeDsB4f6QrZmMINZeSfFhgdjMySQ8hvhbUMGKbX mtMqofnp3OskG1v7EKsGe9MRanrmXsuu0WtbcAqaHi4qxYXG1UsmdgSeL4XYKO2o5Qx3 3SLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si4877833ejo.141.2020.06.12.04.13.53; Fri, 12 Jun 2020 04:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726219AbgFLLNw (ORCPT + 99 others); Fri, 12 Jun 2020 07:13:52 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5821 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726039AbgFLLNv (ORCPT ); Fri, 12 Jun 2020 07:13:51 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 230D9A581DC6AF975B99; Fri, 12 Jun 2020 19:13:48 +0800 (CST) Received: from [127.0.0.1] (10.166.215.198) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Fri, 12 Jun 2020 19:13:42 +0800 Subject: Re: [PATCH 00/10] ext4: fix inconsistency since reading old metadata from disk To: "Theodore Y. Ts'o" , Jan Kara CC: , , References: <20200526071754.33819-1-yi.zhang@huawei.com> <20200608082007.GJ13248@quack2.suse.cz> <20200609121920.GB12551@quack2.suse.cz> <45796804-07f7-2f62-b8c5-db077950d882@huawei.com> <20200610095739.GE12551@quack2.suse.cz> <20200610154543.GI1347934@mit.edu> <20200610162715.GD20677@quack2.suse.cz> <92c92066-472e-1f1a-6043-af59bceeb0d8@huawei.com> <20200611082103.GA18088@quack2.suse.cz> <20200611165523.GQ1347934@mit.edu> From: "zhangyi (F)" Message-ID: <9db65a37-84e7-68c0-c6b5-418d55166a49@huawei.com> Date: Fri, 12 Jun 2020 19:13:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200611165523.GQ1347934@mit.edu> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.166.215.198] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2020/6/12 0:55, Theodore Y. Ts'o wrote: > On Thu, Jun 11, 2020 at 10:21:03AM +0200, Jan Kara wrote: >>> I have thought about this solution, we could add a hook in 'struct super_operations' >>> and call it in blkdev_writepage() like blkdev_releasepage() does, and pick out a >>> wrapper from block_write_full_page() to pass our endio handler in, something like >>> this. >>> >>> static const struct super_operations ext4_sops = { >>> ... >>> .bdev_write_page = ext4_bdev_write_page, >>> ... >>> }; >>> >>> static int blkdev_writepage(struct page *page, struct writeback_control *wbc) >>> { >>> struct super_block *super = BDEV_I(page->mapping->host)->bdev.bd_super; >>> >>> if (super && super->s_op->bdev_write_page) >>> return super->s_op->bdev_write_page(page, blkdev_get_block, wbc); >>> >>> return block_write_full_page(page, blkdev_get_block, wbc); >>> } >>> >>> But I'm not sure it's a optimal ieda. So I continue to realize the "wb_err" >>> solution now ? >> >> The above idea looks good to me. I'm fine with either that solution or >> "wb_err" idea so maybe let's leave it for Ted to decide... > > My preference would be to be able to get the (error from the callback > right away. My reasoning behind that is (a) it allows the file system > to be notified about the problem right away, (b) in the case of a file > system resize, we _really_ want to know about the failure ASAP, so we > can fail the resize before we start allocating inodes and blocks to > use the new space, and (c) over time, we might be able to add some > more intelligence handling of some write errors. > > For example, we already have a way of handling CRC errors when we are > reading an allocation bitmap; we simply avoid allocating blocks and > inodes from that blockgroup. Over time, we could theoretically do > other things to try to recover from some write errors --- for example, > we could try allocating a new block for an extent tree block, and try > writing it, and if that succeeds, updating its parent node to point at > the new location. Is it worth it to try to add that kind of > complexity? I'm really not sure; at the end of the day, it might be > simpler to just call ext4_error() and abort using the entire file > system until a system administrator can sort out the mess. But I > think (a) and (b) are still reasons for doing this by intercepting the > writeback error from the buffer head. > Yeah, it make sense to me, I will realize this callback solution. Thanks, Yi.