From 08174ee11083c380e72a64686c98d38b276ea826 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 11 Feb 2019 18:17:32 -0800 Subject: [PATCH] common: fix _require_btime for lazy filesystems Filesystems are not required to try to fill the statx btime field unless the caller actually sets STATX_BTIME. They're allowed to volunteer that information "if it's cheap", but XFS doesn't volunteer and there may be filesystems that support btime but not cheaply. Either way, we want to test btime on any filesystem that supports it, cheaply or otherwise, so set STATX_BTIME when we're trying to detect support for it. [Eryu: fix _require_scratch_btime too] Signed-off-by: Darrick J. Wong Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- common/rc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index ab468adf..c88c304c 100644 --- a/common/rc +++ b/common/rc @@ -3849,7 +3849,11 @@ _dmsetup_create() _require_btime() { - $XFS_IO_PROG -f $TEST_DIR/test_creation_time -c "statx -v" \ + # Note: filesystems are not required to report btime (creation time) + # if the caller doesn't ask for it, so we define STATX_BTIME here and + # pass it in to the statx command. + export STATX_BTIME=0x800 + $XFS_IO_PROG -f $TEST_DIR/test_creation_time -c "statx -m $STATX_BTIME -v" \ | grep btime >>$seqres.full 2>&1 || \ _notrun "inode creation time not supported by this filesystem" rm -f $TEST_DIR/test_creation_time @@ -3861,7 +3865,11 @@ _require_scratch_btime() _scratch_mkfs > /dev/null 2>&1 _scratch_mount - $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -v" \ + # Note: filesystems are not required to report btime (creation time) + # if the caller doesn't ask for it, so we define STATX_BTIME here and + # pass it in to the statx command. + export STATX_BTIME=0x800 + $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -m $STATX_BTIME -v" \ | grep btime >>$seqres.full 2>&1 || \ _notrun "inode creation time not supported by this filesystem" -- 2.47.3