diff options
Diffstat (limited to 'tests/bugs/shard')
25 files changed, 1223 insertions, 375 deletions
diff --git a/tests/bugs/shard/bug-1245547.t b/tests/bugs/shard/bug-1245547.t index c19b2a6a042..3c46785d10f 100644 --- a/tests/bugs/shard/bug-1245547.t +++ b/tests/bugs/shard/bug-1245547.t @@ -25,11 +25,11 @@ TEST touch $M0/bar TEST truncate -s 10G $M0/bar #Unlink on such a file should succeed. TEST unlink $M0/bar -# + #Create a file 'baz' with holes. TEST touch $M0/baz TEST truncate -s 10G $M0/baz #Rename with a sharded existing dest that has holes must succeed. TEST mv -f $M0/foo $M0/baz -cleanup; +cleanup diff --git a/tests/bugs/shard/bug-1272986.t b/tests/bugs/shard/bug-1272986.t index 762887051fa..66e896ad0c4 100644 --- a/tests/bugs/shard/bug-1272986.t +++ b/tests/bugs/shard/bug-1272986.t @@ -16,16 +16,16 @@ TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M1 # Write some data into a file, such that its size crosses the shard block size. -TEST dd if=/dev/zero of=$M1/file bs=1M count=5 conv=notrunc +TEST dd if=/dev/urandom of=$M1/file bs=1M count=5 conv=notrunc oflag=direct md5sum1_reader=$(md5sum $M0/file | awk '{print $1}') EXPECT "$md5sum1_reader" echo `md5sum $M1/file | awk '{print $1}'` # Append some more data into the file. -TEST `echo "abcdefg" >> $M1/file` +TEST dd if=/dev/urandom of=$M1/file bs=256k count=1 conv=notrunc oflag=direct -md5sum2_reader=$(md5sum $M0/file | awk '{print $1}') +md5sum2_reader=$(dd if=$M0/file iflag=direct bs=256k| md5sum | awk '{print $1}') # Test to see if the reader refreshes its cache correctly as part of the reads # triggered through md5sum. If it does, then the md5sum on the reader and writer diff --git a/tests/bugs/shard/bug-1468483.t b/tests/bugs/shard/bug-1468483.t new file mode 100644 index 00000000000..e462b8d54d5 --- /dev/null +++ b/tests/bugs/shard/bug-1468483.t @@ -0,0 +1,58 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../common-utils.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 16MB +TEST $CLI volume start $V0 +TEST $CLI volume profile $V0 start + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 +TEST dd if=/dev/zero conv=fsync of=$M0/foo bs=1M count=100 + +#This should ensure /.shard is created on the bricks. +TEST stat $B0/${V0}0/.shard + +gfid_foo=$(get_gfid_string $M0/foo) + +TEST stat $B0/${V0}0/.shard/$gfid_foo.1 +TEST stat $B0/${V0}0/.shard/$gfid_foo.2 +TEST stat $B0/${V0}0/.shard/$gfid_foo.3 +TEST stat $B0/${V0}0/.shard/$gfid_foo.4 +TEST stat $B0/${V0}0/.shard/$gfid_foo.5 +TEST stat $B0/${V0}0/.shard/$gfid_foo.6 + +# For a file with 7 shards, there should be 7 fsyncs on the brick. Without this +# fix, I was seeing only 1 fsync (on the base shard alone). + +EXPECT "7" echo `$CLI volume profile $V0 info incremental | grep -w FSYNC | awk '{print $8}'` + +useradd -M test_user 2>/dev/null + +TEST touch $M0/bar + +# Change ownership to non-root on bar. +TEST chown test_user:test_user $M0/bar + +TEST $CLI volume profile $V0 stop +TEST $CLI volume profile $V0 start + +# Write 100M of data on bar as non-root. +TEST run_cmd_as_user test_user "dd if=/dev/zero conv=fsync of=$M0/bar bs=1M count=100" + +EXPECT "7" echo `$CLI volume profile $V0 info incremental | grep -w FSYNC | awk '{print $8}'` + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +userdel test_user +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/bug-1568521-EEXIST.t b/tests/bugs/shard/bug-1568521-EEXIST.t new file mode 100644 index 00000000000..2f9f165aa63 --- /dev/null +++ b/tests/bugs/shard/bug-1568521-EEXIST.t @@ -0,0 +1,91 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +function get_file_count { + ls $1* | wc -l +} + +FILE_COUNT_TIME=5 + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST mkdir $M0/dir +# Unlink a temporary file to trigger creation of .remove_me +TEST touch $M0/tmp +TEST unlink $M0/tmp + +TEST stat $B0/${V0}0/.shard/.remove_me +TEST stat $B0/${V0}1/.shard/.remove_me + +TEST dd if=/dev/zero of=$M0/dir/file bs=1024 count=9216 +gfid_file=$(get_gfid_string $M0/dir/file) + +# Create marker file from the backend to simulate ENODATA. +touch $B0/${V0}0/.shard/.remove_me/$gfid_file +touch $B0/${V0}1/.shard/.remove_me/$gfid_file + +# Set block and file size to incorrect values of 64MB and 5MB to simulate "stale xattrs" case +# and confirm that the correct values are set when the actual unlink takes place + +TEST setfattr -n trusted.glusterfs.shard.block-size -v 0x0000000004000000 $B0/${V0}0/.shard/.remove_me/$gfid_file +TEST setfattr -n trusted.glusterfs.shard.block-size -v 0x0000000004000000 $B0/${V0}1/.shard/.remove_me/$gfid_file + +TEST setfattr -n trusted.glusterfs.shard.file-size -v 0x0000000000500000000000000000000000000000000000000000000000000000 $B0/${V0}0/.shard/.remove_me/$gfid_file +TEST setfattr -n trusted.glusterfs.shard.file-size -v 0x0000000000500000000000000000000000000000000000000000000000000000 $B0/${V0}1/.shard/.remove_me/$gfid_file + +# Sleep for 2 seconds to prevent posix_gfid_heal() from believing marker file is "fresh" and failing lookup with ENOENT +sleep 2 + +TEST unlink $M0/dir/file +TEST ! stat $B0/${V0}0/dir/file +TEST ! stat $B0/${V0}1/dir/file + +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_file +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_file +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_file +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/$gfid_file + +############################## +### Repeat test for rename ### +############################## + +TEST touch $M0/src +TEST dd if=/dev/zero of=$M0/dir/dst bs=1024 count=9216 +gfid_dst=$(get_gfid_string $M0/dir/dst) + +# Create marker file from the backend to simulate ENODATA. +touch $B0/${V0}0/.shard/.remove_me/$gfid_dst +touch $B0/${V0}1/.shard/.remove_me/$gfid_dst + +# Set block and file size to incorrect values of 64MB and 5MB to simulate "stale xattrs" case +# and confirm that the correct values are set when the actual unlink takes place + +TEST setfattr -n trusted.glusterfs.shard.block-size -v 0x0000000004000000 $B0/${V0}0/.shard/.remove_me/$gfid_dst +TEST setfattr -n trusted.glusterfs.shard.block-size -v 0x0000000004000000 $B0/${V0}1/.shard/.remove_me/$gfid_dst + +TEST setfattr -n trusted.glusterfs.shard.file-size -v 0x0000000000500000000000000000000000000000000000000000000000000000 $B0/${V0}0/.shard/.remove_me/$gfid_dst +TEST setfattr -n trusted.glusterfs.shard.file-size -v 0x0000000000500000000000000000000000000000000000000000000000000000 $B0/${V0}1/.shard/.remove_me/$gfid_dst + +# Sleep for 2 seconds to prevent posix_gfid_heal() from believing marker file is "fresh" and failing lookup with ENOENT +sleep 2 + +TEST mv -f $M0/src $M0/dir/dst +TEST ! stat $B0/${V0}0/src +TEST ! stat $B0/${V0}1/src + +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/$gfid_dst + +cleanup diff --git a/tests/bugs/shard/bug-1568521.t b/tests/bugs/shard/bug-1568521.t new file mode 100644 index 00000000000..167fb635ac8 --- /dev/null +++ b/tests/bugs/shard/bug-1568521.t @@ -0,0 +1,53 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + + +function delete_files { + local mountpoint=$1; + local success=0; + local value=$2 + for i in {1..500}; do + unlink $mountpoint/file-$i 2>/dev/null 1>/dev/null + if [ $? -eq 0 ]; then + echo $2 >> $B0/output.txt + fi + done + echo $success +} + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 shard-block-size 4MB +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M1 + +for i in {1..500}; do + dd if=/dev/urandom of=$M0/file-$i bs=1M count=2 +done + +for i in {1..500}; do + stat $M1/file-$i > /dev/null +done + +delete_files $M0 0 & +delete_files $M1 1 & +wait + +success1=$(grep 0 $B0/output.txt | wc -l); +success2=$(grep 1 $B0/output.txt | wc -l); + +echo "Success1 is $success1"; +echo "Success2 is $success2"; + +success_total=$((success1 + success2)); + +EXPECT 500 echo $success_total + +cleanup diff --git a/tests/bugs/shard/bug-1605056-2.t b/tests/bugs/shard/bug-1605056-2.t new file mode 100644 index 00000000000..a9c10fec3ea --- /dev/null +++ b/tests/bugs/shard/bug-1605056-2.t @@ -0,0 +1,34 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 features.shard-lru-limit 25 +TEST $CLI volume set $V0 performance.write-behind off + +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +# Perform a write that would cause 25 shards to be created under .shard +TEST dd if=/dev/zero of=$M0/foo bs=1M count=104 + +# Write into another file bar to ensure all of foo's shards are evicted from lru list of $M0 +TEST dd if=/dev/zero of=$M0/bar bs=1M count=104 + +# Delete foo from $M0. If there's a bug, the mount will crash. +TEST unlink $M0/foo + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/bug-1605056.t b/tests/bugs/shard/bug-1605056.t new file mode 100644 index 00000000000..c2329ea79f8 --- /dev/null +++ b/tests/bugs/shard/bug-1605056.t @@ -0,0 +1,63 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +SHARD_COUNT_TIME=5 + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 features.shard-lru-limit 25 +TEST $CLI volume set $V0 performance.write-behind off + +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M1 + +# Perform a write that would cause 25 shards to be created under .shard +TEST dd if=/dev/zero of=$M0/foo bs=1M count=104 + +# Read the file from $M1, indirectly filling up the lru list. +TEST `cat $M1/foo > /dev/null` +statedump=$(generate_mount_statedump $V0 $M1) +sleep 1 +EXPECT "25" echo $(grep "inode-count" $statedump | cut -f2 -d'=' | tail -1) +rm -f $statedump + +# Delete foo from $M0. +TEST unlink $M0/foo + +# Send stat on foo from $M1 to force $M1 to "forget" inode associated with foo. +# Now the ghost shards associated with "foo" are still in lru list of $M1. +TEST ! stat $M1/foo + +# Let's force the ghost shards of "foo" out of lru list by looking up more shards +# through I/O on a file named "bar" from $M1. This should crash if the base inode +# had been destroyed by now. + +TEST dd if=/dev/zero of=$M1/bar bs=1M count=104 + +############################################### +#### Now for some inode ref-leak tests ... #### +############################################### + +# Expect there to be 29 active inodes - 26 belonging to "bar", 1 for .shard, +# 1 for .shard/remove_me and 1 for '/' +EXPECT_WITHIN $SHARD_COUNT_TIME `expr 26 + 3` get_mount_active_size_value $V0 $M1 + +TEST rm -f $M1/bar +EXPECT_WITHIN $SHARD_COUNT_TIME 3 get_mount_active_size_value $V0 $M1 + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1 + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/bug-1669077.t b/tests/bugs/shard/bug-1669077.t new file mode 100644 index 00000000000..8d3a67a36be --- /dev/null +++ b/tests/bugs/shard/bug-1669077.t @@ -0,0 +1,29 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +SHARD_COUNT_TIME=5 + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 features.shard-lru-limit 25 + +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +# If the bug still exists, client should crash during fallocate below +TEST fallocate -l 200M $M0/foo + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/bug-1696136-lru-limit-equals-deletion-rate.t b/tests/bugs/shard/bug-1696136-lru-limit-equals-deletion-rate.t new file mode 100644 index 00000000000..3e4a65af19a --- /dev/null +++ b/tests/bugs/shard/bug-1696136-lru-limit-equals-deletion-rate.t @@ -0,0 +1,34 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../fallocate.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 features.shard-lru-limit 120 +TEST $CLI volume set $V0 features.shard-deletion-rate 120 +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST build_tester $(dirname $0)/bug-1696136.c -lgfapi -Wall -O2 + +# Create a file +TEST touch $M0/file1 + +# Fallocate a 500M file. This will make sure number of participant shards are > lru-limit +TEST $(dirname $0)/bug-1696136 $H0 $V0 "0" "0" "536870912" /file1 `gluster --print-logdir`/glfs-$V0.log + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 +rm -f $(dirname $0)/bug-1696136 + +cleanup diff --git a/tests/bugs/shard/bug-1696136.c b/tests/bugs/shard/bug-1696136.c new file mode 100644 index 00000000000..cb650535b09 --- /dev/null +++ b/tests/bugs/shard/bug-1696136.c @@ -0,0 +1,122 @@ +#define _GNU_SOURCE +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <glusterfs/api/glfs.h> +#include <glusterfs/api/glfs-handles.h> + +enum fallocate_flag { + TEST_FALLOCATE_NONE, + TEST_FALLOCATE_KEEP_SIZE, + TEST_FALLOCATE_ZERO_RANGE, + TEST_FALLOCATE_PUNCH_HOLE, + TEST_FALLOCATE_MAX, +}; + +int +get_fallocate_flag(int opcode) +{ + int ret = 0; + + switch (opcode) { + case TEST_FALLOCATE_NONE: + ret = 0; + break; + case TEST_FALLOCATE_KEEP_SIZE: + ret = FALLOC_FL_KEEP_SIZE; + break; + case TEST_FALLOCATE_ZERO_RANGE: + ret = FALLOC_FL_ZERO_RANGE; + break; + case TEST_FALLOCATE_PUNCH_HOLE: + ret = FALLOC_FL_PUNCH_HOLE; + break; + default: + ret = -1; + break; + } + return ret; +} + +int +main(int argc, char *argv[]) +{ + int ret = 1; + int opcode = -1; + off_t offset = 0; + size_t len = 0; + glfs_t *fs = NULL; + glfs_fd_t *fd = NULL; + + if (argc != 8) { + fprintf(stderr, + "Syntax: %s <host> <volname> <opcode> <offset> <len> " + "<file-path> <log-file>\n", + argv[0]); + return 1; + } + + fs = glfs_new(argv[2]); + if (!fs) { + fprintf(stderr, "glfs_new: returned NULL\n"); + return 1; + } + + ret = glfs_set_volfile_server(fs, "tcp", argv[1], 24007); + if (ret != 0) { + fprintf(stderr, "glfs_set_volfile_server: returned %d\n", ret); + goto out; + } + + ret = glfs_set_logging(fs, argv[7], 7); + if (ret != 0) { + fprintf(stderr, "glfs_set_logging: returned %d\n", ret); + goto out; + } + + ret = glfs_init(fs); + if (ret != 0) { + fprintf(stderr, "glfs_init: returned %d\n", ret); + goto out; + } + + opcode = atoi(argv[3]); + opcode = get_fallocate_flag(opcode); + if (opcode < 0) { + fprintf(stderr, "get_fallocate_flag: invalid flag \n"); + goto out; + } + + /* Note that off_t is signed but size_t isn't. */ + offset = strtol(argv[4], NULL, 10); + len = strtoul(argv[5], NULL, 10); + + fd = glfs_open(fs, argv[6], O_RDWR); + if (fd == NULL) { + fprintf(stderr, "glfs_open: returned NULL\n"); + goto out; + } + + ret = glfs_fallocate(fd, opcode, offset, len); + if (ret < 0) { + fprintf(stderr, "glfs_fallocate: returned %d\n", ret); + goto out; + } + + ret = glfs_unlink(fs, argv[6]); + if (ret < 0) { + fprintf(stderr, "glfs_unlink: returned %d\n", ret); + goto out; + } + /* Sleep for 3s to give enough time for background deletion to complete + * during which if the bug exists, the process will crash. + */ + sleep(3); + ret = 0; + +out: + if (fd) + glfs_close(fd); + glfs_fini(fs); + return ret; +} diff --git a/tests/bugs/shard/bug-1696136.t b/tests/bugs/shard/bug-1696136.t new file mode 100644 index 00000000000..b6dc858f083 --- /dev/null +++ b/tests/bugs/shard/bug-1696136.t @@ -0,0 +1,33 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../fallocate.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 features.shard-lru-limit 120 +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST build_tester $(dirname $0)/bug-1696136.c -lgfapi -Wall -O2 + +# Create a file +TEST touch $M0/file1 + +# Fallocate a 500M file. This will make sure number of participant shards are > lru-limit +TEST $(dirname $0)/bug-1696136 $H0 $V0 "0" "0" "536870912" /file1 `gluster --print-logdir`/glfs-$V0.log + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 +rm -f $(dirname $0)/bug-1696136 + +cleanup diff --git a/tests/bugs/shard/bug-1705884.t b/tests/bugs/shard/bug-1705884.t new file mode 100644 index 00000000000..f6e50376a58 --- /dev/null +++ b/tests/bugs/shard/bug-1705884.t @@ -0,0 +1,32 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../fallocate.rc + +cleanup + +require_fallocate -l 1m $M0/file + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume set $V0 performance.stat-prefetch off +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST fallocate -l 200M $M0/foo +EXPECT `echo "$(( ( 200 * 1024 * 1024 ) / 512 ))"` stat -c %b $M0/foo +TEST truncate -s 0 $M0/foo +EXPECT "0" stat -c %b $M0/foo +TEST fallocate -l 100M $M0/foo +EXPECT `echo "$(( ( 100 * 1024 * 1024 ) / 512 ))"` stat -c %b $M0/foo + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/bug-1738419.t b/tests/bugs/shard/bug-1738419.t new file mode 100644 index 00000000000..8d0a31d9754 --- /dev/null +++ b/tests/bugs/shard/bug-1738419.t @@ -0,0 +1,29 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 network.remote-dio off +TEST $CLI volume set $V0 performance.io-cache off +TEST $CLI volume set $V0 performance.quick-read off +TEST $CLI volume set $V0 performance.read-ahead off +TEST $CLI volume set $V0 performance.strict-o-direct on +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST dd if=/dev/zero of=$M0/metadata bs=501 count=1 + +EXPECT "501" echo $("dd" if=$M0/metadata bs=4096 count=1 of=/dev/null iflag=direct 2>&1 | awk '/bytes/ {print $1}') + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/bug-shard-discard.c b/tests/bugs/shard/bug-shard-discard.c index 645bacf7d83..6fa93fb89d1 100644 --- a/tests/bugs/shard/bug-shard-discard.c +++ b/tests/bugs/shard/bug-shard-discard.c @@ -4,63 +4,67 @@ #include <glusterfs/api/glfs-handles.h> int -main (int argc, char *argv[]) +main(int argc, char *argv[]) { - int ret = 0; - off_t off = 0; - size_t len = 0; - glfs_t *fs = NULL; - glfs_fd_t *fd = NULL; + int ret = 0; + off_t off = 0; + size_t len = 0; + glfs_t *fs = NULL; + glfs_fd_t *fd = NULL; - if (argc != 7) { - fprintf (stderr, "Syntax: %s <host> <volname> <file-path> <off> <len> <log-file>\n", argv[0]); - return 1; - } + if (argc != 7) { + fprintf( + stderr, + "Syntax: %s <host> <volname> <file-path> <off> <len> <log-file>\n", + argv[0]); + return 1; + } - fs = glfs_new (argv[2]); - if (!fs) { - fprintf (stderr, "glfs_new: returned NULL\n"); - return 1; - } + fs = glfs_new(argv[2]); + if (!fs) { + fprintf(stderr, "glfs_new: returned NULL\n"); + return 1; + } - ret = glfs_set_volfile_server (fs, "tcp", argv[1], 24007); - if (ret != 0) { - fprintf (stderr, "glfs_set_volfile_server: retuned %d\n", ret); - goto out; - } + ret = glfs_set_volfile_server(fs, "tcp", argv[1], 24007); + if (ret != 0) { + fprintf(stderr, "glfs_set_volfile_server: returned %d\n", ret); + goto out; + } - ret = glfs_set_logging (fs, argv[6], 7); - if (ret != 0) { - fprintf (stderr, "glfs_set_logging: returned %d\n", ret); - goto out; - } + ret = glfs_set_logging(fs, argv[6], 7); + if (ret != 0) { + fprintf(stderr, "glfs_set_logging: returned %d\n", ret); + goto out; + } - ret = glfs_init (fs); - if (ret != 0) { - fprintf (stderr, "glfs_init: returned %d\n", ret); - goto out; - } + ret = glfs_init(fs); + if (ret != 0) { + fprintf(stderr, "glfs_init: returned %d\n", ret); + goto out; + } - fd = glfs_open (fs, argv[3], O_RDWR); - if (fd == NULL) { - fprintf (stderr, "glfs_open: returned NULL\n"); - goto out; - } + fd = glfs_open(fs, argv[3], O_RDWR); + if (fd == NULL) { + fprintf(stderr, "glfs_open: returned NULL\n"); + goto out; + } - off = atoi (argv[4]); - len = atoi (argv[5]); + /* Note that off_t is signed but size_t isn't. */ + off = strtol(argv[4], NULL, 10); + len = strtoul(argv[5], NULL, 10); - ret = glfs_discard (fd, off, len); - if (ret <= 0) { - fprintf (stderr, "glfs_discard: returned %d\n", ret); - goto out; - } + ret = glfs_discard(fd, off, len); + if (ret <= 0) { + fprintf(stderr, "glfs_discard: returned %d\n", ret); + goto out; + } - ret = 0; + ret = 0; out: - if (fd) - glfs_close (fd); - glfs_fini (fs); - return ret; + if (fd) + glfs_close(fd); + glfs_fini(fs); + return ret; } diff --git a/tests/bugs/shard/bug-shard-discard.t b/tests/bugs/shard/bug-shard-discard.t index 72d8586a2dc..910ade14801 100644 --- a/tests/bugs/shard/bug-shard-discard.t +++ b/tests/bugs/shard/bug-shard-discard.t @@ -5,6 +5,12 @@ cleanup +FILE_COUNT_TIME=5 + +function get_shard_count { + ls $1/$2.* | wc -l +} + TEST glusterd TEST pidof glusterd TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0..3} @@ -42,14 +48,11 @@ EXPECT_NOT "1" file_all_zeroes `find $B0 -name $gfid_foo.1` # Now unlink the file. And ensure that all shards associated with the file are cleaned up TEST unlink $M0/foo -TEST ! stat $B0/${V0}0/.shard/$gfid_foo.1 -TEST ! stat $B0/${V0}1/.shard/$gfid_foo.1 -TEST ! stat $B0/${V0}2/.shard/$gfid_foo.1 -TEST ! stat $B0/${V0}3/.shard/$gfid_foo.1 -TEST ! stat $B0/${V0}0/.shard/$gfid_foo.2 -TEST ! stat $B0/${V0}1/.shard/$gfid_foo.2 -TEST ! stat $B0/${V0}2/.shard/$gfid_foo.2 -TEST ! stat $B0/${V0}3/.shard/$gfid_foo.2 + +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_shard_count $B0/${V0}0/.shard $gfid_foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_shard_count $B0/${V0}1/.shard $gfid_foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_shard_count $B0/${V0}2/.shard $gfid_foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_shard_count $B0/${V0}3/.shard $gfid_foo TEST ! stat $M0/foo #clean up everything diff --git a/tests/bugs/shard/bug-shard-zerofill.c b/tests/bugs/shard/bug-shard-zerofill.c index 838a656b3bb..ed4c8c54dc2 100644 --- a/tests/bugs/shard/bug-shard-zerofill.c +++ b/tests/bugs/shard/bug-shard-zerofill.c @@ -3,57 +3,58 @@ #include <glusterfs/api/glfs-handles.h> int -main (int argc, char *argv[]) +main(int argc, char *argv[]) { - glfs_t *fs = NULL; - glfs_fd_t *fd = NULL; - int ret = 1; - - if (argc != 5) { - fprintf (stderr, "Syntax: %s <host> <volname> <file-path> <log-file>\n", argv[0]); - return 1; - } - - fs = glfs_new (argv[2]); - if (!fs) { - fprintf (stderr, "glfs_new: returned NULL\n"); - return 1; - } - - ret = glfs_set_volfile_server (fs, "tcp", argv[1], 24007); - if (ret != 0) { - fprintf (stderr, "glfs_set_volfile_server: retuned %d\n", ret); - goto out; - } - ret = glfs_set_logging (fs, argv[4], 7); - if (ret != 0) { - fprintf (stderr, "glfs_set_logging: returned %d\n", ret); - goto out; - } - ret = glfs_init (fs); - if (ret != 0) { - fprintf (stderr, "glfs_init: returned %d\n", ret); - goto out; - } - - fd = glfs_open (fs, argv[3], O_RDWR); - if (fd == NULL) { - fprintf (stderr, "glfs_open: returned NULL\n"); - goto out; - } - - /* Zero-fill "foo" with 10MB of data */ - ret = glfs_zerofill (fd, 0, 10485760); - if (ret <= 0) { - fprintf (stderr, "glfs_zerofill: returned %d\n", ret); - goto out; - } - - ret = 0; + glfs_t *fs = NULL; + glfs_fd_t *fd = NULL; + int ret = 1; + + if (argc != 5) { + fprintf(stderr, "Syntax: %s <host> <volname> <file-path> <log-file>\n", + argv[0]); + return 1; + } + + fs = glfs_new(argv[2]); + if (!fs) { + fprintf(stderr, "glfs_new: returned NULL\n"); + return 1; + } + + ret = glfs_set_volfile_server(fs, "tcp", argv[1], 24007); + if (ret != 0) { + fprintf(stderr, "glfs_set_volfile_server: returned %d\n", ret); + goto out; + } + ret = glfs_set_logging(fs, argv[4], 7); + if (ret != 0) { + fprintf(stderr, "glfs_set_logging: returned %d\n", ret); + goto out; + } + ret = glfs_init(fs); + if (ret != 0) { + fprintf(stderr, "glfs_init: returned %d\n", ret); + goto out; + } + + fd = glfs_open(fs, argv[3], O_RDWR); + if (fd == NULL) { + fprintf(stderr, "glfs_open: returned NULL\n"); + goto out; + } + + /* Zero-fill "foo" with 10MB of data */ + ret = glfs_zerofill(fd, 0, 10485760); + if (ret <= 0) { + fprintf(stderr, "glfs_zerofill: returned %d\n", ret); + goto out; + } + + ret = 0; out: - if (fd) - glfs_close(fd); - glfs_fini (fs); - return ret; + if (fd) + glfs_close(fd); + glfs_fini(fs); + return ret; } diff --git a/tests/bugs/shard/configure-lru-limit.t b/tests/bugs/shard/configure-lru-limit.t new file mode 100644 index 00000000000..923a4d8d747 --- /dev/null +++ b/tests/bugs/shard/configure-lru-limit.t @@ -0,0 +1,52 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 features.shard-lru-limit 25 +TEST $CLI volume start $V0 +EXPECT 'Started' volinfo_field $V0 'Status'; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +# Perform a write that would cause 25 shards to be created, 24 of them under .shard +TEST dd if=/dev/zero of=$M0/foo bs=1M count=100 + +statedump=$(generate_mount_statedump $V0) +sleep 1 +EXPECT "25" echo $(grep "lru-max-limit" $statedump | cut -f2 -d'=' | tail -1) + +# Base shard is never added to this list. So all other shards should make up for 24 inodes in lru list +EXPECT "24" echo $(grep "inode-count" $statedump | cut -f2 -d'=' | tail -1) + +rm -f $statedump + +# Test to ensure there's no "reconfiguration" of the value once set. +TEST $CLI volume set $V0 features.shard-lru-limit 30 +statedump=$(generate_mount_statedump $V0) +sleep 1 +EXPECT "25" echo $(grep "lru-max-limit" $statedump | cut -f2 -d'=' | tail -1) +rm -f $statedump + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 +statedump=$(generate_mount_statedump $V0) +sleep 1 +EXPECT "30" echo $(grep "lru-max-limit" $statedump | cut -f2 -d'=' | tail -1) +rm -f $statedump + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/issue-1243.t b/tests/bugs/shard/issue-1243.t new file mode 100644 index 00000000000..ba22d2b74fe --- /dev/null +++ b/tests/bugs/shard/issue-1243.t @@ -0,0 +1,43 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume set $V0 performance.quick-read off +TEST $CLI volume set $V0 performance.io-cache off +TEST $CLI volume set $V0 performance.read-ahead off +TEST $CLI volume set $V0 performance.strict-o-direct on +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST $CLI volume set $V0 md-cache-timeout 10 + +# Write data into a file such that its size crosses shard-block-size +TEST dd if=/dev/zero of=$M0/foo bs=1048576 count=8 oflag=direct + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +# Execute a setxattr on the file. +TEST setfattr -n trusted.libvirt -v some-value $M0/foo + +# Size of the file should be the aggregated size, not the shard-block-size +EXPECT '8388608' stat -c %s $M0/foo + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +# Execute a removexattr on the file. +TEST setfattr -x trusted.libvirt $M0/foo + +# Size of the file should be the aggregated size, not the shard-block-size +EXPECT '8388608' stat -c %s $M0/foo +cleanup diff --git a/tests/bugs/shard/issue-1281.t b/tests/bugs/shard/issue-1281.t new file mode 100644 index 00000000000..9704caa8944 --- /dev/null +++ b/tests/bugs/shard/issue-1281.t @@ -0,0 +1,34 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 performance.quick-read off +TEST $CLI volume set $V0 performance.io-cache off +TEST $CLI volume set $V0 performance.read-ahead off +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +#Open a file and store descriptor in fd = 5 +exec 5>$M0/foo + +#Unlink the same file which is opened in prev step +TEST unlink $M0/foo + +#Write something on the file using the open fd = 5 +echo "issue-1281" >&5 + +#Write on the descriptor should be succesful +EXPECT 0 echo $? + +#Close the fd = 5 +exec 5>&- + +cleanup diff --git a/tests/bugs/shard/issue-1425.t b/tests/bugs/shard/issue-1425.t new file mode 100644 index 00000000000..bbe82c0e5b2 --- /dev/null +++ b/tests/bugs/shard/issue-1425.t @@ -0,0 +1,45 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +FILE_COUNT_TIME=5 + +function get_file_count { + ls $1* | wc -l +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume start $V0 +TEST $CLI volume profile $V0 start + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST fallocate -l 20M $M0/foo +gfid_new=$(get_gfid_string $M0/foo) + +# Check for the base shard +TEST stat $M0/foo +TEST stat $B0/${V0}0/foo + +# There should be 4 associated shards +EXPECT_WITHIN $FILE_COUNT_TIME 4 get_file_count $B0/${V0}0/.shard/$gfid_new + +# There should be 1+4 shards and we expect 4 lookups less than on the build without this patch +EXPECT "21" echo `$CLI volume profile $V0 info incremental | grep -w LOOKUP | awk '{print $8}'` + +# Delete the base shard and check shards get cleaned up +TEST unlink $M0/foo + +TEST ! stat $M0/foo +TEST ! stat $B0/${V0}0/foo + +# There should be no shards now +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_new +cleanup diff --git a/tests/bugs/shard/shard-append-test.c b/tests/bugs/shard/shard-append-test.c index 92dff3d078d..c7debb2b182 100644 --- a/tests/bugs/shard/shard-append-test.c +++ b/tests/bugs/shard/shard-append-test.c @@ -10,9 +10,10 @@ #include <glusterfs/api/glfs.h> #include <glusterfs/api/glfs-handles.h> -#define LOG_ERR(msg) do { \ - fprintf (stderr, "%s : Error (%s)\n", msg, strerror (errno)); \ - } while (0) +#define LOG_ERR(msg) \ + do { \ + fprintf(stderr, "%s : Error (%s)\n", msg, strerror(errno)); \ + } while (0) /*This test tests that shard xlator handles offset in appending writes * correctly. This test performs writes of 1025 bytes 1025 times, in 5 threads @@ -26,154 +27,157 @@ pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; int thread_data = '1'; glfs_t * -init_glfs (const char *hostname, const char *volname, - const char *logfile) +init_glfs(const char *hostname, const char *volname, const char *logfile) { - int ret = -1; - glfs_t *fs = NULL; + int ret = -1; + glfs_t *fs = NULL; - fs = glfs_new (volname); - if (!fs) { - LOG_ERR ("glfs_new failed"); - return NULL; - } - - ret = glfs_set_volfile_server (fs, "tcp", hostname, 24007); - if (ret < 0) { - LOG_ERR ("glfs_set_volfile_server failed"); - goto out; - } - - ret = glfs_set_logging (fs, logfile, 7); - if (ret < 0) { - LOG_ERR ("glfs_set_logging failed"); - goto out; - } - - ret = glfs_init (fs); - if (ret < 0) { - LOG_ERR ("glfs_init failed"); - goto out; - } - - ret = 0; + fs = glfs_new(volname); + if (!fs) { + LOG_ERR("glfs_new failed"); + return NULL; + } + + ret = glfs_set_volfile_server(fs, "tcp", hostname, 24007); + if (ret < 0) { + LOG_ERR("glfs_set_volfile_server failed"); + goto out; + } + + ret = glfs_set_logging(fs, logfile, 7); + if (ret < 0) { + LOG_ERR("glfs_set_logging failed"); + goto out; + } + + ret = glfs_init(fs); + if (ret < 0) { + LOG_ERR("glfs_init failed"); + goto out; + } + + ret = 0; out: - if (ret) { - glfs_fini (fs); - fs = NULL; - } + if (ret) { + glfs_fini(fs); + fs = NULL; + } - return fs; + return fs; } -void* -write_data (void *data) +void * +write_data(void *data) { - char buf[1025] = {0}; - glfs_fd_t *glfd = NULL; - glfs_t *fs = data; - int i = 0; - - pthread_mutex_lock (&lock); - { - memset(buf, thread_data, sizeof(buf)); - thread_data++; + char buf[1025] = {0}; + glfs_fd_t *glfd = NULL; + glfs_t *fs = data; + int i = 0; + + pthread_mutex_lock(&lock); + { + memset(buf, thread_data, sizeof(buf)); + thread_data++; + } + pthread_mutex_unlock(&lock); + + for (i = 0; i < 1025; i++) { + glfd = glfs_creat(fs, "parallel-write.txt", O_WRONLY | O_APPEND, + S_IRUSR | S_IWUSR | O_SYNC); + if (!glfd) { + LOG_ERR("Failed to create file"); + exit(1); } - pthread_mutex_unlock (&lock); - - for (i = 0; i < 1025; i++) { - glfd = glfs_creat(fs, "parallel-write.txt", O_WRONLY | O_APPEND, - S_IRUSR | S_IWUSR | O_SYNC); - if (!glfd) { - LOG_ERR ("Failed to create file"); - exit(1); - } - - if (glfs_write (glfd, buf, sizeof(buf), 0) < 0) { - LOG_ERR ("Failed to write to file"); - exit(1); - } - if (glfs_close(glfd) != 0) { - LOG_ERR ("Failed to close file"); - exit(1); - } + + if (glfs_write(glfd, buf, sizeof(buf), 0) < 0) { + LOG_ERR("Failed to write to file"); + exit(1); } - return NULL; + if (glfs_close(glfd) != 0) { + LOG_ERR("Failed to close file"); + exit(1); + } + } + return NULL; } int -main (int argc, char *argv[]) +main(int argc, char *argv[]) { - pthread_t tid[5] = {0}; - char buf[1025] = {0}; - char cmp_buf[1025] = {0}; - int ret = 0; - char *hostname = NULL; - char *volname = NULL; - char *logfile = NULL; - glfs_t *fs = NULL; - glfs_fd_t *glfd = NULL; - ssize_t bytes_read = 0; - ssize_t total_bytes_read = 0; - int i = 0; - - if (argc != 4) { - fprintf (stderr, "Invalid argument\n"); - exit(1); - } - - hostname = argv[1]; - volname = argv[2]; - logfile = argv[3]; - - fs = init_glfs (hostname, volname, logfile); - if (fs == NULL) { - LOG_ERR ("init_glfs failed"); - return -1; - } - - for (i = 0; i < 5; i++) { - pthread_create(&tid[i], NULL, write_data, fs); - } - - for (i = 0; i < 5; i++) { - pthread_join(tid[i], NULL); - } - glfd = glfs_open(fs, "parallel-write.txt", O_RDONLY); - if (!glfd) { - LOG_ERR ("Failed to open file for reading"); - exit(1); + pthread_t tid[5] = {0}; + char buf[1025] = {0}; + char cmp_buf[1025] = {0}; + int ret = 0; + char *hostname = NULL; + char *volname = NULL; + char *logfile = NULL; + glfs_t *fs = NULL; + glfs_fd_t *glfd = NULL; + ssize_t bytes_read = 0; + ssize_t total_bytes_read = 0; + int i = 0; + + if (argc != 4) { + fprintf(stderr, "Invalid argument\n"); + exit(1); + } + + hostname = argv[1]; + volname = argv[2]; + logfile = argv[3]; + + fs = init_glfs(hostname, volname, logfile); + if (fs == NULL) { + LOG_ERR("init_glfs failed"); + return -1; + } + + for (i = 0; i < 5; i++) { + pthread_create(&tid[i], NULL, write_data, fs); + } + + for (i = 0; i < 5; i++) { + pthread_join(tid[i], NULL); + } + glfd = glfs_open(fs, "parallel-write.txt", O_RDONLY); + if (!glfd) { + LOG_ERR("Failed to open file for reading"); + exit(1); + } + + while ((bytes_read = glfs_read(glfd, buf, sizeof(buf), 0)) > 0) { + if (bytes_read != sizeof(buf)) { + fprintf(stderr, + "Didn't read complete data read: %zd " + "expected: %lu", + bytes_read, sizeof(buf)); + exit(1); } - while ((bytes_read = glfs_read (glfd, buf, sizeof(buf), 0)) > 0) { - if (bytes_read != sizeof(buf)) { - fprintf (stderr, "Didn't read complete data read: %zd " - "expected: %lu", bytes_read, sizeof(buf)); - exit(1); - } - - total_bytes_read += bytes_read; - if (buf[0] < '1' || buf[0] >= thread_data) { - fprintf(stderr, "Invalid character found: %c", buf[0]); - exit(1); - } - memset(cmp_buf, buf[0], sizeof(cmp_buf)); - if (memcmp(cmp_buf, buf, sizeof(cmp_buf))) { - LOG_ERR ("Data corrupted"); - exit(1); - } - memset(cmp_buf, 0, sizeof(cmp_buf)); + total_bytes_read += bytes_read; + if (buf[0] < '1' || buf[0] >= thread_data) { + fprintf(stderr, "Invalid character found: %c", buf[0]); + exit(1); } - - if (total_bytes_read != 5*1025*1025) { - fprintf(stderr, "Failed to read what is written, read; %zd, " - "expected %zu", total_bytes_read, 5*1025*1025); - exit(1); - } - - if (glfs_close(glfd) != 0) { - LOG_ERR ("Failed to close"); - exit(1); + memset(cmp_buf, buf[0], sizeof(cmp_buf)); + if (memcmp(cmp_buf, buf, sizeof(cmp_buf))) { + LOG_ERR("Data corrupted"); + exit(1); } - return 0; + memset(cmp_buf, 0, sizeof(cmp_buf)); + } + + if (total_bytes_read != 5 * 1025 * 1025) { + fprintf(stderr, + "Failed to read what is written, read; %zd, " + "expected %zu", + total_bytes_read, 5 * 1025 * 1025); + exit(1); + } + + if (glfs_close(glfd) != 0) { + LOG_ERR("Failed to close"); + exit(1); + } + return 0; } diff --git a/tests/bugs/shard/shard-fallocate.c b/tests/bugs/shard/shard-fallocate.c index e16620964c9..cb0714e8564 100644 --- a/tests/bugs/shard/shard-fallocate.c +++ b/tests/bugs/shard/shard-fallocate.c @@ -6,104 +6,108 @@ #include <glusterfs/api/glfs-handles.h> enum fallocate_flag { - TEST_FALLOCATE_NONE, - TEST_FALLOCATE_KEEP_SIZE, - TEST_FALLOCATE_ZERO_RANGE, - TEST_FALLOCATE_PUNCH_HOLE, - TEST_FALLOCATE_MAX, + TEST_FALLOCATE_NONE, + TEST_FALLOCATE_KEEP_SIZE, + TEST_FALLOCATE_ZERO_RANGE, + TEST_FALLOCATE_PUNCH_HOLE, + TEST_FALLOCATE_MAX, }; int -get_fallocate_flag (int opcode) +get_fallocate_flag(int opcode) { - int ret = 0; + int ret = 0; - switch (opcode) { + switch (opcode) { case TEST_FALLOCATE_NONE: - ret = 0; - break; + ret = 0; + break; case TEST_FALLOCATE_KEEP_SIZE: - ret = FALLOC_FL_KEEP_SIZE; - break; + ret = FALLOC_FL_KEEP_SIZE; + break; case TEST_FALLOCATE_ZERO_RANGE: - ret = FALLOC_FL_ZERO_RANGE; - break; + ret = FALLOC_FL_ZERO_RANGE; + break; case TEST_FALLOCATE_PUNCH_HOLE: - ret = FALLOC_FL_PUNCH_HOLE; - break; + ret = FALLOC_FL_PUNCH_HOLE; + break; default: - ret = -1; - break; - } - return ret; + ret = -1; + break; + } + return ret; } int -main (int argc, char *argv[]) +main(int argc, char *argv[]) { - int ret = 1; - int opcode = -1; - off_t offset = 0; - size_t len = 0; - glfs_t *fs = NULL; - glfs_fd_t *fd = NULL; + int ret = 1; + int opcode = -1; + off_t offset = 0; + size_t len = 0; + glfs_t *fs = NULL; + glfs_fd_t *fd = NULL; - if (argc != 8) { - fprintf (stderr, "Syntax: %s <host> <volname> <opcode> <offset> <len> <file-path> <log-file>\n", argv[0]); - return 1; - } + if (argc != 8) { + fprintf(stderr, + "Syntax: %s <host> <volname> <opcode> <offset> <len> " + "<file-path> <log-file>\n", + argv[0]); + return 1; + } - fs = glfs_new (argv[2]); - if (!fs) { - fprintf (stderr, "glfs_new: returned NULL\n"); - return 1; - } + fs = glfs_new(argv[2]); + if (!fs) { + fprintf(stderr, "glfs_new: returned NULL\n"); + return 1; + } - ret = glfs_set_volfile_server (fs, "tcp", argv[1], 24007); - if (ret != 0) { - fprintf (stderr, "glfs_set_volfile_server: retuned %d\n", ret); - goto out; - } + ret = glfs_set_volfile_server(fs, "tcp", argv[1], 24007); + if (ret != 0) { + fprintf(stderr, "glfs_set_volfile_server: returned %d\n", ret); + goto out; + } - ret = glfs_set_logging (fs, argv[7], 7); - if (ret != 0) { - fprintf (stderr, "glfs_set_logging: returned %d\n", ret); - goto out; - } + ret = glfs_set_logging(fs, argv[7], 7); + if (ret != 0) { + fprintf(stderr, "glfs_set_logging: returned %d\n", ret); + goto out; + } - ret = glfs_init (fs); - if (ret != 0) { - fprintf (stderr, "glfs_init: returned %d\n", ret); - goto out; - } + ret = glfs_init(fs); + if (ret != 0) { + fprintf(stderr, "glfs_init: returned %d\n", ret); + goto out; + } - opcode = atoi (argv[3]); - opcode = get_fallocate_flag (opcode); - if (opcode < 0) { - fprintf (stderr, "get_fallocate_flag: invalid flag \n"); - goto out; - } + opcode = atoi(argv[3]); + opcode = get_fallocate_flag(opcode); + if (opcode < 0) { + fprintf(stderr, "get_fallocate_flag: invalid flag \n"); + goto out; + } - offset = atoi (argv[4]); - len = atoi (argv[5]); + /* Note that off_t is signed but size_t isn't. */ + offset = strtol(argv[4], NULL, 10); + len = strtoul(argv[5], NULL, 10); - fd = glfs_open (fs, argv[6], O_RDWR); - if (fd == NULL) { - fprintf (stderr, "glfs_open: returned NULL\n"); - goto out; - } + fd = glfs_open(fs, argv[6], O_RDWR); + if (fd == NULL) { + fprintf(stderr, "glfs_open: returned NULL\n"); + goto out; + } - ret = glfs_fallocate (fd, opcode, offset, len); - if (ret <= 0) { - fprintf (stderr, "glfs_fallocate: returned %d\n", ret); - goto out; - } + ret = glfs_fallocate(fd, opcode, offset, len); + if (ret < 0) { + fprintf(stderr, "glfs_fallocate: returned %d\n", ret); + goto out; + } - ret = 0; + ret = 0; out: - if (fd) - glfs_close(fd); - glfs_fini (fs); - return ret; + if (fd) + glfs_close(fd); + glfs_fini(fs); + return ret; } diff --git a/tests/bugs/shard/shard-inode-refcount-test.t b/tests/bugs/shard/shard-inode-refcount-test.t new file mode 100644 index 00000000000..3fd181be690 --- /dev/null +++ b/tests/bugs/shard/shard-inode-refcount-test.t @@ -0,0 +1,30 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +SHARD_COUNT_TIME=5 + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB +TEST $CLI volume start $V0 + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 + +TEST dd if=/dev/zero conv=fsync of=$M0/one-plus-five-shards bs=1M count=23 + +ACTIVE_INODES_BEFORE=$(get_mount_active_size_value $V0) +TEST rm -f $M0/one-plus-five-shards +# Expect 5 inodes less. But one inode more than before because .remove_me would be created. +EXPECT_WITHIN $SHARD_COUNT_TIME `expr $ACTIVE_INODES_BEFORE - 5 + 1` get_mount_active_size_value $V0 $M0 + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup diff --git a/tests/bugs/shard/unlinks-and-renames.t b/tests/bugs/shard/unlinks-and-renames.t index a8f188b2d3a..990ca69a8b1 100644 --- a/tests/bugs/shard/unlinks-and-renames.t +++ b/tests/bugs/shard/unlinks-and-renames.t @@ -9,6 +9,12 @@ cleanup # and rename fops in sharding and make sure they work fine. # +FILE_COUNT_TIME=5 + +function get_file_count { + ls $1* | wc -l +} + ################################################# ################### UNLINK ###################### ################################################# @@ -25,18 +31,25 @@ TEST mkdir $M0/dir TEST touch $M0/dir/foo TEST touch $M0/dir/new -###################################### -##### Unlink with /.shard absent ##### -###################################### +########################################## +##### 01. Unlink with /.shard absent ##### +########################################## + TEST truncate -s 5M $M0/dir/foo TEST ! stat $B0/${V0}0/.shard TEST ! stat $B0/${V0}1/.shard # Test to ensure that unlink doesn't fail due to absence of /.shard +gfid_foo=$(get_gfid_string $M0/dir/foo) TEST unlink $M0/dir/foo +TEST stat $B0/${V0}0/.shard/.remove_me +TEST stat $B0/${V0}1/.shard/.remove_me +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_foo + +###################################################### +##### 02. Unlink of a sharded file without holes ##### +###################################################### -################################################## -##### Unlink of a sharded file without holes ##### -################################################## # Create a 9M sharded file TEST dd if=/dev/zero of=$M0/dir/new bs=1024 count=9216 gfid_new=$(get_gfid_string $M0/dir/new) @@ -46,17 +59,18 @@ TEST stat $B0/${V0}1/.shard/$gfid_new.1 TEST stat $B0/${V0}0/.shard/$gfid_new.2 TEST stat $B0/${V0}1/.shard/$gfid_new.2 TEST unlink $M0/dir/new -TEST ! stat $B0/${V0}0/.shard/$gfid_new.1 -TEST ! stat $B0/${V0}1/.shard/$gfid_new.1 -TEST ! stat $B0/${V0}0/.shard/$gfid_new.2 -TEST ! stat $B0/${V0}1/.shard/$gfid_new.2 +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_new +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/$gfid_new TEST ! stat $M0/dir/new TEST ! stat $B0/${V0}0/dir/new TEST ! stat $B0/${V0}1/dir/new +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_new +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_new + +########################################### +##### 03. Unlink with /.shard present ##### +########################################### -####################################### -##### Unlink with /.shard present ##### -####################################### TEST truncate -s 5M $M0/dir/foo gfid_foo=$(get_gfid_string $M0/dir/foo) # Ensure its shards are absent. @@ -67,21 +81,28 @@ TEST unlink $M0/dir/foo TEST ! stat $B0/${V0}0/dir/foo TEST ! stat $B0/${V0}1/dir/foo TEST ! stat $M0/dir/foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_foo + +################################################################# +##### 04. Unlink of a file with only one block (the zeroth) ##### +################################################################# -############################################################# -##### Unlink of a file with only one block (the zeroth) ##### -############################################################# TEST touch $M0/dir/foo +gfid_foo=$(get_gfid_string $M0/dir/foo) TEST dd if=/dev/zero of=$M0/dir/foo bs=1024 count=1024 -# Test to ensure that unlink of a sparse file works fine. +# Test to ensure that unlink of a file with only base shard works fine. TEST unlink $M0/dir/foo TEST ! stat $B0/${V0}0/dir/foo TEST ! stat $B0/${V0}1/dir/foo TEST ! stat $M0/dir/foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_foo +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_foo + +######################################################## +##### 05. Unlink of a sharded file with hard-links ##### +######################################################## -#################################################### -##### Unlink of a sharded file with hard-links ##### -#################################################### # Create a 9M sharded file TEST dd if=/dev/zero of=$M0/dir/original bs=1024 count=9216 gfid_original=$(get_gfid_string $M0/dir/original) @@ -94,6 +115,8 @@ TEST stat $B0/${V0}1/.shard/$gfid_original.2 TEST ln $M0/dir/original $M0/link # Now delete the original file. TEST unlink $M0/dir/original +TEST ! stat $B0/${V0}0/.shard/.remove_me/$gfid_original +TEST ! stat $B0/${V0}1/.shard/.remove_me/$gfid_original # Ensure the shards are still intact. TEST stat $B0/${V0}0/.shard/$gfid_original.1 TEST stat $B0/${V0}1/.shard/$gfid_original.1 @@ -105,11 +128,11 @@ TEST stat $B0/${V0}0/link TEST stat $B0/${V0}1/link # Now delete the last link. TEST unlink $M0/link +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_original +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_original # Ensure that the shards are all cleaned up. -TEST ! stat $B0/${V0}0/.shard/$gfid_original.1 -TEST ! stat $B0/${V0}1/.shard/$gfid_original.1 -TEST ! stat $B0/${V0}0/.shard/$gfid_original.2 -TEST ! stat $B0/${V0}1/.shard/$gfid_original.2 +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_original +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/$gfid_original TEST ! stat $M0/link TEST ! stat $B0/${V0}0/link TEST ! stat $B0/${V0}1/link @@ -136,10 +159,12 @@ TEST mkdir $M0/dir TEST touch $M0/dir/src TEST touch $M0/dir/dst -###################################### -##### Rename with /.shard absent ##### -###################################### +########################################## +##### 06. Rename with /.shard absent ##### +########################################## + TEST truncate -s 5M $M0/dir/dst +gfid_dst=$(get_gfid_string $M0/dir/dst) TEST ! stat $B0/${V0}0/.shard TEST ! stat $B0/${V0}1/.shard # Test to ensure that rename doesn't fail due to absence of /.shard @@ -150,10 +175,13 @@ TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src TEST stat $B0/${V0}0/dir/dst TEST stat $B0/${V0}1/dir/dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst + +###################################################### +##### 07. Rename to a sharded file without holes ##### +###################################################### -################################################## -##### Rename to a sharded file without holes ##### -################################################## TEST unlink $M0/dir/dst TEST touch $M0/dir/src # Create a 9M sharded file @@ -165,24 +193,26 @@ TEST stat $B0/${V0}1/.shard/$gfid_dst.1 TEST stat $B0/${V0}0/.shard/$gfid_dst.2 TEST stat $B0/${V0}1/.shard/$gfid_dst.2 TEST mv -f $M0/dir/src $M0/dir/dst -TEST ! stat $B0/${V0}0/.shard/$gfid_dst.1 -TEST ! stat $B0/${V0}1/.shard/$gfid_dst.1 -TEST ! stat $B0/${V0}0/.shard/$gfid_dst.2 -TEST ! stat $B0/${V0}1/.shard/$gfid_dst.2 +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/$gfid_dst TEST ! stat $M0/dir/src TEST stat $M0/dir/dst TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src TEST stat $B0/${V0}0/dir/dst TEST stat $B0/${V0}1/dir/dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst + +####################################################### +##### 08. Rename of dst file with /.shard present ##### +####################################################### -################################################### -##### Rename of dst file with /.shard present ##### -################################################### TEST unlink $M0/dir/dst TEST touch $M0/dir/src TEST truncate -s 5M $M0/dir/dst -# Test to ensure that unlink of a sparse file works fine. +gfid_dst=$(get_gfid_string $M0/dir/dst) +# Test to ensure that rename into a sparse file works fine. TEST mv -f $M0/dir/src $M0/dir/dst TEST ! stat $M0/dir/src TEST stat $M0/dir/dst @@ -190,14 +220,18 @@ TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src TEST stat $B0/${V0}0/dir/dst TEST stat $B0/${V0}1/dir/dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst + +################################################################### +##### 09. Rename of dst file with only one block (the zeroth) ##### +################################################################### -############################################################### -##### Rename of dst file with only one block (the zeroth) ##### -############################################################### TEST unlink $M0/dir/dst TEST touch $M0/dir/src TEST dd if=/dev/zero of=$M0/dir/dst bs=1024 count=1024 -# Test to ensure that unlink of a sparse file works fine. +gfid_dst=$(get_gfid_string $M0/dir/dst) +# Test to ensure that rename into a file with only base shard works fine. TEST mv -f $M0/dir/src $M0/dir/dst TEST ! stat $M0/dir/src TEST stat $M0/dir/dst @@ -205,10 +239,13 @@ TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src TEST stat $B0/${V0}0/dir/dst TEST stat $B0/${V0}1/dir/dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst + +############################################################ +##### 10. Rename to a dst sharded file with hard-links ##### +############################################################ -######################################################## -##### Rename to a dst sharded file with hard-links ##### -######################################################## TEST unlink $M0/dir/dst TEST touch $M0/dir/src # Create a 9M sharded file @@ -231,10 +268,14 @@ TEST stat $B0/${V0}1/.shard/$gfid_dst.2 TEST ! stat $M0/dir/src TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src +TEST ! stat $B0/${V0}0/.shard/.remove_me/$gfid_dst +TEST ! stat $B0/${V0}1/.shard/.remove_me/$gfid_dst # Now rename another file to the last link. TEST touch $M0/dir/src2 TEST mv -f $M0/dir/src2 $M0/link # Ensure that the shards are all cleaned up. +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/$gfid_dst TEST ! stat $B0/${V0}0/.shard/$gfid_dst.1 TEST ! stat $B0/${V0}1/.shard/$gfid_dst.1 TEST ! stat $B0/${V0}0/.shard/$gfid_dst.2 @@ -242,8 +283,13 @@ TEST ! stat $B0/${V0}1/.shard/$gfid_dst.2 TEST ! stat $M0/dir/src2 TEST ! stat $B0/${V0}0/dir/src2 TEST ! stat $B0/${V0}1/dir/src2 +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst +EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst + +############################################################## +##### 11. Rename with non-existent dst and a sharded src ##### +##############################################################l -# Rename with non-existent dst and a sharded src TEST touch $M0/dir/src TEST dd if=/dev/zero of=$M0/dir/src bs=1024 count=9216 gfid_src=$(get_gfid_string $M0/dir/src) @@ -253,7 +299,7 @@ TEST stat $B0/${V0}1/.shard/$gfid_src.1 TEST stat $B0/${V0}0/.shard/$gfid_src.2 TEST stat $B0/${V0}1/.shard/$gfid_src.2 # Now rename src to the dst. -TEST mv $M0/dir/src $M0/dir/dst +TEST mv $M0/dir/src $M0/dir/dst2 TEST stat $B0/${V0}0/.shard/$gfid_src.1 TEST stat $B0/${V0}1/.shard/$gfid_src.1 @@ -262,23 +308,26 @@ TEST stat $B0/${V0}1/.shard/$gfid_src.2 TEST ! stat $M0/dir/src TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src -TEST stat $M0/dir/dst -TEST stat $B0/${V0}0/dir/dst -TEST stat $B0/${V0}1/dir/dst +TEST stat $M0/dir/dst2 +TEST stat $B0/${V0}0/dir/dst2 +TEST stat $B0/${V0}1/dir/dst2 + +############################################################################# +##### 12. Rename with non-existent dst and a sharded src with no shards ##### +############################################################################# -# Rename with non-existent dst and a sharded src with no shards TEST touch $M0/dir/src TEST dd if=/dev/zero of=$M0/dir/src bs=1024 count=1024 gfid_src=$(get_gfid_string $M0/dir/src) TEST ! stat $B0/${V0}0/.shard/$gfid_src.1 TEST ! stat $B0/${V0}1/.shard/$gfid_src.1 # Now rename src to the dst. -TEST mv $M0/dir/src $M0/dir/dst +TEST mv $M0/dir/src $M0/dir/dst1 TEST ! stat $M0/dir/src TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src -TEST stat $M0/dir/dst -TEST stat $B0/${V0}0/dir/dst -TEST stat $B0/${V0}1/dir/dst +TEST stat $M0/dir/dst1 +TEST stat $B0/${V0}0/dir/dst1 +TEST stat $B0/${V0}1/dir/dst1 cleanup diff --git a/tests/bugs/shard/zero-flag.t b/tests/bugs/shard/zero-flag.t index 84cb9635a1b..1f39787ab9f 100644 --- a/tests/bugs/shard/zero-flag.t +++ b/tests/bugs/shard/zero-flag.t @@ -14,6 +14,7 @@ TEST glusterd TEST pidof glusterd TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1,2,3} TEST $CLI volume set $V0 features.shard on +TEST $CLI volume set $V0 features.shard-block-size 4MB TEST $CLI volume start $V0 TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 |
