Re: pynfs: [NFS 4.0] SEC7, LOCK24 test failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 02 Jun 2021, J. Bruce Fields wrote:
> On Tue, Jun 01, 2021 at 04:01:08PM +0200, Petr Vorel wrote:
> 
> > LOCK24   st_lock.testOpenUpgradeLock                              : FAILURE
> >            OP_LOCK should return NFS4_OK, instead got
> >            NFS4ERR_BAD_SEQID
> 
> I suspect the server's actually OK here, but I need to look more
> closely.
> 
I agree.
I think this patch fixes the test.

NeilBrown

From: NeilBrown <neilb@xxxxxxx>
Date: Tue, 18 Jan 2022 15:50:37 +1100
Subject: [PATCH] Fix NFSv4.0 LOCK24 test

Only the first lock request for a given open-owner can use lock_file.
Subsequent lock request must use relock_file.

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---
 nfs4.0/servertests/st_lock.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/nfs4.0/servertests/st_lock.py b/nfs4.0/servertests/st_lock.py
index 468672403ffe..db08fbeedac4 100644
--- a/nfs4.0/servertests/st_lock.py
+++ b/nfs4.0/servertests/st_lock.py
@@ -886,6 +886,7 @@ class open_sequence:
         self.client = client
         self.owner = owner
         self.lockowner = lockowner
+        self.lockseq = 0
     def open(self, access):
         self.fh, self.stateid = self.client.create_confirm(self.owner,
 						access=access,
@@ -899,15 +900,21 @@ class open_sequence:
     def close(self):
         self.client.close_file(self.owner, self.fh, self.stateid)
     def lock(self, type):
-        res = self.client.lock_file(self.owner, self.fh, self.stateid,
-                    type=type, lockowner=self.lockowner)
+        if self.lockseq == 0:
+            res = self.client.lock_file(self.owner, self.fh, self.stateid,
+                                        type=type, lockowner=self.lockowner)
+        else:
+            res = self.client.relock_file(self.lockseq, self.fh, self.lockstateid,
+                                        type=type)
         check(res)
         if res.status == NFS4_OK:
             self.lockstateid = res.lockid
+            self.lockseq = self.lockseq + 1
     def unlock(self):
         res = self.client.unlock_file(1, self.fh, self.lockstateid)
         if res.status == NFS4_OK:
             self.lockstateid = res.lockid
+            self.lockseq = self.lockseq + 1
 
 def testOpenUpgradeLock(t, env):
     """Try open, lock, open, downgrade, close
-- 
2.34.1





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux