Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp957087ybg; Wed, 10 Jun 2020 19:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5RDhDvU2Oysq4mNeGYZPlggNRTe9COhFR9d1wMhHmowbUkEHaYU+x/YBu5S560CDwgAX1 X-Received: by 2002:a17:906:eb0c:: with SMTP id mb12mr6119167ejb.378.1591841642581; Wed, 10 Jun 2020 19:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591841642; cv=none; d=google.com; s=arc-20160816; b=weujilywz68Nsm8FjVzAb6owFISiL+VMvcnB7AIP+iasOd1nMGEjYjAeoXqpsU6MPi s81kj/7W3QJSp0+kR4UvMyLbv2REUQl4Aaa+W2DT2JRBuV4SnyztMtoqG7swGTeC3gyf ShJ1iue7Q6pMJ4uZROmUOgj8ra09xvzch3Jv456+Pc4yG2ENBx9KFmBVzZddYFJiFloX fekOjhhv9QZrrMlDbqa15TSeKQ3UYVQsUZx5Kgf8apFc5DpRWbZ6IcwKepHiNyT12RP0 g0LhEreNoXpOIwJLT+WzJp5kPtPsXU3wH8iBz9svdXzlDYNHjN80DIaD3gtMjxnVtkqL qdDw== 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=W9Ep+CSaF4dnsfp82fliUC5fDITIBh+bWQonO3iyvb4=; b=n7zIEMFMBaz6LFFVfP2RmGxXEPnQbV8ghvq+kHm8mtqM4z96N4xUrByIC6KmT7hmVx X+OjVWriAJQkqdPwZNsSH/nwCvsEPwjYT/mSDAm6y9DTj+xtjLTU/GFB9LAhG+hm/rUg kHy6nQ+itbqXgOWhPshzfrda051zko/mE2hhu8qPAZca97ZFQ74pKlorg4yjYvHGVV/X qdXCeOGfZielL5plhTbhylN0igoUzy+1Rto57b73nRtj8JnsFOROBFmcrV3CrFJfEBlx Hepak6C00btouZYzt7K8hFLYq3ysa9TTCTuJ5hKi45z0ogZiTC0XipIRadbQ1BXU6e/Z v5YQ== 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 lh21si1170284ejb.54.2020.06.10.19.13.31; Wed, 10 Jun 2020 19:14:02 -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 S1726352AbgFKCM5 (ORCPT + 99 others); Wed, 10 Jun 2020 22:12:57 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5876 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726163AbgFKCM5 (ORCPT ); Wed, 10 Jun 2020 22:12:57 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D922F61A59FADC89566F; Thu, 11 Jun 2020 10:12:55 +0800 (CST) Received: from [127.0.0.1] (10.166.215.198) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Thu, 11 Jun 2020 10:12:45 +0800 Subject: Re: [PATCH 00/10] ext4: fix inconsistency since reading old metadata from disk To: Jan Kara , "Theodore Y. Ts'o" 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> From: "zhangyi (F)" Message-ID: <92c92066-472e-1f1a-6043-af59bceeb0d8@huawei.com> Date: Thu, 11 Jun 2020 10:12:45 +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: <20200610162715.GD20677@quack2.suse.cz> 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/11 0:27, Jan Kara wrote: > On Wed 10-06-20 11:45:43, Theodore Y. Ts'o wrote: >> On Wed, Jun 10, 2020 at 11:57:39AM +0200, Jan Kara wrote: >>>> So I guess it may still lead to inconsistency. How about add this checking >>>> into ext4_journal_get_write_access() ? >>> >>> Yes, this also occured to me later. Adding the check to >>> ext4_journal_get_write_access() should be safer. >> >> There's another thing which we could do. One of the issues is that we >> allow buffered writeback for block devices once the change to the >> block has been committed. What if we add a change to block device >> writeback code and in fs/buffer.c so that optionally, the file system >> can specify a callback function can get called when an I/O error has >> been reflected back up from the block layer? >> >> It seems unfortunate that currently, we can immediately report the I/O >> error for buffered writes to *files*, but for metadata blocks, we >> would only be able to report the problem when we next try to modify >> it. >> >> Making changes to fs/buffer.c might be controversial, but I think it >> might be result in a better solution. > > Yeah, what you propose certainly makes sence could be relatively easily > done by blkdev_writepage() using __block_write_full_page() with appropriate > endio handler which calls fs callback. I'm just not sure how propagate the > callback function from the fs to the blkdev... > 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 ? Thanks, Yi.