Skip to contentSkip to conversation

Test generic/614

DISCUSSION Jan Kara 3 participants 6 messages Nov 21, 2022 – Nov 22, 2022

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

Hello Filipe!

I have noticed test generic/614 is failing on ext2. The test creates sparse file, maps it, and writes data to it through mmap. Then it checks i_blocks has increased. However for ext2 (and other trivial filesystems supporting sparse files but not implementing delayed allocation) this is bound to fail because i_block gets incremented only during page writeback.

So would your btrfs test make sense even if we called fsync(2) before checking stat(2) results?

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#1 lore raw
Quoted 2 lines · Jan Kara

Hello Filipe!

Hi Jan!

Quoted 9 lines

I have noticed test generic/614 is failing on ext2. The test creates sparse file, maps it, and writes data to it through mmap. Then it checks i_blocks has increased. However for ext2 (and other trivial filesystems supporting sparse files but not implementing delayed allocation) this is bound to fail because i_block gets incremented only during page writeback.

So would your btrfs test make sense even if we called fsync(2) before checking stat(2) results?

Calling fsync before calling stat would defeat the purpose of the test. I.e. the test would pass both with and without the btrfs fix.

So maybe adding the following to the test:

_supported_fs ^ext2

And listing all other filesystems not supporting delayed allocation?

Or adding a _require_delayed_allocation() helper to make it _notrun().

Thanks.

Quoted 5 lines

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR

author
#2 lore raw
Quoted 16 lines · Filipe Manana
Quoted 2 lines · Jan Kara

Hello Filipe!

Hi Jan!

Quoted 9 lines

I have noticed test generic/614 is failing on ext2. The test creates sparse file, maps it, and writes data to it through mmap. Then it checks i_blocks has increased. However for ext2 (and other trivial filesystems supporting sparse files but not implementing delayed allocation) this is bound to fail because i_block gets incremented only during page writeback.

So would your btrfs test make sense even if we called fsync(2) before checking stat(2) results?

Quoted 8 lines

Calling fsync before calling stat would defeat the purpose of the test. I.e. the test would pass both with and without the btrfs fix.

So maybe adding the following to the test:

_supported_fs ^ext2

And listing all other filesystems not supporting delayed allocation?

Yeah, probably something like this. In fact, it is a filesystem bug that we don't reserve space for blocks written through mmap but one that is basically by design and difficult to fix. I'll think how to best avoid this failure.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#3 lore raw
In reply to Filipe Manana
Quoted 19 lines · Filipe Manana
Quoted 2 lines · Jan Kara

Hello Filipe!

Hi Jan!

Quoted 9 lines

I have noticed test generic/614 is failing on ext2. The test creates sparse file, maps it, and writes data to it through mmap. Then it checks i_blocks has increased. However for ext2 (and other trivial filesystems supporting sparse files but not implementing delayed allocation) this is bound to fail because i_block gets incremented only during page writeback.

So would your btrfs test make sense even if we called fsync(2) before checking stat(2) results?

Calling fsync before calling stat would defeat the purpose of the test. I.e. the test would pass both with and without the btrfs fix.

Quoted 7 lines

So maybe adding the following to the test:

_supported_fs ^ext2

And listing all other filesystems not supporting delayed allocation?

Or adding a _require_delayed_allocation() helper to make it _notrun().

_require_scratch_delalloc() ?

--D

Quoted 9 lines

Thanks.

Quoted 5 lines

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR

author
#4 lore raw
Quoted 22 lines · Darrick J. Wong
Quoted 21 lines · Filipe Manana
Quoted 2 lines · Jan Kara

Hello Filipe!

Hi Jan!

Quoted 9 lines

I have noticed test generic/614 is failing on ext2. The test creates sparse file, maps it, and writes data to it through mmap. Then it checks i_blocks has increased. However for ext2 (and other trivial filesystems supporting sparse files but not implementing delayed allocation) this is bound to fail because i_block gets incremented only during page writeback.

So would your btrfs test make sense even if we called fsync(2) before checking stat(2) results?

Calling fsync before calling stat would defeat the purpose of the test. I.e. the test would pass both with and without the btrfs fix.

So maybe adding the following to the test:

Quoted 7 lines
Quoted 5 lines

_supported_fs ^ext2

And listing all other filesystems not supporting delayed allocation?

Or adding a _require_delayed_allocation() helper to make it _notrun().

_require_scratch_delalloc() ?

Yeah, after some experimentation I think I can even sensibly detect delalloc using filefrag(1) (xfs_io's fiemap command always syncs file before doing fiemap). I'll give it a shot.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#5 lore raw
Quoted 27 lines · Jan Kara
Quoted 26 lines · Darrick J. Wong
Quoted 25 lines · Filipe Manana
Quoted 2 lines · Jan Kara

Hello Filipe!

Hi Jan!

Quoted 9 lines

I have noticed test generic/614 is failing on ext2. The test creates sparse file, maps it, and writes data to it through mmap. Then it checks i_blocks has increased. However for ext2 (and other trivial filesystems supporting sparse files but not implementing delayed allocation) this is bound to fail because i_block gets incremented only during page writeback.

So would your btrfs test make sense even if we called fsync(2) before checking stat(2) results?

Calling fsync before calling stat would defeat the purpose of the test. I.e. the test would pass both with and without the btrfs fix.

So maybe adding the following to the test:

_supported_fs ^ext2

And listing all other filesystems not supporting delayed allocation?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Or adding a _require_delayed_allocation() helper to make it _notrun().

_require_scratch_delalloc() ?

Yeah, after some experimentation I think I can even sensibly detect delalloc using filefrag(1) (xfs_io's fiemap command always syncs file before doing fiemap). I'll give it a shot.

Aha, _require_scratch_delalloc already exists ;)

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR