mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yufen Yu <yuyufen@huawei.com>
To: <jaegeuk@kernel.org>, <chao@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>, <yuyufen@huawei.com>
Subject: [PATCH 5/5] f2fs: update doc for f2fs fault injection
Date: Fri, 1 Apr 2022 15:19:09 +0800	[thread overview]
Message-ID: <20220401071909.505086-6-yuyufen@huawei.com> (raw)
In-Reply-To: <20220401071909.505086-1-yuyufen@huawei.com>

Just update doc for fault injection.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 Documentation/filesystems/f2fs.rst | 118 ++++++++++++++++++++++-------
 1 file changed, 90 insertions(+), 28 deletions(-)

diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
index 4a2426f0485a..e8dfe1541613 100644
--- a/Documentation/filesystems/f2fs.rst
+++ b/Documentation/filesystems/f2fs.rst
@@ -172,34 +172,6 @@ reserve_root=%d		 Support configuring reserved space which is used for
 			 gid, unit: 4KB, the default limit is 0.2% of user blocks.
 resuid=%d		 The user ID which may use the reserved blocks.
 resgid=%d		 The group ID which may use the reserved blocks.
-fault_injection=%d	 Enable fault injection in all supported types with
-			 specified injection rate.
-fault_type=%d		 Support configuring fault injection type, should be
-			 enabled with fault_injection option, fault type value
-			 is shown below, it supports single or combined type.
-
-			 ===================	  ===========
-			 Type_Name		  Type_Value
-			 ===================	  ===========
-			 FAULT_KMALLOC		  0x000000001
-			 FAULT_KVMALLOC		  0x000000002
-			 FAULT_PAGE_ALLOC	  0x000000004
-			 FAULT_PAGE_GET		  0x000000008
-			 FAULT_ALLOC_BIO	  0x000000010 (obsolete)
-			 FAULT_ALLOC_NID	  0x000000020
-			 FAULT_ORPHAN		  0x000000040
-			 FAULT_BLOCK		  0x000000080
-			 FAULT_DIR_DEPTH	  0x000000100
-			 FAULT_EVICT_INODE	  0x000000200
-			 FAULT_TRUNCATE		  0x000000400
-			 FAULT_READ_IO		  0x000000800
-			 FAULT_CHECKPOINT	  0x000001000
-			 FAULT_DISCARD		  0x000002000
-			 FAULT_WRITE_IO		  0x000004000
-			 FAULT_SLAB_ALLOC	  0x000008000
-			 FAULT_DQUOT_INIT	  0x000010000
-			 FAULT_LOCK_OP		  0x000020000
-			 ===================	  ===========
 mode=%s			 Control block allocation mode which supports "adaptive"
 			 and "lfs". In "lfs" mode, there should be no random
 			 writes towards main area.
@@ -367,6 +339,96 @@ The files in each per-device directory are shown in table below.
 Files in /sys/fs/f2fs/<devname>
 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
 
+Fault Injection
+=============
+/sys/kernel/debug/f2fs/<devname>/fault_inject contains fault_inject control.
+
+Support configuring fault injection type by writing value to
+/sys/kernel/debug/f2fs/<devname>/fault_inject/inject_type.
+The values are shown below. They support single or combined type.
+
+			 ===================	  ===========
+			 Type_Name		  Type_Value
+			 ===================	  ===========
+			 FAULT_KMALLOC		  0x000000001
+			 FAULT_KVMALLOC		  0x000000002
+			 FAULT_PAGE_ALLOC	  0x000000004
+			 FAULT_PAGE_GET		  0x000000008
+			 FAULT_ALLOC_BIO	  0x000000010 (obsolete)
+			 FAULT_ALLOC_NID	  0x000000020
+			 FAULT_ORPHAN		  0x000000040
+			 FAULT_BLOCK		  0x000000080
+			 FAULT_DIR_DEPTH	  0x000000100
+			 FAULT_EVICT_INODE	  0x000000200
+			 FAULT_TRUNCATE		  0x000000400
+			 FAULT_READ_IO		  0x000000800
+			 FAULT_CHECKPOINT	  0x000001000
+			 FAULT_DISCARD		  0x000002000
+			 FAULT_WRITE_IO		  0x000004000
+			 FAULT_SLAB_ALLOC	  0x000008000
+			 FAULT_DQUOT_INIT	  0x000010000
+			 FAULT_LOCK_OP		  0x000020000
+			 ===================	  ===========
+
+Example: Inject write io fail
+---------------------------------------------------
+
+::
+
+    mount /dev/sda /mnt
+    echo 0x000000800 > /sys/kernel/debug/f2fs/sda/fault_inject/inject_type
+    echo 1 > /sys/kernel/debug/f2fs/sda/fault_inject/times
+    echo 100 > /sys/kernel/debug/f2fs/sda/fault_inject/probability
+    cp /mnt/file .
+
+Expected Result::
+
+    cat: /mnt/file: Input/output error
+
+Message from dmesg::
+
+    FAULT_INJECTION: forcing a failure.
+    name fault_inject, interval 1, probability 100, space 0, times 1
+    CPU: 30 PID: 0 Comm: swapper/30 Not tainted 5.17.0-rc8 #6
+    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-build
+    Call Trace:
+     <IRQ>
+     ? dump_stack_lvl+0x73/0x9f
+     ? dump_stack+0x13/0x1b
+     ? should_fail.cold+0x4a/0x57
+     ? f2fs_should_fail+0x3e/0x60
+     ? f2fs_read_end_io+0x94/0x230
+     ? bio_endio+0x15d/0x2d0
+     ? blk_update_request+0x188/0x5b0
+     ? kfree+0x138/0x4a0
+     ? scsi_end_request+0x2f/0x230
+     ? scsi_io_completion+0x86/0x9a0
+     ? scsi_dec_host_busy+0xc6/0xe0
+     ? scsi_finish_command+0xf0/0x160
+     ? scsi_complete+0x9f/0x160
+     ? blk_complete_reqs+0x5a/0x70
+     ? blk_done_softirq+0x34/0x40
+     ? __do_softirq+0x14f/0x4ef
+     ? irq_exit_rcu+0x1a7/0x210
+     ? common_interrupt+0xa4/0xc0
+     </IRQ>
+     <TASK>
+     ? asm_common_interrupt+0x1e/0x40
+     ? default_idle+0x38/0x50
+     ? arch_cpu_idle+0x13/0x20
+     ? default_idle_call+0x82/0x270
+     ? do_idle+0x37c/0x4a0
+     ? swake_up_locked+0x38/0x80
+     ? _raw_spin_unlock_irqrestore+0x4b/0x90
+     ? cpu_startup_entry+0x31/0x40
+     ? start_secondary+0x222/0x280
+     ? secondary_startup_64_no_verify+0xc3/0xcb
+     </TASK>
+    F2FS-fs (sda) : inject read IO error in f2fs_read_end_io of bio_endio+0x15d/0x2d0
+
+Files in /sys/kernel/debug/f2fs/<devname>/fault_inject
+(see also Documentation/fault-injection/fault-injection.rst)
+
 Usage
 =====
 
-- 
2.31.1


      parent reply	other threads:[~2022-04-01  7:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01  7:19 [PATCH 0/5] f2fs: try to use common fault injection framework Yufen Yu
2022-04-01  7:19 ` [PATCH 1/5] f2fs: extract f2fs root debugfs to init_f2fs_fs Yufen Yu
2022-04-01  7:19 ` [PATCH 2/5] f2fs: use common fault injection frmework Yufen Yu
2022-04-01  7:19 ` [PATCH 3/5] f2fs: replace function time_to_inject by f2fs_should_fail Yufen Yu
2022-04-01  7:19 ` [PATCH 4/5] f2fs: get rid of stale fault injection code Yufen Yu
2022-04-01  8:28   ` [f2fs-dev] " Chao Yu
2022-04-06  3:01     ` Yufen Yu
2022-04-11 10:04       ` Chao Yu
2022-04-11 21:20         ` Jaegeuk Kim
2022-04-12 11:04           ` Yufen Yu
2022-04-19  2:56             ` Chao Yu
2022-04-01  7:19 ` Yufen Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401071909.505086-6-yuyufen@huawei.com \
    --to=yuyufen@huawei.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®