All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>,
	Carlos Maiolino <cem@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: fix stale delalloc punching for COW I/O v4
Date: Sat, 5 Oct 2024 08:53:12 -0700	[thread overview]
Message-ID: <20241005155312.GM21853@frogsfrogsfrogs> (raw)
In-Reply-To: <20240924074115.1797231-1-hch@lst.de>

On Tue, Sep 24, 2024 at 09:40:42AM +0200, Christoph Hellwig wrote:
> Hi all,
> 
> this is another fallout from the zoned XFS work, which stresses the XFS
> COW I/O path very heavily.  It affects normal I/O to reflinked files as
> well, but is very hard to hit there.
> 
> The main problem here is that we only punch out delalloc reservations
> from the data fork, but COW I/O places delalloc extents into the COW
> fork, which means that it won't get punched out forshort writes.
> 
> [Sorry for the rapid fire repost, but as we're down to comment changes
>  and the series has been fully reviewed except for the trivial
>  refactoring patch at the beginning I'd like to get it out before being
>  semi-offline for a few days]

Hmmm so I tried applying this series, but now I get this splat:

[  217.170122] run fstests xfs/574 at 2024-10-04 16:36:30
[  218.248617] XFS (sda3): EXPERIMENTAL online scrub feature in use. Use at your own risk!
[  219.030068] XFS (sda4): EXPERIMENTAL exchange-range feature enabled. Use at your own risk!
[  219.032253] XFS (sda4): EXPERIMENTAL parent pointer feature enabled. Use at your own risk!
[  219.034749] XFS (sda4): Mounting V5 Filesystem 9de8b32b-dada-468a-b83b-f2c702031b67
[  219.073377] XFS (sda4): Ending clean mount
[  219.076260] XFS (sda4): Quotacheck needed: Please wait.
[  219.083160] XFS (sda4): Quotacheck: Done.
[  219.116532] XFS (sda4): EXPERIMENTAL online scrub feature in use. Use at your own risk!
[  306.312461] INFO: task fsstress:27661 blocked for more than 61 seconds.
[  306.342904]       Not tainted 6.12.0-rc1-djwx #rc1
[  306.344066] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  306.345961] task:fsstress        state:D stack:11464 pid:27661 tgid:27661 ppid:1      flags:0x00004004
[  306.348070] Call Trace:
[  306.348722]  <TASK>
[  306.349177]  __schedule+0x419/0x14c0
[  306.350024]  ? asm_sysvec_apic_timer_interrupt+0x16/0x20
[  306.351305]  schedule+0x2c/0x110
[  306.352082]  schedule_preempt_disabled+0x18/0x30
[  306.353183]  rwsem_down_write_slowpath+0x2a8/0x6a0
[  306.354229]  ? filemap_add_folio+0xc5/0xf0
[  306.355160]  down_write+0x6e/0x70
[  306.355953]  xfs_buffered_write_iomap_end+0xcf/0x130 [xfs 05abef6fe7019e4129a0560dad36f86c40f3b541]
[  306.358115]  iomap_iter+0x78/0x2f0
[  306.358974]  iomap_file_unshare+0x82/0x290
[  306.359935]  xfs_reflink_unshare+0xf4/0x170 [xfs 05abef6fe7019e4129a0560dad36f86c40f3b541]
[  306.361787]  xfs_file_fallocate+0x13f/0x430 [xfs 05abef6fe7019e4129a0560dad36f86c40f3b541]
[  306.364005]  vfs_fallocate+0x110/0x320
[  306.364984]  __x64_sys_fallocate+0x42/0x70
[  306.365999]  do_syscall_64+0x47/0x100
[  306.366974]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
[  306.368228] RIP: 0033:0x7f893d3b2cb3
[  306.369064] RSP: 002b:00007ffd32c796d8 EFLAGS: 00000202 ORIG_RAX: 000000000000011d
[  306.370650] RAX: ffffffffffffffda RBX: 000000000000131e RCX: 00007f893d3b2cb3
[  306.372183] RDX: 000000000002eb27 RSI: 0000000000000041 RDI: 0000000000000005
[  306.373940] RBP: 0000000000000041 R08: 000000000000005f R09: 0000000000000078
[  306.375365] R10: 00000000000b0483 R11: 0000000000000202 R12: 0000000000000005
[  306.376763] R13: 000000000002eb27 R14: 0000000000000000 R15: 00000000000b0483
[  306.378174]  </TASK>

I think this series needs to assert that the invalidatelock is held
(instead of taking it) for the IOMAP_UNSHARE case too, since UNSHARE is
called from fallocate, which has already taken the MMAPLOCK.

--D

> Changes since v3:
>  - improve two comments
> 
> Changes since v2:
>  - drop the patches already merged and rebased to latest Linus' tree
>  - moved taking invalidate_lock from iomap to the caller to avoid a
>    too complicated locking protocol
>  - better document the xfs_file_write_zero_eof return value
>  - fix a commit log typo
> 
> Changes since v1:
>  - move the already reviewed iomap prep changes to the beginning in case
>    Christian wants to take them ASAP
>  - take the invalidate_lock for post-EOF zeroing so that we have a
>    consistent locking pattern for zeroing.
> 
> Diffstat:
>  Documentation/filesystems/iomap/operations.rst |    2 
>  fs/iomap/buffered-io.c                         |  111 ++++++-------------
>  fs/xfs/xfs_aops.c                              |    4 
>  fs/xfs/xfs_bmap_util.c                         |   10 +
>  fs/xfs/xfs_bmap_util.h                         |    2 
>  fs/xfs/xfs_file.c                              |  146 +++++++++++++++----------
>  fs/xfs/xfs_iomap.c                             |   65 +++++++----
>  include/linux/iomap.h                          |   20 ++-
>  8 files changed, 196 insertions(+), 164 deletions(-)
> 

  parent reply	other threads:[~2024-10-05 15:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24  7:40 fix stale delalloc punching for COW I/O v4 Christoph Hellwig
2024-09-24  7:40 ` [PATCH 01/10] iomap: factor out a iomap_last_written_block helper Christoph Hellwig
2024-09-24 14:58   ` Darrick J. Wong
2024-09-24  7:40 ` [PATCH 02/10] iomap: remove iomap_file_buffered_write_punch_delalloc Christoph Hellwig
2024-09-24  7:40 ` [PATCH 03/10] iomap: move locking out of iomap_write_delalloc_release Christoph Hellwig
2024-09-24  7:40 ` [PATCH 04/10] xfs: factor out a xfs_file_write_zero_eof helper Christoph Hellwig
2024-09-24  7:40 ` [PATCH 05/10] xfs: take XFS_MMAPLOCK_EXCL xfs_file_write_zero_eof Christoph Hellwig
2024-09-24  7:40 ` [PATCH 06/10] xfs: zeroing already holds invalidate_lock Christoph Hellwig
2024-09-24  7:40 ` [PATCH 07/10] xfs: support the COW fork in xfs_bmap_punch_delalloc_range Christoph Hellwig
2024-09-24  7:40 ` [PATCH 08/10] xfs: share more code in xfs_buffered_write_iomap_begin Christoph Hellwig
2024-09-24  7:40 ` [PATCH 09/10] xfs: set IOMAP_F_SHARED for all COW fork allocations Christoph Hellwig
2024-09-24  7:40 ` [PATCH 10/10] xfs: punch delalloc extents from the COW fork for COW writes Christoph Hellwig
2024-10-05 15:53 ` Darrick J. Wong [this message]
2024-10-07  5:41   ` fix stale delalloc punching for COW I/O v4 Christoph Hellwig
2024-10-07  6:28     ` Darrick J. Wong
2024-10-07  6:46       ` Christoph Hellwig
2024-10-07 15:20         ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2024-09-23 15:28 fix stale delalloc punching for COW I/O v3 Christoph Hellwig
2024-09-23 15:28 ` [PATCH 01/10] iomap: factor out a iomap_last_written_block helper Christoph Hellwig
2024-09-23 15:53   ` Darrick J. Wong
2024-09-24  5:45     ` Christoph Hellwig
2024-09-23 15:28 ` [PATCH 02/10] iomap: remove iomap_file_buffered_write_punch_delalloc Christoph Hellwig
2024-09-23 16:18   ` Darrick J. Wong
2024-09-23 22:43     ` Dave Chinner
2024-09-24  5:55     ` Christoph Hellwig
2024-09-24  6:05       ` Darrick J. Wong
2024-09-24  6:10         ` Christoph Hellwig
2024-09-23 15:28 ` [PATCH 03/10] iomap: move locking out of iomap_write_delalloc_release Christoph Hellwig
2024-09-23 16:19   ` Darrick J. Wong
2024-09-23 15:28 ` [PATCH 04/10] xfs: factor out a xfs_file_write_zero_eof helper Christoph Hellwig
2024-09-23 16:20   ` Darrick J. Wong
2024-09-23 15:28 ` [PATCH 05/10] xfs: take XFS_MMAPLOCK_EXCL xfs_file_write_zero_eof Christoph Hellwig
2024-09-23 15:28 ` [PATCH 06/10] xfs: zeroing already holds invalidate_lock Christoph Hellwig
2024-09-23 16:22   ` Darrick J. Wong
2024-09-24  5:44     ` Christoph Hellwig
2024-09-23 15:28 ` [PATCH 07/10] xfs: support the COW fork in xfs_bmap_punch_delalloc_range Christoph Hellwig
2024-09-23 15:28 ` [PATCH 08/10] xfs: share more code in xfs_buffered_write_iomap_begin Christoph Hellwig
2024-09-23 15:28 ` [PATCH 09/10] xfs: set IOMAP_F_SHARED for all COW fork allocations Christoph Hellwig
2024-09-23 15:28 ` [PATCH 10/10] xfs: punch delalloc extents from the COW fork for COW writes Christoph Hellwig
2024-09-25  9:19 ` fix stale delalloc punching for COW I/O v3 Christian Brauner
2024-09-25  9:24   ` fix stale delalloc punching for COW I/O v4 Christian Brauner

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=20241005155312.GM21853@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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.