Repository navigation
Conversation
host::tests::a_large_directory_costs_no_descriptors lists /proc/self/fd 1502 times while the other unit tests of the fat crate run in other threads of the same process. procfs takes a reference on every file it lists and on every file whose link it reads. When another test closes its image in that moment, the scanner puts the last reference and the BSD lock is only dropped when the scanner returns to user space. The other test reopens the image right away and fails with EBUSY. Move the test into a test binary of its own, so no other test runs in the process that lists /proc/self/fd. walk_tree() is private to the fat crate, so the test now copies the directory into a volume with copy_tree_with_progress() and counts in the progress callback. That callback runs while the walk holds its pins and the file it copies, so the limit goes up from four descriptors to five. Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
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.
host::tests::a_large_directory_costs_no_descriptors lists /proc/self/fd
and reads every link in it 1502 times while the other unit tests of the
fat crate run in other threads of the same process. procfs takes a
reference on every file it lists and on every file whose link it reads.
If another test closes its image right then, the lister puts the last
reference. __fput() then only runs once the lister returns to user
space, and that's where locks_remove_file() drops the BSD lock. The
other test reopens the image right away, flock(LOCK_EX|LOCK_NB) fails
and the test dies with EBUSY.
So move the test into a test binary of its own. walk_tree() is private
to the crate, so the test now copies the directory into a volume with
copy_tree_with_progress() and counts in the progress callback. The
callback runs while the file being copied is open, so the limit goes up
from four descriptors to five.
Nothing else that shares a process with tests reopening images lists
/proc/self/fd. The integration tests that spawn programs already run
one at a time through common::serial(), since a child holds the files
of its parent until it execs.
On a 512 CPU machine, pinned to 384 CPUs, with RUST_TEST_THREADS=8 and
main and this branch running side by side:
failures on main, none with this branch.
runs each: 1 EBUSY failure on main, in fat's unit tests, none with
this branch.
3000 runs each: 3 EBUSY failures with it, none without.