build / build (push) Successful in 9m26s
0005-posix-no-symlinks.patch makes VersityGW's posix backend resolve every path below its root and versioning directory from a descriptor of that directory, opened once at start: each directory on the way with openat2 and RESOLVE_NO_SYMLINKS|RESOLVE_BENEATH (one O_NOFOLLOW open per element where openat2 is missing), the last element acted on without following it. Upstream followed a link anywhere on a key's way, so on a host that mounts more than one namespace a link planted in a bucket served, overwrote and deleted another namespace's objects (Norn M5 stage 13). A link, FIFO, socket or device is no object: at the end of a key it reads as missing (404) and is never opened, on the way it answers as a file there does (404, 409 ObjectParentIsFile), listings skip it and never enter it, and PUT, copy, complete and DELETE act on the entry itself, never on what a link points to (owner, 2026-11-27). --bucketlinks still follows a link at the bucket level only. Proven on leil-rig on 2026-11-27, against a stock 0001-0004 control: - tests/no-symlinks/proof.sh, throwaway gateways on leil-test-1: 87/87 (control 38/87). - tests/no-symlinks/rig-replay.sh, with the build pinned on the rig's four instances: 75/75 twice (control 17/75). - rig-gateway-check.sh 20/20 in both namespaces. - go test, every package but plugins/: 35/35. The rig was put back on 26e5a763. docs/no-symlinks.md has the rules, the proof and what it costs: GET +3-9%, HEAD +8-25%, listings 2x on a local disk and within noise on LeilFS. README.md and docs/multi-version-pipeline.md name the patch and how to check a rebase of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
2.9 KiB
Bash
57 lines
2.9 KiB
Bash
#!/bin/bash
|
|
#
|
|
# What 0005's resolution costs: one throwaway gateway from the given binary on
|
|
# 127.0.0.1:${BENCH_PORT:-7395}, posix on ${BENCH_DIR:-/var/tmp/s3gw-nf-bench}, internal IAM.
|
|
#
|
|
# sudo bash bench.sh /path/to/versitygw [count]
|
|
#
|
|
# Times <count> (default 500) PUT, GET, HEAD and DELETE calls of 1 KiB objects
|
|
# four directories deep, and ten listings of them (bench.py), then counts the
|
|
# gateway's system calls (strace -f -c) for 100 GETs and 100 HEADs of one of
|
|
# them. Run it with the patched build and with a stock one on the same node, one
|
|
# after the other. Nothing installed is touched; the directory is removed at
|
|
# exit.
|
|
|
|
set -uo pipefail
|
|
|
|
VGW=${1:?usage: bench.sh /path/to/versitygw [count]}
|
|
COUNT=${2:-500}
|
|
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
export S3REQ=${S3REQ:-$HERE/../owner-scope/s3req.py}
|
|
PORT=${BENCH_PORT:-7395}
|
|
W=${BENCH_DIR:-/var/tmp/s3gw-nf-bench}
|
|
export S3_ENDPOINT=http://127.0.0.1:$PORT S3_REGION=us-east-1
|
|
|
|
[ -x "$VGW" ] || { echo "FATAL: $VGW is not an executable" >&2; exit 2; }
|
|
rm -rf "$W" && mkdir -p "$W/iam" "$W/data" || exit 2
|
|
RK=benchroot RS=$(python3 -c 'import secrets; print(secrets.token_hex(16))')
|
|
export S3_KEY=bench S3_SECRET=$(python3 -c 'import secrets; print(secrets.token_hex(16))')
|
|
"$VGW" --access "$RK" --secret "$RS" --region "$S3_REGION" --port "127.0.0.1:$PORT" --iam-dir "$W/iam" \
|
|
posix "$W/data" >"$W/gateway.log" 2>&1 &
|
|
GW=$!
|
|
trap 'kill $GW 2>/dev/null; wait $GW 2>/dev/null; rm -rf "$W"' EXIT
|
|
for _ in $(seq 1 50); do (exec 3<>"/dev/tcp/127.0.0.1/$PORT") 2>/dev/null && break; sleep 0.2; done
|
|
admin() { ADMIN_ACCESS_KEY_ID=$RK ADMIN_SECRET_ACCESS_KEY=$RS "$VGW" admin --region "$S3_REGION" --endpoint-url "$S3_ENDPOINT" "$@"; }
|
|
admin create-user --access "$S3_KEY" --secret "$S3_SECRET" --role user --user-id 74990 --group-id 74990 >/dev/null &&
|
|
admin create-bucket --owner "$S3_KEY" --bucket bench >/dev/null || { echo "FATAL: setup failed" >&2; exit 2; }
|
|
|
|
echo "versitygw sha256 $(sha256sum "$VGW" | cut -c1-16), $(uname -r), $(df -T "$W" | awk 'NR==2 {print $2}')"
|
|
python3 "$HERE/bench.py" bench "$COUNT" || exit 1
|
|
|
|
if command -v strace >/dev/null; then
|
|
printf 'x' >"$W/one" && python3 "$S3REQ" PUT /bench/s/a/b/c/one.txt --body "$W/one" >/dev/null
|
|
for method in GET HEAD; do
|
|
strace -f -c -o "$W/strace.$method" -p "$GW" 2>/dev/null &
|
|
ST=$!
|
|
sleep 1
|
|
for _ in $(seq 1 100); do python3 "$S3REQ" "$method" /bench/s/a/b/c/one.txt -o /dev/null >/dev/null; done
|
|
sleep 0.5
|
|
kill -INT "$ST"; wait "$ST" 2>/dev/null
|
|
# rows: % time, seconds, usecs/call, calls, [errors,] syscall
|
|
total=$(awk '$1 ~ /^[0-9.]+$/ && $NF != "total" {s += $4} END {print s + 0}' "$W/strace.$method")
|
|
top=$(awk '$1 ~ /^[0-9.]+$/ && $NF != "total" {print $NF ":" $4}' "$W/strace.$method" |
|
|
sort -t: -k2 -rn | head -8 | tr '\n' ' ')
|
|
echo "$method x100: $total system calls in the gateway ($((total / 100)) a call); most: $top"
|
|
done
|
|
fi
|