Skip to content

mount: support FUSE helper#3765

Merged
dmcgowan merged 1 commit intocontainerd:masterfrom
AkihiroSuda:mount-fuse
Jan 6, 2020
Merged

mount: support FUSE helper#3765
dmcgowan merged 1 commit intocontainerd:masterfrom
AkihiroSuda:mount-fuse

Conversation

@AkihiroSuda
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda commented Oct 19, 2019

When m.Type starts with either fuse. or fuse3, the mount helper binary mount.fuse or mount.fuse3 is executed.

This is expected to be used by fuse-overlayfs plugin: https://github.com/AkihiroSuda/containerd-fuse-overlayfs

Motivation

The purpose of the containerd fuse-overlayfs snapshotter plugin is to provide OverlayFS functionality for rootless mode without depending on the Ubuntu/Debian kernel patch.
Although fuse-overlayfs provides shiftfs functionality and supports CRFS plugin, these functionalities are not planned to be supported by the containerd fuse-overlayfs snapshotter plugin. (EDIT: shiftfs functionality using fuse-overlayfs snapshotter is being covered in #3885)

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Oct 19, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Oct 19, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Oct 20, 2019

Build succeeded.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 20, 2019

Codecov Report

Merging #3765 into master will decrease coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3765      +/-   ##
==========================================
- Coverage   42.42%   42.35%   -0.08%     
==========================================
  Files         130      130              
  Lines       14710    14735      +25     
==========================================
  Hits         6241     6241              
- Misses       7548     7573      +25     
  Partials      921      921
Flag Coverage Δ
#linux 45.71% <0%> (-0.1%) ⬇️
#windows 37.94% <ø> (ø) ⬆️
Impacted Files Coverage Δ
mount/mount_linux.go 26.2% <0%> (-4.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 537afb1...e739314. Read the comment docs.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Oct 20, 2019

Build succeeded.

AkihiroSuda added a commit to containerd/fuse-overlayfs-snapshotter that referenced this pull request Oct 20, 2019
Requires:

* containerd/containerd#3765
* containers/fuse-overlayfs#133

---

Older commits were imported from containerd with the following commands:

  git filter-branch --prune-empty --subdirectory-filter snapshots/overlay --msg-filter 'cat; echo; echo This commit was imported from https://github.com/containerd/containerd/commit/${GIT_COMMIT}' master
  git tag --list | xargs git tag -d

Signed-off-by: Akihiro Suda <[email protected]>
@fuweid fuweid requested a review from crosbymichael October 22, 2019 15:15
Comment thread mount/mount_linux.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is generic enough. The options should probably just be the arguments.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Oct 22, 2019

We are trying to come up with a generic way to handle resources (specifically mounts and fuse processes) for 1.4. However, for these binaries it seems we could potentially make these pluggable on their own. A few questions I have since I am not as familiar with FUSE.

  1. Will unmounting the target be sufficient for cleanup
  2. Could this be done with a sequence of mount -t commands, what are these binaries additionally doing?
  3. Does the mount need to be performed here inside of the containerd daemon or the shim?

@AkihiroSuda
Copy link
Copy Markdown
Member Author

The interface is intended to be compatible with the external helper convention described in mount(8).

  1. Will unmounting the target be sufficient for cleanup

Mostly yes, but some FUSE might want to register clean up shell command

  1. Could this be done with a sequence of mount -t commands, what are these binaries additionally doing?

Yes, I can rewrite the PR to use mount -t command.

mount -t command actually invokes mount.fuse helper, as described in the mount(8) man page.

  1. Does the mount need to be performed here inside of the containerd daemon or the shim?

Anywhere, in the daemon's mount namespace?

@AkihiroSuda
Copy link
Copy Markdown
Member Author

Calling mount command may hit GNU vs busybox vs something incompatibility.
So it seems better to call mount.<type> helper directly.

@dmcgowan
Copy link
Copy Markdown
Member

Thanks for the link, if mount.<type> has a defined format, then this make sense. It still doesn't seem necessary to handle fuse in a special way though. Maybe mount.<type>+<subtype> format or something like that, we could then do a binary lookup on mount.<type>.

Mostly yes, but some FUSE might want to register clean up shell command

How would this be registered? The plan for the new resource management proposal is that they would have the equivalent of mount and unmount. In this implementation though, there would have to be something else doing all this.

Anywhere, in the daemon's mount namespace?

I'm trying to think of this from a plugin perspective, if this was functionality we configured in the daemon, would that configuration need to be passed down to the shim.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

How would this be registered?

I was thinking that mount.proto should have repeated string umountPreCmd; repeated string umountPostCmd;

@dmcgowan
Copy link
Copy Markdown
Member

I was thinking that mount.proto should have repeated string umountPreCmd; repeated string umountPostCmd;

I don't think that is a road we want to go down. If these mounts require additional behavior we should focus on defining that as a register-able plugin interface rather than adding hooks to existing types. How much of a requirement is that to get this PR useable for what you are doing? I would really like to be able to support this but want to know if I should focus more on getting that plugin stuff working.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

umountcmd stuff is just theoretical and not needed for most FUSE fs including fuse-overlayfs

Comment thread mount/mount_linux.go Outdated
@AkihiroSuda
Copy link
Copy Markdown
Member Author

Updated PR. Now Unmount() calls fusermount -u for FUSE mounts as suggested by Giuseppe.

Thanks for the link, if mount. has a defined format, then this make sense. It still doesn't seem necessary to handle fuse in a special way though. Maybe mount.+ format or something like that, we could then do a binary lookup on mount..

Can it be follow-up PR when we face real usecase?

Anyway, fusermount logic is specific to FUSE.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Nov 13, 2019

Build succeeded.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

cc @hinshun

@hinshun
Copy link
Copy Markdown
Contributor

hinshun commented Nov 15, 2019

Thanks @AkihiroSuda. I think one issue I have with this method is that we prefer not to have duplicate FUSE drivers for a same snapshot, without doing special deduplication on the FUSE mount helper. If multiple containers share a layer, ideally there is a single FUSE driver along with the overlay mount for other layers (FUSE and non-FUSE).

@dmcgowan FYI, I described FUSE with context specific for containerd here: https://github.com/hinshun/hellofs#fuse-overview

As well as a changeset for hanwen/go-fuse that uses containerd.Mount (derived from the implementation of fusermount): https://github.com/hinshun/hellofs#hanwengo-fuse-changes

@AkihiroSuda
Copy link
Copy Markdown
Member Author

@hinshun

This PR is for non-Go fuse binaries, especially fuse-overlayfs, which is needed for providing Copy-on-Write for rootless containers on non-Ubuntu/non-Debian kernels.
This is unrelated to the continuity & CRFS discussion, even though fuse-overlayfs supports CRFS.
Sorry if this was confusing.

For FUSE filesystems written in Go, an additional PR would be needed.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

@dmcgowan Can we move this forward?

@AkihiroSuda
Copy link
Copy Markdown
Member Author

Note: #3841 is basically unrelated to this PR, though this PR might be useful for implementing #3841 as well

@fuweid
Copy link
Copy Markdown
Member

fuweid commented Dec 11, 2019

Need more time to review this. Will update comment later.

@AkihiroSuda
Copy link
Copy Markdown
Member Author

rebased

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Dec 12, 2019

Build succeeded.

Copy link
Copy Markdown
Contributor

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

the FUSE side LGTM

Comment thread mount/mount_linux.go Outdated
When m.Type starts with either `fuse.` or `fuse3`, the
mount helper binary `mount.fuse` or `mount.fuse3` is executed.

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda
Copy link
Copy Markdown
Member Author

updated PR to use FUSE_SUPER_MAGIC

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Dec 31, 2019

Build succeeded.

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

we can move it forward.

Copy link
Copy Markdown
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan dmcgowan merged commit b9fad5e into containerd:master Jan 6, 2020
AkihiroSuda added a commit to containerd/fuse-overlayfs-snapshotter that referenced this pull request Aug 17, 2020
The writeback=0 workaround should no longer be needed:
containerd/containerd#3765 (comment)

Signed-off-by: Akihiro Suda <[email protected]>
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.

6 participants