Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

In the discussions at #3799 it was noted that DirEntry::file_type will often use cached information rather than making a fresh syscall, fixing the list race condition where we lose files while iterating the directory for some filesystems on some Unix platforms.

For some reason, that fix didn't make it into the merged PR, and we rather stuck with DirEntry::metadata() which always does a fresh syscall and always exhibits the problematic behavior. Here we simply swap for DirEntry::file_type which at least fixes the issue for "some filesome filesystems (among them: Btrfs, ext2, ext3, and ext4)" (per readdir(3)).

In the discussions at lightningdevkit#3799 it was noted that `DirEntry::file_type`
will often use cached information rather than making a fresh
syscall, fixing the `list` race condition where we lose files while
iterating the directory for some filesystems on some Unix
platforms.

For some reason, that fix didn't make it into the merged PR, and we
rather stuck with `DirEntry::metadata()` which *always* does a
fresh syscall and always exhibits the problematic behavior. Here we
simply swap for `DirEntry::file_type` which at least fixes the
issue for "some filesome filesystems (among them: Btrfs, ext2,
ext3, and ext4)" (per `readdir(3)`).
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Feb 9, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@tnull tnull self-requested a review February 9, 2026 15:30
@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.02%. Comparing base (2e4a2ac) to head (3661783).

Files with missing lines Patch % Lines
lightning-persister/src/fs_store.rs 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4404      +/-   ##
==========================================
- Coverage   86.02%   86.02%   -0.01%     
==========================================
  Files         156      156              
  Lines      103100   103100              
  Branches   103100   103100              
==========================================
- Hits        88693    88691       -2     
+ Misses      11896    11895       -1     
- Partials     2511     2514       +3     
Flag Coverage Δ
tests 86.02% <66.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants