[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191023063557.21C964C050@d06av22.portsmouth.uk.ibm.com>
Date: Wed, 23 Oct 2019 12:05:55 +0530
From: Ritesh Harjani <riteshh@...ux.ibm.com>
To: Matthew Bobrowski <mbobrowski@...browski.org>, tytso@....edu,
jack@...e.cz, adilger.kernel@...ger.ca
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
hch@...radead.org, david@...morbit.com, darrick.wong@...cle.com
Subject: Re: [PATCH v5 02/12] ext4: iomap that extends beyond EOF should be
marked dirty
On 10/21/19 2:47 PM, Matthew Bobrowski wrote:
> This patch is effectively addressed what Dave Chinner had found and
> fixed within this commit: 8a23414ee345. Justification for needing this
> modification has been provided below:
Not sure if this is a valid commit id. I couldn't find it.
>
> When doing a direct IO that spans the current EOF, and there are
> written blocks beyond EOF that extend beyond the current write, the
> only metadata update that needs to be done is a file size extension.
>
> However, we don't mark such iomaps as IOMAP_F_DIRTY to indicate that
> there is IO completion metadata updates required, and hence we may
> fail to correctly sync file size extensions made in IO completion when
> O_DSYNC writes are being used and the hardware supports FUA.
>
> Hence when setting IOMAP_F_DIRTY, we need to also take into account
> whether the iomap spans the current EOF. If it does, then we need to
> mark it dirty so that IO completion will call generic_write_sync() to
> flush the inode size update to stable storage correctly.
>
> Signed-off-by: Matthew Bobrowski <mbobrowski@...browski.org>
Otherwise, this patch looks good to me. You may add:
Reviewed-by: Ritesh Harjani <riteshh@...ux.ibm.com>
> ---
> fs/ext4/inode.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 158eea9a1944..0dd29ae5cc8c 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3412,8 +3412,14 @@ static void ext4_set_iomap(struct inode *inode, struct iomap *iomap,
> {
> u8 blkbits = inode->i_blkbits;
>
> + /*
> + * Writes that span EOF might trigger an I/O size update on completion,
> + * so consider them to be dirty for the purposes of O_DSYNC, even if
> + * there is no other metadata changes being made or are pending here.
> + */
> iomap->flags = 0;
> - if (ext4_inode_datasync_dirty(inode))
> + if (ext4_inode_datasync_dirty(inode) ||
> + offset + length > i_size_read(inode))
> iomap->flags |= IOMAP_F_DIRTY;
>
> if (map->m_flags & EXT4_MAP_NEW)
>
Powered by blists - more mailing lists