Subject: [nfsv4] NFS4, locks and lock_owner4

From: "Mkrtchyan, Tigran" <[email-masked]>
Date: Wed, 8 Feb 2017 17:01:21 +0100 (CET)

Dear NFS experts,

during testing of locking code we hit an issue with a client which has
unexpected (to me, of course) behavior with lock_owner. The client
speaks NFSv4.0:

 -> OPEN file1, open_owner1
 <- OPEN fh1, open_stateid1
 -> OPEN_CONFIRM open_stateid1
 <- OPEN_CONFIRM OK
 -> LOCK fh1, new lock owner: true, open_owner1, open_stateid1
 <- LOCK lock_stateid1
 -> LOCKU lock_stateid1
 <- LOCKU OK
 -> CLOSE fh1, open_stateid1
 <- CLOSE OK

so far so good. Now:

 -> OPEN file1, open_owner1
 <- OPEN fh1, open_stateid2
 -> OPEN_CONFIRM open_stateid2
 <- OPEN_CONFIRM OK
 -> LOCK fh1, new lock owner: false, lock_stateid1
 <- LOCK BAD_STATEID

(capture file: https://desycloud.desy.de/index.php/s/jfxBVd1RjrVgkob) 

IOW, client issues LOCK and uses lock_stateid1. My reading of https://tools.ietf.org/html/rfc7530#section-16.2.5
tells me, that CLOSE invalidates all locking stats, e.q. old lock_state1 is invalid.

Can someone throw light on this?

Thanks a lot,
   Tigran.