Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1393pxb; Wed, 25 Aug 2021 18:07:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPaS1aeeWlll0JCRkb8ZYqR6MPoC7d8TFv6SngjHfzcNqCpj9OPP53niNeJDNqRpCwYIXz X-Received: by 2002:a17:906:32ce:: with SMTP id k14mr1475974ejk.503.1629940075530; Wed, 25 Aug 2021 18:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629940075; cv=none; d=google.com; s=arc-20160816; b=iNYn3PU01AIjf9qOfJfO/wAIgxJSq10L5s/VfIoRql1yMYh8RV2CYu2p20dvLN2EEZ 3QLS8C/J+lh2X0bDrW5t59yMYCi1Qn1nDPyXMwzTs90Ogwurj5dqtTw3m65VyhJuMHiF eiKpJsNpqDfypiFOmBZ2WbdQ0oNOgRNQB8G6naDzp5Fg2/aoslf6MTcN20aCvs4QU4tK 06jqOcWGwGiP9zoDC/5kLULQ/MSrT3XXvHqAs5QMbRURQkPU2tc9T/mf00ytLLYHnOUI 0Xpdc2tMFcm89poc61hnjeD6/bMjUBrWv+TRUkOXCYd2/t16zPg5HCtl34Kg5ayb8Fv8 7J3w== 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:references:cc:to :subject; bh=SLPbU4Rg0uhQsngs+J74upTfGkPnUUaO0hincGli3bg=; b=sFDNmNRrD/+cqdfo2pODsJPK/NSq6GRFNIbKeoi113zKzvcFo5MnCqDrtJVv0ZqpKz 8tU6sYeiZyORkQh/EKLJ1eOxlVw5sGNuRCI1Q1F3ulCbnBHIZ0mBrVtaYW0A/aWWl/MC 7S9ayHJcvL002IlZS+qTnDtmoDPX2oruSV9LA+WX2d7m3z4thtQTeZyvOgYC6YAp37tE WG4/OXdOXSJMcMkzEqhqnkVBo2AUQvLaI/nm9c5kiqZc3wWGkGNS42N7DvqREQk7aF+x W2xgm+m0CoRWGfbcJ+O2O4/hiw8SYdq9pmV9xwIv+xC+Ub2Zus/p/KFVE/fT2zpkMaFa BUfg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si1726156edr.517.2021.08.25.18.07.24; Wed, 25 Aug 2021 18:07:55 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235318AbhHZBHb (ORCPT + 99 others); Wed, 25 Aug 2021 21:07:31 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:15216 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235211AbhHZBHa (ORCPT ); Wed, 25 Aug 2021 21:07:30 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Gw4RP3B9Rz19Vch; Thu, 26 Aug 2021 09:06:09 +0800 (CST) Received: from dggema766-chm.china.huawei.com (10.1.198.208) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 26 Aug 2021 09:06:38 +0800 Received: from [10.174.177.210] (10.174.177.210) by dggema766-chm.china.huawei.com (10.1.198.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 26 Aug 2021 09:06:37 +0800 Subject: Re: [QUESTION] question for commit 2d01ddc86606 ("ext4: save error info to sb through journal if available") To: Jan Kara CC: "Theodore Y . Ts'o" , Ext4 Developers List References: <05ff3a17-6559-9317-a382-f0a02fa59926@huawei.com> <20210825102518.GA14620@quack2.suse.cz> From: yangerkun Message-ID: <61524dfc-ddd3-0bf2-2ef6-278e024fd6bd@huawei.com> Date: Thu, 26 Aug 2021 09:06:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210825102518.GA14620@quack2.suse.cz> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.210] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggema766-chm.china.huawei.com (10.1.198.208) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 在 2021/8/25 18:25, Jan Kara 写道: > > Hello Kun! > > On Wed 25-08-21 10:13:03, yangerkun wrote: >> There is a question about 2d01ddc86606 ("ext4: save error info to sb through >> journal if available"). This commit describe that we can have checksum >> failure with follow case: >> >> 1. ext4_handle_error will call ext4_commit_super which write directly to the >> superblock >> 2. At the same time, jounalled update of the superblock is ongoing >> >> However, after commit 05c2c00f3769 ("ext4: protect superblock modifications >> with a buffer lock"), all the update for superblock and the csum will be >> protected with buffer lock. It seems we won't get a csum error after that >> commit and the journal logic in flush_stashed_error_work seems useless. >> >> Maybe there is something missing... Can you help to explain more for that... > > You are correct that after commit 05c2c00f3769 the checksum will be > correct. However there are also other problems that 2d01ddc86606 addresses > and that are mentioned in the commit description like "writing inconsistent > information". The fundamental problem is that you cannot mix journalled and > non-journalled updates to any block. Because e.g. the unjournalled update > could store to disk information that was changed only as part of the > currently running transaction and if the machine crashes before the > transaction commits, we have too new information in the block and thus > inconsistent filesystem. Or in the other direction, journal replay can > overwrite unjournalled modifications to the superblock if we crash at the > right moment. Got it! Thanks for your explain! > > Honza >