FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH v2] check: set seqres before calling init_rc which could write there
@ 2026-11-03  9:31 Andrey Albershteyn
  2026-11-03 12:15 ` Zorro Lang
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Albershteyn @ 2026-11-03  9:31 UTC (permalink / raw)
  To: fstests, zlang; +Cc: ojaswin, hch, Andrey Albershteyn

There's path where >>$seqres is used in init_rc:

-> init_rc
	-> _test_mount
		-> _prepare_for_eio_shutdown
			->_xfs_prepare_for_eio_shutdown
				-> _set_fs_sysfs_attr

Which will try to write to .full because $seqres is not set. Fix this by
setting seqres first, this way it should go to $RESULT_DIR/check.full.

The init_rc is called in the top context and then per section, however,
for top context we don't have environment set up yet. These logs are
just a few sysfs_attr writes and aren't that important, so, let's save
those to /tmp/xxx.check.full just in case.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
---
Changes in v2:
- remove The before init_rc in the comment
---
 check | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/check b/check
index 534c2cdf7a06..afe855bcf0ed 100755
--- a/check
+++ b/check
@@ -534,6 +534,10 @@ if ! . ./common/rc; then
 	_fatal "check: failed to source common/rc"
 fi
 
+# init_rc could write to the $seqres.full, however we don't have any context
+# here yet, and no RESULT_BASE is setup. These logs aren't that important but
+# let's keep them in /tmp anyway.
+seqres=$tmp.check
 init_rc
 
 # If the test config specified a soak test duration, see if there are any
@@ -932,8 +936,6 @@ function run_section()
 		_test_unmount 2> /dev/null
 	fi
 
-	init_rc
-
 	seq="check.$$"
 	check="$RESULT_BASE/check"
 	seqres="$check"
@@ -941,6 +943,8 @@ function run_section()
 	# don't leave old full output behind on a clean run
 	rm -f $check.full
 
+	init_rc
+
 	[ -f $check.time ] || touch $check.time
 
 	# print out our test configuration
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] check: set seqres before calling init_rc which could write there
  2026-11-03  9:31 [PATCH v2] check: set seqres before calling init_rc which could write there Andrey Albershteyn
@ 2026-11-03 12:15 ` Zorro Lang
  0 siblings, 0 replies; 2+ messages in thread
From: Zorro Lang @ 2026-11-03 12:15 UTC (permalink / raw)
  To: Andrey Albershteyn; +Cc: fstests, ojaswin, hch

On Tue, Nov 03, 2026 at 10:31:17AM +0100, Andrey Albershteyn wrote:
> There's path where >>$seqres is used in init_rc:
> 
> -> init_rc
> 	-> _test_mount
> 		-> _prepare_for_eio_shutdown
> 			->_xfs_prepare_for_eio_shutdown
> 				-> _set_fs_sysfs_attr
> 
> Which will try to write to .full because $seqres is not set. Fix this by
> setting seqres first, this way it should go to $RESULT_DIR/check.full.
> 
> The init_rc is called in the top context and then per section, however,
> for top context we don't have environment set up yet. These logs are
> just a few sysfs_attr writes and aren't that important, so, let's save
> those to /tmp/xxx.check.full just in case.
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> ---
> Changes in v2:
> - remove The before init_rc in the comment
> ---
>  check | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/check b/check
> index 534c2cdf7a06..afe855bcf0ed 100755
> --- a/check
> +++ b/check
> @@ -534,6 +534,10 @@ if ! . ./common/rc; then
>  	_fatal "check: failed to source common/rc"
>  fi
>  
> +# init_rc could write to the $seqres.full, however we don't have any context
> +# here yet, and no RESULT_BASE is setup. These logs aren't that important but
> +# let's keep them in /tmp anyway.
> +seqres=$tmp.check

The code around init_rc is definitely messy and deserves a proper refactor.
For this patch specifically, though, it looks good to me.

Reviewed-by: Zorro Lang <zlang@kernel.org>

>  init_rc
>  
>  # If the test config specified a soak test duration, see if there are any
> @@ -932,8 +936,6 @@ function run_section()
>  		_test_unmount 2> /dev/null
>  	fi
>  
> -	init_rc
> -
>  	seq="check.$$"
>  	check="$RESULT_BASE/check"
>  	seqres="$check"
> @@ -941,6 +943,8 @@ function run_section()
>  	# don't leave old full output behind on a clean run
>  	rm -f $check.full
>  
> +	init_rc
> +
>  	[ -f $check.time ] || touch $check.time
>  
>  	# print out our test configuration
> -- 
> 2.54.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-03 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03  9:31 [PATCH v2] check: set seqres before calling init_rc which could write there Andrey Albershteyn
2026-11-03 12:15 ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox