diff options
Diffstat (limited to 'src/ceph/qa/workunits/fs/misc')
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/acl.sh | 50 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/chmod.sh | 60 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/direct_io.py | 50 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/dirfrag.sh | 52 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/filelock_deadlock.py | 72 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/filelock_interrupt.py | 87 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/i_complete_vs_rename.sh | 31 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/layout_vxattrs.sh | 116 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/mkpool_layout_vxattrs.sh | 15 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/multiple_rsync.sh | 25 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/trivial_sync.sh | 7 | ||||
-rwxr-xr-x | src/ceph/qa/workunits/fs/misc/xattrs.sh | 14 |
12 files changed, 0 insertions, 579 deletions
diff --git a/src/ceph/qa/workunits/fs/misc/acl.sh b/src/ceph/qa/workunits/fs/misc/acl.sh deleted file mode 100755 index 198b056..0000000 --- a/src/ceph/qa/workunits/fs/misc/acl.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -x - -set -e -mkdir -p testdir -cd testdir - -set +e -setfacl -d -m u:nobody:rw . -if test $? != 0; then - echo "Filesystem does not support ACL" - exit 0 -fi - -expect_failure() { - if "$@"; then return 1; else return 0; fi -} - -set -e -c=0 -while [ $c -lt 100 ] -do - c=`expr $c + 1` - # inherited ACL from parent directory's default ACL - mkdir d1 - c1=`getfacl d1 | grep -c "nobody:rw"` - echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null - c2=`getfacl d1 | grep -c "nobody:rw"` - rmdir d1 - if [ $c1 -ne 2 ] || [ $c2 -ne 2 ] - then - echo "ERROR: incorrect ACLs" - exit 1 - fi -done - -mkdir d1 - -# The ACL xattr only contains ACL header. ACL should be removed -# in this case. -setfattr -n system.posix_acl_access -v 0x02000000 d1 -setfattr -n system.posix_acl_default -v 0x02000000 . - -expect_failure getfattr -n system.posix_acl_access d1 -expect_failure getfattr -n system.posix_acl_default . - - -rmdir d1 -cd .. -rmdir testdir -echo OK diff --git a/src/ceph/qa/workunits/fs/misc/chmod.sh b/src/ceph/qa/workunits/fs/misc/chmod.sh deleted file mode 100755 index de66776..0000000 --- a/src/ceph/qa/workunits/fs/misc/chmod.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -x - -set -e - -check_perms() { - - file=$1 - r=$(ls -la ${file}) - if test $? != 0; then - echo "ERROR: File listing/stat failed" - exit 1 - fi - - perms=$2 - if test "${perms}" != $(echo ${r} | awk '{print $1}') && \ - test "${perms}." != $(echo ${r} | awk '{print $1}') && \ - test "${perms}+" != $(echo ${r} | awk '{print $1}'); then - echo "ERROR: Permissions should be ${perms}" - exit 1 - fi -} - -file=test_chmod.$$ - -echo "foo" > ${file} -if test $? != 0; then - echo "ERROR: Failed to create file ${file}" - exit 1 -fi - -chmod 400 ${file} -if test $? != 0; then - echo "ERROR: Failed to change mode of ${file}" - exit 1 -fi - -check_perms ${file} "-r--------" - -set +e -echo "bar" >> ${file} -if test $? = 0; then - echo "ERROR: Write to read-only file should Fail" - exit 1 -fi - -set -e -chmod 600 ${file} -echo "bar" >> ${file} -if test $? != 0; then - echo "ERROR: Write to writeable file failed" - exit 1 -fi - -check_perms ${file} "-rw-------" - -echo "foo" >> ${file} -if test $? != 0; then - echo "ERROR: Failed to write to file" - exit 1 -fi diff --git a/src/ceph/qa/workunits/fs/misc/direct_io.py b/src/ceph/qa/workunits/fs/misc/direct_io.py deleted file mode 100755 index b5c4226..0000000 --- a/src/ceph/qa/workunits/fs/misc/direct_io.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/python - -import json -import mmap -import os -import subprocess - - -def get_data_pool(): - cmd = ['ceph', 'fs', 'ls', '--format=json-pretty'] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) - out = proc.communicate()[0] - return json.loads(out)[0]['data_pools'][0] - - -def main(): - fd = os.open("testfile", os.O_RDWR | os.O_CREAT | os.O_TRUNC | os.O_DIRECT, 0o644) - - ino = os.fstat(fd).st_ino - obj_name = "{ino:x}.00000000".format(ino=ino) - pool_name = get_data_pool() - - buf = mmap.mmap(-1, 1) - buf.write('1') - os.write(fd, buf) - - proc = subprocess.Popen(['rados', '-p', pool_name, 'get', obj_name, 'tmpfile']) - proc.wait() - - with open('tmpfile', 'r') as tmpf: - out = tmpf.read() - if out != '1': - raise RuntimeError("data were not written to object store directly") - - with open('tmpfile', 'w') as tmpf: - tmpf.write('2') - - proc = subprocess.Popen(['rados', '-p', pool_name, 'put', obj_name, 'tmpfile']) - proc.wait() - - os.lseek(fd, 0, os.SEEK_SET) - out = os.read(fd, 1) - if out != '2': - raise RuntimeError("data were not directly read from object store") - - os.close(fd) - print('ok') - - -main() diff --git a/src/ceph/qa/workunits/fs/misc/dirfrag.sh b/src/ceph/qa/workunits/fs/misc/dirfrag.sh deleted file mode 100755 index c059f88..0000000 --- a/src/ceph/qa/workunits/fs/misc/dirfrag.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -set -e - -DEPTH=5 -COUNT=10000 - -kill_jobs() { - jobs -p | xargs kill -} -trap kill_jobs INT - -create_files() { - for i in `seq 1 $COUNT` - do - touch file$i - done -} - -delete_files() { - for i in `ls -f` - do - if [[ ${i}a = file*a ]] - then - rm -f $i - fi - done -} - -rm -rf testdir -mkdir testdir -cd testdir - -echo "creating folder hierarchy" -for i in `seq 1 $DEPTH`; do - mkdir dir$i - cd dir$i - create_files & -done -wait - -echo "created hierarchy, now cleaning up" - -for i in `seq 1 $DEPTH`; do - delete_files & - cd .. -done -wait - -echo "cleaned up hierarchy" -cd .. -rm -rf testdir diff --git a/src/ceph/qa/workunits/fs/misc/filelock_deadlock.py b/src/ceph/qa/workunits/fs/misc/filelock_deadlock.py deleted file mode 100755 index 3ebc977..0000000 --- a/src/ceph/qa/workunits/fs/misc/filelock_deadlock.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/python - -import errno -import fcntl -import os -import signal -import struct -import time - - -def handler(signum, frame): - pass - - -def lock_two(f1, f2): - lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 10, 0, 0) - fcntl.fcntl(f1, fcntl.F_SETLKW, lockdata) - time.sleep(10) - - # don't wait forever - signal.signal(signal.SIGALRM, handler) - signal.alarm(10) - exitcode = 0 - try: - fcntl.fcntl(f2, fcntl.F_SETLKW, lockdata) - except IOError as e: - if e.errno == errno.EDEADLK: - exitcode = 1 - elif e.errno == errno.EINTR: - exitcode = 2 - else: - exitcode = 3 - os._exit(exitcode) - - -def main(): - pid1 = os.fork() - if pid1 == 0: - f1 = open("testfile1", 'w') - f2 = open("testfile2", 'w') - lock_two(f1, f2) - - pid2 = os.fork() - if pid2 == 0: - f1 = open("testfile2", 'w') - f2 = open("testfile3", 'w') - lock_two(f1, f2) - - pid3 = os.fork() - if pid3 == 0: - f1 = open("testfile3", 'w') - f2 = open("testfile1", 'w') - lock_two(f1, f2) - - deadlk_count = 0 - i = 0 - while i < 3: - pid, status = os.wait() - exitcode = status >> 8 - if exitcode == 1: - deadlk_count += 1 - elif exitcode != 0: - raise RuntimeError("unexpect exit code of child") - i += 1 - - if deadlk_count != 1: - raise RuntimeError("unexpect count of EDEADLK") - - print('ok') - - -main() diff --git a/src/ceph/qa/workunits/fs/misc/filelock_interrupt.py b/src/ceph/qa/workunits/fs/misc/filelock_interrupt.py deleted file mode 100755 index 2a413a6..0000000 --- a/src/ceph/qa/workunits/fs/misc/filelock_interrupt.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/python - -import errno -import fcntl -import signal -import struct - -""" -introduced by Linux 3.15 -""" -fcntl.F_OFD_GETLK = 36 -fcntl.F_OFD_SETLK = 37 -fcntl.F_OFD_SETLKW = 38 - - -def handler(signum, frame): - pass - - -def main(): - f1 = open("testfile", 'w') - f2 = open("testfile", 'w') - - fcntl.flock(f1, fcntl.LOCK_SH | fcntl.LOCK_NB) - - """ - is flock interruptable? - """ - signal.signal(signal.SIGALRM, handler) - signal.alarm(5) - try: - fcntl.flock(f2, fcntl.LOCK_EX) - except IOError as e: - if e.errno != errno.EINTR: - raise - else: - raise RuntimeError("expect flock to block") - - fcntl.flock(f1, fcntl.LOCK_UN) - - lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 10, 0, 0) - try: - fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata) - except IOError as e: - if e.errno != errno.EINVAL: - raise - else: - print('kernel does not support fcntl.F_OFD_SETLK') - return - - lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 10, 10, 0, 0) - fcntl.fcntl(f2, fcntl.F_OFD_SETLK, lockdata) - - """ - is poxis lock interruptable? - """ - signal.signal(signal.SIGALRM, handler) - signal.alarm(5) - try: - lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) - fcntl.fcntl(f2, fcntl.F_OFD_SETLKW, lockdata) - except IOError as e: - if e.errno != errno.EINTR: - raise - else: - raise RuntimeError("expect posix lock to block") - - """ - file handler 2 should still hold lock on 10~10 - """ - try: - lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 10, 10, 0, 0) - fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata) - except IOError as e: - if e.errno == errno.EAGAIN: - pass - else: - raise RuntimeError("expect file handler 2 to hold lock on 10~10") - - lockdata = struct.pack('hhllhh', fcntl.F_UNLCK, 0, 0, 0, 0, 0) - fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata) - fcntl.fcntl(f2, fcntl.F_OFD_SETLK, lockdata) - - print('ok') - - -main() diff --git a/src/ceph/qa/workunits/fs/misc/i_complete_vs_rename.sh b/src/ceph/qa/workunits/fs/misc/i_complete_vs_rename.sh deleted file mode 100755 index a9b9827..0000000 --- a/src/ceph/qa/workunits/fs/misc/i_complete_vs_rename.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -set -e - -mkdir x -cd x -touch a -touch b -touch c -touch d -ls -chmod 777 . -stat e || true -touch f -touch g - -# over existing file -echo attempting rename over existing file... -touch ../xx -mv ../xx f -ls | grep f || false -echo rename over existing file is okay - -# over negative dentry -echo attempting rename over negative dentry... -touch ../xx -mv ../xx e -ls | grep e || false -echo rename over negative dentry is ok - -echo OK diff --git a/src/ceph/qa/workunits/fs/misc/layout_vxattrs.sh b/src/ceph/qa/workunits/fs/misc/layout_vxattrs.sh deleted file mode 100755 index 29ac407..0000000 --- a/src/ceph/qa/workunits/fs/misc/layout_vxattrs.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -x - -set -e -set -x - -# detect data pool -datapool= -dir=. -while true ; do - echo $dir - datapool=$(getfattr -n ceph.dir.layout.pool $dir --only-values) && break - dir=$dir/.. -done - -# file -rm -f file file2 -touch file file2 - -getfattr -n ceph.file.layout file -getfattr -n ceph.file.layout file | grep -q object_size= -getfattr -n ceph.file.layout file | grep -q stripe_count= -getfattr -n ceph.file.layout file | grep -q stripe_unit= -getfattr -n ceph.file.layout file | grep -q pool= -getfattr -n ceph.file.layout.pool file -getfattr -n ceph.file.layout.pool_namespace file -getfattr -n ceph.file.layout.stripe_unit file -getfattr -n ceph.file.layout.stripe_count file -getfattr -n ceph.file.layout.object_size file - -getfattr -n ceph.file.layout.bogus file 2>&1 | grep -q 'No such attribute' -getfattr -n ceph.dir.layout file 2>&1 | grep -q 'No such attribute' - -setfattr -n ceph.file.layout.stripe_unit -v 1048576 file2 -setfattr -n ceph.file.layout.stripe_count -v 8 file2 -setfattr -n ceph.file.layout.object_size -v 10485760 file2 - -setfattr -n ceph.file.layout.pool -v $datapool file2 -getfattr -n ceph.file.layout.pool file2 | grep -q $datapool -setfattr -n ceph.file.layout.pool_namespace -v foons file2 -getfattr -n ceph.file.layout.pool_namespace file2 | grep -q foons -setfattr -x ceph.file.layout.pool_namespace file2 -getfattr -n ceph.file.layout.pool_namespace file2 | grep -q -v foons - -getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 1048576 -getfattr -n ceph.file.layout.stripe_count file2 | grep -q 8 -getfattr -n ceph.file.layout.object_size file2 | grep -q 10485760 - -setfattr -n ceph.file.layout -v "stripe_unit=4194304 stripe_count=16 object_size=41943040 pool=$datapool pool_namespace=foons" file2 -getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 4194304 -getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16 -getfattr -n ceph.file.layout.object_size file2 | grep -q 41943040 -getfattr -n ceph.file.layout.pool file2 | grep -q $datapool -getfattr -n ceph.file.layout.pool_namespace file2 | grep -q foons - -setfattr -n ceph.file.layout -v "stripe_unit=1048576" file2 -getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 1048576 -getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16 -getfattr -n ceph.file.layout.object_size file2 | grep -q 41943040 -getfattr -n ceph.file.layout.pool file2 | grep -q $datapool -getfattr -n ceph.file.layout.pool_namespace file2 | grep -q foons - -setfattr -n ceph.file.layout -v "stripe_unit=2097152 stripe_count=4 object_size=2097152 pool=$datapool pool_namespace=barns" file2 -getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 2097152 -getfattr -n ceph.file.layout.stripe_count file2 | grep -q 4 -getfattr -n ceph.file.layout.object_size file2 | grep -q 2097152 -getfattr -n ceph.file.layout.pool file2 | grep -q $datapool -getfattr -n ceph.file.layout.pool_namespace file2 | grep -q barns - -# dir -rm -f dir/file || true -rmdir dir || true -mkdir -p dir - -getfattr -d -m - dir | grep -q ceph.dir.layout && exit 1 || true -getfattr -d -m - dir | grep -q ceph.file.layout && exit 1 || true -getfattr -n ceph.dir.layout dir && exit 1 || true - -setfattr -n ceph.dir.layout.stripe_unit -v 1048576 dir -setfattr -n ceph.dir.layout.stripe_count -v 8 dir -setfattr -n ceph.dir.layout.object_size -v 10485760 dir -setfattr -n ceph.dir.layout.pool -v $datapool dir -setfattr -n ceph.dir.layout.pool_namespace -v dirns dir - -getfattr -n ceph.dir.layout dir -getfattr -n ceph.dir.layout dir | grep -q object_size=10485760 -getfattr -n ceph.dir.layout dir | grep -q stripe_count=8 -getfattr -n ceph.dir.layout dir | grep -q stripe_unit=1048576 -getfattr -n ceph.dir.layout dir | grep -q pool=$datapool -getfattr -n ceph.dir.layout dir | grep -q pool_namespace=dirns -getfattr -n ceph.dir.layout.pool dir | grep -q $datapool -getfattr -n ceph.dir.layout.stripe_unit dir | grep -q 1048576 -getfattr -n ceph.dir.layout.stripe_count dir | grep -q 8 -getfattr -n ceph.dir.layout.object_size dir | grep -q 10485760 -getfattr -n ceph.dir.layout.pool_namespace dir | grep -q dirns - - -setfattr -n ceph.file.layout -v "stripe_count=16" file2 -getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16 -setfattr -n ceph.file.layout -v "object_size=10485760 stripe_count=8 stripe_unit=1048576 pool=$datapool pool_namespace=dirns" file2 -getfattr -n ceph.file.layout.stripe_count file2 | grep -q 8 - -touch dir/file -getfattr -n ceph.file.layout.pool dir/file | grep -q $datapool -getfattr -n ceph.file.layout.stripe_unit dir/file | grep -q 1048576 -getfattr -n ceph.file.layout.stripe_count dir/file | grep -q 8 -getfattr -n ceph.file.layout.object_size dir/file | grep -q 10485760 -getfattr -n ceph.file.layout.pool_namespace dir/file | grep -q dirns - -setfattr -x ceph.dir.layout.pool_namespace dir -getfattr -n ceph.dir.layout dir | grep -q -v pool_namespace=dirns - -setfattr -x ceph.dir.layout dir -getfattr -n ceph.dir.layout dir 2>&1 | grep -q 'No such attribute' - -echo OK - diff --git a/src/ceph/qa/workunits/fs/misc/mkpool_layout_vxattrs.sh b/src/ceph/qa/workunits/fs/misc/mkpool_layout_vxattrs.sh deleted file mode 100755 index 91d3166..0000000 --- a/src/ceph/qa/workunits/fs/misc/mkpool_layout_vxattrs.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -touch foo.$$ -rados mkpool foo.$$ -ceph mds add_data_pool foo.$$ -setfattr -n ceph.file.layout.pool -v foo.$$ foo.$$ - -# cleanup -rm foo.$$ -ceph mds remove_data_pool foo.$$ -rados rmpool foo.$$ foo.$$ --yes-i-really-really-mean-it - -echo OK diff --git a/src/ceph/qa/workunits/fs/misc/multiple_rsync.sh b/src/ceph/qa/workunits/fs/misc/multiple_rsync.sh deleted file mode 100755 index 4397c1e..0000000 --- a/src/ceph/qa/workunits/fs/misc/multiple_rsync.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -ex - - -# Populate with some arbitrary files from the local system. Take -# a copy to protect against false fails from system updates during test. -export PAYLOAD=/tmp/multiple_rsync_payload.$$ -sudo cp -r /usr/lib/ $PAYLOAD - -set -e - -sudo rsync -av $PAYLOAD payload.1 -sudo rsync -av $PAYLOAD payload.2 - -# this shouldn't transfer any additional files -echo we should get 4 here if no additional files are transferred -sudo rsync -auv $PAYLOAD payload.1 | tee /tmp/$$ -hexdump -C /tmp/$$ -wc -l /tmp/$$ | grep 4 -sudo rsync -auv $PAYLOAD payload.2 | tee /tmp/$$ -hexdump -C /tmp/$$ -wc -l /tmp/$$ | grep 4 -echo OK - -rm /tmp/$$ -sudo rm -rf $PAYLOAD diff --git a/src/ceph/qa/workunits/fs/misc/trivial_sync.sh b/src/ceph/qa/workunits/fs/misc/trivial_sync.sh deleted file mode 100755 index 68e4072..0000000 --- a/src/ceph/qa/workunits/fs/misc/trivial_sync.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -e - -mkdir foo -echo foo > bar -sync diff --git a/src/ceph/qa/workunits/fs/misc/xattrs.sh b/src/ceph/qa/workunits/fs/misc/xattrs.sh deleted file mode 100755 index fcd94d2..0000000 --- a/src/ceph/qa/workunits/fs/misc/xattrs.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -x - -set -e - -touch file - -setfattr -n user.foo -v foo file -setfattr -n user.bar -v bar file -setfattr -n user.empty file -getfattr -d file | grep foo -getfattr -d file | grep bar -getfattr -d file | grep empty - -echo OK. |