summaryrefslogtreecommitdiffstats
path: root/src/tools/rbd_nbd/rbd-nbd_quiesce
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/tools/rbd_nbd/rbd-nbd_quiesce
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/rbd_nbd/rbd-nbd_quiesce')
-rwxr-xr-xsrc/tools/rbd_nbd/rbd-nbd_quiesce31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tools/rbd_nbd/rbd-nbd_quiesce b/src/tools/rbd_nbd/rbd-nbd_quiesce
new file mode 100755
index 000000000..a62a12b15
--- /dev/null
+++ b/src/tools/rbd_nbd/rbd-nbd_quiesce
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+echo "$0 $@" >&2
+
+if [ $# -lt 2 ]; then
+ echo "usage: $0 <dev> <cmd>" >&2
+ exit 1
+fi
+
+dev=$1
+cmd=$2
+
+export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+
+findmnt -S "${dev}" -fno TARGET |
+while read mnt; do
+ case "${cmd}" in
+ quiesce)
+ echo "freezing ${mnt}" >&2
+ fsfreeze -f "${mnt}"
+ ;;
+ unquiesce)
+ echo "unfreezing ${mnt}" >&2
+ fsfreeze -u "${mnt}"
+ ;;
+ *)
+ echo "unknown command ${cmd}" >&2
+ exit 1
+ ;;
+ esac
+done