diff mbox series

CACHE: Fix test script as delegation being introduced

Message ID 1548297019-9398-1-git-send-email-suyj.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series CACHE: Fix test script as delegation being introduced | expand

Commit Message

Su Yanjun Jan. 24, 2019, 2:30 a.m. UTC
When we run nfstest_cache with nfsversion=4, it fails.
As i know nfsv4 introduces delegation, so nfstest_cache runs fail since nfsv4.

The test commandline is as below:
 ./nfstest_cache --nfsversion=4 -e  /nfsroot --server 192.168.102.143 --client 192.168.102.142 --runtest acregmax_data --verbose all

This patch adds compatible code for nfsv3 and nfsv4.
When we test nfsv4, just use 'chmod' to recall delegation, then
run the test. As 'chmod' will modify atime, so use 'noatime' mount option.

Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com>
---
 test/nfstest_cache | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Su Yanjun Feb. 19, 2019, 1 a.m. UTC | #1
Any ping?

On 2019/1/24 10:30, Su Yanjun wrote:
> When we run nfstest_cache with nfsversion=4, it fails.
> As i know nfsv4 introduces delegation, so nfstest_cache runs fail since nfsv4.
>
> The test commandline is as below:
>   ./nfstest_cache --nfsversion=4 -e  /nfsroot --server 192.168.102.143 --client 192.168.102.142 --runtest acregmax_data --verbose all
>
> This patch adds compatible code for nfsv3 and nfsv4.
> When we test nfsv4, just use 'chmod' to recall delegation, then
> run the test. As 'chmod' will modify atime, so use 'noatime' mount option.
>
> Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com>
> ---
>   test/nfstest_cache | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/test/nfstest_cache b/test/nfstest_cache
> index 0838418..a31d48f 100755
> --- a/test/nfstest_cache
> +++ b/test/nfstest_cache
> @@ -165,8 +165,13 @@ class CacheTest(TestUtil):
>               fd = None
>               attr = 'data' if data_cache else 'attribute'
>               header = "Verify consistency of %s caching with %s on a file" % (attr, self.nfsstr())
> +
>               # Mount options
> -            mtopts = "hard,intr,rsize=4096,wsize=4096"
> +            if self.nfsversion >= 4:
> +                mtopts = "noatime,hard,intr,rsize=4096,wsize=4096"
> +            else:
> +                mtopts = "hard,intr,rsize=4096,wsize=4096"
> +
>               if actimeo:
>                   header += " actimeo = %d" % actimeo
>                   mtopts += ",actimeo=%d" % actimeo
> @@ -216,6 +221,11 @@ class CacheTest(TestUtil):
>               if fstat.st_size != dlen:
>                   raise Exception("Size of newly created file is %d, should have been %d" %(fstat.st_size, dlen))
>   
> +            if self.nfsversion >= 4:
> +                # revoke delegation
> +                self.dprint('DBG3', "revoke delegation")
> +                self.clientobj.run_cmd('chmod +x %s' % self.absfile)
> +
>               if acregmax:
>                   # Stat the unchanging file until acregmax is hit
>                   # each stat doubles the valid cache time
diff mbox series

Patch

diff --git a/test/nfstest_cache b/test/nfstest_cache
index 0838418..a31d48f 100755
--- a/test/nfstest_cache
+++ b/test/nfstest_cache
@@ -165,8 +165,13 @@  class CacheTest(TestUtil):
             fd = None
             attr = 'data' if data_cache else 'attribute'
             header = "Verify consistency of %s caching with %s on a file" % (attr, self.nfsstr())
+
             # Mount options
-            mtopts = "hard,intr,rsize=4096,wsize=4096"
+            if self.nfsversion >= 4:
+                mtopts = "noatime,hard,intr,rsize=4096,wsize=4096"
+            else: 
+                mtopts = "hard,intr,rsize=4096,wsize=4096"
+
             if actimeo:
                 header += " actimeo = %d" % actimeo
                 mtopts += ",actimeo=%d" % actimeo
@@ -216,6 +221,11 @@  class CacheTest(TestUtil):
             if fstat.st_size != dlen:
                 raise Exception("Size of newly created file is %d, should have been %d" %(fstat.st_size, dlen))
 
+            if self.nfsversion >= 4:
+                # revoke delegation
+                self.dprint('DBG3', "revoke delegation")
+                self.clientobj.run_cmd('chmod +x %s' % self.absfile)
+
             if acregmax:
                 # Stat the unchanging file until acregmax is hit
                 # each stat doubles the valid cache time