LKML Archive mirror
 help / color / mirror / Atom feed
From: Zhang Yi <yi.zhang@huaweicloud.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, ritesh.list@gmail.com,
	yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH v3 03/10] ext4: warn if delalloc counters are not zero on inactive
Date: Mon, 13 May 2024 22:17:37 +0800	[thread overview]
Message-ID: <7d8e3e67-a246-2bfd-39ad-663d7d9d8eed@huaweicloud.com> (raw)
In-Reply-To: <20240512151038.wdg4g3evfvimr7ul@quack3>

On 2024/5/12 23:10, Jan Kara wrote:
> On Wed 08-05-24 14:12:13, Zhang Yi wrote:
>> From: Zhang Yi <yi.zhang@huawei.com>
>>
>> The per-inode i_reserved_data_blocks count the reserved delalloc blocks
>> in a regular file, it should be zero when destroying the file. The
>> per-fs s_dirtyclusters_counter count all reserved delalloc blocks in a
>> filesystem, it also should be zero when umounting the filesystem. Now we
>> have only an error message if the i_reserved_data_blocks is not zero,
>> which is unable to be simply captured, so add WARN_ON_ONCE to make it
>> more visable.
>>
>> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> 
> Well, maybe the warnings could be guarded by !(EXT4_SB(sb)->s_mount_state &
> EXT4_ERROR_FS)? Because the warning isn't very interesting when the
> filesystem was corrupted and if somebody runs with errors=continue we would
> still possibly hit this warning although we don't really care...
> 

Make sense, I missed the errors=continue mode.

Thanks,
Yi.

> 
>> ---
>>  fs/ext4/super.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
>> index 044135796f2b..440dd54eea25 100644
>> --- a/fs/ext4/super.c
>> +++ b/fs/ext4/super.c
>> @@ -1343,6 +1343,9 @@ static void ext4_put_super(struct super_block *sb)
>>  
>>  	ext4_group_desc_free(sbi);
>>  	ext4_flex_groups_free(sbi);
>> +
>> +	WARN_ON_ONCE(!ext4_forced_shutdown(sb) &&
>> +		     percpu_counter_sum(&sbi->s_dirtyclusters_counter));
>>  	ext4_percpu_param_destroy(sbi);
>>  #ifdef CONFIG_QUOTA
>>  	for (int i = 0; i < EXT4_MAXQUOTAS; i++)
>> @@ -1473,7 +1476,8 @@ static void ext4_destroy_inode(struct inode *inode)
>>  		dump_stack();
>>  	}
>>  
>> -	if (EXT4_I(inode)->i_reserved_data_blocks)
>> +	if (!ext4_forced_shutdown(inode->i_sb) &&
>> +	    WARN_ON_ONCE(EXT4_I(inode)->i_reserved_data_blocks))
>>  		ext4_msg(inode->i_sb, KERN_ERR,
>>  			 "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!",
>>  			 inode->i_ino, EXT4_I(inode),
>> -- 
>> 2.39.2
>>


  reply	other threads:[~2024-05-13 14:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  6:12 [PATCH v3 00/10] ext4: support adding multi-delalloc blocks Zhang Yi
2024-05-08  6:12 ` [PATCH v3 01/10] ext4: factor out a common helper to query extent map Zhang Yi
2024-05-08  6:12 ` [PATCH v3 02/10] ext4: check the extent status again before inserting delalloc block Zhang Yi
2024-05-08 15:02   ` Markus Elfring
2024-05-09  8:26     ` Zhang Yi
2024-05-08  6:12 ` [PATCH v3 03/10] ext4: warn if delalloc counters are not zero on inactive Zhang Yi
2024-05-12 15:10   ` Jan Kara
2024-05-13 14:17     ` Zhang Yi [this message]
2024-05-08  6:12 ` [PATCH v3 04/10] ext4: trim delalloc extent Zhang Yi
2024-05-08 15:21   ` Markus Elfring
2024-05-09  8:27     ` Zhang Yi
2024-05-08  6:12 ` [PATCH v3 05/10] ext4: drop iblock parameter Zhang Yi
2024-05-08  6:12 ` [PATCH v3 06/10] ext4: make ext4_es_insert_delayed_block() insert multi-blocks Zhang Yi
2024-05-12 15:19   ` Jan Kara
2024-05-08  6:12 ` [PATCH v3 07/10] ext4: make ext4_da_reserve_space() reserve multi-clusters Zhang Yi
2024-05-08  6:12 ` [PATCH v3 08/10] ext4: factor out check for whether a cluster is allocated Zhang Yi
2024-05-12 15:40   ` Jan Kara
2024-05-14  2:37     ` Zhang Yi
2024-05-08  6:12 ` [PATCH v3 09/10] ext4: make ext4_insert_delayed_block() insert multi-blocks Zhang Yi
2024-05-12 21:47   ` Jan Kara
2024-05-08  6:12 ` [PATCH v3 10/10] ext4: make ext4_da_map_blocks() buffer_head unaware Zhang Yi
2024-05-12 21:51   ` Jan Kara

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=7d8e3e67-a246-2bfd-39ad-663d7d9d8eed@huaweicloud.com \
    --to=yi.zhang@huaweicloud.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=chengzhihao1@huawei.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@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 read-only IMAP folder(s) and NNTP newsgroup(s).