Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp272488pxv; Thu, 24 Jun 2021 07:37:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIxh6Cu0hRsrXLR1rcttR6hNwmXXYcrOx8OhdDsbJDaYblrxoHe7bKvyN56UpdHhmjmRRa X-Received: by 2002:a17:906:6d95:: with SMTP id h21mr5664163ejt.260.1624545468113; Thu, 24 Jun 2021 07:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624545468; cv=none; d=google.com; s=arc-20160816; b=dIqD2bvDbR63twjkv9yZODoEIrZnDnHPhv20QKHIay+dSrlohoM00kALO2r/cWnqF8 U549gBhgA4Xl3ZUuOOOcrPWKBGj8AZn98zX5eYFvBMdU+mOYHAhCUmkzCOISxOcvOxsU pJFzCJxq3Cw1QhnYmIbxXldSqfIMlnjURl2q+hqPuTxKE4TtHvAwpDX0S8U5yLmPmkJE 04M1hrETzWz+1ftl3lQmhjGkwzCpP0fK66APRWfFEKoYFIB+BtR7gbpa4HbTURQ9/QMO R4eG7V6RE8BWHLkR5TZYm/kQqjIz7Is9kUmcmYWG282E0bu2K/F09buRY8hY0o/5v3Z3 K8mQ== 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=GoOdLzjgIbT63XPt8pS7q3ZohnqfkL7OtFo+ktZN1YQ=; b=jETl81jzybubyITobkj10l3yI159lSxI41QT0g2GXdsID6Sf7MTCA3q1+biEJYCkZ+ m5CjfQBga0Mj9EqGlwgNChf1ep3PUMenKjLXVAa5NAXwlR93QSH7PlU3VYDZDa0LGBBr zd04oLTg4q/uY4/kxZYWPlAxCn6oS9hgwa5MtoCdPt50CveDat4V9fVE1+9mYrr0PoZ7 JvGLNC0WjhrbZ4/yXsrmZVyc0XLE/fAyhlRS5myf9c9PExpDJAs0Q8Ezfy9x6Zgowk8l NzYmzczBcoRqiLoMLBIosQWCbJVAcPre5HAfEoeQQ2EX/Wi0FY7NV1UZqTt2XOmdyWQ+ TlCw== 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 bh4si3730892ejb.358.2021.06.24.07.37.24; Thu, 24 Jun 2021 07:37:48 -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 S232063AbhFXOiq (ORCPT + 99 others); Thu, 24 Jun 2021 10:38:46 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:53484 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230170AbhFXOim (ORCPT ); Thu, 24 Jun 2021 10:38:42 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 15OEZOhp006025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Jun 2021 10:35:25 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id D389415C3CD7; Thu, 24 Jun 2021 10:35:24 -0400 (EDT) Date: Thu, 24 Jun 2021 10:35:24 -0400 From: "Theodore Ts'o" To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, jack@suse.cz, adilger.kernel@dilger.ca, david@fromorbit.com, hch@infradead.org Subject: Re: [RFC PATCH v4 2/8] jbd2: ensure abort the journal if detect IO error when writing original buffer back Message-ID: References: <20210610112440.3438139-1-yi.zhang@huawei.com> <20210610112440.3438139-3-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210610112440.3438139-3-yi.zhang@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Jun 10, 2021 at 07:24:34PM +0800, Zhang Yi wrote: > Although we merged c044f3d8360 ("jbd2: abort journal if free a async > write error metadata buffer"), there is a race between > jbd2_journal_try_to_free_buffers() and jbd2_journal_destroy(), so the > jbd2_log_do_checkpoint() may still fail to detect the buffer write > io error flag which may lead to filesystem inconsistency. > > jbd2_journal_try_to_free_buffers() ext4_put_super() > jbd2_journal_destroy() > __jbd2_journal_remove_checkpoint() > detect buffer write error jbd2_log_do_checkpoint() > jbd2_cleanup_journal_tail() > <--- lead to inconsistency > jbd2_journal_abort() > > Fix this issue by introducing a new atomic flag which only have one > JBD2_CHECKPOINT_IO_ERROR bit now, and set it in > __jbd2_journal_remove_checkpoint() when freeing a checkpoint buffer > which has write_io_error flag. Then jbd2_journal_destroy() will detect > this mark and abort the journal to prevent updating log tail. > > Signed-off-by: Zhang Yi > Reviewed-by: Jan Kara Applied, thanks. - Ted