Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug fix] Kernel list cache remove directory operation fails when files are created on GCS #2163

Merged
merged 8 commits into from
Jul 29, 2024

Conversation

ashmeenkaur
Copy link
Collaborator

Description

Scenario:

  1. Read directory (listing) with kernel list cache enabled
  2. List response is cached in kernel.
  3. Create a file on the same GCS bucket inside the same directory outside of the GCSFuse mount via another tool like pantheon, gsutil.
  4. call os.RemoveAll on the same directory in GCS Fuse.
  5. Kernel will use the list cache response to list & delete the files and the newly created file (outside GCSFuse mount) won't be deleted.
  6. os.RemoveAll will fail with directory not empty error when trying to delete the parent directory.

Fix:

  1. As part of the RmDir call, we will invalidate the cache by setting the previous directory listing timestamp to 0.
  2. This will make the open dir call to invalidate the cache so os.RemoveAll will start working.

Note: even after this fix, rm -r from terminal continues to fail as there in that case, we don't get first RmDir call (which invalidates the cache). Ref:

// When rm -r or os.RemoveAll call is made, the following calls are made in order

Link to the issue in case of a bug fix.

NA

Testing details

  1. Manual - NA
  2. Unit tests - Added
  3. Integration tests - Added

Copy link

codecov bot commented Jul 12, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.28%. Comparing base (96d844b) to head (9e32d09).

Files Patch % Lines
internal/fs/inode/base_dir.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2163      +/-   ##
==========================================
+ Coverage   71.24%   71.28%   +0.03%     
==========================================
  Files         104      104              
  Lines       11404    11409       +5     
==========================================
+ Hits         8125     8133       +8     
+ Misses       2942     2940       -2     
+ Partials      337      336       -1     
Flag Coverage Δ
unittests 71.28% <80.00%> (+0.03%) ⬆️

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.

@ashmeenkaur ashmeenkaur marked this pull request as ready for review July 12, 2024 13:36
@ashmeenkaur ashmeenkaur requested a review from a team as a code owner July 12, 2024 13:36
@ashmeenkaur ashmeenkaur requested a review from sethiay July 12, 2024 13:36
@kislaykishore kislaykishore requested review from a team and kislaykishore and removed request for a team July 12, 2024 13:37
@ashmeenkaur ashmeenkaur force-pushed the list-delete-test branch 2 times, most recently from a6b815f to ce34ae5 Compare July 22, 2024 07:01
internal/fs/fs.go Outdated Show resolved Hide resolved
internal/fs/fs.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@raj-prince raj-prince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, few minor comments.

@ashmeenkaur ashmeenkaur merged commit 930efde into master Jul 29, 2024
13 checks passed
@ashmeenkaur ashmeenkaur deleted the list-delete-test branch July 29, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-integration-tests Run only integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants