diff options
author | Raghavendra G <raghavendra@gluster.com> | 2011-04-07 02:51:50 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-04-07 11:40:05 -0700 |
commit | 476b672347641c3f0d6b346b13feaf530ecbbe93 (patch) | |
tree | c49851965960496877404223cb8d3246158082d5 /extras/quota-remove-xattr.sh | |
parent | 7a32aa912ea4e49d3ef922ec6e0cb3d394109962 (diff) |
extras: scripts to cleanup xattrs stored by quota.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Vijay Bellur <vijay@gluster.com>
BUG: 2664 (Quota: recreating the volume on same bricks shows similar info as for earlier one using "list")
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2664
Diffstat (limited to 'extras/quota-remove-xattr.sh')
-rwxr-xr-x | extras/quota-remove-xattr.sh | 24 |
1 files changed, 24 insertions, 0 deletions
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 $@ |