From 6cb2106c22e1ea3758ac63dc725b888470f5dd5a Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Tue, 22 Oct 2013 16:12:58 +0530 Subject: features/quota: Metadata cleanup Quota and marker uses 'trusted.glusterfs.quota*' and 'trusted.pgfid*' xattrs to store its configurations and accounting information and also to build the parent inode chain in case of absense of path. Problem: After disabling and then enabling quota back, the xattrs may contain stale data leading to impaired accounting and thus improper enforcement. Solution: Clean up all the quota related xattrs after quota disable. Marker xlator implements a virtual xattr to cleanup quota and pgfid xattrs. In this approach glusterd mounts an auxiliary mount and sends the below command to all the files by crawling the mountpoint. #setfattr -n "glusterfs.quota-xattr-cleanup" -v 1 Credit: Krishnan Parthasarathi Varun Shastry Change-Id: I9380eca58a285dc27dd572de1767aac8f2cd8049 BUG: 969461 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/6369 Reviewed-by: Raghavendra G Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Vijay Bellur Reviewed-on: http://review.gluster.org/6838 --- extras/Makefile.am | 10 ++++------ extras/quota-metadata-cleanup.sh | 24 ------------------------ extras/quota-remove-xattr.sh | 24 ------------------------ 3 files changed, 4 insertions(+), 54 deletions(-) delete mode 100755 extras/quota-metadata-cleanup.sh delete mode 100755 extras/quota-remove-xattr.sh (limited to 'extras') diff --git a/extras/Makefile.am b/extras/Makefile.am index cf619329b75..2633e20a571 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -1,4 +1,3 @@ - EditorModedir = $(docdir) EditorMode_DATA = glusterfs-mode.el glusterfs.vim @@ -13,8 +12,7 @@ vol_DATA = glusterd.vol 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 glusterfs-logrotate clear_xattrs.sh \ - group-virt.example glusterd-sysconfig gluster-rsyslog-7.2.conf \ - gluster-rsyslog-5.8.conf logger.conf.example glusterd.vol \ - glusterfs-georep-logrotate + backend-cleanup.sh disk_usage_sync.sh glusterfs-logrotate \ + clear_xattrs.sh group-virt.example glusterd-sysconfig \ + gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.conf \ + logger.conf.example glusterd.vol glusterfs-georep-logrotate diff --git a/extras/quota-metadata-cleanup.sh b/extras/quota-metadata-cleanup.sh deleted file mode 100755 index 37ad8bc3137..00000000000 --- a/extras/quota-metadata-cleanup.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 " -} - -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 deleted file mode 100755 index 7191f9bd443..00000000000 --- a/extras/quota-remove-xattr.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 " -} - -main () -{ - [ $# -ne 1 ] && usage $0 - - XATTR_KEY_VALUE_PAIRS=`getfattr -h -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 -h -x $XATTR_KEY $1 - done -} - -main $@ -- cgit