Skip to contentSkip to conversation

generic/622: increase sleep time for lazytime expiration on compressed f2fs

PATCH Superseded Jan Prusakowski 2 participants 3 messages Oct 8

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/622: increase sleep time for lazytime expiration on compressed f2fs

In generic/622, expire_timestamps() tests whether lazytime timestamp updates are persisted after dirtytime expiration. It configures dirtytime_expire_seconds to 1 second and enables continuous writeback of dirty inodes, followed by sleeping for 2 seconds to allow the asynchronous VFS flusher thread to expire the I_DIRTY_TIME inode, invoke the filesystem's write_inode callback, and flush the dirty metadata before the test executes _scratch_shutdown -f.

However, on F2FS with transparent compression enabled, compressed files cannot use inline data and writes use out-of-place updates (OPU) with higher latency in the compression and writeback pipeline. Because the inode is only eligible for expiration after 1 second, only about 1 second remains in the 2-second sleep window for the flusher thread to schedule, expire the inode, and mark the inode page dirty before restore_expiration_settings resets dirtytime_expire_seconds to 24 hours and shutdown occurs. If the flusher thread is delayed, the subsequent shutdown checkpoint ignores the unexpired I_DIRTY_TIME inode, causing the test to intermittently fail with:

FAIL: lazytime mtime wasn't persisted by expiration ondisk_time (...) != expected_time (...)

Increase the sleep duration in expire_timestamps() from 2 to 4 seconds when running on F2FS in compress mode to give sufficient margin for the flusher thread to reliably expire the lazytime inode and dirty the inode page before shutdown.

Change-Id I208bf14c189b54cc209059b0fd2de9e403a073f2
---
 tests/generic/622 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/generic/622 +8 -2
index e8ead300..5879e85e 100755
@@ -60,8 +60,14 @@ expire_timestamps()
 	__expire_inodes
 
 	# Userspace doesn't have direct visibility into when inodes are dirty,
-	# so the best we can do is sleep for a couple seconds.
-	sleep 2
+	# so the best we can do is sleep for a couple seconds.  On F2FS with
+	# compression enabled, out-of-place updates and compression writeback
+	# add extra latency, so sleep a bit longer.
+	if [[ "$FSTYP" == "f2fs" && "$MOUNT_OPTIONS" == *compress* ]]; then
+		sleep 4
+	else
+		sleep 2
+	fi
 	restore_expiration_settings
 }
 
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
#1 lore raw
Quoted 4 lines

Increase the sleep duration in expire_timestamps() from 2 to 4 seconds when running on F2FS in compress mode to give sufficient margin for the flusher thread to reliably expire the lazytime inode and dirty the inode page before shutdown.

Please just increase the timeout unconditionally and add a comment explaining it. While there are some historic hacks like this, generic tests really should not have file system specific conditionals.

Quoted 1 line

Change-Id: I208bf14c189b54cc209059b0fd2de9e403a073f2

And please don't add useless not-standard patch trailers.

#2 lore raw
Quoted 7 lines

Please just increase the timeout unconditionally and add a comment explaining it. While there are some historic hacks like this, generic tests really should not have file system specific conditionals.

Quoted 1 line

Change-Id: I208bf14c189b54cc209059b0fd2de9e403a073f2

And please don't add useless not-standard patch trailers.

Thanks, I'll send a V2 shortly.