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

Fuse OverlayFs implementation #156

Merged
merged 5 commits into from
Mar 11, 2024

Conversation

WeiZhang555
Copy link
Collaborator

These commits add first implementation of userspace OverlayFs, which aims to add writable upper layer for Nydus, and makes Nydus capable to get more control over user's file writing behavior.

The implementation refers a lot to kernel Overlay Fs, but there're still some differences due to limitation of Fuse
protocol. And the first implementation is not perfect but could be a start.

It was tested under xfstest testsuite, about 300+ test cases were tested and only 25 failed as designed or being limited by Fuse. I'll add external CI process later to make xfstest workable later.

Let me know your review opinions.

@WeiZhang555
Copy link
Collaborator Author

xfstests CI action costs about 39min, one example log: https://github.com/WeiZhang555/fuse-backend-rs/actions/runs/6322500147/job/17168241410

@bergwolf bergwolf mentioned this pull request Nov 2, 2023
@WeiZhang555 WeiZhang555 force-pushed the overlay-impl branch 3 times, most recently from 6031c63 to 48dcb15 Compare November 6, 2023 15:41
@WeiZhang555 WeiZhang555 force-pushed the overlay-impl branch 3 times, most recently from dc5b618 to e30c271 Compare November 21, 2023 07:56
.gitignore Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@@ -30,6 +30,11 @@ pub use async_io::{AsyncFileSystem, AsyncZeroCopyReader, AsyncZeroCopyWriter};
mod sync_io;
pub use sync_io::FileSystem;

#[cfg(all(any(feature = "fusedev", feature = "virtiofs"), target_os = "linux"))]
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be preferrable to mount overlayfs inside guest, so is there any need to turn on overlayfs for virtiofs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea of Fuse OverlayFS is to take over Container RootFs totally through Nydus and Fuse-backend-rs, so I suppose mounting overlayfs on host is strong requirement.

Besides, the OverlayFs replies heavily on Passthroughfs currently, so I copied #[cfg] for 'passthroughfs' from src/lib.rs:

#[cfg(all(any(feature = "fusedev", feature = "virtiofs"), target_os = "linux"))]
pub mod passthrough;

@WeiZhang555 WeiZhang555 force-pushed the overlay-impl branch 2 times, most recently from df8537a to 1af13d1 Compare January 4, 2024 11:52
@WeiZhang555 WeiZhang555 force-pushed the overlay-impl branch 6 times, most recently from 1fdbb6b to 1b20bbd Compare January 16, 2024 08:50
@WeiZhang555
Copy link
Collaborator Author

Add unionmount-testsuite as Overlay function test cases, this gave us more confidence on the functionality.

src/overlayfs/mod.rs Outdated Show resolved Hide resolved
@WeiZhang555 WeiZhang555 force-pushed the overlay-impl branch 2 times, most recently from 8f623a5 to 757cec5 Compare January 25, 2024 03:39
@WeiZhang555
Copy link
Collaborator Author

The Integration into Nydus can be seen in Nydus PR

@WeiZhang555 WeiZhang555 force-pushed the overlay-impl branch 3 times, most recently from a001087 to e5bce4a Compare February 6, 2024 06:41
@WeiZhang555
Copy link
Collaborator Author

ping @hhhhsdxxxx @jiangliu @eryugey

@hhhhsdxxxx
Copy link

lgtm

Add first implementation of overlay fs which can imitate kernel
overlay fs. This allow you to customize a union fs with many customized
layers, for example, one passthrough fs as upper layer and one NFS as
lower layer.

This can be quite useful for some projects relying on fuse-backend-rs,
e.g. Nydus, which can add writable upper layer on readonly RAFS lower
layer, to act as a complete container rootfs.

More details will be added in docs.

Signed-off-by: Yang Bo <bo@hyper.sh>
This commit refactor a lot to previous one, including:

* Modified layer trait
* Lots of bugfixes to make xfstests happy.
* Performance improvement.
* Whiteout logics
* Remove plugin & Direct layer logics.
* A better inode allocator with inode consistency guarantee.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
Add xfstests into CI for overlayfs, it will work as Github Actions.

Currently not all test cases can be run, only about half of `generic/*`
for the Fuse Overlay FS, some test cases are expected to fail due to
missing function implementation, little are unexpected due to potential
bugs which will be investigated laterly.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
Add basic introduction for overlay fs implementations, also architecture
design are illustrated.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
Add unionmount-testsuite into CI for Overlay implementation

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
@eryugey eryugey merged commit 7f485f4 into cloud-hypervisor:master Mar 11, 2024
10 checks passed
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