Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4681651rdb; Tue, 12 Dec 2023 06:38:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFfJ5nbWuvOKaqURa+fzy0ic2q9q1ATMop4SPkvcJ08at0WCQciNvOsxGUZZ5m12D/98P8 X-Received: by 2002:a17:902:e807:b0:1d1:cb7a:a908 with SMTP id u7-20020a170902e80700b001d1cb7aa908mr7478724plg.60.1702391899449; Tue, 12 Dec 2023 06:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702391899; cv=none; d=google.com; s=arc-20160816; b=ZyW59VL6LDF/rftgoDWRUi2o4r9gdmhr82IqFbtYXFH9OmKHdV50l4RswM4QaepO/t LvdxCX++1WXodH1n+AY3276sZ0nrRj/g2ezX8ahZkhjOQ/ZmqGwBDhdeqFA/+iP0B3UT QMDVRVQs18uo7wCIwdm9av0zQyuCicKFcdkGVkCLtwqpyuPxElJGsn13vNoJS77KqyN2 otWDeIFp1jMaMe4EPhDrw3vpe71x0UknxbTqKASkKm2MZhvjx8LU4WIZqFt45ExnQEDX 28ibv6krCOWAQJ67jgVImUJKMYmjSJWq5y5I5tCFgzSk38v9DTbvG+CgLrkKiC1uSYDe GqbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=/ZOmGiL2XSwyp2RvWwhBdg1lvKKLDaZcV4wtLkchxZI=; fh=ZnCOFr57llyVxJjIWpns9nayHXALd95dApTjlIsS2Ts=; b=nAZCQoTNRKo9q5HREcV1OA9LeBmB9Sc3xzviWbKPB20Y9Nf9TgjzaU01tJ4oCkDh82 yl63HyqVN6zPKN6PRTcZ+gPJyAOSSYsa/YmEOfRyxX8E8/y/BC2j+IoFlGyjgt+hao0G UZMKCxeyCt+yiuF94oOEzlbfi7EoLjFHOQR2sca1kGAsljn/ImNTuyhKIiB4YVQwrIIy AMu7WOlkiSr/IITiWStxcm0Q/zVvpWeMu4YiW25cjGjitjYp0ISoeawX79JPsBbDAV43 pyiH8Ybdr9rAPTac/o8Ylg6J1qheo6oDrtr2gIPPh4bt566qlup7zz5WESpm2cDgwEeh vetA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nVMVQ4w5; dkim=neutral (no key) header.i=@suse.cz header.b=b7F0wFQJ; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nVMVQ4w5; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=b7F0wFQJ; spf=pass (google.com: domain of linux-ext4+bounces-405-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-405-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d18-20020a170902ced200b001d09e7f1e1esi8008310plg.429.2023.12.12.06.38.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:38:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-405-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nVMVQ4w5; dkim=neutral (no key) header.i=@suse.cz header.b=b7F0wFQJ; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=nVMVQ4w5; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=b7F0wFQJ; spf=pass (google.com: domain of linux-ext4+bounces-405-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-405-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 84365B20D99 for ; Tue, 12 Dec 2023 14:38:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B4917319E; Tue, 12 Dec 2023 14:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="nVMVQ4w5"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="b7F0wFQJ"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="nVMVQ4w5"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="b7F0wFQJ" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06A768E for ; Tue, 12 Dec 2023 06:38:07 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 827481FB45; Tue, 12 Dec 2023 14:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702391885; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/ZOmGiL2XSwyp2RvWwhBdg1lvKKLDaZcV4wtLkchxZI=; b=nVMVQ4w5IbRVEr2TDGKDgg19bX7FL7rK9Cj0a/wuKOLp5kJL7PzjwKsvtYc4FosqVsFTRz WRDLd8+CRtWk8X8dCYlNECD9iGlEShUloDh3nwDyog1G5JuWx6CNLTlVmN0Mluy4DFVvO4 TKKk4duYS7VFghY1TuVeq85++cXbF4E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702391885; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/ZOmGiL2XSwyp2RvWwhBdg1lvKKLDaZcV4wtLkchxZI=; b=b7F0wFQJ9w8AR1x5USRxUO3gfR39yO6ZPjV9lZyBfSyhVnyoBX2qE4Y1WUd8o9Gb2e+OE7 8pz/FWQSaG9mAJAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702391885; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/ZOmGiL2XSwyp2RvWwhBdg1lvKKLDaZcV4wtLkchxZI=; b=nVMVQ4w5IbRVEr2TDGKDgg19bX7FL7rK9Cj0a/wuKOLp5kJL7PzjwKsvtYc4FosqVsFTRz WRDLd8+CRtWk8X8dCYlNECD9iGlEShUloDh3nwDyog1G5JuWx6CNLTlVmN0Mluy4DFVvO4 TKKk4duYS7VFghY1TuVeq85++cXbF4E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702391885; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/ZOmGiL2XSwyp2RvWwhBdg1lvKKLDaZcV4wtLkchxZI=; b=b7F0wFQJ9w8AR1x5USRxUO3gfR39yO6ZPjV9lZyBfSyhVnyoBX2qE4Y1WUd8o9Gb2e+OE7 8pz/FWQSaG9mAJAg== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 7745E132DC; Tue, 12 Dec 2023 14:38:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id vBEdHU1weGVkVwAAn2gu4w (envelope-from ); Tue, 12 Dec 2023 14:38:05 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 27DFFA06E5; Tue, 12 Dec 2023 15:38:05 +0100 (CET) Date: Tue, 12 Dec 2023 15:38:05 +0100 From: Jan Kara To: Zhihao Cheng Cc: tytso@mit.edu, jack@suse.com, linux-ext4@vger.kernel.org, yi.zhang@huawei.com Subject: Re: [PATCH 4/5] jbd2: Abort journal when detecting metadata writeback error of fs dev Message-ID: <20231212143805.annty5auy6q2uf3d@quack3> References: <20231103145250.2995746-1-chengzhihao1@huawei.com> <20231103145250.2995746-5-chengzhihao1@huawei.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231103145250.2995746-5-chengzhihao1@huawei.com> X-Spam-Level: X-Spam-Score: 0.08 X-Spam-Level: X-Spam-Flag: NO Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [0.17 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,huawei.com:email,suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.23)[72.42%] X-Spam-Score: 0.17 On Fri 03-11-23 22:52:49, Zhihao Cheng wrote: > This is a replacement solution of commit bc71726c725767 ("ext4: abort > the filesystem if failed to async write metadata buffer"), JBD2 can > detects metadata writeback error of fs dev by 'j_fs_dev_wb_err'. ^^^ detect > Signed-off-by: Zhihao Cheng Otherwise looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/jbd2/transaction.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c > index 5f08b5fd105a..cb0b8d6fc0c6 100644 > --- a/fs/jbd2/transaction.c > +++ b/fs/jbd2/transaction.c > @@ -1231,11 +1231,25 @@ static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh, > int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh) > { > struct journal_head *jh; > + journal_t *journal; > int rc; > > if (is_handle_aborted(handle)) > return -EROFS; > > + journal = handle->h_transaction->t_journal; > + if (jbd2_check_fs_dev_write_error(journal)) { > + /* > + * If the fs dev has writeback errors, it may have failed > + * to async write out metadata buffers in the background. > + * In this case, we could read old data from disk and write > + * it out again, which may lead to on-disk filesystem > + * inconsistency. Aborting journal can avoid it happen. > + */ > + jbd2_journal_abort(journal, -EIO); > + return -EIO; > + } > + > if (jbd2_write_access_granted(handle, bh, false)) > return 0; > > -- > 2.39.2 > -- Jan Kara SUSE Labs, CR