All of lore.kernel.org
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: "Antonio M." <quactinoids@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: pynfs blocking lock test
Date: Wed, 18 Apr 2018 11:54:39 -0400	[thread overview]
Message-ID: <20180418155439.GA9897@fieldses.org> (raw)
In-Reply-To: <CAABTemTHvp+2rthSZNPgZBzfVvumy53bLuKS7wLEcuFopUpVig@mail.gmail.com>

On Tue, Apr 17, 2018 at 07:32:42PM +0530, Antonio M. wrote:
> It looks like "testLongPoll" in st_lock.py is trying to test whether
> lock is not granted to others before client lease expires.
> 
> However, I don't understand that the following part of the code where
> lockowner3 is trying to grab a lock is also part of the same Client
> and sends LOCK with the same ClientID.
> ...
>         if badpoll:
>             # Third owner tries to butt in and steal lock
>             res3 = c.lock_file("owner3", fh3, stateid3,
>                                type=WRITEW_LT, lockowner="lockowner3_LOCK22")
> ...
> 
> So, after performing the LOCK operation (even though it was denied),
> lease on client will be renewed.
> And thus, lease will never expire. Only when the loop completes, LOCK
> will be unlocked by the first owner.

Without looking in detail at that code, I think what it's trying to test
for is the optional fair-locking behavior described here:

	https://tools.ietf.org/html/rfc7530#section-9.4

	Two new lock types are added, READW and WRITEW, and are used to
	indicate to the server that the client is requesting a blocking
	lock.  The server should maintain an ordered list of pending
	blocking locks.  When the conflicting lock is released, the
	server may wait the lease period for the first waiting client to
	re-request the lock.  After the lease period expires, the next
	waiting client request is allowed the lock.  Clients are
	required to poll at an interval sufficiently small that it is
	likely to acquire the lock in a timely manner.  The server is
	not required to maintain a list of pending blocked locks, as it
	is not used to provide correct operation but only to increase
	fairness.

So it's not expecting the server to remove the client entirely due to
lease expiry, it's just expecting the server to give up waiting for
another attempt to acquire that particular lock.

(Really I think the test should be using different clients instead of
just different lockowners.  Though if we modify it to use different
clients we will need to make sure it renews the leases on all of them
regularly, since it's the queuing of blocked locks we're trying to test,
not lease expiry.)

> Also, the test does not consider that if NFS server is implementing
> delayed return of DENIAL for conflicting locks.
> 
> Does this test assume certain NFS server implementation ? Also, what
> if the lease is anyway going to be renewed for failed operation since
> client id would be matching and that is good enough to renew lease.

If I remember right, those tests were written years ago to test some
linux server code that never got merged.

There's a reason those tests aren't run by default.  I'll happily take
patches if you thin the tests can be made more useful.  Removing them
entirely might also be OK if you think they're not salvageable.

--b.

      reply	other threads:[~2018-04-18 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 14:02 pynfs blocking lock test Antonio M.
2018-04-18 15:54 ` J. Bruce Fields [this message]

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=20180418155439.GA9897@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=quactinoids@gmail.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.