9c1d7cebbc
When subvols-per-directory is < available subvols, then there are layouts which are not populated. This leads to incorrect identification of holes or overlaps. We need to ignore layouts, which have err == 0, and start == stop. In the current scenario (start == stop == 0). Additionally, in layout-merge, treat missing xattrs as err = 0. In case of missing layouts, anomalies will reset them. For any other valid subvoles, err != 0 in case of layouts being zeroed out. Also reverted back dht_selfheal_dir_xattr, which does layout calculation only on subvols which have errors. Change-Id: I9f57062722c9e8a26285e10675c31a78921115a1 BUG: 921408 Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.org/4668 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
80 lines
1.7 KiB
Bash
80 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
function get_layout()
|
|
{
|
|
getfattr -n trusted.glusterfs.dht -e hex $1 2>&1|grep dht |cut -d = -f2
|
|
|
|
}
|
|
|
|
## 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
|
|
}
|
|
|
|
|
|
function rebalance_completed()
|
|
{
|
|
val=1
|
|
test=`gluster volume rebalance $V0 status |grep localhost|grep -v "in progress" 2>&1`
|
|
if [ $? -eq 0 ]
|
|
then
|
|
val=0
|
|
fi
|
|
|
|
echo $val
|
|
}
|