diff mbox series

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

Message ID 20230824234714.GA17900@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series btrfs/282: skip test if /var/lib/btrfs isnt writable | expand

Commit Message

Darrick J. Wong Aug. 24, 2023, 11:47 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

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

Comments

Anand Jain Aug. 29, 2023, 7:50 a.m. UTC | #1
On 25/08/2023 07:47, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> I run fstests in a readonly container, and accidentally uninstalled the
> btrfsprogs package.  When I did, this test started faililng:
> 


> --- btrfs/282.out
> +++ btrfs/282.out.bad
> @@ -1,3 +1,7 @@

git am is getting confused and starts applying from here.

>   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.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>   tests/btrfs/282 |    7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/btrfs/282 b/tests/btrfs/282
> index 980262dcab..395e0626da 100755
> --- a/tests/btrfs/282
> +++ b/tests/btrfs/282
> @@ -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.

Reviewed-by: Anand Jain <anand.jain@oracle.com>


>   _scratch_mkfs >> $seqres.full 2>&1
>   _scratch_mount
>
Anand Jain Aug. 29, 2023, 9:53 a.m. UTC | #2
>>   _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.

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

> 
> However, for now, this patch is fine has been applied locally with
> commit log changes.
> 
> Reviewed-by: Anand Jain <anand.jain@oracle.com>
> 
> 
>>   _scratch_mkfs >> $seqres.full 2>&1
>>   _scratch_mount
>
Zorro Lang Sept. 1, 2023, 7:36 p.m. UTC | #3
On Thu, Aug 24, 2023 at 04:47:14PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> I run fstests in a readonly container, and accidentally uninstalled the
> btrfsprogs package.  When I did, this test started faililng:
> 
> --- btrfs/282.out
> +++ btrfs/282.out.bad

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

> @@ -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.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/btrfs/282 |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/btrfs/282 b/tests/btrfs/282
> index 980262dcab..395e0626da 100755
> --- a/tests/btrfs/282
> +++ b/tests/btrfs/282
> @@ -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
>  
>
Qu Wenruo Sept. 2, 2023, 12:40 a.m. UTC | #4
On 2023/9/2 03:36, Zorro Lang wrote:
> On Thu, Aug 24, 2023 at 04:47:14PM -0700, Darrick J. Wong wrote:
>> From: Darrick J. Wong <djwong@kernel.org>
>>
>> I run fstests in a readonly container, and accidentally uninstalled the
>> btrfsprogs package.  When I did, this test started faililng:
>>
>> --- btrfs/282.out
>> +++ btrfs/282.out.bad
>
> 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?

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
>
> Thanks,
> Zorro
>
>> @@ -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.
>>
>> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
>> ---
>>   tests/btrfs/282 |    7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/tests/btrfs/282 b/tests/btrfs/282
>> index 980262dcab..395e0626da 100755
>> --- a/tests/btrfs/282
>> +++ b/tests/btrfs/282
>> @@ -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
>>
>>
>
Zorro Lang Sept. 2, 2023, 5:46 a.m. UTC | #5
On Sat, Sep 02, 2023 at 08:40:17AM +0800, Qu Wenruo wrote:
> 
> 
> On 2023/9/2 03:36, Zorro Lang wrote:
> > On Thu, Aug 24, 2023 at 04:47:14PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > I run fstests in a readonly container, and accidentally uninstalled the
> > > btrfsprogs package.  When I did, this test started faililng:
> > > 
> > > --- btrfs/282.out
> > > +++ btrfs/282.out.bad
> > 
> > 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?
> 
> 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

> 
> Thanks,
> Qu
> > 
> > Thanks,
> > Zorro
> > 
> > > @@ -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.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > >   tests/btrfs/282 |    7 +++++++
> > >   1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/tests/btrfs/282 b/tests/btrfs/282
> > > index 980262dcab..395e0626da 100755
> > > --- a/tests/btrfs/282
> > > +++ b/tests/btrfs/282
> > > @@ -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
> > > 
> > > 
> > 
>
diff mbox series

Patch

--- btrfs/282.out
+++ btrfs/282.out.bad
@@ -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.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/btrfs/282 |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/btrfs/282 b/tests/btrfs/282
index 980262dcab..395e0626da 100755
--- a/tests/btrfs/282
+++ b/tests/btrfs/282
@@ -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