All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Sheng Yong <shengyong@oppo.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [RCF PATCH v3 00/10] f2fs-tools: introduce inject.f2fs
Date: Wed, 10 Jul 2024 22:57:41 +0000	[thread overview]
Message-ID: <Zo8R5dV8awZ8NuDj@google.com> (raw)
In-Reply-To: <20240704025740.527171-1-shengyong@oppo.com>

Hi Sheng,

Can we have a list of tests to check the expected behavior of given
inject.f2fs followed by fsck.f2fs?

Thanks,

On 07/04, Sheng Yong wrote:
> This patchset introduces a new tool inject.f2fs to modify metadata or
> data (directory entry) of f2fs image offline flexibly.
> 
> With inject.f2fs, it is easier to generate a corrupted f2fs image, which
> can help verify fsck or reproduce userspace behaviors of some a fault.
> If option `--dry-run' is used, nothing really gets changed, and that
> could be used to get the value of a specified field.
> 
> inject.f2fs allows injecting some members in sb, cp, nat, sit, ssa, node
> and dentry for now. The available members of each part can be listed by
> executing command like:
>   inject.f2fs --sb 0 --help
> 
>   [...]
>   [mb]:
>     magic: inject magic number
>     s_stop_reason: inject s_stop_reason array selected by --idx <index>
>     s_errors: inject s_errors array selected by --idx <index>
>     devs.path: inject path in devs array selected by --idx <index> specified by --str <string>
> 
> More injection fields are still work-in-progress. The TODO list includes:
>  * sb: features
>  * cp: fsync dnodes
>  * inode: extent, extra attrs, xattr
>  * data: fsverify?
>  * other fields which is needed to verify fsck
> 
> v3:
>   * patch 3, fix error handling of inject sb->devs.path
>   * patch 3, do not ASSERT devs.path when inject is executed
>   * patch 3, allow inject to execute if image is umounted unclean
>   * patch 9, check whether blkaddr is valid before reading dentry block
>   * add is_digits and strtol entptr check when parsing numeric options
> 
> v2:
>   * change print format of s_errors
>   * add write_raw_cp_blocks to write the first & last cp blocks directly
>     to avoid updating ckpt_flags by write_checkpoint
>   * call update_block if i_inode_checksum is injected to avoid updating
>     i_inode_checksum by update_inode
>   * go through all dentry blocks to find the target dir entry
> 
> Examples:
> 
> Inject sb's magic
> =================
> inject.f2fs --sb 0 --mb magic --val 0x12345 $DEV
> 
> Info: inject sb auto
> Info: inject member magic
> Info: inject value 74565 : 0x12345
> [...]
> Info: inject magic of sb 1: 0xf2f52010 -> 0x12345
> [update_superblock: 890] Info: Done to update superblock
> 
> Inject cp's cur_data_segno
> ==========================
> inject.f2fs --cp 0 --mb cur_data_segno --idx 1 --val 0x12345 $DEV
> 
> Info: inject cp pack auto
> Info: inject member cur_data_segno
> Info: inject slot index 1
> Info: inject value 74565 : 0x12345
> [...]
> Info: inject cur_data_segno[1] of cp 1: 0x4 -> 0x12345
> Info: write_checkpoint() cur_cp:1
> 
> Inject nat's ino
> ================
> inject.f2fs --nat 0 --mb ino --nid $INO --val 0x12345 $DEV
> 
> Info: inject nat pack auto
> Info: inject nid 4 : 0x4
> Info: inject member ino
> Info: inject value 74565 : 0x12345
> [...]
> Info: inject nat entry ino of nid 4 in pack 1: 4 -> 74565
> 
> Inject ssa's nid
> ================
> inject.f2fs --ssa --blk $BLK --mb nid --val 0x12345 $DEV
> 
> Info: inject ssa
> Info: inject blkaddr 7511 : 0x1d57
> Info: inject member nid
> Info: inject value 74565 : 0x12345
> [...]
> Info: auto idx = 343
> Info: inject summary entry nid of block 0x1d57: 0x4 -> 0x12345
> 
> Inject inode's i_addr
> =====================
> inject.f2fs --node --nid $INO --mb i_addr --idx 100 --val 0x12345 $DEV
> 
> Info: inject node
> Info: inject nid 4 : 0x4
> Info: inject member i_addr
> Info: inject slot index 100
> Info: inject value 74565 : 0x12345
> [...]
> Info: inject inode i_addr[100] of nid 4: 0x20864 -> 0x12345
> 
> Inject inode's dentry hash
> ==========================
> inject.f2fs --dent --nid $INO --mb d_hash --val 0x12345 $DEV
> 
> Info: inject dentry
> Info: inject nid 4 : 0x4
> Info: inject member d_hash
> Info: inject value 74565 : 0x12345
> [..]
> Info: inject dentry d_hash of nid 4: 0xc77b804e -> 0x12345
> 
> Sheng Yong (10):
>   f2fs-tools: export is_digits
>   inject.f2fs: introduce inject.f2fs
>   inject.f2fs: add sb injection
>   inject.f2fs: add cp injection
>   inject.f2fs: add nat injection
>   inject.f2fs: add sit injection
>   inject.f2fs: add ssa injection
>   inject.f2fs: add node injection
>   inject.f2fs: add dentry injection
>   man: add inject.f2fs man page
> 
>  fsck/Makefile.am  |    5 +-
>  fsck/fsck.h       |    6 +
>  fsck/inject.c     | 1104 +++++++++++++++++++++++++++++++++++++++++++++
>  fsck/inject.h     |   41 ++
>  fsck/main.c       |   38 +-
>  fsck/mount.c      |   30 +-
>  include/f2fs_fs.h |    2 +
>  man/Makefile.am   |    2 +-
>  man/inject.f2fs.8 |  225 +++++++++
>  9 files changed, 1447 insertions(+), 6 deletions(-)
>  create mode 100644 fsck/inject.c
>  create mode 100644 fsck/inject.h
>  create mode 100644 man/inject.f2fs.8
> 
> -- 
> 2.40.1


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2024-07-10 22:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  2:57 [f2fs-dev] [RCF PATCH v3 00/10] f2fs-tools: introduce inject.f2fs Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 01/10] f2fs-tools: export is_digits Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 02/10] inject.f2fs: introduce inject.f2fs Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 03/10] inject.f2fs: add sb injection Sheng Yong via Linux-f2fs-devel
2024-07-04  3:39   ` Chao Yu
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 04/10] inject.f2fs: add cp injection Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 05/10] inject.f2fs: add nat injection Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 06/10] inject.f2fs: add sit injection Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 07/10] inject.f2fs: add ssa injection Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 08/10] inject.f2fs: add node injection Sheng Yong via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 09/10] inject.f2fs: add dentry injection Sheng Yong via Linux-f2fs-devel
2024-07-04  3:43   ` Chao Yu
2024-09-03 10:14   ` Sheng Yong via Linux-f2fs-devel
2024-09-03 21:28     ` Jaegeuk Kim via Linux-f2fs-devel
2024-07-04  2:57 ` [f2fs-dev] [RCF PATCH v3 10/10] man: add inject.f2fs man page Sheng Yong via Linux-f2fs-devel
2024-07-04  3:26 ` [f2fs-dev] [RCF PATCH v3 00/10] f2fs-tools: introduce inject.f2fs Chao Yu
2024-07-10 22:57 ` Jaegeuk Kim [this message]
2024-07-10 23:04   ` Jaegeuk Kim
2024-07-11  1:25     ` Sheng Yong via Linux-f2fs-devel

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=Zo8R5dV8awZ8NuDj@google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=shengyong@oppo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.