All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Long Li <leo.lilong@huawei.com>
Cc: djwong@kernel.org, cem@kernel.org, brauner@kernel.org,
	linux-xfs@vger.kernel.org, david@fromorbit.com,
	yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com,
	lonuxli.64@gmail.com
Subject: Re: [PATCH] iomap: fix zero padding data issue in concurrent append writes
Date: Fri, 8 Nov 2024 06:55:23 -0800	[thread overview]
Message-ID: <Zy4mW6r3rjMEsNir@infradead.org> (raw)
In-Reply-To: <20241108122738.2617669-1-leo.lilong@huawei.com>

On Fri, Nov 08, 2024 at 08:27:38PM +0800, Long Li wrote:
> After reboot, file has zero padding in range [A+B, A+B+C]:
> 
>   |<         Block Size (BS)      >|
>   |DDDDDDDDDDDDDDDD0000000000000000|
>   ^               ^        ^
>   A              A+B      A+B+C (EOF)
> 
>   D = Valid Data
>   0 = Zero Padding
> 
> The issue stems from disk size being set to min(io_offset + io_size,
> inode->i_size) at I/O completion. Since io_offset+io_size is block
> size granularity, it may exceed the actual valid file data size. In
> the case of concurrent append writes, inode->i_size may be larger
> than the actual range of valid file data written to disk, leading to
> inaccurate disk size updates.

Oh, interesting one.  Do you have a reproducer we could wire up
to xfstests?

> This patch introduce ioend->io_end to trace the end position of the
> valid data in ioend, rather than solely relying on ioend->io_size.
> It ensures more precise disk size updates and avoids the zero padding
> issue. Another benefit is that it makes the xfs_ioend_is_append()
> check more accurate, which can reduce unnecessary end bio callbacks
> of xfs_end_bio() in certain scenarios, such as repeated writes at the
> file tail without extending the file size.

Hmm.  Can we do away with two members for the size by just rounding
up the block size for the block based operations?


  reply	other threads:[~2024-11-08 14:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 12:27 [PATCH] iomap: fix zero padding data issue in concurrent append writes Long Li
2024-11-08 14:55 ` Christoph Hellwig [this message]
2024-11-09  7:13   ` Long Li
2024-11-11  5:45     ` Christoph Hellwig
2024-11-11 14:16       ` Long Li

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=Zy4mW6r3rjMEsNir@infradead.org \
    --to=hch@infradead.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=houtao1@huawei.com \
    --cc=leo.lilong@huawei.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=lonuxli.64@gmail.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.