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

fix for #1102 #1107

Merged
merged 8 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [#1100](https://github.com/Azure/azure-storage-fuse/issues/1100) If content-encoding is set in blob then transport layer compression shall be disabled.
- Subdir mount is not able to list blobs correctly when virtual-directory is turned on.
- Adding support to pass down uid/gid values supplied in mount to libfuse.
- [#1102](https://github.com/Azure/azure-storage-fuse/issues/1102) Remove nanoseconds from file times as storage does not provide that granularity.

**Features**
- Added new CLI parameter "--sync-to-flush". Once configured sync() call on file will force upload a file to storage container. As this is file handle based api, if file was not in file-cache it will first download and then upload the file.
Expand Down
6 changes: 3 additions & 3 deletions component/libfuse/libfuse2_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,13 @@ func (lf *Libfuse) fillStat(attr *internal.ObjAttr, stbuf *C.stat_t) {
}

(*stbuf).st_atim.tv_sec = C.long(attr.Atime.Unix())
(*stbuf).st_atim.tv_nsec = C.long(attr.Atime.UnixNano())
(*stbuf).st_atim.tv_nsec = 0
gapra-msft marked this conversation as resolved.
Show resolved Hide resolved

(*stbuf).st_ctim.tv_sec = C.long(attr.Ctime.Unix())
(*stbuf).st_ctim.tv_nsec = C.long(attr.Ctime.UnixNano())
(*stbuf).st_ctim.tv_nsec = 0

(*stbuf).st_mtim.tv_sec = C.long(attr.Mtime.Unix())
(*stbuf).st_mtim.tv_nsec = C.long(attr.Mtime.UnixNano())
(*stbuf).st_mtim.tv_nsec = 0
}

// File System Operations
Expand Down
8 changes: 8 additions & 0 deletions component/libfuse/libfuse2_handler_test_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ func testCreate(suite *libfuseTestSuite) {

err := libfuse_create(path, 0775, info)
suite.assert.Equal(C.int(0), err)

option := internal.GetAttrOptions{Name: name}
suite.mock.EXPECT().GetAttr(option).Return(&internal.ObjAttr{}, nil)
stbuf := &C.stat_t{}
err = libfuse2_getattr(path, stbuf)
suite.assert.Equal(C.int(0), err)
suite.assert.Equal(stbuf.st_mtim.tv_nsec, C.long(0))
suite.assert.NotEqual(stbuf.st_mtim.tv_sec, C.long(0))
}

func testCreateError(suite *libfuseTestSuite) {
Expand Down
6 changes: 3 additions & 3 deletions component/libfuse/libfuse_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ func (lf *Libfuse) fillStat(attr *internal.ObjAttr, stbuf *C.stat_t) {
}

(*stbuf).st_atim.tv_sec = C.long(attr.Atime.Unix())
(*stbuf).st_atim.tv_nsec = C.long(attr.Atime.UnixNano())
(*stbuf).st_atim.tv_nsec = 0

(*stbuf).st_ctim.tv_sec = C.long(attr.Ctime.Unix())
(*stbuf).st_ctim.tv_nsec = C.long(attr.Ctime.UnixNano())
(*stbuf).st_ctim.tv_nsec = 0

(*stbuf).st_mtim.tv_sec = C.long(attr.Mtime.Unix())
(*stbuf).st_mtim.tv_nsec = C.long(attr.Mtime.UnixNano())
(*stbuf).st_mtim.tv_nsec = 0
}

// File System Operations
Expand Down
7 changes: 7 additions & 0 deletions component/libfuse/libfuse_handler_test_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ func testCreate(suite *libfuseTestSuite) {

err := libfuse_create(path, 0775, info)
suite.assert.Equal(C.int(0), err)
option := internal.GetAttrOptions{Name: name}
suite.mock.EXPECT().GetAttr(option).Return(&internal.ObjAttr{}, nil)
stbuf := &C.stat_t{}
err = libfuse_getattr(path, stbuf, &C.fuse_file_info_t{})
suite.assert.Equal(C.int(0), err)
suite.assert.Equal(stbuf.st_mtim.tv_nsec, C.long(0))
suite.assert.NotEqual(stbuf.st_mtim.tv_sec, C.long(0))
}

func testCreateError(suite *libfuseTestSuite) {
Expand Down