mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 05:16:00 +03:00
[PR #1957] [MERGED] Fixed a bug that regular files could not be created by mknod #2272
Labels
No labels
bug
bug
dataloss
duplicate
enhancement
feature request
help wanted
invalid
need info
performance
pull-request
question
question
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/s3fs-fuse#2272
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1957
Author: @ggtakec
Created: 6/10/2022
Status: ✅ Merged
Merged: 6/29/2022
Merged by: @gaul
Base:
master← Head:fix_release_without_flush📝 Commits (2)
a39224dFixed a bug that regular files could not be created by mknod2b512a6Fixed a bug that regular files could not be created by mknod📊 Changes
9 files changed (+268 additions, -31 deletions)
View changed files
📝
.gitignore(+1 -0)📝
src/fdcache_auto.cpp(+3 -3)📝
src/fdcache_auto.h(+1 -1)📝
src/fdcache_entity.cpp(+45 -23)📝
src/fdcache_entity.h(+13 -2)📝
src/s3fs.cpp(+8 -1)📝
test/Makefile.am(+3 -1)📝
test/integration-test-main.sh(+13 -0)➕
test/mknod_test.c(+181 -0)📄 Description
Relevant Issue (if applicable)
#1934
Details
The touch command fails when the directory on which s3fs is mounted is mounted with NFS, by #1934.
As a result of investigating this, it turned out to be a bug.
Cause
FUSE calls the
create(s3fs_sreate) hook when creating a regular file with mknod.After that,
flush(s3fs_flush) is not called because mknod is the trigger, andrelease(s3fs_release) closes the file handle.After this, file attribute changes such as
utimensare called.Also, when creating a file such as a
touchcommand, NFS does not callopen/close, but callsmknod.Due to the above operation of FUSE and NFS, to create a new file with zero file size by the
touchcommand,create(s3fs_create) is called, andrelease(s3fs_release) is called withoutflush(s3fs_flush).s3fs delays the creation of new zero file size files until
flush(s3fs_flush). (you know #1640, #1655, #1780, etc.)This does not take into account the call flow by mknod, so the pending file creation(and meta update) is not done.
After that, calling
utimenswill result in an error because the file has not been created.Therefore, the touch command failed via NFS.
Fix
When
release(s3fs_release) is called, if it is in the pending state(new file creation, meta information update), it has been modified to update them.This allows you to
create(touchcommand) regular files withmknod(from NFS).I also added a test for
mknod.FUSE is called by
create(s3fs_create) in the case of regular file creation, but bymknod(s3fs_mknod) in other cases.Including these, I am making it possible to inspect with this test.
All
mknodtests are bypassed on macos (because root privileges are required).It will also be bypassed if you create a BLOCK device as well.
Remaining issues
It looks like mknod's non-regular file creation is supported, but it doesn't work correctly.
I think that
BLOCK,FIFOandSOCKwill not work.As for
CHARACTER, it may work, but it has not been implemented as a block device.I will post new issue about it.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
std::unique_ptrfromS3fsCurlcallbacks #2434