From 777ad8f6a17d11e4582cf11d332a1a4d4c0c706f Mon Sep 17 00:00:00 2001 From: Sanoj Unnikrishnan Date: Wed, 19 Jul 2017 18:40:38 +0530 Subject: Heal root xattr correctly upon an add-brick operation When an add-brick is performed the root path xattr is healed using a hook script. For a volume in stopped state, the hook script is triggered in post op of add-brick. Otherwise, if the volume is in started state the hook script is started on a subsequent volume start. The script unlinks itself after execution. The issue is that current hook script does not work when you have multiple volumes in stopped state. A hook script meant for volume1 can get trigerred during start of volume2. Fix: create separate hook script links for individual volumes. Bug: 1472609 Change-Id: If5f056509505fdbbbf73d3363e9966047ae6a3d3 Signed-off-by: Sanoj Unnikrishnan Reviewed-on: https://review.gluster.org/17824 Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra G --- .../add-brick/post/disabled-quota-root-xattr-heal.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'extras/hook-scripts/add-brick/post') diff --git a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh index bde7249d429..ee3ad341e16 100755 --- a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh +++ b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh @@ -20,7 +20,10 @@ VOL_NAME= VERSION= VOLUME_OP= GLUSTERD_WORKDIR= -ENABLED_NAME="S28Quota-root-xattr-heal.sh" +ENABLED_NAME_PREFIX="S28" +ENABLED_NAME="Quota-root-xattr-heal.sh" + +THIS_SCRIPT=`echo $0 | awk -F'/' '{print $NF}'` cleanup_mountpoint () { @@ -102,7 +105,11 @@ do done ##---------------------------------------- -ENABLED_STATE="$GLUSTERD_WORKDIR/hooks/$VERSION/$VOLUME_OP/post/$ENABLED_NAME" +ENABLED_STATE="$GLUSTERD_WORKDIR/hooks/$VERSION/$VOLUME_OP/post/""$ENABLED_NAME_PREFIX$VOL_NAME""-""$ENABLED_NAME" + +if [[ $THIS_SCRIPT != *"$VOL_NAME"* ]]; then + exit 0 +fi ## Is quota enabled? FLAG=`grep "^features.quota=" $GLUSTERD_WORKDIR/vols/$VOL_NAME/info \ -- cgit