3
dhthashdebugxattr="dht.file.hashed-subvol."
7
getfattr -n trusted.glusterfs.dht -e hex $1 2>&1 | grep dht | cut -d = -f2
10
## populates $BRICK1 and $BRICK2 with hashed/cached subvolume. These will be
11
## used by get_cached_brick and get_hashed_brick
13
function file_has_linkfile()
17
while [ $k -lt $BRICK_COUNT ]
19
stat=$(stat $B0/${V0}$k/$1 2>/dev/null)
31
function get_cached_brick()
37
test=$(getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1)
50
function get_hashed_brick()
56
test=$(getfattr -n trusted.glusterfs.dht.linkto -e text $B0/${V0}$brick/$1 2>&1)
70
function cluster_rebalance_completed()
74
# Rebalance status will be either "failed" or "completed"
76
test=$($CLI_1 volume rebalance $V0 status | grep "in progress" 2>&1)
83
# Do not *return* the value here. If it's non-zero, that will cause
84
# EXPECT_WITHIN (e.g. in bug-884455.t) to return prematurely, leading to
85
# a spurious test failure. Nothing else checks the return value anyway
86
# (they all check the output) so there's no need for it to be non-zero
87
# just because grep didn't find what we want.
90
function rebalance_completed()
93
test=$($CLI volume rebalance $V0 status | grep localhost | grep "completed" 2>&1)
100
# Do not *return* the value here. If it's non-zero, that will cause
101
# EXPECT_WITHIN (e.g. in bug-884455.t) to return prematurely, leading to
102
# a spurious test failure. Nothing else checks the return value anyway
103
# (they all check the output) so there's no need for it to be non-zero
104
# just because grep didn't find what we want.
107
function remove_brick_completed()
110
test=$(gluster volume remove-brick $V0 $H0:$B0/${V0}2 status | grep localhost | grep "completed" 2>&1)
119
function dht_get_linkto_target()
122
echo $(getfattr -e text --only-values --absolute-names -n trusted.glusterfs.dht.linkto $path)
125
function is_dht_linkfile()
129
local output=$(stat -c %a $path)
130
if [ $output -eq 1000 ]; then
139
# Given an existing directory on the volume, get the hashed subvol for a file
141
# Input: filename dirpath_on_mount
143
function dht_get_hash_subvol()
146
hashed_subvol=$(getfattr --only-values -n "$dhthashdebugxattr$1" $2 2>/dev/null)
151
# Find the first filename that hashes to the same subvol
153
# Input: subvol_name dirpath_on_mount file_pattern
155
function dht_first_filename_with_hashsubvol()
160
local file_pattern=$3
165
filename="$file_pattern$i"
166
in_hash_subvol=$(dht_get_hash_subvol "$filename" "$in_path")
167
# echo $in_hash_subvol
168
if [ "$in_subvol" == "$in_hash_subvol" ]; then
169
fn_return_val=$filename
176
function has_sticky_attr()
187
function has_sgid_attr()
190
#-g checks SGID bit. -k checks for sticky bit