summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2013-08-20 17:54:10 +0530
committerRaghavendra G <rgowdapp@redhat.com>2013-09-03 10:28:04 +0530
commit19c728d4162c16a12363fc9ad2cda1aa835b6b31 (patch)
tree84939cc32586c9ed3968d44f382418062d930bc1
parent81e4bb08f60e8fe58925d0ec058b332303486321 (diff)
features/quota: Add test case to trigger quota ancestry building
codepath. Change-Id: I41bdfb55d9313d2b7f735464fb3409875981bc40 BUG: 969461 Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
-rwxr-xr-xtests/basic/quota-anon-fd-nfs.t52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/basic/quota-anon-fd-nfs.t b/tests/basic/quota-anon-fd-nfs.t
new file mode 100755
index 00000000..ec65c6e6
--- /dev/null
+++ b/tests/basic/quota-anon-fd-nfs.t
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+
+cleanup;
+
+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 start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+TEST $CLI volume quota $V0 enable
+TEST $CLI volume quota $V0 limit-usage / 10GB
+
+TEST mount -t nfs localhost:/$V0 $N0
+sleep 20
+deep=/0/1/2/3/4/5/6/7/8/9
+TEST mkdir -p $N0/$deep
+
+
+TEST dd if=/dev/zero of=$N0/$deep/file bs=1K count=1M &
+TEST dd if=/dev/zero of=$N0/$deep/newfile bs=1K count=1M &
+
+# wait for completion of background jobs
+wait
+
+cleanup;