public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Jan Kara <jack@suse.cz>
Cc: <jack@suse.com>, <tytso@mit.edu>, <brauner@kernel.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-ext4@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <yukuai3@huawei.com>
Subject: Re: [PATCH 1/3] quota: Check next/prev free block number after reading from quota file
Date: Thu, 22 Sep 2022 20:58:50 +0800	[thread overview]
Message-ID: <bb852092-5eab-9a9f-9c0e-4ae1d1b1f892@huawei.com> (raw)
In-Reply-To: <20220922113902.rhoxfgdzcvdzo3wc@quack3>

在 2022/9/22 19:39, Jan Kara 写道:
> On Thu 22-09-22 16:13:59, Zhihao Cheng wrote:
[...]
>>>
>>> The free block should actually be > QT_TREEOFF so I'd add the check to
>>> do_check_range().
>>
>> 'dh->dqdh_next_free' may be updated when quota entry removed,
>> 'dh->dqdh_next_free' can be used for next new quota entris.
>> Before sending v2, I found 'dh->dqdh_next_free' and 'dh->dqdh_prev_free' can
>> easily be zero in newly allocated blocks when continually creating files
>> onwed by different users:
>> find_free_dqentry
>>    get_free_dqblk
>>      write_blk(info, info->dqi_blocks, buf)  // zero'd qt_disk_dqdbheader
>>      blk = info->dqi_blocks++   // allocate new one block
>>    info->dqi_free_entry = blk   // will be used for new quota entries
>>
>> find_free_dqentry
>>    if (info->dqi_free_entry)
>>      blk = info->dqi_free_entry
>>      read_blk(info, blk, buf)   // dh->dqdh_next_free = dh->dqdh_prev_free =
>> 0
>>
>> I think it's normal when 'dh->dqdh_next_free' or 'dh->dqdh_prev_free' equals
>> to 0.
> 
> Good point! 0 means "not present". So any block number (either in free list
> or pointed from the quota tree) should be either 0 or > QT_TREEOFF.
> 
> 								Honza
> 

In case my emails being filtered agagin, this is notification of v2:
https://lore.kernel.org/linux-ext4/20220922130401.1792256-1-chengzhihao1@huawei.com/T/#m9676d64e8f7cdd7b7decdd0d6b725ec658110b3e

  reply	other threads:[~2022-09-22 12:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20 11:05 [PATCH 0/3] Check content after reading from quota file Zhihao Cheng
2022-08-20 11:05 ` [PATCH 1/3] quota: Check next/prev free block number " Zhihao Cheng
2022-09-21 13:37   ` Jan Kara
2022-09-22  8:13     ` Zhihao Cheng
2022-09-22 11:39       ` Jan Kara
2022-09-22 12:58         ` Zhihao Cheng [this message]
2022-08-20 11:05 ` [PATCH 2/3] quota: Replace all block number checking with helper function Zhihao Cheng
2022-08-20 11:05 ` [PATCH 3/3] quota: Add more checking after reading from quota file Zhihao Cheng
2022-09-13  1:16 ` [PATCH 0/3] Check content " Zhihao Cheng
2022-09-21  7:39   ` 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=bb852092-5eab-9a9f-9c0e-4ae1d1b1f892@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --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