summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flo@geekplace.eu>2024-10-25 10:44:21 +0200
committerFlorian Schmaus <flo@geekplace.eu>2024-10-25 10:46:26 +0200
commit9ed0f3fd723ba1efa6c8ccee19d65f06820c64d0 (patch)
treefc7e49a441175a9aa39d3dcb8748252b8bcd2d59
parent4f9293b045cf32dfc629ce300180d311aba8f53a (diff)
mount: print a helpful error message
Just returning a failure exit status makes it hard to tell what the actual issue was. Instead, the mount command now also provides some textual output. See https://github.com/koverstreet/bcachefs-tools/issues/308 for an example where mount does not provide any helpful output, even with BCACHEFS_LOG=trace enabled. Signed-off-by: Florian Schmaus <flo@geekplace.eu>
-rw-r--r--src/commands/mount.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/commands/mount.rs b/src/commands/mount.rs
index fe69bf57..5bda4075 100644
--- a/src/commands/mount.rs
+++ b/src/commands/mount.rs
@@ -10,7 +10,7 @@ use std::{
use anyhow::{ensure, Result};
use bch_bindgen::{bcachefs, bcachefs::bch_sb_handle, opt_set, path_to_cstr};
use clap::Parser;
-use log::{debug, info};
+use log::{debug, error, info};
use uuid::Uuid;
use crate::{
@@ -385,6 +385,9 @@ pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> std::process::
match cmd_mount_inner(&cli) {
Ok(_) => std::process::ExitCode::SUCCESS,
- Err(_) => std::process::ExitCode::FAILURE,
+ Err(e) => {
+ error!("Mount failed: {e}");
+ std::process::ExitCode::FAILURE
+ }
}
}