Skip to contentSkip to conversation

generic/390: Add tests for inode timestamp policy

PATCH In review Deepa Dinamani 2 participants 4 messages Jan 4, 2017 – Apr 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 generic/390: Add tests for inode timestamp policy

The test helps to validate clamping and mount behaviors according to supported file system timestamp ranges.

Note that the test can fail on 32-bit systems for a few file systems. This will be corrected when vfs is transitioned to use 64-bit timestamps.

---
The branch of the kernel tree can be located at

https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy

The xfs_io patch to add utimes is at

https://www.spinics.net/lists/linux-xfs/msg02952.html

Changes since v2:
* Refactored notrun handling
* Updated comments

Changes since v1:
* Use xfs_io utimes command
* Updated error handling
* Reorganized code according to review comments

 common/rc             |  48 +++++++++++++
 tests/generic/390     | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/390.out |   2 +
 tests/generic/group   |   1 +
 4 files changed, 243 insertions(+)
 create mode 100755 tests/generic/390
 create mode 100644 tests/generic/390.out
common/rc +48 -0
index e3b54ec..17f025e 100644
@@ -1960,6 +1960,51 @@ _run_aiodio()
     return $status
 }
 
+# this test requires y2038 sysfs switch and filesystem
+# timestamp ranges support.
+_require_y2038()
+{
+	local device=${1:-$TEST_DEV}
+	local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
+
+	if [ ! -e $sysfsdir ]; then
+		_notrun "no kernel support for y2038 sysfs switch"
+	fi
+
+	local tsmin tsmax
+	read tsmin tsmax <<<$(_filesystem_timestamp_range $device)
+	if [ $tsmin -eq -1 -a $tsmax -eq -1 ]; then
+		_notrun "filesystem $FSTYP timestamp bounds are unknown"
+	fi
+}
+
+_filesystem_timestamp_range()
+{
+	device=${1:-$TEST_DEV}
+	case $FSTYP in
+	ext4)
+		if [ $(dumpe2fs -h $device 2>/dev/null | grep "Inode size:" | cut -d: -f2) -gt 128 ]; then
+			echo "-2147483648 15032385535"
+		else
+			echo "-2147483648 2147483647"
+		fi
+		;;
+
+	xfs)
+		echo "-2147483648 2147483647"
+		;;
+	jfs)
+		echo "0 4294967295"
+		;;
+	f2fs)
+		echo "-2147483648 2147483647"
+		;;
+	*)
+		echo "-1 -1"
+		;;
+	esac
+}
+
 # indicate whether YP/NIS is active or not
 #
 _yp_active()
@@ -2070,6 +2115,9 @@ _require_xfs_io_command()
 		echo $testio | egrep -q "Inappropriate ioctl" && \
 			_notrun "xfs_io $command support is missing"
 		;;
+	"utimes" )
+		testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
+		;;
 	*)
 		testio=`$XFS_IO_PROG -c "$command help" 2>&1`
 	esac
tests/generic/390 new file +192 -0

192 lines not on this page · raw message

tests/generic/390.out new file +2 -0
new file mode 100644
index 0000000..82bd4eb
@@ -0,0 +1,2 @@
+QA output created by 390
+y2038 inode timestamp tests completed successfully
tests/generic/group +1 -0
index 08007d7..d137d01 100644
@@ -392,3 +392,4 @@
 387 auto clone
 388 auto log metadata
 389 auto quick acl
+390 auto quick rw
Signature · 1 line
2.7.4
#1 lore raw

Obsolete test? (Was: Re: [PATCH v3] generic/390: Add tests for inode timestamp policy)

Quoted 7 lines · Deepa Dinamani

The test helps to validate clamping and mount behaviors according to supported file system timestamp ranges.

Note that the test can fail on 32-bit systems for a few file systems. This will be corrected when vfs is transitioned to use 64-bit timestamps.

Quoted 5 lines

---
The branch of the kernel tree can be located at

https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy

It's 2019 and the functionality hasn't been merged to kernel, but maybe there's a replacement I have missed.

common/rc _run_aiodio() · line 1972

Quoted 9 lines
common/rc +9 -0
+# timestamp ranges support.
+_require_y2038()
+{
+	local device=${1:-$TEST_DEV}
+	local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
+
+	if [ ! -e $sysfsdir ]; then
+		_notrun "no kernel support for y2038 sysfs switch"
+	fi

This will always fail, so either the kernel functionality gets merged or the test dropped. Can you let us know the status? Thanks.

#2 lore raw

Re: Obsolete test? (Was: Re: [PATCH v3] generic/390: Add tests for inode timestamp policy)

Quoted 19 lines · David Sterba
Quoted 9 lines · Deepa Dinamani

The test helps to validate clamping and mount behaviors according to supported file system timestamp ranges.

Note that the test can fail on 32-bit systems for a few file systems. This will be corrected when vfs is transitioned to use 64-bit timestamps.

Quoted 5 lines

---
The branch of the kernel tree can be located at

https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy

It's 2019 and the functionality hasn't been merged to kernel, but maybe there's a replacement I have missed.

Quoted 12 lines

common/rc _run_aiodio() · line 1972

Quoted 9 lines
common/rc +9 -0
+# timestamp ranges support.
+_require_y2038()
+{
+    local device=${1:-$TEST_DEV}
+    local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
+
+    if [ ! -e $sysfsdir ]; then
+        _notrun "no kernel support for y2038 sysfs switch"
+    fi

This will always fail, so either the kernel functionality gets merged or the test dropped. Can you let us know the status? Thanks.

I’m posting a more comprehensive kernel series (~35 patches) for this in a week or so. This test was requested as a prerequisite to merge the series:
https://lists.linaro.org/pipermail/y2038/2016-November/001981.html
There have been 5 versions of patches posted since then. It has been a little difficult to get these reviewed.

The series makes more sense now anyway as we finally have 64 bit timestamps for vfs.
If the test is a precondition, then we should still keep it?

-Deepa

-Deepa

#3 lore raw

Re: Obsolete test? (Was: Re: [PATCH v3] generic/390: Add tests for inode timestamp policy)

Quoted 32 lines · Deepa Dinamani
Quoted 19 lines · David Sterba
Quoted 9 lines · Deepa Dinamani

The test helps to validate clamping and mount behaviors according to supported file system timestamp ranges.

Note that the test can fail on 32-bit systems for a few file systems. This will be corrected when vfs is transitioned to use 64-bit timestamps.

Quoted 5 lines

---
The branch of the kernel tree can be located at

https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy

It's 2019 and the functionality hasn't been merged to kernel, but maybe there's a replacement I have missed.

Quoted 12 lines

common/rc _run_aiodio() · line 1972

Quoted 9 lines
common/rc +9 -0
+# timestamp ranges support.
+_require_y2038()
+{
+    local device=${1:-$TEST_DEV}
+    local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
+
+    if [ ! -e $sysfsdir ]; then
+        _notrun "no kernel support for y2038 sysfs switch"
+    fi

This will always fail, so either the kernel functionality gets merged or the test dropped. Can you let us know the status? Thanks.

Quoted 6 lines

I’m posting a more comprehensive kernel series (~35 patches) for this in a week or so. This test was requested as a prerequisite to merge the series:
https://lists.linaro.org/pipermail/y2038/2016-November/001981.html
There have been 5 versions of patches posted since then. It has been a little difficult to get these reviewed.

Ok, understood.

Quoted 3 lines

The series makes more sense now anyway as we finally have 64 bit timestamps for vfs.
If the test is a precondition, then we should still keep it?

Yeah, in that case keep it. The kernel patches are on the way to mainline and strftime("%Y") is still less then 2038. Thanks.