Skip to contentSkip to conversation

btrfs/282: skip test if /var/lib/btrfs isnt writable

PATCH In review Darrick J. Wong 5 participants 6 messages Aug 24, 2023 – Sep 2, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs/282: skip test if /var/lib/btrfs isnt writable

From: Darrick J. Wong <[email protected]>

I run fstests in a readonly container, and accidentally uninstalled the btrfsprogs package. When I did, this test started faililng:

282.out.bad renamed from 282.out +4 -0
@@ -1,3 +1,7 @@
 QA output created by 282
 wrote 2147483648/2147483648 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried

Skip the test if /var/lib/btrfs isn't writable, or if /var/lib isn't writable, which means we cannot create /var/lib/btrfs.

---
 tests/btrfs/282 |    7 +++++++
 1 file changed, 7 insertions(+)
tests/btrfs/282 +7 -0
index 980262dcab..395e0626da 100755
@@ -19,6 +19,13 @@ _wants_kernel_commit eb3b50536642 \
 # We want at least 5G for the scratch device.
 _require_scratch_size $(( 5 * 1024 * 1024))
 
+# Make sure we can create scrub progress data file
+if [ -e /var/lib/btrfs ]; then
+	test -w /var/lib/btrfs || _notrun '/var/lib/btrfs is not writable'
+else
+	test -w /var/lib || _notrun '/var/lib/btrfs cannot be created'
+fi
+
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 
Reviewed-by on v1 1/1
#1 lore raw

282.out.bad

Quoted 10 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

I run fstests in a readonly container, and accidentally uninstalled the btrfsprogs package. When I did, this test started faililng:

282.out.bad renamed from 282.out +0 -0
@@ -1,3 +1,7 @@

git am is getting confused and starts applying from here.

Quoted 21 lines
282.out.bad renamed from 282.out +4 -0
  QA output created by 282
  wrote 2147483648/2147483648 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried

Skip the test if /var/lib/btrfs isn't writable, or if /var/lib isn't writable, which means we cannot create /var/lib/btrfs.

---
  tests/btrfs/282 |    7 +++++++
  1 file changed, 7 insertions(+)
tests/btrfs/282 +0 -0
index 980262dcab..395e0626da 100755

tests/btrfs/282 _wants_kernel_commit eb3b50536642 \ · line 28

Quoted 10 lines
tests/btrfs/282 +7 -0
@@ -19,6 +19,13 @@ _wants_kernel_commit eb3b50536642 \
  # We want at least 5G for the scratch device.
  _require_scratch_size $(( 5 * 1024 * 1024))
 
+# Make sure we can create scrub progress data file
+if [ -e /var/lib/btrfs ]; then
+	test -w /var/lib/btrfs || _notrun '/var/lib/btrfs is not writable'
+else
+	test -w /var/lib || _notrun '/var/lib/btrfs cannot be created'
+fi
+

We need to enhance this to a common helper, as there are many test cases with the scrub command in them. I'll enhance it.

However, for now, this patch is fine has been applied locally with commit log changes.

Quoted 3 lines
tests/btrfs/282 +0 -0
  _scratch_mkfs >> $seqres.full 2>&1
  _scratch_mount
 
#2 lore raw
Quoted 12 lines

tests/btrfs/282 _wants_kernel_commit eb3b50536642 \ · line 28

Quoted 9 lines

  _require_scratch_size $(( 5 * 1024 * 1024))

tests/btrfs/282 +7 -0
+# Make sure we can create scrub progress data file
+if [ -e /var/lib/btrfs ]; then
+    test -w /var/lib/btrfs || _notrun '/var/lib/btrfs is not writable'
+else
+    test -w /var/lib || _notrun '/var/lib/btrfs cannot be created'
+fi
+

We need to enhance this to  a common helper, as there are many test cases with the scrub command in them. I'll enhance it.

Hmm. No, for all the remaining test cases that use btrfs scrub start, the output and its stderr are redirected to seqres.full. So, those test cases will still pass. And, btrfs/282"is the only test case that requires scrub status.

Thanks, Anand

Quoted 10 lines

However, for now, this patch is fine has been applied locally with commit log changes.

Quoted 2 lines

  _scratch_mkfs >> $seqres.full 2>&1
  _scratch_mount

#3 lore raw
In reply to Darrick J. Wong

282.out.bad

Quoted 7 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

I run fstests in a readonly container, and accidentally uninstalled the btrfsprogs package. When I did, this test started faililng:

282.out.bad renamed from 282.out +0 -0

I can't merge this patch, it fails:

Applying: btrfs/282: skip test if /var/lib/btrfs isnt writable
error: 282.out: does not exist in index
Patch failed at 0001 btrfs/282: skip test if /var/lib/btrfs isnt writable
...

How can you generate this patch with btrfs/282.out.bad?

Thanks,
Zorro

Quoted 36 lines
282.out.bad renamed from 282.out +4 -0
@@ -1,3 +1,7 @@
 QA output created by 282
 wrote 2147483648/2147483648 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried

Skip the test if /var/lib/btrfs isn't writable, or if /var/lib isn't writable, which means we cannot create /var/lib/btrfs.

---
 tests/btrfs/282 |    7 +++++++
 1 file changed, 7 insertions(+)
tests/btrfs/282 +7 -0
index 980262dcab..395e0626da 100755
@@ -19,6 +19,13 @@ _wants_kernel_commit eb3b50536642 \
 # We want at least 5G for the scratch device.
 _require_scratch_size $(( 5 * 1024 * 1024))
 
+# Make sure we can create scrub progress data file
+if [ -e /var/lib/btrfs ]; then
+	test -w /var/lib/btrfs || _notrun '/var/lib/btrfs is not writable'
+else
+	test -w /var/lib || _notrun '/var/lib/btrfs cannot be created'
+fi
+
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 
#4 lore raw
Quoted 11 lines · Zorro Lang

282.out.bad

Quoted 7 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

I run fstests in a readonly container, and accidentally uninstalled the btrfsprogs package. When I did, this test started faililng:

282.out.bad renamed from 282.out +0 -0

I can't merge this patch, it fails:

Quoted 6 lines

Applying: btrfs/282: skip test if /var/lib/btrfs isnt writable
error: 282.out: does not exist in index
Patch failed at 0001 btrfs/282: skip test if /var/lib/btrfs isnt writable
...

How can you generate this patch with btrfs/282.out.bad?

It's the diff format in the commit message confusing "git am".

You can add extra space(s) in the commit message so that "git am" can understand what's going on.

Thanks,
Qu

Quoted 41 lines

Thanks,
Zorro

Quoted 36 lines
282.out.bad renamed from 282.out +4 -0
@@ -1,3 +1,7 @@
  QA output created by 282
  wrote 2147483648/2147483648 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried

Skip the test if /var/lib/btrfs isn't writable, or if /var/lib isn't writable, which means we cannot create /var/lib/btrfs.

---
  tests/btrfs/282 |    7 +++++++
  1 file changed, 7 insertions(+)
tests/btrfs/282 +7 -0
index 980262dcab..395e0626da 100755
@@ -19,6 +19,13 @@ _wants_kernel_commit eb3b50536642 \
  # We want at least 5G for the scratch device.
  _require_scratch_size $(( 5 * 1024 * 1024))
 
+# Make sure we can create scrub progress data file
+if [ -e /var/lib/btrfs ]; then
+	test -w /var/lib/btrfs || _notrun '/var/lib/btrfs is not writable'
+else
+	test -w /var/lib || _notrun '/var/lib/btrfs cannot be created'
+fi
+
  _scratch_mkfs >> $seqres.full 2>&1
  _scratch_mount
 
#5 lore raw
Quoted 19 lines · Qu Wenruo
Quoted 16 lines · Zorro Lang

282.out.bad

Quoted 7 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

I run fstests in a readonly container, and accidentally uninstalled the btrfsprogs package. When I did, this test started faililng:

282.out.bad renamed from 282.out +0 -0

I can't merge this patch, it fails:

Applying: btrfs/282: skip test if /var/lib/btrfs isnt writable
error: 282.out: does not exist in index
Patch failed at 0001 btrfs/282: skip test if /var/lib/btrfs isnt writable
...

Quoted 6 lines
Quoted 1 line

How can you generate this patch with btrfs/282.out.bad?

It's the diff format in the commit message confusing "git am".

You can add extra space(s) in the commit message so that "git am" can understand what's going on.

Ahaha, I just noticed that it's commit log, I thought it's a part of the source code :-D

Quoted 45 lines

Thanks,
Qu

Quoted 41 lines

Thanks,
Zorro

Quoted 36 lines
282.out.bad renamed from 282.out +4 -0
@@ -1,3 +1,7 @@
  QA output created by 282
  wrote 2147483648/2147483648 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried
+WARNING: cannot create scrub data file, mkdir /var/lib/btrfs failed: Read-only file system. Status recording disabled
+WARNING: failed to open the progress status socket at /var/lib/btrfs/scrub.progress.3e1cf8c6-8f8f-4b51-982c-d6783b8b8825: No such file or directory. Progress cannot be queried

Skip the test if /var/lib/btrfs isn't writable, or if /var/lib isn't writable, which means we cannot create /var/lib/btrfs.

---
  tests/btrfs/282 |    7 +++++++
  1 file changed, 7 insertions(+)
tests/btrfs/282 +7 -0
index 980262dcab..395e0626da 100755
@@ -19,6 +19,13 @@ _wants_kernel_commit eb3b50536642 \
  # We want at least 5G for the scratch device.
  _require_scratch_size $(( 5 * 1024 * 1024))
 
+# Make sure we can create scrub progress data file
+if [ -e /var/lib/btrfs ]; then
+	test -w /var/lib/btrfs || _notrun '/var/lib/btrfs is not writable'
+else
+	test -w /var/lib || _notrun '/var/lib/btrfs cannot be created'
+fi
+
  _scratch_mkfs >> $seqres.full 2>&1
  _scratch_mount