Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9190480rwl; Wed, 11 Jan 2023 02:39:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXv9NlMZV/ljrMKPgMRFuPxRBdMFaaHiMLD8qxTzYbZjxVIBJFAVDaHdBuBnyZL6yCGAHcxa X-Received: by 2002:a05:6402:5407:b0:47e:d7ea:d980 with SMTP id ev7-20020a056402540700b0047ed7ead980mr58358395edb.14.1673433583284; Wed, 11 Jan 2023 02:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673433583; cv=none; d=google.com; s=arc-20160816; b=gysWXSOgiMwT2C1DIXrcq9mxWWudWBh5+wo4f3aBXoGIpphYjIPNFoas72z4VutnSa zwtgK6WKYHVEFLrWonBXULJP6EF6006K2ZvgtOBeNmbbP05LC2MAOPjrS4C/2WukVWVd 3SjowZBMS8SxMFNqFBeNO614QOkHh8Wr6d+cH1ap3eyWK4W/HyC+mNxPG+Y0i2WtGgo9 nI9lNm1daGvIMFyWkPlEsVKRqfmHSHTXCLzriCqt8HRgzbxgMirN03+q0h92Lc1jEMVF WVKpeMeA/qPTFResDqUYL3dJeUpb7k2KULJFVYa0TI2R4GY2VlLsh9ITHyKXB8Rn+dVy XGVA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=rqpyc7p31idPZXlUJxRUkjnz/Qv/YNB1YeWrgc8aABk=; b=0AgDEUuzBtgQjWvrs8X/nHzBxw1s9a1ddZXaQJKgeyO0pO3V0xu6tVIuZTKcvhxgHB Gw59CyOK3w2mXBDfmoYJWLIohVheE6sURBjMLOwKHBEdPB1bHW5A3CJRwkAnh1DfopXU yiAxsCinbYoDOpK0/Vxn1UzMnmM06gcJ30b1Z/NBUpdBpP7qtjZETkXbf5UOkctOUI2O ofInKQFfMpmbpFHLHBmGJeXjWyvzqH5YG6JGeMvQCBv7KG8LXu0SKpXbkTz8ef/AMrx7 GjGCeDCFuI7+VX75VK6yFdB7w/toIa7XMAY3Ky7LgrLzlPHcbsf3rBA1OhpFSnuyQukp 8gQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=EzeK6AMD; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a056402440200b0046fc4297641si18540432eda.293.2023.01.11.02.39.14; Wed, 11 Jan 2023 02:39:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=EzeK6AMD; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbjAKK0L (ORCPT + 99 others); Wed, 11 Jan 2023 05:26:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232326AbjAKK0K (ORCPT ); Wed, 11 Jan 2023 05:26:10 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 617AFF35 for ; Wed, 11 Jan 2023 02:26:04 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E3AE1173B2; Wed, 11 Jan 2023 10:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673432761; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rqpyc7p31idPZXlUJxRUkjnz/Qv/YNB1YeWrgc8aABk=; b=EzeK6AMDpDKLsaQXSTyR+it1te2CerkRULYiapJZyRug3o986MNYL8Hz3Pmlc91pJ6ReCc bxN7YQmHv8ZJWLoqjQRHGzLuJnEzVzmPKI6AWgs++3reFmZ7gxVad/+rYpB46Htob0bnJt LUwBwXnGOwJ6xXkwdg8gwSGaf/kYEU0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673432761; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rqpyc7p31idPZXlUJxRUkjnz/Qv/YNB1YeWrgc8aABk=; b=BUY2v4yn3dadsQ4FZLottO8ohPCwRmEazvMBrW+k+x3uGnmOvt54atYFne+ir1BXh8VA+o UFO9VwND5OwfbRDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D726513591; Wed, 11 Jan 2023 10:26:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dLh4NLmOvmMrBQAAMHmgww (envelope-from ); Wed, 11 Jan 2023 10:26:01 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 6C958A0744; Wed, 11 Jan 2023 11:26:01 +0100 (CET) Date: Wed, 11 Jan 2023 11:26:01 +0100 From: Jan Kara To: zhanchengbin Cc: tytso@mit.edu, jack@suse.com, linux-ext4@vger.kernel.org, yi.zhang@huawei.com, linfeilong@huawei.com, liuzhiqiang26@huawei.com Subject: Re: [PATCH 2/2] ext4: call ext4_handle_error when read extent failed in ext4_ext_insert_extent Message-ID: <20230111102601.igx6act3cxofml53@quack3> References: <20230110133407.994711-1-zhanchengbin1@huawei.com> <20230110133407.994711-3-zhanchengbin1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230110133407.994711-3-zhanchengbin1@huawei.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 10-01-23 21:34:07, zhanchengbin wrote: > In addition to ext4_find_extent reading extent block return > -EIO, ext4_handle_error will be called when there is a problem that > may cause file system inconsistency in the ext4_ext_insert_extent > function. > So call the ext4_handle_error function when the ext4_find_extent > read fails,and make the filesystem read-only when mount for > `errors=remount-ro`, and Check whether the journal is aborted in > the ext4_split_extent_at function. > > Signed-off-by: zhanchengbin > Signed-off-by: Zhang Yi Thanks for the patch! Some comments below. > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c > index 3559ea6b0781..3798b2a8e550 100644 > --- a/fs/ext4/extents.c > +++ b/fs/ext4/extents.c > @@ -935,6 +935,7 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block, > > bh = read_extent_tree_block(inode, path[ppos].p_idx, --i, flags); > if (IS_ERR(bh)) { > + EXT4_ERROR_INODE(inode, "IO error reading extent block"); So this is fine... > ret = PTR_ERR(bh); > goto err; > } > @@ -3251,7 +3252,7 @@ static int ext4_split_extent_at(handle_t *handle, > ext4_ext_mark_unwritten(ex2); > > err = ext4_ext_insert_extent(handle, inode, ppath, &newex, flags); > - if (err != -ENOSPC && err != -EDQUOT && err != -ENOMEM) > + if (err && is_handle_aborted(handle)) > goto out; But this doesn't look right. Firstly, if err == 0, it will wrongly go to the zero-out part although we should exit. Secondly, is_handle_aborted() is not going to work for nojournal mode. So I don't think we can simplify the condition like this. Honza -- Jan Kara SUSE Labs, CR