All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: NeilBrown <neilb@suse.de>
Cc: "J. Bruce Fields" <bfields@redhat.com>,
	linux-nfs@vger.kernel.org, Yong Sun <yosun@suse.com>
Subject: Re: pynfs: [NFS 4.0] SEC7, LOCK24 test failures
Date: Thu, 20 Jan 2022 11:51:35 +0100	[thread overview]
Message-ID: <Yek+t754lmv5lCQI@pevik> (raw)
In-Reply-To: <164248153844.24166.16775550865302060652@noble.neil.brown.name>

Hi Neil,

> 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@suse.de>
> 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.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>

Thanks!

> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
>  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
I'd just: self.lockseq += 1
(supported even on python 2.x)

>      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
And here.


Kind regards,
Petr

>  def testOpenUpgradeLock(t, env):
>      """Try open, lock, open, downgrade, close

  reply	other threads:[~2022-01-20 10:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 14:01 pynfs: [NFS 4.0] SEC7, LOCK24 test failures Petr Vorel
2021-06-01 15:31 ` J. Bruce Fields
2021-06-02  7:58   ` Petr Vorel
2022-01-18  4:52   ` NeilBrown
2022-01-20 10:51     ` Petr Vorel [this message]
2022-01-25 22:46     ` Bruce Fields
2022-01-25 23:48       ` NeilBrown
2022-01-26  0:14       ` Frank Filz
2022-04-01 13:30         ` Petr Vorel

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=Yek+t754lmv5lCQI@pevik \
    --to=pvorel@suse.cz \
    --cc=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=yosun@suse.com \
    /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.