Skip to contentSkip to conversation

common/attr: require xfs_spaceman for xfs acl_get_max

PATCH In review David Disseldorp 5 participants 12 messages Dec 12, 2022 – Dec 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 common/attr: require xfs_spaceman for xfs acl_get_max

For xfs, _acl_get_max() calls xfs_info which in turn calls "xfs_spaceman -c info ...".

Without this change, xfs_spaceman absence results in:

home/david/xfstests/results//generic/026.out.bad renamed from generic/026.out +2 -0
@@ -1,9 +1,11 @@
 QA output created by 026
+/usr/sbin/xfs_info: line 44: xfs_spaceman: command not found
 
 === Test out large ACLs  ===
+/usr/sbin/xfs_info: line 44: xfs_spaceman: command not found
 1 below acl max
 acl max

...

---
 common/attr | 3 +++
 1 file changed, 3 insertions(+)
common/attr +3 -0
index cce4d1b2..a94c5e4b 100644
@@ -57,6 +57,9 @@ _acl_get_max()
 
 _require_acl_get_max()
 {
+	# _acl_get_max -> xfs_info -> xfs_spaceman
+	[ "$FSTYP" == "xfs" ] && _require_xfs_spaceman_command "info"
+
 	if [ $(_acl_get_max) -eq 0 ]; then
 		_notrun "$FSTYP does not define maximum ACL count"
 	fi
Signature · 1 line
2.35.3
#1 lore raw

PATCH 2/3 tests/generic/027: use c-style for loops

---
 tests/generic/027 | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tests/generic/027 +2 -6
index 47f1981d..002be120 100755
@@ -53,22 +53,18 @@ fi
 
 dir=$SCRATCH_MNT/testdir
 echo -n "iteration" >>$seqres.full
-i=1
-while [ $i -le $loop ]; do
+for ((i = 1; i < loop; i++)); do
 	echo -n " $i" >>$seqres.full
-	nr_worker=8
-	while [ $nr_worker -gt 0 ]; do
+	for ((nr_worker = 8; nr_worker > 0; nr_worker--)); do
 		# half buffered I/O half direct I/O
 		if [ `expr $nr_worker % 2` -eq 0 ]; then
 			create_file $dir/$nr_worker -d >>$seqres.full &
 		else
 			create_file $dir/$nr_worker >>$seqres.full &
 		fi
-		let nr_worker=$nr_worker-1
 	done
 	wait
 	rm -rf $dir
-	let i=$i+1
 done
 _scratch_unmount
 
Signature · 1 line
2.35.3
#2 lore raw

Re: [PATCH 2/3] tests/generic/027: use c-style for loops

Quoted 10 lines · David Disseldorp
---
 tests/generic/027 | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tests/generic/027 +0 -0
index 47f1981d..002be120 100755

tests/generic/027 fi · line 56

Quoted 6 lines
tests/generic/027 +1 -2
@@ -53,22 +53,18 @@ fi
 
 dir=$SCRATCH_MNT/testdir
 echo -n "iteration" >>$seqres.full
-i=1
-while [ $i -le $loop ]; do
+for ((i = 1; i < loop; i++)); do

This does one fewer iteration than before.

- Eric

#3 lore raw

Re: [PATCH 2/3] tests/generic/027: use c-style for loops

Quoted 4 lines · Eric Biggers

tests/generic/027 fi · line 56

Quoted 2 lines
tests/generic/027 +1 -1
-while [ $i -le $loop ]; do
+for ((i = 1; i < loop; i++)); do  

This does one fewer iteration than before.

Gah you're right. I'll drop this patch as it was only intended as a readability clean-up. Thanks for the review.

Cheers, David

#4 lore raw

PATCH 3/3 check: ensure sect_stop is initialized if interrupted

In reply to David Disseldorp

sect_stop is normally set immediately prior to calling _wrapup() via run_section(). However, when called via a trap signal handler, sect_stop may be uninitialized, leading to a negative section time (sect_stop - sect_start) in the xunit report. E.g.
Interrupted!
Passed all 1 tests
Xunit report: /home/david/xfstests/results//result.xml

  rapido1:/# head /home/david/xfstests/results//result.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <testsuite name="xfstests" failures="0" skipped="0" tests="1"
   time="-1670885797" ... >

This commit uses the existing $interrupt flag to determine when sect_stop needs to be initialised.

---
 check | 1 +
 1 file changed, 1 insertion(+)
check +1 -0
index d2e51296..cb3ea155 100755
@@ -433,6 +433,7 @@ _wrapup()
 {
 	seq="check"
 	check="$RESULT_BASE/check"
+	$interrupt && sect_stop=`_wallclock`
 
 	if $showme && $needwrap; then
 		if $do_report; then
Signature · 1 line
2.35.3
Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] check: ensure sect_stop is initialized if interrupted

Quoted 12 lines · David Disseldorp

sect_stop is normally set immediately prior to calling _wrapup() via run_section(). However, when called via a trap signal handler, sect_stop may be uninitialized, leading to a negative section time (sect_stop - sect_start) in the xunit report. E.g.
Interrupted!
Passed all 1 tests
Xunit report: /home/david/xfstests/results//result.xml

  rapido1:/# head /home/david/xfstests/results//result.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <testsuite name="xfstests" failures="0" skipped="0" tests="1"
   time="-1670885797" ... >
Quoted 5 lines

This commit uses the existing $interrupt flag to determine when sect_stop needs to be initialised.

---

I don't use Xunit report generally, but this change makes sense to me.

Quoted 18 lines
 check | 1 +
 1 file changed, 1 insertion(+)
check +1 -0
index d2e51296..cb3ea155 100755
@@ -433,6 +433,7 @@ _wrapup()
 {
 	seq="check"
 	check="$RESULT_BASE/check"
+	$interrupt && sect_stop=`_wallclock`
 
 	if $showme && $needwrap; then
 		if $do_report; then
Signature · 1 line
2.35.3
#6 lore raw
In reply to David Disseldorp

home/david/xfstests/results//generic/026.out.bad line 2

Quoted 9 lines · David Disseldorp

For xfs, _acl_get_max() calls xfs_info which in turn calls "xfs_spaceman -c info ...".

Without this change, xfs_spaceman absence results in:

home/david/xfstests/results//generic/026.out.bad renamed from generic/026.out +1 -0
@@ -1,9 +1,11 @@
 QA output created by 026
+/usr/sbin/xfs_info: line 44: xfs_spaceman: command not found

Hmm.. That's weird, both xfs_info and xfs_spaceman are from xfsprogs package. If someone xfsprogs version doesn't hasve provide xfs_spaceman, why its xfs_info would like to call that? What xfsprogs do you use?

Thanks,
Zorro

Quoted 29 lines
home/david/xfstests/results//generic/026.out.bad renamed from generic/026.out +1 -0
 === Test out large ACLs  ===
+/usr/sbin/xfs_info: line 44: xfs_spaceman: command not found
 1 below acl max
 acl max
...
---
 common/attr | 3 +++
 1 file changed, 3 insertions(+)
common/attr +3 -0
index cce4d1b2..a94c5e4b 100644
@@ -57,6 +57,9 @@ _acl_get_max()
 
 _require_acl_get_max()
 {
+	# _acl_get_max -> xfs_info -> xfs_spaceman
+	[ "$FSTYP" == "xfs" ] && _require_xfs_spaceman_command "info"
+
 	if [ $(_acl_get_max) -eq 0 ]; then
 		_notrun "$FSTYP does not define maximum ACL count"
 	fi
Signature · 1 line
2.35.3
#7 lore raw
Quoted 3 lines · Zorro Lang

Hmm.. That's weird, both xfs_info and xfs_spaceman are from xfsprogs package. If someone xfsprogs version doesn't hasve provide xfs_spaceman, why its xfs_info would like to call that? What xfsprogs do you use?

I have a hacky bunch of scripts that use Dracut to generate an initramfs image with minimal dependencies for xfstests alongside the test kernel: https://github.com/rapido-linux/rapido

The rapido dependency list is now fixed, but I figured that this change makes sense given the other scattered _require_X checks for xfsprogs binaries. Feel free to drop this change if you don't agree.

Cheers, David

#8 lore raw
Quoted 6 lines · David Disseldorp
Quoted 3 lines · Zorro Lang

Hmm.. That's weird, both xfs_info and xfs_spaceman are from xfsprogs package. If someone xfsprogs version doesn't hasve provide xfs_spaceman, why its xfs_info would like to call that? What xfsprogs do you use?

Quoted 7 lines

I have a hacky bunch of scripts that use Dracut to generate an initramfs image with minimal dependencies for xfstests alongside the test kernel: https://github.com/rapido-linux/rapido

The rapido dependency list is now fixed, but I figured that this change makes sense given the other scattered _require_X checks for xfsprogs binaries. Feel free to drop this change if you don't agree.

We should let xfsprogs decide how xfs_info works. xfs_info doesn't always depends on xfs_spaceman, old xfs_info might use xfs_db or other things to get xfs info, and I don't know if it'll be changed to use other command in the future again.

So this change will cause all cases which call _require_acl_get_max will notrun on old (maybe future) xfsprogs which doesn't has xfs_spaceman "info" command. I think that's not what we want, so I'd like to drop this patch. Thanks for your understanding.

Thanks,
Zorro

Quoted 3 lines

Cheers, David

#9 lore raw
Quoted 9 lines · Zorro Lang

We should let xfsprogs decide how xfs_info works. xfs_info doesn't always depends on xfs_spaceman, old xfs_info might use xfs_db or other things to get xfs info, and I don't know if it'll be changed to use other command in the future again.

So this change will cause all cases which call _require_acl_get_max will notrun on old (maybe future) xfsprogs which doesn't has xfs_spaceman "info" command. I think that's not what we want, so I'd like to drop this patch. Thanks for your understanding.

I wasn't aware that the xfs_info->xfs_spaceman call path was a new change. With that in mind, I agree it makes sense to drop this patch.

Cheers, David

#10 lore raw
Quoted 7 lines · David Disseldorp
Quoted 5 lines · Zorro Lang

We should let xfsprogs decide how xfs_info works. xfs_info doesn't always depends on xfs_spaceman, old xfs_info might use xfs_db or other things to get xfs info, and I don't know if it'll be changed to use other command in the future again.

Quoted 7 lines
Quoted 4 lines

So this change will cause all cases which call _require_acl_get_max will notrun on old (maybe future) xfsprogs which doesn't has xfs_spaceman "info" command. I think that's not what we want, so I'd like to drop this patch. Thanks for your understanding.

I wasn't aware that the xfs_info->xfs_spaceman call path was a new change. With that in mind, I agree it makes sense to drop this patch.

Since 4.17, xfs_info requires xfs_spaceman if the fs is mounted, or xfs_db if unmounted. Before that, it required xfs_growfs and only worked on mounted filesystems.

That said, perhaps _acl_get_max should be doing:

$XFS_INFO_PROG $TEST_DIR | _filter_mkfs > /dev/null 2> $tmp.info test "${PIPESTATUS[0]}" -ne 0 && \
_fail "cannot get maximum acl count for xfs"

Rather than spraying whatever nonsense it does if spaceman is missing?

--D

Quoted 1 line

Cheers, David

#11 lore raw
Quoted 20 lines · Darrick J. Wong
Quoted 7 lines · David Disseldorp
Quoted 5 lines · Zorro Lang

We should let xfsprogs decide how xfs_info works. xfs_info doesn't always depends on xfs_spaceman, old xfs_info might use xfs_db or other things to get xfs info, and I don't know if it'll be changed to use other command in the future again.

Quoted 7 lines
Quoted 4 lines

So this change will cause all cases which call _require_acl_get_max will notrun on old (maybe future) xfsprogs which doesn't has xfs_spaceman "info" command. I think that's not what we want, so I'd like to drop this patch. Thanks for your understanding.

I wasn't aware that the xfs_info->xfs_spaceman call path was a new change. With that in mind, I agree it makes sense to drop this patch.

Since 4.17, xfs_info requires xfs_spaceman if the fs is mounted, or xfs_db if unmounted. Before that, it required xfs_growfs and only worked on mounted filesystems.

Quoted 7 lines

That said, perhaps _acl_get_max should be doing:

$XFS_INFO_PROG $TEST_DIR | _filter_mkfs > /dev/null 2> $tmp.info test "${PIPESTATUS[0]}" -ne 0 && \
_fail "cannot get maximum acl count for xfs"

Rather than spraying whatever nonsense it does if spaceman is missing?

Make more sense, but I don't think it's necessary to check return status of each command line. xfs_info generally works well, we can do this change when we have a real requirement in one day :)

Thanks,
Zorro

Quoted 5 lines

--D

Quoted 1 line

Cheers, David