From 6ff62cf2baaa5c8a8e270c193822e5b57691ebd2 Mon Sep 17 00:00:00 2001 From: Christian Denk Date: Wed, 27 Oct 2021 22:27:45 +0200 Subject: [PATCH] On branch sync-after-delete Your branch is up to date with 'origin/sync-after-delete'. Changes to be committed: modified: btrbk modified: ssh_filter_btrbk.sh btrbk: - included the btrbk filesystem sync command for btrfs-progs-sudo - inserted the btrbk filesystem sync command in between btrfs subvolume delete and btrfs subvolume sync in case "btrfs_commit_delete=sync" Rationale: The btrfs filesystem sync actually triggers the deletion of the subvolume right away. Therefore, btrfs subvolume sync does not wait so long. --- btrbk | 4 ++++ ssh_filter_btrbk.sh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/btrbk b/btrbk index f0fcac0..ce18adb 100755 --- a/btrbk +++ b/btrbk @@ -321,6 +321,7 @@ my %backend_cmd_map = ( "btrfs subvolume snapshot" => [ "sudo", "-n", "btrfs", "subvolume", "snapshot" ], "btrfs subvolume delete" => [ "sudo", "-n", "btrfs", "subvolume", "delete" ], "btrfs subvolume sync" => [ "sudo", "-n", "btrfs", "subvolume", "sync" ], + "btrfs filesystem sync" => [ "sudo", "-n", "btrfs", "filesystem", "sync" ], "btrfs send" => [ "sudo", "-n", "btrfs", "send" ], "btrfs receive" => [ "sudo", "-n", "btrfs", "receive" ], "btrfs filesystem usage" => [ "sudo", "-n", "btrfs", "filesystem", "usage" ], @@ -1477,6 +1478,9 @@ sub btrfs_subvolume_delete($@) fatal_stderr => sub { m/^ERROR: /; }, # probably not needed, "btrfs sub delete" returns correct exit status filter_stderr => \&_btrfs_filter_stderr, ); + $ret = run_cmd(cmd => vinfo_cmd($target, "btrfs filesystem sync", { unsafe => $target->{VINFO_MOUNTPOINT}{PATH} } ), + rsh => vinfo_rsh($target), + ); $ret = run_cmd(cmd => vinfo_cmd($target, "btrfs subvolume sync", { unsafe => $target->{VINFO_MOUNTPOINT}{PATH} }, $target->{node}{id} ), rsh => vinfo_rsh($target), ); diff --git a/ssh_filter_btrbk.sh b/ssh_filter_btrbk.sh index c1d47b7..bd3c2fe 100755 --- a/ssh_filter_btrbk.sh +++ b/ssh_filter_btrbk.sh @@ -140,6 +140,8 @@ while [[ "$#" -ge 1 ]]; do -d|--delete) allow_cmd "${sudo_prefix}btrfs subvolume delete" + allow_cmd "${sudo_prefix}btrfs subvolume sync" + allow_cmd "${sudo_prefix}btrfs filesystem sync" ;; -i|--info)