public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Eric Whitney <enwlinux@gmail.com>,
	Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: fix reserved space counter leakage
Date: Sun, 22 Aug 2021 21:06:59 +0800	[thread overview]
Message-ID: <c7a95109-e468-cd25-1042-20e0779a87d4@linux.alibaba.com> (raw)
In-Reply-To: <20210820164556.GA30851@localhost.localdomain>



On 8/21/21 12:45 AM, Eric Whitney wrote:
> * Jeffle Xu <jefflexu@linux.alibaba.com>:
>> When ext4_es_insert_delayed_block() returns error, e.g., ENOMEM,
>> previously reserved space is not released as the error handling,
>> in which case @s_dirtyclusters_counter is left over. Since this delayed
>> extent failes to be inserted into extent status tree, when inode is
>> written back, the extra @s_dirtyclusters_counter won't be subtracted and
>> remains there forever.
>>
>> This can leads to /sys/fs/ext4/<dev>/delayed_allocation_blocks remains
>> non-zero even when syncfs is executed on the filesystem.
>>
> 
> Hi:
> 
> I think the fix below looks fine.  However, this comment doesn't look right
> to me.  Are you really seeing delayed_allocation_blocks values that remain
> incorrectly elevated across last closes (or across file system unmounts and
> remounts)?  s_dirtyclusters_counter isn't written out to stable storage -
> it's an in-memory only variable that's created when a file is first opened
> and destroyed on last close.
> 

Actually we've encountered a real case in our production environment,
which has about 20G space lost (df - du = ~20G).
After some investigation, we've confirmed that it cause by leaked
s_dirtyclusters_counter (~5M), and even we do manually sync, it remains.
Since there is no error messages, we've checked all logic around
s_dirtyclusters_counter and found this. Also we can manually inject
error and reproduce the leaked s_dirtyclusters_counter.

Thanks,
Joseph

  parent reply	other threads:[~2021-08-22 13:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  9:13 [PATCH] ext4: fix reserved space counter leakage Jeffle Xu
2021-08-20 16:45 ` Eric Whitney
2021-08-22  5:17   ` Gao Xiang
2021-08-22 13:06   ` Joseph Qi [this message]
2021-08-22 13:14     ` Joseph Qi
2021-08-22 21:52       ` Eric Whitney
2021-08-23  1:42         ` Joseph Qi
2021-08-23  5:46         ` JeffleXu

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=c7a95109-e468-cd25-1042-20e0779a87d4@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=enwlinux@gmail.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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