]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_admin: pick up log arguments correctly
authorDarrick J. Wong <djwong@kernel.org>
Thu, 15 Apr 2021 19:44:10 +0000 (15:44 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 15 Apr 2021 19:44:10 +0000 (15:44 -0400)
In commit ab9d8d69, we added support to xfs_admin to pass an external
log to xfs_db and xfs_repair.  Unfortunately, we didn't do this
correctly -- by appending the log arguments to DB_OPTS, we now guarantee
an invocation of xfs_db when we don't have any work for it to do.

Brian Foster noticed that this results in xfs/764 hanging fstests
because xfs_db (when not compiled with libeditline) will wait for input
on stdin.  I didn't notice because my build includes libeditline and my
test runner script does silly things with pipes such that xfs_db would
exit immediately.

Reported-by: Brian Foster <bfoster@redhat.com>
Fixes: ab9d8d69 ("xfs_admin: support adding features to V5 filesystems")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/xfs_admin.sh

index 916050cbdbf71217efd1661eb642de7e825f7edd..409975b22286b16cee059370113329ab92639890 100755 (executable)
@@ -8,7 +8,7 @@ status=0
 DB_OPTS=""
 REPAIR_OPTS=""
 REPAIR_DEV_OPTS=""
-DB_LOG_OPTS=""
+LOG_OPTS=""
 USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-O v5_feature] [-r rtdev] [-U uuid] device [logdev]"
 
 while getopts "c:efjlL:O:pr:uU:V" c
@@ -40,19 +40,18 @@ case $# in
        1|2)
                # Pick up the log device, if present
                if [ -n "$2" ]; then
-                       DB_OPTS=$DB_OPTS" -l '$2'"
-                       REPAIR_DEV_OPTS=$REPAIR_DEV_OPTS" -l '$2'"
+                       LOG_OPTS=" -l '$2'"
                fi
 
                if [ -n "$DB_OPTS" ]
                then
-                       eval xfs_db -x -p xfs_admin $DB_OPTS "$1"
+                       eval xfs_db -x -p xfs_admin $LOG_OPTS $DB_OPTS "$1"
                        status=$?
                fi
                if [ -n "$REPAIR_OPTS" ]
                then
                        echo "Running xfs_repair to upgrade filesystem."
-                       eval xfs_repair $REPAIR_DEV_OPTS $REPAIR_OPTS "$1"
+                       eval xfs_repair $LOG_OPTS $REPAIR_DEV_OPTS $REPAIR_OPTS "$1"
                        status=`expr $? + $status`
                fi
                ;;