linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: clear PageError on the read path
@ 2018-09-26  1:46 Jaegeuk Kim
  2018-09-26  1:46 ` [PATCH 2/2] f2fs: return correct errno in f2fs_gc Jaegeuk Kim
  2018-09-28 11:58 ` [f2fs-dev] [PATCH 1/2] f2fs: clear PageError on the read path Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2018-09-26  1:46 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

When running fault injection test, I hit somewhat wrong behavior in f2fs_gc ->
gc_data_segment():

0. fault injection generated some PageError'ed pages

1. gc_data_segment
 -> f2fs_get_read_data_page(REQ_RAHEAD)

2. move_data_page
 -> f2fs_get_lock_data_page()
  -> f2f_get_read_data_page()
   -> f2fs_submit_page_read()
    -> submit_bio(READ)
  -> return EIO due to PageError
  -> fail to move data

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/data.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 41102c227eee..cb3ebcae0398 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -77,7 +77,8 @@ static void __read_end_io(struct bio *bio)
 		/* PG_error was set if any post_read step failed */
 		if (bio->bi_status || PageError(page)) {
 			ClearPageUptodate(page);
-			SetPageError(page);
+			/* will re-read again later */
+			ClearPageError(page);
 		} else {
 			SetPageUptodate(page);
 		}
@@ -591,6 +592,7 @@ static int f2fs_submit_page_read(struct inode *inode, struct page *page,
 		bio_put(bio);
 		return -EFAULT;
 	}
+	ClearPageError(page);
 	__submit_bio(F2FS_I_SB(inode), bio, DATA);
 	return 0;
 }
@@ -1571,6 +1573,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
 		if (bio_add_page(bio, page, blocksize, 0) < blocksize)
 			goto submit_and_realloc;
 
+		ClearPageError(page);
 		last_block_in_bio = block_nr;
 		goto next_page;
 set_error_page:
-- 
2.17.0.441.gb46fe60e1d-goog


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

* [PATCH 2/2] f2fs: return correct errno in f2fs_gc
  2018-09-26  1:46 [PATCH 1/2] f2fs: clear PageError on the read path Jaegeuk Kim
@ 2018-09-26  1:46 ` Jaegeuk Kim
  2018-09-28 10:45   ` [f2fs-dev] " Chao Yu
  2018-09-28 11:58 ` [f2fs-dev] [PATCH 1/2] f2fs: clear PageError on the read path Chao Yu
  1 sibling, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2018-09-26  1:46 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This fixes overriding error number in f2fs_gc.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/gc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 77ffa8045a3b..c051dc4ddf1a 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1241,7 +1241,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,
 
 	put_gc_inode(&gc_list);
 
-	if (sync)
+	if (sync && !ret)
 		ret = sec_freed ? 0 : -EAGAIN;
 	return ret;
 }
-- 
2.17.0.441.gb46fe60e1d-goog


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

* Re: [f2fs-dev] [PATCH 2/2] f2fs: return correct errno in f2fs_gc
  2018-09-26  1:46 ` [PATCH 2/2] f2fs: return correct errno in f2fs_gc Jaegeuk Kim
@ 2018-09-28 10:45   ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-09-28 10:45 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2018/9/26 9:46, Jaegeuk Kim wrote:
> This fixes overriding error number in f2fs_gc.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


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

* Re: [f2fs-dev] [PATCH 1/2] f2fs: clear PageError on the read path
  2018-09-26  1:46 [PATCH 1/2] f2fs: clear PageError on the read path Jaegeuk Kim
  2018-09-26  1:46 ` [PATCH 2/2] f2fs: return correct errno in f2fs_gc Jaegeuk Kim
@ 2018-09-28 11:58 ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-09-28 11:58 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2018-9-26 9:46, Jaegeuk Kim wrote:
> When running fault injection test, I hit somewhat wrong behavior in f2fs_gc ->
> gc_data_segment():
> 
> 0. fault injection generated some PageError'ed pages
> 
> 1. gc_data_segment
>  -> f2fs_get_read_data_page(REQ_RAHEAD)
> 
> 2. move_data_page
>  -> f2fs_get_lock_data_page()
>   -> f2f_get_read_data_page()
>    -> f2fs_submit_page_read()
>     -> submit_bio(READ)
>   -> return EIO due to PageError
>   -> fail to move data
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/data.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 41102c227eee..cb3ebcae0398 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -77,7 +77,8 @@ static void __read_end_io(struct bio *bio)
>  		/* PG_error was set if any post_read step failed */
>  		if (bio->bi_status || PageError(page)) {
>  			ClearPageUptodate(page);
> -			SetPageError(page);
> +			/* will re-read again later */
> +			ClearPageError(page);
>  		} else {
>  			SetPageUptodate(page);

How about:

if (PaegeError(page))
	ClearPageError(page);

if (bio->bi_status) {
	ClearPageUptodate(page);
	SetPageError(page);
} else {
	SetPageUptodate(page);
	ClearPageError(page);
}

So that below codes are not needed.

Thanks,

>  		}
> @@ -591,6 +592,7 @@ static int f2fs_submit_page_read(struct inode *inode, struct page *page,
>  		bio_put(bio);
>  		return -EFAULT;
>  	}
> +	ClearPageError(page);
>  	__submit_bio(F2FS_I_SB(inode), bio, DATA);
>  	return 0;
>  }
> @@ -1571,6 +1573,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
>  		if (bio_add_page(bio, page, blocksize, 0) < blocksize)
>  			goto submit_and_realloc;
>  
> +		ClearPageError(page);
>  		last_block_in_bio = block_nr;
>  		goto next_page;
>  set_error_page:
> 

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

end of thread, other threads:[~2018-09-28 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  1:46 [PATCH 1/2] f2fs: clear PageError on the read path Jaegeuk Kim
2018-09-26  1:46 ` [PATCH 2/2] f2fs: return correct errno in f2fs_gc Jaegeuk Kim
2018-09-28 10:45   ` [f2fs-dev] " Chao Yu
2018-09-28 11:58 ` [f2fs-dev] [PATCH 1/2] f2fs: clear PageError on the read path Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).