|
|
7f4c2a |
From 4054c96ec56c90ccd5955af555a7e953417206fa Mon Sep 17 00:00:00 2001
|
|
|
7f4c2a |
From: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
7f4c2a |
Date: Mon, 20 Jul 2015 16:03:40 +0530
|
|
|
7f4c2a |
Subject: [PATCH 286/304] tests: set inode-lru-limit to 1 and check if bit-rot xattrs are wrongy created
|
|
|
7f4c2a |
|
|
|
7f4c2a |
Backport of http://review.gluster.org/11718
|
|
|
7f4c2a |
|
|
|
7f4c2a |
This test sets the lru limit of the inode table to 1 and checks if inode forgets
|
|
|
7f4c2a |
and resolve cause any problem with bit-rot xattrs (especially bad-file xattr).
|
|
|
7f4c2a |
|
|
|
7f4c2a |
> Change-Id: I1fa25fa2d31dda8d26e8192562e896e5bddd0381
|
|
|
7f4c2a |
> BUG: 1244613
|
|
|
7f4c2a |
> Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
7f4c2a |
> Reviewed-on: http://review.gluster.org/11718
|
|
|
7f4c2a |
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
7f4c2a |
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
|
|
|
7f4c2a |
> Reviewed-by: Venky Shankar <vshankar@redhat.com>
|
|
|
7f4c2a |
> Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
7f4c2a |
|
|
|
7f4c2a |
Change-Id: I0daddac9b47211e2e6b9f1299396eadf0ec1e207
|
|
|
7f4c2a |
BUG: 1251409
|
|
|
7f4c2a |
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
7f4c2a |
Reviewed-on: https://code.engineering.redhat.com/gerrit/55884
|
|
|
7f4c2a |
---
|
|
|
7f4c2a |
tests/bitrot/bug-1244613.t | 87 ++++++++++++++++++++++++++
|
|
|
7f4c2a |
xlators/protocol/server/src/server-resolve.c | 28 +++++----
|
|
|
7f4c2a |
2 files changed, 103 insertions(+), 12 deletions(-)
|
|
|
7f4c2a |
create mode 100644 tests/bitrot/bug-1244613.t
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/tests/bitrot/bug-1244613.t b/tests/bitrot/bug-1244613.t
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..000a1d3
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/tests/bitrot/bug-1244613.t
|
|
|
7f4c2a |
@@ -0,0 +1,87 @@
|
|
|
7f4c2a |
+#!/bin/bash
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+. $(dirname $0)/../include.rc
|
|
|
7f4c2a |
+. $(dirname $0)/../volume.rc
|
|
|
7f4c2a |
+. $(dirname $0)/../nfs.rc
|
|
|
7f4c2a |
+. $(dirname $0)/../fileio.rc
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+cleanup;
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TESTS_EXPECTED_IN_LOOP=16
|
|
|
7f4c2a |
+TEST glusterd
|
|
|
7f4c2a |
+TEST pidof glusterd
|
|
|
7f4c2a |
+TEST $CLI volume info;
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST $CLI volume create $V0 $H0:$B0/brick1;
|
|
|
7f4c2a |
+EXPECT 'Created' volinfo_field $V0 'Status';
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+# The test makes use of inode-lru-limit to hit a scenario, where we
|
|
|
7f4c2a |
+# find an inode whose ancestry is not there. Following is the
|
|
|
7f4c2a |
+# hypothesis (which is confirmed by seeing logs indicating that
|
|
|
7f4c2a |
+# codepath has been executed, but not through a good understanding of
|
|
|
7f4c2a |
+# NFS internals).
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+# At the end of an fop, the reference count of an inode would be
|
|
|
7f4c2a |
+# zero. The inode (and its ancestry) persists in memory only
|
|
|
7f4c2a |
+# because of non-zero lookup count. These looked up inodes are put
|
|
|
7f4c2a |
+# in an lru queue of size 1 (here). So, there can be at most one
|
|
|
7f4c2a |
+# such inode in memory.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+# NFS Server makes use of anonymous fds. So, if it cannot find
|
|
|
7f4c2a |
+# valid fd, it does a nameless lookup. This gives us an inode
|
|
|
7f4c2a |
+# whose ancestry is NULL. When a write happens on this inode,
|
|
|
7f4c2a |
+# quota-enforcer/marker finds a NULL ancestry and asks
|
|
|
7f4c2a |
+# storage/posix to build it.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST $CLI volume set $V0 network.inode-lru-limit 1
|
|
|
7f4c2a |
+TEST $CLI volume set $V0 performance.nfs.write-behind off
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST $CLI volume start $V0;
|
|
|
7f4c2a |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST mount_nfs $H0:/$V0 $N0;
|
|
|
7f4c2a |
+deep=/0/1/2/3/4/5/6/7/8/9
|
|
|
7f4c2a |
+TEST mkdir -p $N0/$deep
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST touch $N0/$deep/file1 $N0/$deep/file2 $N0/$deep/file3 $N0/$deep/file4
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST fd_open 3 'w' "$N0/$deep/file1"
|
|
|
7f4c2a |
+TEST fd_open 4 'w' "$N0/$deep/file2"
|
|
|
7f4c2a |
+TEST fd_open 5 'w' "$N0/$deep/file3"
|
|
|
7f4c2a |
+TEST fd_open 6 'w' "$N0/$deep/file4"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+# consume all quota
|
|
|
7f4c2a |
+echo "Hello" > $N0/$deep/new_file_1
|
|
|
7f4c2a |
+echo "World" >> $N0/$deep/new_file_1
|
|
|
7f4c2a |
+echo 1 >> $N0/$deep/new_file_1
|
|
|
7f4c2a |
+echo 2 >> $N0/$deep/new_file_1
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+# At the end of each fop in server, reference count of the
|
|
|
7f4c2a |
+# inode associated with each of the file above drops to zero and hence
|
|
|
7f4c2a |
+# put into lru queue. Since lru-limit is set to 1, an fop next file
|
|
|
7f4c2a |
+# will displace the current inode from itable. This will ensure that
|
|
|
7f4c2a |
+# when writes happens on same fd, fd resolution results in
|
|
|
7f4c2a |
+# nameless lookup from server and encounters an fd
|
|
|
7f4c2a |
+# associated with an inode whose parent is not present in itable.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+for j in $(seq 1 2); do
|
|
|
7f4c2a |
+ for i in $(seq 3 6); do
|
|
|
7f4c2a |
+ TEST_IN_LOOP fd_write $i "content"
|
|
|
7f4c2a |
+ TEST_IN_LOOP sync
|
|
|
7f4c2a |
+ done
|
|
|
7f4c2a |
+done
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+exec 3>&-
|
|
|
7f4c2a |
+exec 4>&-
|
|
|
7f4c2a |
+exec 5>&-
|
|
|
7f4c2a |
+exec 6>&-
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+$CLI volume statedump $V0 all
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+TEST $CLI volume stop $V0
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+cleanup;
|
|
|
7f4c2a |
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
|
|
|
7f4c2a |
index 906dc00..5f3d475 100644
|
|
|
7f4c2a |
--- a/xlators/protocol/server/src/server-resolve.c
|
|
|
7f4c2a |
+++ b/xlators/protocol/server/src/server-resolve.c
|
|
|
7f4c2a |
@@ -167,12 +167,14 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
inode_path (resolve_loc->parent, resolve_loc->name,
|
|
|
7f4c2a |
(char **) &resolve_loc->path);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- dict = dict_copy_with_ref (state->xdata, NULL);
|
|
|
7f4c2a |
- if (!dict && state->xdata)
|
|
|
7f4c2a |
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
|
|
|
7f4c2a |
- "BUG: dict allocation failed (pargfid: %s, name: %s), "
|
|
|
7f4c2a |
- "still continuing", uuid_utoa (resolve_loc->gfid),
|
|
|
7f4c2a |
- resolve_loc->name);
|
|
|
7f4c2a |
+ if (state->xdata) {
|
|
|
7f4c2a |
+ dict = dict_copy_with_ref (state->xdata, NULL);
|
|
|
7f4c2a |
+ if (!dict)
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "BUG: dict allocation failed (pargfid: %s, name: %s), "
|
|
|
7f4c2a |
+ "still continuing", uuid_utoa (resolve_loc->gfid),
|
|
|
7f4c2a |
+ resolve_loc->name);
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
|
|
|
7f4c2a |
STACK_WIND (frame, resolve_gfid_entry_cbk,
|
|
|
7f4c2a |
frame->root->client->bound_xl,
|
|
|
7f4c2a |
@@ -210,12 +212,14 @@ resolve_gfid (call_frame_t *frame)
|
|
|
7f4c2a |
resolve_loc->inode = inode_new (state->itable);
|
|
|
7f4c2a |
ret = loc_path (resolve_loc, NULL);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- xdata = dict_copy_with_ref (state->xdata, NULL);
|
|
|
7f4c2a |
- if (!xdata && state->xdata)
|
|
|
7f4c2a |
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
|
|
|
7f4c2a |
- "BUG: dict allocation failed (gfid: %s), "
|
|
|
7f4c2a |
- "still continuing",
|
|
|
7f4c2a |
- uuid_utoa (resolve_loc->gfid));
|
|
|
7f4c2a |
+ if (state->xdata) {
|
|
|
7f4c2a |
+ xdata = dict_copy_with_ref (state->xdata, NULL);
|
|
|
7f4c2a |
+ if (!xdata)
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "BUG: dict allocation failed (gfid: %s), "
|
|
|
7f4c2a |
+ "still continuing",
|
|
|
7f4c2a |
+ uuid_utoa (resolve_loc->gfid));
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
|
|
|
7f4c2a |
STACK_WIND (frame, resolve_gfid_cbk,
|
|
|
7f4c2a |
frame->root->client->bound_xl,
|
|
|
7f4c2a |
--
|
|
|
7f4c2a |
1.7.1
|
|
|
7f4c2a |
|