lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTinZ5Lw0R9Nf1Un_gEA8DZqo7y15TA@mail.gmail.com>
Date:	Fri, 10 Jun 2011 14:17:30 +0400
From:	Maxim Patlasov <maxim.patlasov@...il.com>
To:	tytso@....edu
Cc:	adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: ext4_free_blocks() fix

I apologise for flooding, patch description in former email was for
slightly different kernel version. Correct description is below:

Existent implementation of ext4_free_blocks() always calls dquot_free_block
This looks quite sensible in the most cases: blocks to be freed are associated
with inode and were accounted in quota and i_blocks some time ago.

However, there is a case when blocks to free were not accounted by the time
calling ext4_free_blocks() yet:

1. delalloc is on, write_begin pre-allocated some space in quota
2. write-back happens, ext4 allocates some blocks in ext4_ext_map_blocks()
3. then ext4_ext_map_blocks() gets an error (e.g.  ENOSPC) from
   ext4_ext_insert_extent() and calls ext4_free_blocks().

In this scenario, ext4_free_blocks() calls dquot_free_block() who, in turn,
decrements i_blocks for blocks which were not accounted yet (due to delalloc)
After clean umount, e2fsck reports something like:

> Inode 21, i_blocks is 5080, should be 5128.  Fix<y>?
because i_blocks was erroneously decremented as explained above.

The patch fixes the problem by passing EXT4_FREE_BLOCKS_SKIP_QUPD flag to
ext4_free_blocks(). This flag forces ext4_free_blocks() to skip
dquot_free_block() call.

Signed-off-by: Maxim Patlasov <maxim.patlasov@...il.com>

On Fri, Jun 10, 2011 at 2:07 PM, Maxim Patlasov
<maxim.patlasov@...il.com> wrote:
> Existent implementation of ext4_free_blocks() always calls vfs_dq_free_block
> This looks quite sensible in the most cases: blocks to be freed are associated
> with inode and were accounted in quota and i_blocks some time ago.
>
> However, there is a case when blocks to free were not accounted by the time
> calling ext4_free_blocks() yet:
>
> 1. delalloc is on, write_begin pre-allocated some space in quota
> 2. write-back happens, ext4 allocates some blocks in ext4_ext_get_blocks()
> 3. then ext4_ext_get_blocks() gets an error (e.g.  ENOSPC) from
>   ext4_ext_insert_extent() and calls ext4_free_blocks().
>
> In this scenario, ext4_free_blocks() calls vfs_dq_free_block() who, in turn,
> decrements i_blocks for blocks which were not accounted yet (due to delalloc)
> After clean umount, e2fsck reports something like:
>
>> Inode 21, i_blocks is 5080, should be 5128.  Fix<y>?
> because i_blocks was erroneously decremented as explained above.
>
> The patch fixes the problem by passing EXT4_FREE_BLOCKS_SKIP_QUPD flag to
> ext4_free_blocks(). This flag forces ext4_free_blocks() to skip
> vfs_dq_free_block() call.
>
> Signed-off-by: Maxim Patlasov <maxim.patlasov@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ