Fix test_passthroughfs() failure due to unexpected mtime/ctime differences#130
Merged
Fix test_passthroughfs() failure due to unexpected mtime/ctime differences#130
Conversation
…ences. What's happening here is the following: - If the FUSE (kernel-level) writeback cache is enabled, the filesystem daemon cannot be trusted by the kernel to produce accurate mtime and ctime values, because there may be pending writes in the cache that have not been flushed to the daemon. - Therefore, the kernel still calls the getattr() handler, but ignores the mtime and ctime values, and instead maintains them internally. - When a file is closed, the kernel communicates the correct mtime and ctime values to the filesystem daemon through an extra setattr() call. - Therefore, the (correct) mtime value that a userspace program gets from the kernel for the FUSE filesystem will not agree with the (also correct) mtime value reported by the underlying filesystem as long as the file is open. - Once the file has been closed, the mtime values agree, but the filesystem daemon has updated this with an utimens() call which has resulted in ctime change, so now the ctime values do not agree. To fix this, make the writeback cache configurable and only check mtimes if writeback caching is disabled. Fixes: #57.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes test failures in test_passthroughfs() caused by mtime/ctime mismatches when FUSE writeback cache is enabled. The kernel maintains its own mtime/ctime values when writeback cache is active, leading to discrepancies with the underlying filesystem until files are closed.
Key Changes:
- Made writeback cache configurable via a new command-line flag
--enable-writeback-cache - Modified tests to run with both writeback cache enabled and disabled
- Updated time comparison logic to skip mtime/ctime checks when writeback cache is enabled
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| examples/passthroughfs.py | Made enable_writeback_cache configurable through constructor parameter and CLI flag instead of hardcoded class attribute |
| test/test_examples.py | Parametrized test_passthroughfs to test both cache modes, and conditionally skip time checks when writeback cache is enabled |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's happening here is the following:
To fix this, make the writeback cache configurable and only check mtimes if writeback caching is disabled.
Fixes: #57.