Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp687789ybg; Fri, 12 Jun 2020 11:53:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKJSvy/LY0f+e34fwNr7eJJpv0EVAmtHHWh5RlyJMpu+wzNPkneQy8bv1WKDTGJ72iQJRk X-Received: by 2002:a17:906:bcfc:: with SMTP id op28mr14019480ejb.237.1591987992917; Fri, 12 Jun 2020 11:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591987992; cv=none; d=google.com; s=arc-20160816; b=X0PDd5DbgWkq+9mJHXy008c+G1odI3QRBs+GdyWZlzytRpWAvpPV1RdP5+FhI5FPzZ oaHgOnflnSNjqQVJCV+6ke/gxcgq/Di9begiEE9jNKckU3ULKIJYx5yC52RbYLwBXTzr rEUZzWUyIi3MGPvW6GuSE7+zCn4b36OnLNBdx5WssvmREIbcvjGax2sv25+jzI67S7gN GabiQ5X5gWRdwTAy4NpI7k9IWioW+c7/p6e04WXHNmjefIb3W4Y7dCwdAY1KdqaJ37n2 rTYzfcnnXaQ+aDP5ih4iyzOGUn8db/B8xeY8rfbnfHRISzPlcucmreQEVkYOej7I7W8h f+iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=0IOrMs/vkRiLXcysud4XXwsF4PZdQpmPMv2HDJuOWOo=; b=SfxiRIvleLkF7Rxos2zlcGofmfDJsuEEIELomwXYo/8/dlV7ItpZeV2Xcb6AoGNnRH jaqdBecTUDmfnn9SHWLMuUxoVV/2pkqCmNOM0EwspT0eWZVkUTYJrdFw4Ix9lJsD36rZ suVt5pTQxD1MG4rEsnIaAtZ3MJNvPEF/UBhPXCYXK+Gx0Q4BX7+ph307wl50yX/ivMH5 Jf1mDb3sLQ34hIi/uTQ471gdZRs0P/j/YjBLLm65KpyMUMpNxAG+WJ3JXoXWqEy9ICON pQ+Sm39uoVFoHpjDvdZdybVRTrc05cGWUOCTT/T0uT9bF9fpzy6G7HM7BsHBqngJhor+ vbvw== 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 u10si4124103edy.364.2020.06.12.11.52.47; Fri, 12 Jun 2020 11:53:12 -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 S1726283AbgFLSwZ (ORCPT + 99 others); Fri, 12 Jun 2020 14:52:25 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:42526 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726085AbgFLSwY (ORCPT ); Fri, 12 Jun 2020 14:52:24 -0400 Received: from callcc.thunk.org (pool-100-0-195-244.bstnma.fios.verizon.net [100.0.195.244]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 05CIq7oI020942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jun 2020 14:52:08 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id A15D042026D; Fri, 12 Jun 2020 14:52:07 -0400 (EDT) Date: Fri, 12 Jun 2020 14:52:07 -0400 From: "Theodore Y. Ts'o" To: Jan Kara Cc: "zhangyi (F)" , linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, zhangxiaoxu5@huawei.com Subject: Re: [PATCH v2] ext4, jbd2: ensure panic by fix a race between jbd2 abort and ext4 error handlers Message-ID: <20200612185207.GB2863913@mit.edu> References: <20200609073540.3810702-1-yi.zhang@huawei.com> <20200609115026.GA12551@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200609115026.GA12551@quack2.suse.cz> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jun 09, 2020 at 01:50:26PM +0200, Jan Kara wrote: > On Tue 09-06-20 15:35:40, zhangyi (F) wrote: > > In the ext4 filesystem with errors=panic, if one process is recording > > errno in the superblock when invoking jbd2_journal_abort() due to some > > error cases, it could be raced by another __ext4_abort() which is > > setting the SB_RDONLY flag but missing panic because errno has not been > > recorded. > > > > jbd2_journal_commit_transaction() > > jbd2_journal_abort() > > journal->j_flags |= JBD2_ABORT; > > jbd2_journal_update_sb_errno() > > | ext4_journal_check_start() > > | __ext4_abort() > > | sb->s_flags |= SB_RDONLY; > > | if (!JBD2_REC_ERR) > > | return; > > journal->j_flags |= JBD2_REC_ERR; > > > > Finally, it will no longer trigger panic because the filesystem has > > already been set read-only. Fix this by introduce j_abort_mutex to make > > sure journal abort is completed before panic, and remove JBD2_REC_ERR > > flag. > > > > Fixes: 4327ba52afd03 ("ext4, jbd2: ensure entering into panic after recording an error in superblock") > > Signed-off-by: zhangyi (F) > > Cc: > > Great, thanks! The patch looks good to me. You can add: > > Reviewed-by: Jan Kara Applied, thanks. - Ted