RE: [f2fs-dev] [PATCH 1/3] f2fs: check the page status filled from disk
From: Chao Yu
Date: Tue Jan 05 2016 - 04:32:49 EST
Hi Jaegeuk,
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@xxxxxxxxxx]
> Sent: Sunday, January 03, 2016 9:26 AM
> To: linux-kernel@xxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx;
> linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 1/3] f2fs: check the page status filled from disk
>
> After reading a page, we need to check whether there is any error.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
> ---
> fs/f2fs/data.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 89a978c..11b2111 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -448,6 +448,14 @@ repeat:
>
> /* wait for read completion */
> lock_page(page);
> + if (unlikely(!PageUptodate(page))) {
> + f2fs_put_page(page, 1);
> + return ERR_PTR(-EIO);
There is a convention in get_new_data_page, anyway we should release ipage
if there is any error occurs, but I think it will be ok to return directly
since it seems impossible the new dentry page has its real block address.
To avoid any bug here or wrong usage, how about add bug_on as following patch?