linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Zhang Qilong <zhangqilong3@huawei.com>, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: Fix error log cluster size warning in sanity_check_inode()
Date: Wed, 16 Nov 2022 09:24:43 +0800	[thread overview]
Message-ID: <0b0ca95a-108b-d77b-9669-b298ccec6e53@kernel.org> (raw)
In-Reply-To: <20221115084655.84191-1-zhangqilong3@huawei.com>

On 2022/11/15 16:46, Zhang Qilong wrote:
> Mounting f2fs with following issue:
> sanity_check_inode: inode (ino=4827) has unsupported log cluster size: 0, run fsck to fix
> 
> ->find_fsync_dnodes
>   ->add_fsync_inode
>    ->f2fs_iget_retry
>     ->f2fs_iget
>      ->do_read_inode
>       ->sanity_check_inode
> 
> It is triggered when entering recovery mode after a system crash.
> The root cause is 'i_log_cluster_size' is zero in f2fs inode with
> F2FS_COMPR_FL flag. It will resulted in mounting failed, and the
> filesystem need to be fscked.

fsync on compressed inode will trigger checkpoint, so f2fs_recover_inode_page()
will never process compressed inode?

Thanks,

> 
> We fix it by adding copying compresion information to f2fs inode
> page when recover inode page in f2fs_recover_inode_page().
> 
> Cc: stable@vger.kernel.org
> Fixes: 4c8ff7095bef ("f2fs: support data compression")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>   fs/f2fs/node.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 83cc8a9e4982..2c4031ed71c9 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -2799,6 +2799,14 @@ int f2fs_recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
>   			dst->i_crtime = src->i_crtime;
>   			dst->i_crtime_nsec = src->i_crtime_nsec;
>   		}
> +		if (f2fs_sb_has_compression(sbi) &&
> +			F2FS_FITS_IN_INODE(src, le16_to_cpu(src->i_extra_isize),
> +						i_log_cluster_size)) {
> +			dst->i_compr_blocks = src->i_compr_blocks;
> +			dst->i_compress_algorithm = src->i_compress_algorithm;
> +			dst->i_log_cluster_size = src->i_log_cluster_size;
> +			dst->i_compress_flag = src->i_compress_flag;
> +		}
>   	}
>   
>   	new_ni = old_ni;


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

      reply	other threads:[~2022-11-16  1:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  8:46 [f2fs-dev] [PATCH] f2fs: Fix error log cluster size warning in sanity_check_inode() Zhang Qilong via Linux-f2fs-devel
2022-11-16  1:24 ` Chao Yu [this message]

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=0b0ca95a-108b-d77b-9669-b298ccec6e53@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=zhangqilong3@huawei.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 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).