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 in block cache open call #1580

Open
wants to merge 1 commit into
base: blobfuse/2.4.1
Choose a base branch
from
Open

Conversation

syeleti-msft
Copy link
Member

✅ What

current implementation of open file when opened in O_WRONLY will truncate the file to zero. This is incorrect behaviour.

👩‍🔬 How to validate if applicable

We don't see it in the normal scenario as write-back cache is on by default. Hence all the open calls with O_WRONLY will be redirected O_RDWR. To simulate this turn of the write-back cache while mounting with --disable-writeback-cache=true and then open file in O_WRONLY.

…cate the file to zero. This is incorrect behaviour.

We don't see it in the normal scenario as write-back cache is on by default. Hence all the open calls with O_WRONLY will be redirected O_RDWR.
To simulate this turn of the write-back cache and then open file in O_WRONLY.
@@ -397,7 +397,7 @@ func (bc *BlockCache) OpenFile(options internal.OpenFileOptions) (*handlemap.Han
log.Debug("BlockCache::OpenFile : Size of file handle.Size %v", handle.Size)
bc.prepareHandleForBlockCache(handle)

if options.Flags&os.O_TRUNC != 0 || (options.Flags&os.O_WRONLY != 0 && options.Flags&os.O_APPEND == 0) {
if options.Flags&os.O_TRUNC != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Earlier we were not changing the open flags in libfuse later due to some other issues we encountered we started doing that (opening all files in RDWR mode). Hence this check is independent and not relying on what libfuse does. Tomorow if we change that logic we need to remember to correct this flag here. Also, this is just in open and one time call, so it does not have any impact on the system. I suggest we leave this here as is as some day we might correct the libfuse behavior of overriding the flags.

@vibhansa-msft vibhansa-msft added this to the v2-2.4.1 milestone Nov 29, 2024
@vibhansa-msft vibhansa-msft changed the base branch from main to blobfuse/2.4.1 November 29, 2024 07:52
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.

2 participants