summaryrefslogtreecommitdiff
path: root/src/commands/subvolume.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/subvolume.rs')
-rw-r--r--src/commands/subvolume.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/commands/subvolume.rs b/src/commands/subvolume.rs
index a5ebcf53..64743115 100644
--- a/src/commands/subvolume.rs
+++ b/src/commands/subvolume.rs
@@ -42,6 +42,10 @@ pub fn subvolume(argv: Vec<String>) -> i32 {
match cli.subcommands {
Subcommands::Create { targets } => {
for target in targets {
+ let target = target
+ .canonicalize()
+ .expect("unable to canonicalize a target path");
+
if let Some(dirname) = target.parent() {
let fs = unsafe { BcachefsHandle::open(dirname) };
fs.create_subvolume(target)
@@ -50,6 +54,10 @@ pub fn subvolume(argv: Vec<String>) -> i32 {
}
}
Subcommands::Delete { target } => {
+ let target = target
+ .canonicalize()
+ .expect("unable to canonicalize a target path");
+
if let Some(dirname) = target.parent() {
let fs = unsafe { BcachefsHandle::open(dirname) };
fs.delete_subvolume(target)