diff mbox series

[v3,1/1] generic/402: Make timestamp range check conditional

Message ID 20200119005744.12852-1-deepa.kernel@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/1] generic/402: Make timestamp range check conditional | expand

Commit Message

Deepa Dinamani Jan. 19, 2020, 12:57 a.m. UTC
Addition of fs-specific timestamp range checking was added
in 188d20bcd1eb ("vfs: Add file timestamp range support").

Add a check for whether the kernel supports the limits check
before running the associated test.

Based on an off-list discussion, we use a simpler interim approach
until fsinfo syscall would provide fs timestamp limits info.
This isn't perfect, but works for filesystems expiring in 2038.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
 common/rc         |  7 +++++++
 tests/generic/402 | 13 ++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

Comments

Amir Goldstein Jan. 19, 2020, 9:19 a.m. UTC | #1
On Sun, Jan 19, 2020 at 2:57 AM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
>
> Addition of fs-specific timestamp range checking was added
> in 188d20bcd1eb ("vfs: Add file timestamp range support").
>
> Add a check for whether the kernel supports the limits check
> before running the associated test.
>
> Based on an off-list discussion, we use a simpler interim approach
> until fsinfo syscall would provide fs timestamp limits info.
> This isn't perfect, but works for filesystems expiring in 2038.
>
> Suggested-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> ---

Excellent! Thank you.

Eryu, you may add any of:
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Tested-by: Amir Goldstein <amir73il@gmail.com>

On kernel v5.4, ext2,ext4,xfs,btrfs (default mkfs) still pass.
On Kernel v5.3, ext2,xfs are notrun for lack of kernel support
(instead of failing),
ext4 (256 bytes inodes) still fails
and btrfs still pass, because bash overflows $(($s64max + 1 )) just the same as
the kernel...

Thanks,
Amir.
Eryu Guan Feb. 1, 2020, 9:14 a.m. UTC | #2
On Sun, Jan 19, 2020 at 11:19:24AM +0200, Amir Goldstein wrote:
> On Sun, Jan 19, 2020 at 2:57 AM Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> >
> > Addition of fs-specific timestamp range checking was added
> > in 188d20bcd1eb ("vfs: Add file timestamp range support").
> >
> > Add a check for whether the kernel supports the limits check
> > before running the associated test.
> >
> > Based on an off-list discussion, we use a simpler interim approach
> > until fsinfo syscall would provide fs timestamp limits info.
> > This isn't perfect, but works for filesystems expiring in 2038.
> >
> > Suggested-by: Amir Goldstein <amir73il@gmail.com>
> > Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> > ---
> 
> Excellent! Thank you.
> 
> Eryu, you may add any of:
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> Tested-by: Amir Goldstein <amir73il@gmail.com>
> 
> On kernel v5.4, ext2,ext4,xfs,btrfs (default mkfs) still pass.
> On Kernel v5.3, ext2,xfs are notrun for lack of kernel support
> (instead of failing),
> ext4 (256 bytes inodes) still fails
> and btrfs still pass, because bash overflows $(($s64max + 1 )) just the same as
> the kernel...

Thanks a lot for the double checking! And many thanks to Deepa for the
fix!

Thanks,
Eryu
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index eeac1355..fc82c17a 100644
--- a/common/rc
+++ b/common/rc
@@ -1990,6 +1990,13 @@  _require_timestamp_range()
 	if [ $tsmin -eq -1 -a $tsmax -eq -1 ]; then
 		_notrun "filesystem $FSTYP timestamp bounds are unknown"
 	fi
+
+	# expect console warning from rw scratch mount if fs limit is near
+	if [ $tsmax -le $((1<<31)) ] && \
+		! _check_dmesg_for "filesystem being mounted at .* supports timestamps until"
+	then
+		_notrun "Kernel does not support timestamp limits"
+	fi
 }
 
 _filesystem_timestamp_range()
diff --git a/tests/generic/402 b/tests/generic/402
index 0392c258..2a34d127 100755
--- a/tests/generic/402
+++ b/tests/generic/402
@@ -16,7 +16,13 @@  echo "QA output created by $seq"
 here=`pwd`
 tmp=/tmp/$$
 status=1	# failure is the default!
-trap "exit \$status" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
 
 # Get standard environment, filters and checks.
 . ./common/rc
@@ -30,6 +36,7 @@  rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_scratch
+_require_check_dmesg
 _require_xfs_io_command utimes
 
 # Compare file timestamps obtained from stat
@@ -80,6 +87,8 @@  run_test()
 }
 
 _scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mount || _fail "scratch mount failed"
+
 _require_timestamp_range $SCRATCH_DEV
 
 read tsmin tsmax <<<$(_filesystem_timestamp_range $SCRATCH_DEV)
@@ -96,8 +105,6 @@  declare -a TIMESTAMPS=(
 	$((tsmax+1))
 )
 
-_scratch_mount || _fail "scratch mount failed"
-
 status=0
 
 # Begin test case 1