summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-13 01:47:33 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-15 12:53:52 -0500
commit039fd4064af9d6171ae5bf87a199f61e7e3da718 (patch)
treee633986cf7b3acffb81ed0ae193582a5a69fc2dd
parent5ed0dcc00100c2f361e917760bd114a7af12394a (diff)
cmd_mount: Use noxcl for opening block devicesv1.4.1
We're only reading the superblocks, no need for O_EXCL - and this fixes mounts failing because we're still holding the devices open. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--rust-src/src/cmd_mount.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/rust-src/src/cmd_mount.rs b/rust-src/src/cmd_mount.rs
index 6db109c4..eccfe6d0 100644
--- a/rust-src/src/cmd_mount.rs
+++ b/rust-src/src/cmd_mount.rs
@@ -1,5 +1,5 @@
use atty::Stream;
-use bch_bindgen::{bcachefs, bcachefs::bch_sb_handle};
+use bch_bindgen::{bcachefs, bcachefs::bch_sb_handle, opt_set};
use log::{info, debug, error, LevelFilter};
use clap::{Parser};
use uuid::Uuid;
@@ -104,7 +104,10 @@ fn read_super_silent(path: &std::path::PathBuf) -> anyhow::Result<bch_sb_handle>
// Stop libbcachefs from spamming the output
let _gag = gag::BufferRedirect::stdout().unwrap();
- bch_bindgen::rs::read_super(&path)
+ let mut opts = bcachefs::bch_opts::default();
+ opt_set!(opts, noexcl, 1);
+
+ bch_bindgen::rs::read_super_opts(&path, opts)
}
fn get_devices_by_uuid(uuid: Uuid) -> anyhow::Result<Vec<(PathBuf, bch_sb_handle)>> {
@@ -188,7 +191,7 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> {
for dev in opt.dev.split(':') {
let dev = PathBuf::from(dev);
- sbs.push(bch_bindgen::rs::read_super(&dev)?);
+ sbs.push(read_super_silent(&dev)?);
}
(opt.dev, sbs)