[lvc-project] [PATCH 5.10/6.1] nilfs2: switch WARN_ONs to warning output in nilfs_sufile_do_free()

Fedor Pchelkin pchelkin at ispras.ru
Thu Jun 18 16:53:52 MSK 2026


On Thu, 18. Jun 16:15, Makar Semyonov wrote:
> From: Ryusuke Konishi <konishi.ryusuke at gmail.com>
> 
> commit 2c20b0f26694e1d40bb9b86f8eff5675e87003d1 upstream.
> 
> nilfs_sufile_do_free(), which is called when log write fails or during
> GC, uses WARN_ONs to check for abnormal status of metadata.  In the
> former case, these WARN_ONs will not be fired, but in the latter case
> they don't "never-happen".  It is possible to trigger these by
> intentionally modifying the userland GC library to release segments
> that are not in the expected state.
> 
> So, replace them with warning output using the dedicated macro
> nilfs_warn().
> 
> Link: https://lkml.kernel.org/r/20231207045730.5205-1-konishi.ryusuke@gmail.com
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke at gmail.com>
> Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
> 

Пустая строка выше не нужна.

> Fixes: a703018f7bbe ("nilfs2: segment usage file cleanups")
> Link: https://lore.kernel.org/all/1239341281-20249-8-git-send-email-konishi.ryusuke@lab.ntt.co.jp

Зачем сюда этот Link поставлен?

Ну и на вопрос касательно валидности тега Fixes из прошлых писем к
сожалению комментариев дано не было.  А это требует исследования и
корректировки тега при необходимости.  a703018f7bbe лишь зарефакторил и
сделал дедупликацию кода, он точно _внёс_ ошибку?

> Signed-off-by: Makar Semyonov <m.semenov at tssltd.ru>
> ---
>  fs/nilfs2/sufile.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
> index dc359b56fdfa..a7c50a79b845 100644
> --- a/fs/nilfs2/sufile.c
> +++ b/fs/nilfs2/sufile.c
> @@ -471,10 +471,16 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,
>  		kunmap_atomic(kaddr);
>  		return;
>  	}
> -	WARN_ON(nilfs_segment_usage_error(su));
> -	WARN_ON(!nilfs_segment_usage_dirty(su));
> +	if (unlikely(nilfs_segment_usage_error(su)))
> +		nilfs_warn(sufile->i_sb, "free segment %llu marked in error",
> +	(unsigned long long)segnum);
> 
>  	sudirty = nilfs_segment_usage_dirty(su);
> +

Апстримный коммит не добавляет выше пустую строку.  Просьба подправить.

В целом, надеюсь, что не вручную переносили изменения, ибо git cherry-pick
апстримного 2c20b0f26694e1d40bb9b86f8eff5675e87003d1 срабатывает чисто
на 5.10 и 6.1 ветках, т.е. ручных изменений здесь не потребовалось бы.

> +	if (unlikely(!sudirty))
> +		nilfs_warn(sufile->i_sb, "free unallocated segment %llu",
> +		(unsigned long long)segnum);
> +
>  	nilfs_segment_usage_set_clean(su);
>  	kunmap_atomic(kaddr);
>  	mark_buffer_dirty(su_bh);
> -- 
> 2.43.0



More information about the lvc-project mailing list