On Tue, Aug 12, 2025 at 10:15:55PM -0700, Christoph Hellwig wrote: > On Tue, Aug 12, 2025 at 11:54:59AM -0700, Darrick J. Wong wrote: > > On Wed, Jul 30, 2025 at 07:18:48AM -0700, Christoph Hellwig wrote: > > > On Tue, Jul 29, 2025 at 01:08:46PM -0700, Darrick J. Wong wrote: > > > > The pwrite failure comes from the aio-dio-eof-race.c program because the > > > > filesystem ran out of space. There are no speculative posteof > > > > preallocations on a zoned filesystem, so let's skip this test on those > > > > setups. > > > > > > Did it run out of space because it is overwriting and we need a new > > > allocation (I've not actually seen this fail in my zoned testing, > > > that's why I'm asking)? If so it really should be using the new > > > _require_inplace_writes Filipe just sent to the list. > > > > I took a deeper look into what's going on here, and I think the > > intermittent ENOSPC failures are caused by: > > > > 1. First we write to every byte in the 256M zoned rt device so that > > 0x55 gets written to the disk. > > 2. Then we delete the huge file we created. > > 3. The zoned garbage collector doesn't run. > > 4. aio-dio-eof-race starts up and initiates an aiodio at pos 0. > > 5. xfs_file_dio_write_zoned calls xfs_zoned_write_space_reserve > > 6. xfs_zoned_space_reserve tries to decrement 64k from XC_FREE_RTEXTENTS > > but gets ENOSPC. > > 7. We didn't pass XFS_ZR_GREEDY, so we error out. > > > > If I make the test sleep until I see zonegc do some work before starting > > aio-dio-eof-race, the problem goes away. I'm not sure what the proper > > solution is, but maybe it's adding a wake_up to the gc process and > > waiting for it? > > Isn't the problem here that zonegc only even sees the freed block > after inodegc did run? i.e. after 2 the inode hasn't been truncated > yet, and thus the blocks haven't been marked as free. Yeah... for the other ENOSPC-on-write paths, we kick inodegc, so maybe xfs_zoned_space_reserve (or its caller, more likely) ought to do that too? --D