All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail
@ 2022-05-11  7:14 Fengnan Chang
  2022-06-03  2:12 ` fengnan chang
  2022-06-07 18:45 ` Jaegeuk Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Fengnan Chang @ 2022-05-11  7:14 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel

When decompressed failed, f2fs_prepare_compress_overwrite will enter
endless loop, may casue hungtask.

[   14.088665] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
[   14.089851] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155

Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
---
 fs/f2fs/compress.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 12a56f9e1572..6a65443fd9b3 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1060,7 +1060,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
 	sector_t last_block_in_bio;
 	unsigned fgp_flag = FGP_LOCK | FGP_WRITE | FGP_CREAT;
 	pgoff_t start_idx = start_idx_of_cluster(cc);
-	int i, ret;
+	int i, ret, retry_count = 3;
 
 retry:
 	ret = f2fs_is_compressed_cluster(cc->inode, start_idx);
@@ -1120,7 +1120,12 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
 			f2fs_put_rpages(cc);
 			f2fs_unlock_rpages(cc, i + 1);
 			f2fs_destroy_compress_ctx(cc, true);
-			goto retry;
+			if (retry_count--)
+				goto retry;
+			else {
+				ret = -EIO;
+				goto out;
+			}
 		}
 	}
 
-- 
2.25.1



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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail
  2022-05-11  7:14 [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail Fengnan Chang
@ 2022-06-03  2:12 ` fengnan chang
  2022-06-07 18:45 ` Jaegeuk Kim
  1 sibling, 0 replies; 4+ messages in thread
From: fengnan chang @ 2022-06-03  2:12 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

ping...

Fengnan Chang <fengnanchang@gmail.com> 于2022年5月11日周三 15:14写道:
>
> When decompressed failed, f2fs_prepare_compress_overwrite will enter
> endless loop, may casue hungtask.
>
> [   14.088665] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
> [   14.089851] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
>
> Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
> ---
>  fs/f2fs/compress.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index 12a56f9e1572..6a65443fd9b3 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1060,7 +1060,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>         sector_t last_block_in_bio;
>         unsigned fgp_flag = FGP_LOCK | FGP_WRITE | FGP_CREAT;
>         pgoff_t start_idx = start_idx_of_cluster(cc);
> -       int i, ret;
> +       int i, ret, retry_count = 3;
>
>  retry:
>         ret = f2fs_is_compressed_cluster(cc->inode, start_idx);
> @@ -1120,7 +1120,12 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>                         f2fs_put_rpages(cc);
>                         f2fs_unlock_rpages(cc, i + 1);
>                         f2fs_destroy_compress_ctx(cc, true);
> -                       goto retry;
> +                       if (retry_count--)
> +                               goto retry;
> +                       else {
> +                               ret = -EIO;
> +                               goto out;
> +                       }
>                 }
>         }
>
> --
> 2.25.1
>


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail
  2022-05-11  7:14 [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail Fengnan Chang
  2022-06-03  2:12 ` fengnan chang
@ 2022-06-07 18:45 ` Jaegeuk Kim
  2022-06-08  1:57   ` Chao Yu
  1 sibling, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2022-06-07 18:45 UTC (permalink / raw)
  To: Fengnan Chang; +Cc: linux-f2fs-devel

On 05/11, Fengnan Chang wrote:
> When decompressed failed, f2fs_prepare_compress_overwrite will enter
> endless loop, may casue hungtask.
> 
> [   14.088665] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
> [   14.089851] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
> 
> Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
> ---
>  fs/f2fs/compress.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index 12a56f9e1572..6a65443fd9b3 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1060,7 +1060,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>  	sector_t last_block_in_bio;
>  	unsigned fgp_flag = FGP_LOCK | FGP_WRITE | FGP_CREAT;
>  	pgoff_t start_idx = start_idx_of_cluster(cc);
> -	int i, ret;
> +	int i, ret, retry_count = 3;
>  
>  retry:
>  	ret = f2fs_is_compressed_cluster(cc->inode, start_idx);
> @@ -1120,7 +1120,12 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>  			f2fs_put_rpages(cc);
>  			f2fs_unlock_rpages(cc, i + 1);
>  			f2fs_destroy_compress_ctx(cc, true);
> -			goto retry;

Do we need to return EIO right away?
			if (!page)
				goto retry;
			ret = -EIO;
			goto out;

> +			if (retry_count--)
> +				goto retry;
> +			else {
> +				ret = -EIO;
> +				goto out;
> +			}
>  		}
>  	}
>  
> -- 
> 2.25.1


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail
  2022-06-07 18:45 ` Jaegeuk Kim
@ 2022-06-08  1:57   ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2022-06-08  1:57 UTC (permalink / raw)
  To: Jaegeuk Kim, Fengnan Chang; +Cc: linux-f2fs-devel

On 2022/6/8 2:45, Jaegeuk Kim wrote:
> On 05/11, Fengnan Chang wrote:
>> When decompressed failed, f2fs_prepare_compress_overwrite will enter
>> endless loop, may casue hungtask.
>>
>> [   14.088665] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
>> [   14.089851] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
>>
>> Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
>> ---
>>   fs/f2fs/compress.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>> index 12a56f9e1572..6a65443fd9b3 100644
>> --- a/fs/f2fs/compress.c
>> +++ b/fs/f2fs/compress.c
>> @@ -1060,7 +1060,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>   	sector_t last_block_in_bio;
>>   	unsigned fgp_flag = FGP_LOCK | FGP_WRITE | FGP_CREAT;
>>   	pgoff_t start_idx = start_idx_of_cluster(cc);
>> -	int i, ret;
>> +	int i, ret, retry_count = 3;
>>   
>>   retry:
>>   	ret = f2fs_is_compressed_cluster(cc->inode, start_idx);
>> @@ -1120,7 +1120,12 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>   			f2fs_put_rpages(cc);
>>   			f2fs_unlock_rpages(cc, i + 1);
>>   			f2fs_destroy_compress_ctx(cc, true);
>> -			goto retry;
> 
> Do we need to return EIO right away?
> 			if (!page)

page point is valid here, however page is not uptodate here.

Maybe we can set Pg_error flag if decompress failed, and here, we can break the
loop if Pg_error flag was set?

Thanks,

> 				goto retry;
> 			ret = -EIO;
> 			goto out;
> 
>> +			if (retry_count--)
>> +				goto retry;
>> +			else {
>> +				ret = -EIO;
>> +				goto out;
>> +			}
>>   		}
>>   	}
>>   
>> -- 
>> 2.25.1


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-08  1:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  7:14 [f2fs-dev] [PATCH] f2fs: fix hungtask when decompressed fail Fengnan Chang
2022-06-03  2:12 ` fengnan chang
2022-06-07 18:45 ` Jaegeuk Kim
2022-06-08  1:57   ` Chao Yu

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.