summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/Makefile.am2
-rwxr-xr-xextras/quota-metadata-cleanup.sh24
-rwxr-xr-xextras/quota-remove-xattr.sh24
3 files changed, 49 insertions, 1 deletions
diff --git a/extras/Makefile.am b/extras/Makefile.am
index 9deb3dfa188..048227a1287 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -5,5 +5,5 @@ EditorMode_DATA = glusterfs-mode.el glusterfs.vim
SUBDIRS = init.d benchmarking
-EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim migrate-unify-to-distribute.sh backend-xattr-sanitize.sh backend-cleanup.sh disk_usage_sync.sh
+EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim migrate-unify-to-distribute.sh backend-xattr-sanitize.sh backend-cleanup.sh disk_usage_sync.sh quota-remove-xattr.sh quota-metadata-cleanup.sh
diff --git a/extras/quota-metadata-cleanup.sh b/extras/quota-metadata-cleanup.sh
new file mode 100755
index 00000000000..37ad8bc3137
--- /dev/null
+++ b/extras/quota-metadata-cleanup.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# This script is used to cleanup xattrs setup by quota-translator in (a)
+# backend directory(ies). It takes a single or list of backend directories
+# as argument(s).
+
+usage ()
+{
+ echo >&2 "usage: $0 <list-of-backend-directories>"
+}
+
+main ()
+{
+ [ $# -lt 1 ] && usage
+
+ INSTALL_DIR=`dirname $0`
+
+ for i in $@; do
+ find $i -exec $INSTALL_DIR/quota-remove-xattr.sh '{}' \;
+ done
+
+}
+
+main $@
diff --git a/extras/quota-remove-xattr.sh b/extras/quota-remove-xattr.sh
new file mode 100755
index 00000000000..83e8c292e84
--- /dev/null
+++ b/extras/quota-remove-xattr.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# This script is used to remove xattrs set by quota translator on a path.
+# It is generally invoked from quota-metadata-cleanup.sh, but can
+# also be used stand-alone.
+
+usage ()
+{
+ echo >&2 "usage: $0 <path>"
+}
+
+main ()
+{
+ [ $# -ne 1 ] && usage $0
+
+ XATTR_KEY_VALUE_PAIRS=`getfattr -d -m 'trusted.glusterfs.quota' $1 2>/dev/null | sed -e '/^# file/d'`
+
+ for i in $XATTR_KEY_VALUE_PAIRS; do
+ XATTR_KEY=`echo $i | sed -e 's/\([^=]*\).*/\1/g'`
+ setfattr -x $XATTR_KEY $1
+ done
+}
+
+main $@