Skip to contentSkip to conversation

generic/622: increase sleep time for lazytime expiration

PATCH In review Jan Prusakowski 3 participants 3 messages Oct 9 – Oct 14

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 generic/622: increase sleep time for lazytime expiration

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 filesystems or configurations with higher writeback overhead -- such as F2FS with transparent compression enabled, where compressed files cannot use inline data and writes use out-of-place updates (OPU) with higher latency in the compression and writeback pipeline -- the 2-second sleep window can occasionally be insufficient. 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 to give sufficient margin for the flusher thread to reliably expire the lazytime inode and dirty the inode page before shutdown.

---
Changes in v2:
- Increase sleep time to 4 seconds unconditionally with an explanatory comment instead of using an F2FS-specific conditional.
- Remove the non-standard Change-Id trailer.

 tests/generic/622 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/generic/622 +6 -2
index cb0f5828..16088199 100755
@@ -60,8 +60,12 @@ 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 few seconds.  Because
+	# dirtytime_expire_seconds is 1 second, sleeping for 4 seconds leaves
+	# enough margin after expiration for background writeback to finish even
+	# on filesystems with higher writeback overhead (e.g. F2FS with file
+	# compression).
+	sleep 4
 	restore_expiration_settings
 }
 
Signature · 1 line
2.56.0.360.g66cac248cb-goog
Reviewed-by on v2 1/1
#2 lore raw
In reply to Jan Prusakowski
Quoted 8 lines · Jan Prusakowski

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.

Quoted 4 lines

However, on filesystems or configurations with higher writeback overhead -- such as F2FS with transparent compression enabled, where compressed files cannot use inline data and writes use out-of-place updates (OPU) with higher latency in the compression and writeback

FYI, I encounter similar issue on non-compressed inode, so v2 w/o checking compression makes sense to me.

Quoted 9 lines

pipeline -- the 2-second sleep window can occasionally be insufficient. 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:

Quoted 8 lines

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

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

Thanks,