pkgsrc/filesystems/glusterfs/files/xattr-init.sh
manu 157d3fb8fa - Use linkat(2) if available. This fixes a EPERM error when using rename(2)
on a symlink within a glusterfs volume that uses DHT
- Consider gfid changes as nn fatal. Glustefs will fix instead of panic.
2011-08-09 07:15:42 +00:00

67 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
# $NetBSD: xattr-init.sh,v 1.8 2011/08/09 07:15:42 manu Exp $
GLUSTERFS_XATTR="
trusted.distribute.linkinfo
trusted.distribute.fix.layout
trusted.glusterfs.pathinfo
trusted.glusterfs.volume-mark
trusted.glusterfs.test
trusted.posix1.gen
trusted.gfid
trusted.afr
glusterfs.open-fd-count
glusterfs.inodelk-count
glusterfs.entrylk-count
glusterfs.posixlk-count
"
test $# -ne 1 && {
echo "usage: $0 /export/volume/path"
exit 1
}
VOLUME=$1
test -d ${VOLUME} || {
echo "$0: ${VOLUME} is not a directory"
exit 1
}
mkdir -p ${VOLUME}/.attribute/user || {
echo "$0: cannot create ${VOLUME}/.attribute/user"
exit 1
}
mkdir -p ${VOLUME}/.attribute/system || {
echo "$0: cannot create ${VOLUME}/.attribute/system"
exit 1
}
extattrctl start ${VOLUME} || {
echo "$0: cannot start extended attributes on ${VOLUME}"
exit 1
}
for attr in ${GLUSTERFS_XATTR} ; do
ns="user";
echo ${attr} | egrep -q '^(trusted|system|security)\.' && ns="system"
attrfile=${VOLUME}/.attribute/${ns}/${attr}
test -e ${attrfile} && {
echo "$0: ${attrfile} exists."
exit 1
}
extattrctl initattr 1024 ${attrfile} || {
echo "$0: cannot initialize ${attrfile}"
exit 1
}
extattrctl enable ${VOLUME} ${ns} ${attr} ${attrfile} || {
echo "$0: cannot enable ${attr} backed by ${attrfile}"
exit 1
}
done