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] [day] [month] [year] [list]
Message-ID: <de8d30d7-7b5d-4e7c-9119-a6c4cca3d0aa@kernel.org>
Date: Mon, 12 Jan 2026 09:37:26 +0800
From: Chao Yu <chao@...nel.org>
To: jaegeuk@...nel.org
Cc: chao@...nel.org, linux-f2fs-devel@...ts.sourceforge.net,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] f2fs: make FAULT_DISCARD obsolete

Ping,

On 12/15/2025 8:28 PM, Chao Yu wrote:
> __blkdev_issue_discard() in __submit_discard_cmd() will never fail, so
> let's make FAULT_DISCARD fault injection obsolete.
> 
> Signed-off-by: Chao Yu <chao@...nel.org>
> ---
>   Documentation/ABI/testing/sysfs-fs-f2fs |  2 +-
>   Documentation/filesystems/f2fs.rst      |  2 +-
>   fs/f2fs/f2fs.h                          |  2 +-
>   fs/f2fs/segment.c                       | 18 +++---------------
>   4 files changed, 6 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 770470e0598b..7920c233d8ec 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -732,7 +732,7 @@ Description:	Support configuring fault injection type, should be
>   		FAULT_TRUNCATE                   0x00000400
>   		FAULT_READ_IO                    0x00000800
>   		FAULT_CHECKPOINT                 0x00001000
> -		FAULT_DISCARD                    0x00002000
> +		FAULT_DISCARD                    0x00002000 (obsolete)
>   		FAULT_WRITE_IO                   0x00004000
>   		FAULT_SLAB_ALLOC                 0x00008000
>   		FAULT_DQUOT_INIT                 0x00010000
> diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
> index 9b3b835a174e..27aa4032c7cd 100644
> --- a/Documentation/filesystems/f2fs.rst
> +++ b/Documentation/filesystems/f2fs.rst
> @@ -206,7 +206,7 @@ fault_type=%d		 Support configuring fault injection type, should be
>   			     FAULT_TRUNCATE                   0x00000400
>   			     FAULT_READ_IO                    0x00000800
>   			     FAULT_CHECKPOINT                 0x00001000
> -			     FAULT_DISCARD                    0x00002000
> +			     FAULT_DISCARD                    0x00002000 (obsolete)
>   			     FAULT_WRITE_IO                   0x00004000
>   			     FAULT_SLAB_ALLOC                 0x00008000
>   			     FAULT_DQUOT_INIT                 0x00010000
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index d7600979218e..65ca1a5eaa88 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -54,7 +54,7 @@ enum {
>   	FAULT_TRUNCATE,
>   	FAULT_READ_IO,
>   	FAULT_CHECKPOINT,
> -	FAULT_DISCARD,
> +	FAULT_DISCARD,		/* it's obsolete due to __blkdev_issue_discard() will never fail */
>   	FAULT_WRITE_IO,
>   	FAULT_SLAB_ALLOC,
>   	FAULT_DQUOT_INIT,
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index c26424f47686..5168026b2960 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1286,7 +1286,6 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
>   					&(dcc->fstrim_list) : &(dcc->wait_list);
>   	blk_opf_t flag = dpolicy->sync ? REQ_SYNC : 0;
>   	block_t lstart, start, len, total_len;
> -	int err = 0;
>   
>   	if (dc->state != D_PREP)
>   		return 0;
> @@ -1327,7 +1326,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
>   
>   	dc->di.len = 0;
>   
> -	while (total_len && *issued < dpolicy->max_requests && !err) {
> +	while (total_len && *issued < dpolicy->max_requests) {
>   		struct bio *bio = NULL;
>   		unsigned long flags;
>   		bool last = true;
> @@ -1343,17 +1342,6 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
>   
>   		dc->di.len += len;
>   
> -		err = 0;
> -		if (time_to_inject(sbi, FAULT_DISCARD)) {
> -			err = -EIO;
> -			spin_lock_irqsave(&dc->lock, flags);
> -			if (dc->state == D_PARTIAL)
> -				dc->state = D_SUBMIT;
> -			spin_unlock_irqrestore(&dc->lock, flags);
> -
> -			break;
> -		}
> -
>   		__blkdev_issue_discard(bdev, SECTOR_FROM_BLOCK(start),
>   				SECTOR_FROM_BLOCK(len), GFP_NOFS, &bio);
>   		f2fs_bug_on(sbi, !bio);
> @@ -1392,11 +1380,11 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
>   		len = total_len;
>   	}
>   
> -	if (!err && len) {
> +	if (len) {
>   		dcc->undiscard_blks -= len;
>   		__update_discard_tree_range(sbi, bdev, lstart, start, len);
>   	}
> -	return err;
> +	return 0;
>   }
>   
>   static void __insert_discard_cmd(struct f2fs_sb_info *sbi,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ