Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3608279rwb; Tue, 8 Nov 2022 06:31:13 -0800 (PST) X-Google-Smtp-Source: AMsMyM5fEgQYkxdKVdF6LU/rOndh5GC8Pt3KzAAA7oUQLNjhbHlW5u1Ni3hVJFtKKGt96vXRsfkU X-Received: by 2002:a05:6402:42c6:b0:462:1abc:e576 with SMTP id i6-20020a05640242c600b004621abce576mr55941763edc.223.1667917873088; Tue, 08 Nov 2022 06:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667917873; cv=none; d=google.com; s=arc-20160816; b=Gu7Du8q19gKZqXmtVpsh9YpiMxU+hGQfjsbqLqvqwZAq+rV/bNu+Xz7EXlC/jhYum2 XXFW/scy5WxvOosDK3gFfCI2QcuFENU7I8h5THwG4/lwEuKWMWTozySGnHaQY5SffoyI JQS7h66UFWDQMN5aSNAL2Hg48j1JLFIdFANizn3Tdrlz7G3qFDh9WFTte73dl15NcSl9 39RDRbCIXsCH07GLUPHjYk9H9o6TkaquvHQG84Hp60CU1JDhEK7Yb4sjxMDzH1/Davr5 wuv9NYTfmNu52MDj6NADvL7wjIyjau3dYDkC/nIiY3AfLOe89TI8U7xDVtlEEUe7Znvj U4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wrOa8MCGqBmVrptGw0GzPQawiFhPsClzsq4ZBRGtxy8=; b=tpkjO4dv9zVbJJG87kN41A1YxcULrWQukfsaW6Gsk/qpR3OhGtew6Fc1UxT6GpyLhI qtT8A7vK0wqOxYh8tty4jf/PwczQs7gf3VPbiW7iFR2lkCNC9PG8mb5f6DhxEEPKf6E0 rsNio1MQ322jMXNttiXsv2gOOPH/TJoTlm/hAGi/FlU1HdK76NodEvvNOS2jTxsGm5FB mbQAurlikk/temN4BZLmrOm1EgSTIJJfyGg7je8zWYo21uA138f92WJBgFIqIYBcOykw BAg5m7otbql5dB1vQv/j1igZWYdbVtfDcxK19WtDZJlIM728RU7jO4tP/onyvFHMJwzG m2jw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg37-20020a170907a42500b0078dce38525asi14465143ejc.896.2022.11.08.06.30.48; Tue, 08 Nov 2022 06:31:13 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233410AbiKHO0q (ORCPT + 99 others); Tue, 8 Nov 2022 09:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234011AbiKHO0L (ORCPT ); Tue, 8 Nov 2022 09:26:11 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058435C76D for ; Tue, 8 Nov 2022 06:24:52 -0800 (PST) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N69J73vvnzpWFt; Tue, 8 Nov 2022 22:21:11 +0800 (CST) Received: from huawei.com (10.175.127.227) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 22:24:50 +0800 From: Zhang Yi To: CC: , , , , Subject: [PATCH 06/12] ext4: add extent block I/O fault injection Date: Tue, 8 Nov 2022 22:46:11 +0800 Message-ID: <20221108144617.4159381-7-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221108144617.4159381-1-yi.zhang@huawei.com> References: <20221108144617.4159381-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 Add inode extent block reading I/O fault injection, we can specify the inode and physical metadata block to inject, it will return -EIO immediately instead of submitting I/O. Signed-off-by: Zhang Yi --- fs/ext4/ext4.h | 2 ++ fs/ext4/extents.c | 5 +++++ fs/ext4/sysfs.c | 1 + 3 files changed, 8 insertions(+) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 29a819a186f7..9c1dcbed59e6 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1522,6 +1522,7 @@ enum ext4_fault_bits { EXT4_FAULT_IBITMAP_EIO, /* inode bitmap block */ EXT4_FAULT_BBITMAP_EIO, /* block bitmap block */ EXT4_FAULT_INODE_EIO, /* inode */ + EXT4_FAULT_EXTENT_EIO, /* extent block */ EXT4_FAULT_MAX }; @@ -1624,6 +1625,7 @@ EXT4_FAULT_INODE_FN(XATTR_CSUM, xattr_csum, 1) EXT4_FAULT_GRP_FN(IBITMAP_EIO, inode_bitmap_io, -EIO) EXT4_FAULT_GRP_FN(BBITMAP_EIO, block_bitmap_io, -EIO) EXT4_FAULT_INODE_FN(INODE_EIO, inode_io, -EIO) +EXT4_FAULT_INODE_PBLOCK_FN(EXTENT_EIO, extent_io, -EIO) /* * fourth extended-fs super-block data in memory diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 0d07e5cf4dab..504ed35ffeaf 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -566,6 +566,11 @@ __read_extent_tree_block(const char *function, unsigned int line, if (!bh_uptodate_or_lock(bh)) { trace_ext4_ext_load_extent(inode, pblk, _RET_IP_); + err = ext4_fault_extent_io(inode->i_sb, inode->i_ino, pblk); + if (err) { + unlock_buffer(bh); + goto errout; + } err = ext4_read_bh(bh, 0, NULL); if (err < 0) goto errout; diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index 9c6d9a212d47..bad4885399dd 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c @@ -581,6 +581,7 @@ char *ext4_fault_names[EXT4_FAULT_MAX] = { "inode_bitmap_eio", /* EXT4_FAULT_IBITMAP_EIO */ "block_bitmap_eio", /* EXT4_FAULT_BBITMAP_EIO */ "inode_eio", /* EXT4_FAULT_INODE_EIO */ + "extent_block_eio", /* EXT4_FAULT_EXTENT_EIO */ }; static int ext4_fault_available_show(struct seq_file *m, void *v) -- 2.31.1