Skip to contentSkip to conversation

generic/322: remove bad xfs_io sync_range

PATCH In review Andreas Gruenbacher 4 participants 6 messages Aug 5, 2019 – Aug 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/322: remove bad xfs_io sync_range

The xfs_io sync_range command requires offset and length arguments. Those are missing here, so the command fails with:

bad argument count 1 to sync_range, expected at least 2 arguments

This went unnoticed because xfs_io still exits with status 0 in such cases, which looks like a separate bug.

I'm assuming that the test did catch regressions as is and that the sync_range command isn't needed. If this isn't the case, please fix the test.

---
 tests/generic/322 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/322 +1 -1
index 2afd7127..22797c04 100755
@@ -65,7 +65,7 @@ _write_after_fsync_rename_test()
 	echo "fsync rename test"
 	_mount_flakey
 	$XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" -c "pwrite 2M 1M" \
-		-c "sync_range -b" $SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"
+		$SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"
 	mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
 	$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
 	md5sum $SCRATCH_MNT/bar | _filter_scratch
Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · Andreas Gruenbacher

The xfs_io sync_range command requires offset and length arguments. Those are missing here, so the command fails with:

bad argument count 1 to sync_range, expected at least 2 arguments

This went unnoticed because xfs_io still exits with status 0 in such cases, which looks like a separate bug.

I'm assuming that the test did catch regressions as is and that the sync_range command isn't needed. If this isn't the case, please fix the test.

Copying Josef who seems to be the author of this test case.

Quoted 19 lines
---
 tests/generic/322 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/322 +1 -2
index 2afd7127..22797c04 100755
@@ -65,7 +65,7 @@ _write_after_fsync_rename_test()
        echo "fsync rename test"
        _mount_flakey
        $XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" -c "pwrite 2M 1M" \
-               -c "sync_range -b" $SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"
+               $SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"
        mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
        $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
        md5sum $SCRATCH_MNT/bar | _filter_scratch
--
Quoted 1 line

2.20.1

Thanks,
Andreas

#2 lore raw
Quoted 7 lines · Andreas Gruenbacher
Quoted 6 lines · Andreas Gruenbacher

The xfs_io sync_range command requires offset and length arguments. Those are missing here, so the command fails with:

bad argument count 1 to sync_range, expected at least 2 arguments

Quoted 7 lines
Quoted 5 lines

This went unnoticed because xfs_io still exits with status 0 in such cases, which looks like a separate bug.

I'm assuming that the test did catch regressions as is and that the sync_range command isn't needed. If this isn't the case, please fix the test.

Copying Josef who seems to be the author of this test case.

Looking back at it I think I added the sync_range because it was a little racey wether it would trip the problem or not. The rename in btrfs would do the dirty writeout IIRC so that's probably why the problem still reproduced even though the sync file range was wrong.

That being said the sync_range needs to be there, so instead of deleting it we should have

sync_range -b 2M 1M

Thanks,

Josef

#3 lore raw
Quoted 21 lines · Josef Bacik
Quoted 7 lines · Andreas Gruenbacher
Quoted 6 lines · Andreas Gruenbacher

The xfs_io sync_range command requires offset and length arguments. Those are missing here, so the command fails with:

bad argument count 1 to sync_range, expected at least 2 arguments

Quoted 7 lines
Quoted 5 lines

This went unnoticed because xfs_io still exits with status 0 in such cases, which looks like a separate bug.

I'm assuming that the test did catch regressions as is and that the sync_range command isn't needed. If this isn't the case, please fix the test.

Copying Josef who seems to be the author of this test case.

Looking back at it I think I added the sync_range because it was a little racey wether it would trip the problem or not. The rename in btrfs would do the dirty writeout IIRC so that's probably why the problem still reproduced even though the sync file range was wrong.

Quoted 4 lines

That being said the sync_range needs to be there, so instead of deleting it we should have

sync_range -b 2M 1M

Hi Andreas, would you like to update the patch with the sync_range fixed?

Thanks,
Eryu

#4 lore raw
Quoted 22 lines · Eryu Guan
Quoted 21 lines · Josef Bacik
Quoted 7 lines · Andreas Gruenbacher
Quoted 6 lines · Andreas Gruenbacher

The xfs_io sync_range command requires offset and length arguments. Those are missing here, so the command fails with:

bad argument count 1 to sync_range, expected at least 2 arguments

Quoted 7 lines
Quoted 5 lines

This went unnoticed because xfs_io still exits with status 0 in such cases, which looks like a separate bug.

I'm assuming that the test did catch regressions as is and that the sync_range command isn't needed. If this isn't the case, please fix the test.

Copying Josef who seems to be the author of this test case.

Looking back at it I think I added the sync_range because it was a little racey wether it would trip the problem or not. The rename in btrfs would do the dirty writeout IIRC so that's probably why the problem still reproduced even though the sync file range was wrong.

Quoted 7 lines
Quoted 4 lines

That being said the sync_range needs to be there, so instead of deleting it we should have

sync_range -b 2M 1M

Hi Andreas, would you like to update the patch with the sync_range fixed?

Done, if that helps.

Andreas

#5 lore raw
In reply to Andreas Gruenbacher
Quoted 7 lines · Andreas Gruenbacher

The xfs_io sync_range command requires offset and length arguments. Those are missing here, so the command fails with:

bad argument count 1 to sync_range, expected at least 2 arguments

This went unnoticed because xfs_io still exits with status 0 in such cases, which looks like a separate bug.

Yes, fstests should not rely on return status of xfs_io.

Quoted 3 lines

I'm assuming that the test did catch regressions as is and that the sync_range command isn't needed. If this isn't the case, please fix the test.

Josef, would you please confirm?

Quoted 11 lines
---
 tests/generic/322 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/322 +0 -0
index 2afd7127..22797c04 100755

tests/generic/322 _write_after_fsync_rename_test() · line 68

Quoted 5 lines
tests/generic/322 +1 -1
@@ -65,7 +65,7 @@ _write_after_fsync_rename_test()
 	echo "fsync rename test"
 	_mount_flakey
 	$XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" -c "pwrite 2M 1M" \
-		-c "sync_range -b" $SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"
+		$SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"

We don't need the "_fail" part then, and appending xfs_io log to $seqres.full, not overwriting. The same is true for _rename_test().

Thanks,
Eryu

Quoted 5 lines
tests/generic/322 +0 -0
 	mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
 	$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
 	md5sum $SCRATCH_MNT/bar | _filter_scratch
Signature · 1 line
2.20.1