Skip to contentSkip to conversation

Avoid failing shutdown tests without a journal

PATCH In review Jan Kara 3 participants 10 messages Feb 10 – Feb 16

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

cover Avoid failing shutdown tests without a journal

Hello,

this patch series adds requirement for metadata journalling to couple of tests using filesystem shutdown. After shutdown a filesystem without a journal is not guaranteed to be consistent and thus tests often fail.

Honza

author
#1 lore raw

PATCH 1/4 ext4/051: Fix failure in nojournal mode

The test uses fs shutdown. Without journalling the filesystem isn't guaranteed to be consistent after shutdown so not much we can test there.

---
 tests/ext4/051 | 1 +
 1 file changed, 1 insertion(+)
tests/ext4/051 +1 -0
index 728ad19bfcec..9fbf0404fec9 100755
@@ -16,6 +16,7 @@ _exclude_fs ext2
 _exclude_fs ext3
 _require_scratch
 _require_scratch_shutdown
+_require_metadata_journaling
 _require_command "$TUNE2FS_PROG" tune2fs
 
 echo "Silence is golden"
Signature · 1 line
2.51.0
author
#2 lore raw

PATCH 2/4 generic/635: Fix failure without a journal

In reply to Jan Kara

The test uses fs shutdown. Without journalling the filesystem isn't guaranteed to be consistent after shutdown so not much we can test there.

---
 tests/generic/635 | 1 +
 1 file changed, 1 insertion(+)
tests/generic/635 +1 -0
index 4a811630a621..018b868cb6ce 100755
@@ -26,6 +26,7 @@ _begin_fstest auto quick atime bigtime shutdown
 
 _require_scratch
 _require_scratch_shutdown
+_require_metadata_journaling
 
 _scratch_mkfs > $seqres.full
 _scratch_mount
Signature · 1 line
2.51.0
author
#3 lore raw

PATCH 3/4 generic/646: Fix failure without a journal

In reply to Jan Kara

The test uses fs shutdown. Without journalling the filesystem isn't guaranteed to be consistent after shutdown so not much we can test there.

---
 tests/generic/646 | 1 +
 1 file changed, 1 insertion(+)
tests/generic/646 +1 -0
index b3b0ab0ace56..1e3f0cd54087 100755
@@ -19,6 +19,7 @@ _begin_fstest auto quick recoveryloop shutdown
 
 _require_scratch
 _require_scratch_shutdown
+_require_metadata_journaling
 _scratch_mkfs > $seqres.full 2>&1
 
 _scratch_mount
Signature · 1 line
2.51.0
author
#4 lore raw

PATCH 4/4 generic/705: Fix failure without a journal

In reply to Jan Kara

The test uses fs shutdown. Without journalling the filesystem isn't guaranteed to be consistent after shutdown so not much we can test there.

---
 tests/generic/705 | 1 +
 1 file changed, 1 insertion(+)
tests/generic/705 +1 -0
index 9c27fbbc389b..23f06d699dfa 100755
@@ -12,6 +12,7 @@ _begin_fstest auto shutdown
 
 _require_scratch
 _require_scratch_shutdown
+_require_metadata_journaling
 _require_command "$FILEFRAG_PROG" filefrag
 _scratch_mkfs > $seqres.full 2>&1
 _scratch_mount
Signature · 1 line
2.51.0
#5 lore raw
In reply to Jan Kara
Quoted 5 lines · Jan Kara

Hello,

this patch series adds requirement for metadata journalling to couple of tests using filesystem shutdown. After shutdown a filesystem without a journal is not guaranteed to be consistent and thus tests often fail.

Hi Jan,

This patchset makes sense to me, thanks for fixing them :)

Since you brought this up, I just tried to check all cases using _require_scratch_shutdown but lack _require_metadata_journaling, I got this:

$ for f in `grep -rsnl _require_scratch_shutdown tests/`;do grep -q _require_metadata_journaling $f || echo $f;done
tests/ext4/051       <=== fixed by this patchset
tests/generic/050
tests/generic/461
tests/generic/474
tests/generic/536
tests/generic/599
tests/generic/622
tests/generic/635    <=== fixed by this patchset
tests/generic/646    <=== fixed by this patchset
tests/generic/705    <=== fixed by this patchset
tests/generic/722
tests/generic/730
tests/generic/737
tests/generic/775
tests/generic/778
tests/overlay/078
tests/overlay/087
tests/xfs/270
tests/xfs/546

g/050 tests ro mount, so it might not need _require_metadata_journaling. g/461 doesn't care the fs consistency, so ignore it too. g/730 looks like doesn't need _require_metadata_journaling. overlay/087 looks like can ignore _require_metadata_journaling.

Others, include g/474, g/536, g/599, g/622, g/722, g/737, g/775, g/778, overlay/078 look like all need a journal fs.

About x/270 and x/546, if we don't suppose other fs would like to run xfs cases, then xfs always support journal.

I initially considered calling _require_metadata_journaling directly inside _require_scratch_shutdown. However, I decided against it because some cases might only need the shutdown ioctl and don't strictly require a journal.

Does these make sense to you?

Thanks,
Zorro

Quoted 3 lines

Honza

author
#6 lore raw
Quoted 35 lines · Zorro Lang
Quoted 5 lines · Jan Kara

Hello,

this patch series adds requirement for metadata journalling to couple of tests using filesystem shutdown. After shutdown a filesystem without a journal is not guaranteed to be consistent and thus tests often fail.

Hi Jan,

This patchset makes sense to me, thanks for fixing them :)

Since you brought this up, I just tried to check all cases using _require_scratch_shutdown but lack _require_metadata_journaling, I got this:

$ for f in `grep -rsnl _require_scratch_shutdown tests/`;do grep -q _require_metadata_journaling $f || echo $f;done
tests/ext4/051       <=== fixed by this patchset
tests/generic/050
tests/generic/461
tests/generic/474
tests/generic/536
tests/generic/599
tests/generic/622
tests/generic/635    <=== fixed by this patchset
tests/generic/646    <=== fixed by this patchset
tests/generic/705    <=== fixed by this patchset
tests/generic/722
tests/generic/730
tests/generic/737
tests/generic/775
tests/generic/778
tests/overlay/078
tests/overlay/087
tests/xfs/270
tests/xfs/546
Quoted 1 line

g/050 tests ro mount, so it might not need _require_metadata_journaling.

Yes, g/050 checks using _has_metadata_journaling and treats the fs accordingly.

Quoted 1 line

g/461 doesn't care the fs consistency, so ignore it too.

Ack.

Quoted 1 line

g/730 looks like doesn't need _require_metadata_journaling.

Ack.

Quoted 1 line

overlay/087 looks like can ignore _require_metadata_journaling.

I think this actually needs it since we shutdown the fs and then mount it again which may fail with inconsistent fs.

Quoted 3 lines

Others, include g/474, g/536, g/599, g/622, g/722, g/737, g/775, g/778, overlay/078
look like all need a journal fs.

g/474 seems good to test without metadata journalling it does syncfs and then shutdown. In that case the data checksums should be valid even without journalling.

g/599 should be also fine - we shutdown after remounting ro so that should be working even without journalling.

g/622 - some bits should work even without journalling but for now I guess we should just require it for simplicity.

g/737 - uses O_SYNC - should work even without journalling (perhaps the test should be extended to fsync also the parent dir for complete correctness).

g/775 - tests atomic writes - should work even without journalling if the fs claims to support atomic writes

g/778 - ditto

overlay/078 - this fsyncs the file before shutdown so it should work even without journalling (but might need to fsync the parent dir for complete correctness).

Quoted 2 lines

About x/270 and x/546, if we don't suppose other fs would like to run xfs cases, then xfs always support journal.

Correct.

Quoted 3 lines

I initially considered calling _require_metadata_journaling directly inside _require_scratch_shutdown. However, I decided against it because some cases might only need the shutdown ioctl and don't strictly require a journal.

Absolutely. I think they should stay separate.

So to summarize I think we should still add _require_metadata_journaling to:

overlay/087
g/536
g/622
g/722

and we might add fsync of parent directory before shutdown to g/737 and overlay/078. Does this sound good?

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#7 lore raw
Quoted 36 lines · Jan Kara
Quoted 35 lines · Zorro Lang
Quoted 5 lines · Jan Kara

Hello,

this patch series adds requirement for metadata journalling to couple of tests using filesystem shutdown. After shutdown a filesystem without a journal is not guaranteed to be consistent and thus tests often fail.

Hi Jan,

This patchset makes sense to me, thanks for fixing them :)

Since you brought this up, I just tried to check all cases using _require_scratch_shutdown but lack _require_metadata_journaling, I got this:

$ for f in `grep -rsnl _require_scratch_shutdown tests/`;do grep -q _require_metadata_journaling $f || echo $f;done
tests/ext4/051       <=== fixed by this patchset
tests/generic/050
tests/generic/461
tests/generic/474
tests/generic/536
tests/generic/599
tests/generic/622
tests/generic/635    <=== fixed by this patchset
tests/generic/646    <=== fixed by this patchset
tests/generic/705    <=== fixed by this patchset
tests/generic/722
tests/generic/730
tests/generic/737
tests/generic/775
tests/generic/778
tests/overlay/078
tests/overlay/087
tests/xfs/270
tests/xfs/546
Quoted 2 lines
Quoted 1 line

g/050 tests ro mount, so it might not need _require_metadata_journaling.

Hi Jan,

Thanks for your detailed response.

Quoted 2 lines

Yes, g/050 checks using _has_metadata_journaling and treats the fs accordingly.

I didn't notice that line, thanks.

Quoted 5 lines
Quoted 2 lines

g/461 doesn't care the fs consistency, so ignore it too.

Ack.

Quoted 8 lines
Quoted 1 line

g/730 looks like doesn't need _require_metadata_journaling.

Ack.

Quoted 1 line

overlay/087 looks like can ignore _require_metadata_journaling.

I think this actually needs it since we shutdown the fs and then mount it again which may fail with inconsistent fs.

Thanks for the reminder, I totally overlooked the sync call. You're right, even aside from the journal, sync effectively help filesystem to be a consistent state (if no any hardware crashes during the sync running)

Quoted 8 lines
Quoted 4 lines

Others, include g/474, g/536, g/599, g/622, g/722, g/737, g/775, g/778, overlay/078
look like all need a journal fs.

g/474 seems good to test without metadata journalling it does syncfs and then shutdown. In that case the data checksums should be valid even without journalling.

Sure.

Quoted 3 lines

g/599 should be also fine - we shutdown after remounting ro so that should be working even without journalling.

Oh, there's "_scratch_remount ro" before shutdown, sure.

Quoted 7 lines

g/622 - some bits should work even without journalling but for now I guess we should just require it for simplicity.

g/737 - uses O_SYNC - should work even without journalling (perhaps the test should be extended to fsync also the parent dir for complete correctness).

Quoted 8 lines

g/775 - tests atomic writes - should work even without journalling if the fs claims to support atomic writes

g/778 - ditto

overlay/078 - this fsyncs the file before shutdown so it should work even without journalling (but might need to fsync the parent dir for complete correctness).

I'm not sure we can arbitrarily add more sync calls before or after a specific fsync step. Doing so might break the original intent of the test. So I think we can keep it, and see if anyone complains or hits a bug later :)

Quoted 10 lines
Quoted 3 lines

About x/270 and x/546, if we don't suppose other fs would like to run xfs cases, then xfs always support journal.

Correct.

Quoted 3 lines

I initially considered calling _require_metadata_journaling directly inside _require_scratch_shutdown. However, I decided against it because some cases might only need the shutdown ioctl and don't strictly require a journal.

Quoted 8 lines

Absolutely. I think they should stay separate.

So to summarize I think we should still add _require_metadata_journaling to:

overlay/087
g/536
g/622
g/722

Agree :)

Quoted 3 lines

and we might add fsync of parent directory before shutdown to g/737 and overlay/078. Does this sound good?

I'm concerned that adding broader sync or fsync operations might interfere with the test's original intent. We should probably evaluate the impact further. Alternatively, we could simply use _require_metadata_journaling to ensure we at least keep the coverage for the original bug :)

Any more ideas please feel free to tell me.

Thanks,
Zorro

Quoted 6 lines

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#8 lore raw
Quoted 7 lines · Zorro Lang
Quoted 6 lines · Jan Kara
Quoted 3 lines

I initially considered calling _require_metadata_journaling directly inside _require_scratch_shutdown. However, I decided against it because some cases might only need the shutdown ioctl and don't strictly require a journal.

Absolutely. I think they should stay separate.

Quoted 8 lines
Quoted 6 lines

So to summarize I think we should still add _require_metadata_journaling to:

overlay/087
g/536
g/622
g/722

Agree :)

Should I send patches or will you do this modification?

Quoted 7 lines
Quoted 2 lines

and we might add fsync of parent directory before shutdown to g/737 and overlay/078. Does this sound good?

I'm concerned that adding broader sync or fsync operations might interfere with the test's original intent. We should probably evaluate the impact further. Alternatively, we could simply use _require_metadata_journaling to ensure we at least keep the coverage for the original bug :)

I agree with the approach to just leave the test as is for now and invest time into deciding what's the proper solution once someone complains :)

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#9 lore raw
Quoted 10 lines · Jan Kara
Quoted 9 lines · Zorro Lang
Quoted 8 lines · Jan Kara
Quoted 3 lines

I initially considered calling _require_metadata_journaling directly inside _require_scratch_shutdown. However, I decided against it because some cases might only need the shutdown ioctl and don't strictly require a journal.

Absolutely. I think they should stay separate.

So to summarize I think we should still add _require_metadata_journaling to:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

overlay/087
g/536
g/622
g/722

Agree :)

Should I send patches or will you do this modification?

As you brought this issue up, so I'd like to leave the finish line to you :) I saw your 4 patches nearly use same subject and commit log too. If you fix more 4 cases, we'll have 8 seperated patches :-D So how about squashing all changes into one single patch? Does that make sense to you?

Thanks,
Zorro

Quoted 17 lines
Quoted 8 lines
Quoted 3 lines

and we might add fsync of parent directory before shutdown to g/737 and overlay/078. Does this sound good?

I'm concerned that adding broader sync or fsync operations might interfere with the test's original intent. We should probably evaluate the impact further. Alternatively, we could simply use _require_metadata_journaling to ensure we at least keep the coverage for the original bug :)

I agree with the approach to just leave the test as is for now and invest time into deciding what's the proper solution once someone complains :)

Honza

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