diff options
author | shishir gowda <sgowda@redhat.com> | 2013-02-11 22:27:29 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-03-04 02:40:01 -0800 |
commit | 41400b3a4e34a77af5e13ba926ec372291553fe6 (patch) | |
tree | 256f90fc695d5730fdbb4cf35200c301759f0f11 /tests/dht.rc | |
parent | 6a303c8b9ce01d17453914841f5b61bf9daf91ac (diff) |
cluster/dht: Create linkfile with file uid/gid
Currently, linkfile creation happens as root.
use uid/gid returned from _cbk (link/rename) to set the correct ownership of
the link files.
Also added test/dht.rc to implement common dht functions
BUG: 884597
Change-Id: I6bc0e04f62d4716fc033681e5678e852a1be7a2f
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4607
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'tests/dht.rc')
-rw-r--r-- | tests/dht.rc | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/dht.rc b/tests/dht.rc new file mode 100644 index 00000000000..1c811a63c6e --- /dev/null +++ b/tests/dht.rc @@ -0,0 +1,72 @@ +#!/bin/bash + +function get_layout() +{ + layout=`getfattr -n trusted.glusterfs.dht -e hex $1 2>&1|grep dht |cut -d = -f2` + if [ $? -eq 1] + then + return -1 + else + return $layout + fi + +} + +## populates $BRICK1 and $BRICK2 with hashed/cached subvolume. These will be +## used by get_cached_brick and get_hashed_brick + +function file_has_linkfile() +{ + k=0 + l=0 + while [ $k -lt $BRICK_COUNT ] + do + stat=`stat $B0/${V0}$k/$1 2>/dev/null` + if [ $? -eq 0 ] + then + let l++ + let "BRICK${l}=$k" + + fi + let k++ + done + return $l +} + +function get_cached_brick() +{ + i=1 + brick=$BRICK1 + while [ $i -lt 3 ] + do + test=`getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1` + if [ $? -eq 1 ] + then + cached=$brick + i=$(( $i+3 )) + fi + brick=$BRICK1 + let i++ + done + + return $cached +} + +function get_hashed_brick() +{ + j=1 + brick=$BRICK1 + while [ $j -lt 3 ] + do + test=`getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1` + if [ $? -eq 0 ] + then + hashed=$brick + j=$(( $j+3 )) + fi + brick=$BRICK2 + let j++ + done + + return $hashed +} |