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

Add fuse3 #325

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
72cbdae
First pass using fuse3
jfantinhardesty Aug 28, 2024
57d6622
Fix builds for Linux
jfantinhardesty Sep 3, 2024
b740bff
Try to build seperate fuse2, fuse3 releases for cloudfuse. Fuse3 on L…
jfantinhardesty Sep 3, 2024
eeb7ba4
Change build script to build fuse2 or fuse3
jfantinhardesty Sep 3, 2024
1ed540b
Merge branch 'main' into add-fuse3
jfantinhardesty Sep 13, 2024
c274872
Fix libfuse struct
jfantinhardesty Sep 13, 2024
4aa9a61
Merge branch 'main' into add-fuse3
jfantinhardesty Sep 16, 2024
fa004b1
Zig compiling fuse3 on Linux amd64
jfantinhardesty Sep 16, 2024
39fcf90
Fix for fuse3 on Linux amd64
jfantinhardesty Sep 16, 2024
a850fff
Add cross compilation for arm64 with fuse3
jfantinhardesty Sep 18, 2024
d288f5d
Merge branch 'main' into add-fuse3
jfantinhardesty Sep 18, 2024
c9250e2
Use only fuse2 for builds
jfantinhardesty Sep 19, 2024
ea4269a
Move to use only fuse3 for Linux
jfantinhardesty Sep 19, 2024
1135e3b
Cleanup archives for goreleaser
jfantinhardesty Sep 19, 2024
4e81847
Cleanup libfuse2 code for windows
jfantinhardesty Sep 23, 2024
a94c8ce
Fix linting and build issues
jfantinhardesty Sep 23, 2024
7852eb8
Merge branch 'main' into add-fuse3
jfantinhardesty Sep 23, 2024
764cced
Cleanup documentation
jfantinhardesty Sep 23, 2024
e37af90
Merge branch 'main' into add-fuse3
jfantinhardesty Sep 25, 2024
55a3290
Merge branch 'main' into add-fuse3
jfantinhardesty Oct 17, 2024
d74ba2e
Merge branch 'main' into add-fuse3
jfantinhardesty Oct 18, 2024
6599364
Merge branch 'main' into add-fuse3
jfantinhardesty Oct 30, 2024
63dfd00
Support fuse2 using build flags
jfantinhardesty Oct 30, 2024
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
14 changes: 6 additions & 8 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- job_name: linux
os: ubuntu-latest
containerName: 'test-cnt-ubn'
fuselib: libfuse-dev
fuselib2: fuse
fuselib: libfuse3-dev
fuselib2: fuse3

runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -50,8 +50,7 @@ jobs:

- name: Install libfuse
run: |-
sudo apt-get update --fix-missing -o Dpkg::Options::="--force-confnew"
sudo apt-get install make cmake gcc g++ parallel ${{ matrix.fuselib }} ${{ matrix.fuselib2 }} -y -o Dpkg::Options::="--force-confnew"
sudo apt-get install ${{ matrix.fuselib }} ${{ matrix.fuselib2 }}

- name: Create Directory Structure
run: |-
Expand Down Expand Up @@ -1012,8 +1011,8 @@ jobs:
- job_name: linux
os: ubuntu-latest
containerName: 'test-cnt-ubn'
fuselib: libfuse-dev
fuselib2: fuse
fuselib: libfuse3-dev
fuselib2: fuse3

runs-on: ${{ matrix.os }}
timeout-minutes: 30
Expand All @@ -1030,8 +1029,7 @@ jobs:

- name: Install dependency
run: |-
sudo apt-get update --fix-missing -o Dpkg::Options::="--force-confnew"
sudo apt-get install make cmake gcc g++ parallel ${{ matrix.fuselib }} ${{ matrix.fuselib2 }} -y -o Dpkg::Options::="--force-confnew"
sudo apt-get install ${{ matrix.fuselib }} ${{ matrix.fuselib2 }}

- name: Cleanup Blob Storage
run: go test -timeout 120m -v test/accoutcleanup/accountcleanup_test.go
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,19 @@ jobs:
zig: 0.13.0

steps:
- # libfuse-dev is required to build our command-line program
- name: Add arm64 repository
run: |
echo -e "deb [arch=arm64] http://ports.ubuntu.com/ jammy main restricted\n" "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main restricted\n" "deb [arch=arm64] http://ports.ubuntu.com/ jammy universe\n" "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates universe\n" "deb [arch=arm64] http://ports.ubuntu.com/ jammy multiverse\n" "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates multiverse\n" "deb [arch=arm64] http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/arm-cross-compile-sources.list
sudo dpkg --add-architecture arm64
sudo apt-get update
- # libfuse3-dev is required to build our command-line program
name: Install Libfuse
run: |
sudo apt-get install -y libfuse-dev
sudo apt-get install -y libfuse3-dev
- # enable GoReleaser to build for ARM64
name: Install ARM64 compilers
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
sudo apt-get install -y gcc-aarch64-linux-gnu libfuse3-dev:arm64
- # Get code and Go ready
name: Checkout code
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install libfuse on Linux
shell: bash
run: |
sudo apt-get install fuse3 libfuse-dev rpm pkg-config
sudo apt-get install fuse3 libfuse3-dev rpm pkg-config

- name: Build
run: |
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
- name: Install libfuse on Linux
shell: bash
run: |
sudo apt-get install libfuse-dev
sudo apt-get install libfuse3-dev

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
Expand Down
31 changes: 17 additions & 14 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ builds:
- amd64
env:
- CGO_ENABLED=1
- CC=zig cc -target x86_64-linux-gnu
- CXX=zig c++ -target x86_64-linux-gnu
- CGO_LDFLAGS=-L/usr/lib/x86_64-linux-gnu
- CC=zig cc -target x86_64-linux-gnu -isystem /usr/lib/x86_64-linux-gnu -iwithsysroot /usr/include
- CXX=zig c++ -target x86_64-linux-gnu -isystem /usr/lib/x86_64-linux-gnu -iwithsysroot /usr/include
flags:
- -trimpath
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- -s -w -X github.com/Seagate/cloudfuse/common.GitCommit={{.Commit}} -X github.com/Seagate/cloudfuse/common.CommitDate={{ .CommitDate }}
- -s -w -X github.com/Seagate/cloudfuse/common.GitCommit={{.Commit}} -X github.com/Seagate/cloudfuse/common.CommitDate={{ .CommitDate }} -L /usr/lib/x86_64-linux-gnu

- id: linux-amd64-health-monitor
main: ./tools/health-monitor/main.go
Expand All @@ -86,16 +87,17 @@ builds:
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- -s -w -X github.com/Seagate/cloudfuse/common.GitCommit={{.Commit}} -X github.com/Seagate/cloudfuse/common.CommitDate={{ .CommitDate }}

- id: linux-arm64
goos:
- linux
goarch:
- arm64
env:
- CGO_ENABLED=1
- CC=zig cc -target aarch64-linux-gnu
- CXX=zig c++ -target aarch64-linux-gnu
- CGO_LDFLAGS=-L/usr/lib/aarch64-linux-gnu
- CC=zig cc -target aarch64-linux-gnu -isystem /usr/lib/aarch64-linux-gnu -iwithsysroot /usr/include
- CXX=zig c++ -target aarch64-linux-gnu -isystem /usr/lib/aarch64-linux-gnu -iwithsysroot /usr/include
flags:
- -trimpath
mod_timestamp: '{{ .CommitTimestamp }}'
Expand Down Expand Up @@ -145,7 +147,7 @@ archives:
dst: "./samples/sampleStreamingConfigS3.yaml"
- src: "sampleStreamingConfigAzure.yaml"
dst: "./samples/sampleStreamingConfigAzure.yaml"

- id: linux-amd64_no_gui
builds:
- linux-amd64
Expand All @@ -168,7 +170,7 @@ archives:
dst: "./samples/sampleStreamingConfigS3.yaml"
- src: "sampleStreamingConfigAzure.yaml"
dst: "./samples/sampleStreamingConfigAzure.yaml"

- id: linux-arm64_no_gui
builds:
- linux-arm64
Expand All @@ -191,7 +193,7 @@ archives:
dst: "./samples/sampleStreamingConfigS3.yaml"
- src: "sampleStreamingConfigAzure.yaml"
dst: "./samples/sampleStreamingConfigAzure.yaml"

- id: windows
builds:
- windows
Expand All @@ -216,7 +218,7 @@ archives:
dst: "./samples/sampleStreamingConfigS3.yaml"
- src: "sampleStreamingConfigAzure.yaml"
dst: "./samples/sampleStreamingConfigAzure.yaml"

- id: windows_no_gui
builds:
- windows
Expand All @@ -240,6 +242,7 @@ archives:
- src: "sampleStreamingConfigAzure.yaml"
dst: "./samples/sampleStreamingConfigAzure.yaml"


release:
extra_files:
- glob: ./build/Output/cloudfuse_{{.Version}}_windows_amd64.exe
Expand Down Expand Up @@ -305,11 +308,11 @@ nfpms:
overrides:
deb:
dependencies:
- libfuse-dev
- libfuse3-dev

rpm:
dependencies:
- fuse-devel
- fuse3-devel

- id: linux_no_gui

Expand Down Expand Up @@ -367,11 +370,11 @@ nfpms:
overrides:
deb:
dependencies:
- libfuse-dev
- libfuse3-dev

rpm:
dependencies:
- fuse-devel
- fuse3-devel

metadata:
mod_timestamp: "{{ .CommitTimestamp }}"
17 changes: 3 additions & 14 deletions TSG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ FUSE allows mounting filesystem in user space, and is only accessible by the use
You try to unmount the blob storage, but the recommended command is not found. Whilst `umount` may work instead, fusermount is the recommended method, so install the fuse package, for example on Ubuntu 20+:

sudo apt install fuse3
please note the fuse version (2 or 3) is dependent on the linux distribution you're using. Refer to fuse version for your distro.

**8. Hangs while mounting to private link storage account**

Expand Down Expand Up @@ -249,27 +248,17 @@ For non-HNS accounts Cloudfuse expects special directory marker files to exist i

**10. File size and LMT are updated but file contents are not refreshed**

Cloudfuse supports fuse2 compatible linux distros. In all linux distros kernel cached contents of file in its page-cache. As long as cache is valid read/write are served from cache and calls will not reach to file-system drivers (Cloudfuse in our case). This page-cache is invalidated when page is swapped-out, manually cleared by user through cli or file-system driver requests for it.

In case of fuse2 compliant distros, libfuse does not support invalidating the page cache. Contents once cached will remain with kernel until user manually clears the page-cache or kernel decides to swap it out. This means even if the file size or LMT has changed and Cloudfuse decided to refresh the content by redownloading the file, on read user will still get the stale contents.

<!-- Uncomment when cgofuse supports fuse3
In case of fuse3 compliant distros, Cloudfuse configures libfuse to invalidate the page cache on file size or LMT change so this issue will not be hit.
-->

If user is observing that list or stat call to file shows updated time or size but contents are not reflecting accordingly, first confirm with Cloudfuse logs that file was indeed downloaded afresh. If file-cache-timeout has not expired then Cloudfuse will keep using the current version of file persisted on temp cache and contents will not be refreshed. If Cloudfuse has downloaded the latest file and user still observes stale contents then clear the kernel page-cache manually using ```sysctl -w vm.drop_caches=3``` command.

<!-- Uncomment when cgofuse supports fuse3
If your workflow involves updating the file directly on container (not using Cloudfuse) and you wish to get latest contents on Cloudfuse mount then do the following (for fuse3 compliant linux distro only):

- set all timeouts in libfuse section to 0 (entry, attribute, negative)
- remove attr_cache from your pipeline section in config
- set file-cache-timeout to 0
- in libfuse section of you config file add "disable-writeback-cache: true"
-->

# Problems with build

Make sure you have correctly setup your GO dev environment. Ensure you have installed fuse2 for example:
Make sure you have correctly setup your GO dev environment. Ensure you have installed fuse3 for example:

sudo apt-get install fuse libfuse-dev -y
sudo apt-get install fuse3 libfuse3-dev -y
15 changes: 11 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/bin/bash
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [ "$1" == "fuse2" ]
then
rm -rf cloudfuse
# Build cloudfuse with fuse2
go build -o cloudfuse -tags fuse2
else
rm -rf cloudfuse
# Build cloudfuse with fuse3
go build -o cloudfuse
fi

# Build Health Monitor binary
rm -rf cfusemon
go build -o cfusemon ./tools/health-monitor/

# Build cloudfuse
rm -rf cloudfuse
go build -o cloudfuse
else
rm -rf cfusemon
go build -o cfusemon.exe ./tools/health-monitor/
Expand Down
33 changes: 33 additions & 0 deletions common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,36 @@ func IsDriveLetter(path string) bool {
match, _ := regexp.MatchString(pattern, path)
return match
}

func GetFuseMinorVersion() int {
var out bytes.Buffer
cmd := exec.Command("fusermount3", "--version")
cmd.Stdout = &out

err := cmd.Run()
if err != nil {
return 0
}

output := strings.Split(out.String(), ":")
if len(output) < 2 {
return 0
}

version := strings.Trim(output[1], " ")
if version == "" {
return 0
}

output = strings.Split(version, ".")
if len(output) < 2 {
return 0
}

val, err := strconv.Atoi(output[1])
if err != nil {
return 0
}

return val
}
Loading
Loading