diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2015-07-20 16:03:40 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2015-08-10 21:22:09 -0700 |
commit | c0da330c32312edc4233fe6f660ce8e218638fb5 (patch) | |
tree | bae1c42b34d2a60483df6977703542e56055660c /tests/bitrot/bug-1244613.t | |
parent | cdf238e7c90273beff73617481d19d77fc8014db (diff) | |
download | glusterfs-c0da330c32312edc4233fe6f660ce8e218638fb5.tar.gz glusterfs-c0da330c32312edc4233fe6f660ce8e218638fb5.tar.xz glusterfs-c0da330c32312edc4233fe6f660ce8e218638fb5.zip |
tests: set inode-lru-limit to 1 and check if bit-rot xattrs are wrongy created
This test sets the lru limit of the inode table to 1 and checks if inode forgets
and resolve cause any problem with bit-rot xattrs (especially bad-file xattr).
Change-Id: I1fa25fa2d31dda8d26e8192562e896e5bddd0381
BUG: 1244613
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/11718
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'tests/bitrot/bug-1244613.t')
-rw-r--r-- | tests/bitrot/bug-1244613.t | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/bitrot/bug-1244613.t b/tests/bitrot/bug-1244613.t new file mode 100644 index 0000000000..000a1d358e --- /dev/null +++ b/tests/bitrot/bug-1244613.t @@ -0,0 +1,87 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../nfs.rc +. $(dirname $0)/../fileio.rc + +cleanup; + +TESTS_EXPECTED_IN_LOOP=16 +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/brick1; +EXPECT 'Created' volinfo_field $V0 'Status'; + + +# The test makes use of inode-lru-limit to hit a scenario, where we +# find an inode whose ancestry is not there. Following is the +# hypothesis (which is confirmed by seeing logs indicating that +# codepath has been executed, but not through a good understanding of +# NFS internals). + +# At the end of an fop, the reference count of an inode would be +# zero. The inode (and its ancestry) persists in memory only +# because of non-zero lookup count. These looked up inodes are put +# in an lru queue of size 1 (here). So, there can be at most one +# such inode in memory. + +# NFS Server makes use of anonymous fds. So, if it cannot find +# valid fd, it does a nameless lookup. This gives us an inode +# whose ancestry is NULL. When a write happens on this inode, +# quota-enforcer/marker finds a NULL ancestry and asks +# storage/posix to build it. + +TEST $CLI volume set $V0 network.inode-lru-limit 1 +TEST $CLI volume set $V0 performance.nfs.write-behind off + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +TEST mount_nfs $H0:/$V0 $N0; +deep=/0/1/2/3/4/5/6/7/8/9 +TEST mkdir -p $N0/$deep + +TEST touch $N0/$deep/file1 $N0/$deep/file2 $N0/$deep/file3 $N0/$deep/file4 + +TEST fd_open 3 'w' "$N0/$deep/file1" +TEST fd_open 4 'w' "$N0/$deep/file2" +TEST fd_open 5 'w' "$N0/$deep/file3" +TEST fd_open 6 'w' "$N0/$deep/file4" + +# consume all quota +echo "Hello" > $N0/$deep/new_file_1 +echo "World" >> $N0/$deep/new_file_1 +echo 1 >> $N0/$deep/new_file_1 +echo 2 >> $N0/$deep/new_file_1 + + +# At the end of each fop in server, reference count of the +# inode associated with each of the file above drops to zero and hence +# put into lru queue. Since lru-limit is set to 1, an fop next file +# will displace the current inode from itable. This will ensure that +# when writes happens on same fd, fd resolution results in +# nameless lookup from server and encounters an fd +# associated with an inode whose parent is not present in itable. + +for j in $(seq 1 2); do + for i in $(seq 3 6); do + TEST_IN_LOOP fd_write $i "content" + TEST_IN_LOOP sync + done +done + +exec 3>&- +exec 4>&- +exec 5>&- +exec 6>&- + +$CLI volume statedump $V0 all + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 + +TEST $CLI volume stop $V0 + +cleanup; |