lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220401071909.505086-6-yuyufen@huawei.com>
Date:   Fri, 1 Apr 2022 15:19:09 +0800
From:   Yufen Yu <yuyufen@...wei.com>
To:     <jaegeuk@...nel.org>, <chao@...nel.org>
CC:     <linux-kernel@...r.kernel.org>,
        <linux-f2fs-devel@...ts.sourceforge.net>, <yuyufen@...wei.com>
Subject: [PATCH 5/5] f2fs: update doc for f2fs fault injection

Just update doc for fault injection.

Signed-off-by: Yufen Yu <yuyufen@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ