Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Calum Mackay <calum.mackay@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] WRT18: have it also check the ctime between writes
Date: Thu,  4 May 2023 07:42:37 -0400	[thread overview]
Message-ID: <20230504114237.31090-1-jlayton@kernel.org> (raw)

On many servers, the ctime doesn't have sufficient granularity to show
an apparent change between rapid writes, but some are able to do so.
Have the test also check the ctimes here and pass_warn if it doesn't
change after every write.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 nfs4.0/servertests/st_write.py | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

I've been using this some to test the multigrain ctime patches, and I
think it'd be a reasonable addition. We could also consider adding a
separate test for this.

diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py
index db1b1e585fdb..e635717f76c9 100644
--- a/nfs4.0/servertests/st_write.py
+++ b/nfs4.0/servertests/st_write.py
@@ -497,19 +497,27 @@ def testChangeGranularityWrite(t, env):
     c = env.c1
     c.init_connection()
     fh, stateid = c.create_confirm(t.word())
-    ops = c.use_obj(fh) + [c.getattr([FATTR4_CHANGE])] \
-        + [op.write(stateid, 0,  UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \
-        + [op.write(stateid, 10, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \
-        + [op.write(stateid, 20, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \
-        + [op.write(stateid, 30, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])]
+    attrlist = [FATTR4_CHANGE, FATTR4_TIME_METADATA]
+    ops = c.use_obj(fh) + [c.getattr(attrlist)] \
+        + [op.write(stateid, 0,  UNSTABLE4, _text)] + [c.getattr(attrlist)] \
+        + [op.write(stateid, 10, UNSTABLE4, _text)] + [c.getattr(attrlist)] \
+        + [op.write(stateid, 20, UNSTABLE4, _text)] + [c.getattr(attrlist)] \
+        + [op.write(stateid, 30, UNSTABLE4, _text)] + [c.getattr(attrlist)]
     res = c.compound(ops)
     check(res)
-    chattr1 = res.resarray[1].obj_attributes
-    chattr2 = res.resarray[3].obj_attributes
-    chattr3 = res.resarray[5].obj_attributes
-    chattr4 = res.resarray[7].obj_attributes
+    chattr1 = res.resarray[1].obj_attributes[FATTR4_CHANGE]
+    chattr2 = res.resarray[3].obj_attributes[FATTR4_CHANGE]
+    chattr3 = res.resarray[5].obj_attributes[FATTR4_CHANGE]
+    chattr4 = res.resarray[7].obj_attributes[FATTR4_CHANGE]
     if chattr1 == chattr2 or chattr2 == chattr3 or chattr3 == chattr4:
-        t.fail("consecutive SETATTR(mode)'s don't all change change attribute")
+        t.fail("consecutive WRITE's don't change change attribute")
+
+    ctime1 = res.resarray[1].obj_attributes[FATTR4_TIME_METADATA]
+    ctime2 = res.resarray[3].obj_attributes[FATTR4_TIME_METADATA]
+    ctime3 = res.resarray[5].obj_attributes[FATTR4_TIME_METADATA]
+    ctime4 = res.resarray[7].obj_attributes[FATTR4_TIME_METADATA]
+    if compareTimes(ctime1, ctime2) == 0 or compareTimes(ctime2, ctime3) == 0 or compareTimes(ctime3, ctime4) == 0:
+        t.pass_warn("consecutive WRITE's don't all change time_metadata")
 
 def testStolenStateid(t, env):
     """WRITE with incorrect permissions and somebody else's stateid
-- 
2.40.1


                 reply	other threads:[~2023-05-04 11:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230504114237.31090-1-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=calum.mackay@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox