All of lore.kernel.org
 help / color / mirror / Atom feed
From: "suy.fnst@fujitsu.com" <suy.fnst@fujitsu.com>
To: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Cc: "bfields@redhat.com" <bfields@redhat.com>,
	"calum.mackay@oracle.com" <calum.mackay@oracle.com>,
	"suy.fnst@fujitsu.com" <suy.fnst@fujitsu.com>
Subject: [PATCH] pynfs: courtesy: send RECLAIM_COMPLETE before session2 opening the file
Date: Thu, 10 Jun 2021 01:01:43 +0000	[thread overview]
Message-ID: <TY2PR01MB2124D8FDDDCA29F5691F3DD089359@TY2PR01MB2124.jpnprd01.prod.outlook.com> (raw)

The test fails on v5.13-rc5 and old kernels. Because the second session
doesn't send RECLAIM_COMPLETE before attempting to do a non-reclaim
open. So the server returns NFS4ERR_GRACE instead of NFS4_OK.

    # ./testserver.py ${server_IP}:/nfsroot --rundeps COUR2
    INFO   :rpc.poll:got connection from ('127.0.0.1', 39206), assigned to
    fd=5
    INFO   :rpc.thread:Called connect(('193.168.140.239', 2049))
    INFO   :rpc.poll:Adding 6 generated by another thread
    INFO   :test.env:Created client to 193.168.140.239, 2049
    INFO   :test.env:Called do_readdir()
    INFO   :test.env:do_readdir() = [entry4(cookie=512,
    name=b'COUR2_1623055313', attrs={})]
    fileb'COUR2_1623119443'created by sess1
    INFO   :test.env:Sleeping for 22 seconds: twice the lease period
    INFO   :test.env:Woke up
    session created
    **************************************************
    COUR2    st_courtesy.testLockSleepLock                            :
    FAILURE
           OP_OPEN should return NFS4_OK, instead got
                     NFS4ERR_GRACE
    **************************************************
    Command line asked for 1 of 255 tests
      Of those: 0 Skipped, 1 Failed, 0 Warned, 0 Passed

RFC5661, page 567:
"Whenever a client establishes a new client ID and before it does the
first non-reclaim operation that obtains a lock, it MUST send a
RECLAIM_COMPLETE with rca_one_fs set to FALSE, even if there are no
locks to reclaim. If non-reclaim locking operations are done before
the RECLAIM_COMPLETE, an NFS4ERR_GRACE error will be returned."

Send RECLAIM_COMPLETE before the file open to let the test pass.
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 nfs4.1/server41tests/st_courtesy.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nfs4.1/server41tests/st_courtesy.py b/nfs4.1/server41tests/st_courtesy.py
index dd911a37772d..3478a9d93dbf 100644
--- a/nfs4.1/server41tests/st_courtesy.py
+++ b/nfs4.1/server41tests/st_courtesy.py
@@ -74,6 +74,9 @@ def testLockSleepLock(t, env):
     c2 = env.c1.new_client(b"%s_2" % env.testname(t))
     sess2 = c2.create_session()
 
+    res = sess2.compound([op.reclaim_complete(FALSE)])
+    check(res)
+
     res = open_file(sess2, env.testname(t), access=OPEN4_SHARE_ACCESS_WRITE)
     check(res)
 
-- 
2.30.1

             reply	other threads:[~2021-06-10  1:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  1:01 suy.fnst [this message]
2021-06-10 11:44 ` [PATCH] pynfs: courtesy: send RECLAIM_COMPLETE before session2 opening the file Calum Mackay
2021-06-14 20:50 ` Calum Mackay
2021-06-15 14:47   ` J. Bruce Fields
2021-06-15 15:38     ` Calum Mackay
2021-06-15 15:50       ` J. Bruce Fields
2021-06-15 15:58         ` Calum Mackay

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=TY2PR01MB2124D8FDDDCA29F5691F3DD089359@TY2PR01MB2124.jpnprd01.prod.outlook.com \
    --to=suy.fnst@fujitsu.com \
    --cc=bfields@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.