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

feat(bin/ofs): privileged mount #4507

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
32 changes: 2 additions & 30 deletions bin/ofs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bin/ofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ fuse3 = { "version" = "0.7.1", "features" = ["tokio-runtime", "unprivileged"] }
futures-util = "0.3.30"
libc = "0.2.151"
log = "0.4.21"
nix = { version = "0.27.1", features = ["user"] }
nix = { version = "0.28.0", features = ["user"] }
opendal = { version = "0.45.1", path = "../../core" }
sharded-slab = "0.1.7"
tokio = { version = "1.37", features = [
tokio = { version = "1.37.0", features = [
"fs",
"macros",
"rt-multi-thread",
"rt",
"io-std",
"signal",
] }
Expand Down
3 changes: 2 additions & 1 deletion bin/ofs/src/bin/ofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
use anyhow::Result;
use clap::Parser;

#[tokio::main]
// FIXME: https://github.com/Sherlock-Holo/fuse3/issues/91
Copy link
Member

Choose a reason for hiding this comment

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

Please don't link to external issues directly. Create an issue in opendal and add this link as references.

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let cfg = ofs::Config::parse();

Expand Down
14 changes: 11 additions & 3 deletions bin/ofs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,20 @@ async fn execute_inner(args: Args) -> Result<()> {
mount_option.uid(uid.into());
mount_option.gid(gid.into());
mount_option.no_open_dir_support(true);
mount_option.read_only(true);

let adapter = fuse::Fuse::new(args.backend, uid.into(), gid.into());

let mut mount_handle = Session::new(mount_option)
.mount_with_unprivileged(adapter, args.mount_path)
.await?;
let session = Session::new(mount_option);

let mut mount_handle = if uid.is_root() {
session.mount(adapter, args.mount_path).await?
} else {
log::warn!("unprivileged mount may not detect external unmount, tracking issue: https://github.com/Sherlock-Holo/fuse3/issues/72");
Copy link
Member

Choose a reason for hiding this comment

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

I think we have resolved it in #4393 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No we not

session
.mount_with_unprivileged(adapter, args.mount_path)
.await?
};

let handle = &mut mount_handle;

Expand Down