diff mbox series

[2/3] common/xfs: work around a hang-on-stdin bug in xfs_admin 5.11

Message ID 161715289578.2703773.11659648563859531836.stgit@magnolia (mailing list archive)
State New
Headers show
Series fstests: make sure NEEDSREPAIR feature stops mounts | expand

Commit Message

Darrick J. Wong March 31, 2021, 1:08 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

xfs_admin in xfsprogs 5.11 has a bug wherein a caller who specifies an
external log device forces xfs_db to be invoked, potentially with zero
command arguments.  When this happens, xfs_db will wait for input on
stdin, which causes fstests to hang.  Since xfs_admin is not an
interactive tool, redirect stdin from /dev/null to prevent this issue.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/xfs |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Brian Foster March 31, 2021, 4:39 p.m. UTC | #1
On Tue, Mar 30, 2021 at 06:08:15PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> xfs_admin in xfsprogs 5.11 has a bug wherein a caller who specifies an
> external log device forces xfs_db to be invoked, potentially with zero
> command arguments.  When this happens, xfs_db will wait for input on
> stdin, which causes fstests to hang.  Since xfs_admin is not an
> interactive tool, redirect stdin from /dev/null to prevent this issue.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  common/xfs |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/common/xfs b/common/xfs
> index 189da54b..c97e08ba 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -277,7 +277,13 @@ _scratch_xfs_admin()
>  			_notrun 'xfs_admin does not support rt devices'
>  		rt_opts+=(-r "$SCRATCH_RTDEV")
>  	fi
> -	$XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}"
> +
> +	# xfs_admin in xfsprogs 5.11 has a bug where an external log device
> +	# forces xfs_db to be invoked, potentially with zero command arguments.
> +	# When this happens, xfs_db will wait for input on stdin, which causes
> +	# fstests to hang.  Since xfs_admin is not an interactive tool, we
> +	# can redirect stdin from /dev/null to prevent this issue.
> +	$XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}" < /dev/null
>  }
>  
>  _scratch_xfs_logprint()
>
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index 189da54b..c97e08ba 100644
--- a/common/xfs
+++ b/common/xfs
@@ -277,7 +277,13 @@  _scratch_xfs_admin()
 			_notrun 'xfs_admin does not support rt devices'
 		rt_opts+=(-r "$SCRATCH_RTDEV")
 	fi
-	$XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}"
+
+	# xfs_admin in xfsprogs 5.11 has a bug where an external log device
+	# forces xfs_db to be invoked, potentially with zero command arguments.
+	# When this happens, xfs_db will wait for input on stdin, which causes
+	# fstests to hang.  Since xfs_admin is not an interactive tool, we
+	# can redirect stdin from /dev/null to prevent this issue.
+	$XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}" < /dev/null
 }
 
 _scratch_xfs_logprint()