Skip to contentSkip to conversation

generic/459: don't run on non-journaled ext4 file systems

PATCH In review Eric Whitney 3 participants 4 messages Jan 24, 2024 – Feb 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/459: don't run on non-journaled ext4 file systems

generic/459 fails when run on an ext4 file system created without a journal or when its journal has not been loaded at mount time.

The test expects that a file system that it has been unable to freeze will be automatically remounted read only. However, the default error handling policy for ext4 is to continue when possible after errors.

A workaround was added to the test in the past to force ext4 to perform a read only remount in order to meet the test's expectations. The touch command was used to create a new file after a freeze failure. This forces ext4 to start a new journal transaction, where it discovers the journal has previously aborted due to lack of space, and triggers special case error handling that results in a read only remount.

The workaround requires a journal. Since ext4 is behaving as designed, prevent the test from running if there isn't one.

---
 tests/generic/459 | 5 +++++
 1 file changed, 5 insertions(+)
tests/generic/459 +5 -0
index c3f0b2b0..63fbbc9b 100755
@@ -49,6 +49,11 @@ _require_command "$THIN_CHECK_PROG" thin_check
 _require_freeze
 _require_odirect
 
+# non-journaled ext4 won't remount read only after freeze failure
+if [ "$FSTYP" == "ext4" ]; then
+	_require_metadata_journaling
+fi
+
 vgname=vg_$seq
 lvname=lv_$seq
 poolname=pool_$seq
Signature · 1 line
2.30.2
#1 lore raw
Quoted 27 lines · Eric Whitney

generic/459 fails when run on an ext4 file system created without a journal or when its journal has not been loaded at mount time.

The test expects that a file system that it has been unable to freeze will be automatically remounted read only. However, the default error handling policy for ext4 is to continue when possible after errors.

A workaround was added to the test in the past to force ext4 to perform a read only remount in order to meet the test's expectations. The touch command was used to create a new file after a freeze failure. This forces ext4 to start a new journal transaction, where it discovers the journal has previously aborted due to lack of space, and triggers special case error handling that results in a read only remount.

The workaround requires a journal. Since ext4 is behaving as designed, prevent the test from running if there isn't one.

---
 tests/generic/459 | 5 +++++
 1 file changed, 5 insertions(+)
tests/generic/459 +0 -0
index c3f0b2b0..63fbbc9b 100755

tests/generic/459 _require_command "$THIN_CHECK_PROG" thin_check · line 54

Quoted 6 lines
tests/generic/459 +3 -0
@@ -49,6 +49,11 @@ _require_command "$THIN_CHECK_PROG" thin_check
 _require_freeze
 _require_odirect
 
+# non-journaled ext4 won't remount read only after freeze failure
+if [ "$FSTYP" == "ext4" ]; then
+	_require_metadata_journaling

I'm wondering ... won't other fs need this, besides ext4?

Quoted 9 lines
tests/generic/459 +2 -0
+fi
+
 vgname=vg_$seq
 lvname=lv_$seq
 poolname=pool_$seq
Signature · 1 line
2.30.2
#2 lore raw

* Zorro Lang <[email protected]>:

Quoted 31 lines · Eric Whitney
Quoted 30 lines

generic/459 fails when run on an ext4 file system created without a journal or when its journal has not been loaded at mount time.

The test expects that a file system that it has been unable to freeze will be automatically remounted read only. However, the default error handling policy for ext4 is to continue when possible after errors.

A workaround was added to the test in the past to force ext4 to perform a read only remount in order to meet the test's expectations. The touch command was used to create a new file after a freeze failure. This forces ext4 to start a new journal transaction, where it discovers the journal has previously aborted due to lack of space, and triggers special case error handling that results in a read only remount.

The workaround requires a journal. Since ext4 is behaving as designed, prevent the test from running if there isn't one.

---
 tests/generic/459 | 5 +++++
 1 file changed, 5 insertions(+)
tests/generic/459 +0 -0
index c3f0b2b0..63fbbc9b 100755
@@ -49,6 +49,11 @@ _require_command "$THIN_CHECK_PROG" thin_check
 _require_freeze
 _require_odirect
 
Quoted 5 lines

tests/generic/459 _require_command "$THIN_CHECK_PROG" thin_check · line 54

Quoted 3 lines
tests/generic/459 +3 -0
+# non-journaled ext4 won't remount read only after freeze failure
+if [ "$FSTYP" == "ext4" ]; then
+	_require_metadata_journaling

I'm wondering ... won't other fs need this, besides ext4?

Thanks for looking at this patch.

I'd been mainly concerned with ext4, but since you mention it, ext2 and ext3 ought to be added as well, since the failure behavior is similar.

The check for metadata journaling is limited to just ext4 here because the commit history for this test appears to suggest the touch command workaround is specific to ext4. Perhaps the test should unconditionally require metadata journaling for all file system types, but given that I don't work with many other file systems I was uncomfortable asserting that in this patch. If freezing any file system requires a metadata journal, then it would make sense to do that.

Your thoughts?

Eric

Quoted 11 lines
Quoted 10 lines
tests/generic/459 +2 -0
+fi
+
 vgname=vg_$seq
 lvname=lv_$seq
 poolname=pool_$seq
Signature · 1 line
2.30.2
#3 lore raw
Quoted 51 lines · Eric Whitney

* Zorro Lang <[email protected]>:

Quoted 31 lines · Eric Whitney
Quoted 30 lines

generic/459 fails when run on an ext4 file system created without a journal or when its journal has not been loaded at mount time.

The test expects that a file system that it has been unable to freeze will be automatically remounted read only. However, the default error handling policy for ext4 is to continue when possible after errors.

A workaround was added to the test in the past to force ext4 to perform a read only remount in order to meet the test's expectations. The touch command was used to create a new file after a freeze failure. This forces ext4 to start a new journal transaction, where it discovers the journal has previously aborted due to lack of space, and triggers special case error handling that results in a read only remount.

The workaround requires a journal. Since ext4 is behaving as designed, prevent the test from running if there isn't one.

---
 tests/generic/459 | 5 +++++
 1 file changed, 5 insertions(+)
tests/generic/459 +0 -0
index c3f0b2b0..63fbbc9b 100755
@@ -49,6 +49,11 @@ _require_command "$THIN_CHECK_PROG" thin_check
 _require_freeze
 _require_odirect
 
Quoted 5 lines

tests/generic/459 _require_command "$THIN_CHECK_PROG" thin_check · line 54

Quoted 3 lines
tests/generic/459 +3 -0
+# non-journaled ext4 won't remount read only after freeze failure
+if [ "$FSTYP" == "ext4" ]; then
+	_require_metadata_journaling

I'm wondering ... won't other fs need this, besides ext4?

Thanks for looking at this patch.

I'd been mainly concerned with ext4, but since you mention it, ext2 and ext3 ought to be added as well, since the failure behavior is similar.

The check for metadata journaling is limited to just ext4 here because the commit history for this test appears to suggest the touch command workaround is specific to ext4. Perhaps the test should unconditionally require metadata journaling for all file system types, but given that I don't work with many other file systems I was uncomfortable asserting that in this patch. If freezing any file system requires a metadata journal, then it would make sense to do that.

Quoted 1 line

Your thoughts?

ext2 never had journalling, so requiring metadata journalling effectively _notruns this test.

I don't think there's any harm done if you shortcut
"if [[ $FSTYP == ext* ]];..." to stop this test on ext2 and ext3-nojournal as well.

That said, the exact behavior of filesystems during freeze is undefined, so I think the only option is whackamole _notrun-listing. :/

--D

Quoted 14 lines

Eric

Quoted 11 lines
Quoted 10 lines
tests/generic/459 +2 -0
+fi
+
 vgname=vg_$seq
 lvname=lv_$seq
 poolname=pool_$seq
Signature · 1 line
2.30.2