[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160929131457.wyhlp34n55ewzzxu@localhost.localdomain>
Date: Thu, 29 Sep 2016 15:14:57 +0200
From: Lukas Czerner <lczerner@...hat.com>
To: Jan Kara <jack@...e.cz>
Cc: Ted Tso <tytso@....edu>, linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: Unmap metadata when zeroing blocks
Hi Jan,
do we have a xfstest case for this particular problem ?
Thanks!
-Lukas
On Tue, Sep 27, 2016 at 06:15:18PM +0200, Jan Kara wrote:
> When zeroing blocks for DAX allocations, we also have to unmap aliases
> in the block device mappings. Otherwise writeback can overwrite zeros
> with stale data from block device page cache.
>
> Signed-off-by: Jan Kara <jack@...e.cz>
> ---
> fs/ext4/inode.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> Ted, can you merge this patch please? It's a data corruption issue for DAX.
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index c6ea25a190f8..87150122d361 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -647,11 +647,19 @@ found:
> /*
> * We have to zeroout blocks before inserting them into extent
> * status tree. Otherwise someone could look them up there and
> - * use them before they are really zeroed.
> + * use them before they are really zeroed. We also have to
> + * unmap metadata before zeroing as otherwise writeback can
> + * overwrite zeros with stale data from block device.
> */
> if (flags & EXT4_GET_BLOCKS_ZERO &&
> map->m_flags & EXT4_MAP_MAPPED &&
> map->m_flags & EXT4_MAP_NEW) {
> + ext4_lblk_t i;
> +
> + for (i = 0; i < map->m_len; i++) {
> + unmap_underlying_metadata(inode->i_sb->s_bdev,
> + map->m_pblk + i);
> + }
> ret = ext4_issue_zeroout(inode, map->m_lblk,
> map->m_pblk, map->m_len);
> if (ret) {
> --
> 2.6.6
>
> --
> 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
--
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