From patchwork Mon Mar 13 11:23:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 13172274 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 989F6C6FD19 for ; Mon, 13 Mar 2023 11:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbjCMLYH (ORCPT ); Mon, 13 Mar 2023 07:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbjCMLYG (ORCPT ); Mon, 13 Mar 2023 07:24:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E94A23C51 for ; Mon, 13 Mar 2023 04:24:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF39261044 for ; Mon, 13 Mar 2023 11:24:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7FB2C433D2; Mon, 13 Mar 2023 11:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678706644; bh=UalLtbEUXRlAxkm63nC35oHQ+IYrk9ag7KeY+8BixDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmlnyXyLE2IYbcu6IUv+gltldLYlWy0k+MFbCPDUdPyEENMOipbZBTJz2lOZDSA+T +iKrybNu1xVb8m+uxoSlCBLeKksEwa3l4HHsAcPX+7UikG632MEm69S2668gse/cAY QwLYSDO+vfUV8OX6J1wo9VgoCZO1r05C4Jhwmh5U69K5Y4HCYN4lDEBPRtNPLGmtRi RVC+EZu+srxAgsXSEhmTIlHKepoGeL/x9xP8sZetjdjZ2jh1xGJIbChunmSKK/7wNZ Cs1zvcUHa3baRe+lAK+us59LfqmYM8geelUMpKKaXDlpUwa/VFpk+oMn4GYLj97xNd hRZ2U1+XXXkZQ== From: Jeff Layton To: calum.mackay@oracle.com Cc: bfields@fieldses.org, ffilzlnx@mindspring.com, linux-nfs@vger.kernel.org, Dai Ngo Subject: [pynfs PATCH v2 1/5] nfs4.0: add a retry loop on NFS4ERR_DELAY to compound function Date: Mon, 13 Mar 2023 07:23:57 -0400 Message-Id: <20230313112401.20488-2-jlayton@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313112401.20488-1-jlayton@kernel.org> References: <20230313112401.20488-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The latest knfsd server is "courteous" in that it will not revoke a lease held by an expired client until there is competing access for it. When there is competing access, it can now return NFS4ERR_DELAY until the old client is expired. I've seen this happen when running pynfs in a loop against a server with only 4g of memory. The v4.0 compound handler doesn't retry automatically on NFS4ERR_DELAY like the v4.1 version does. Add support for it using the same timeouts as the v4.1 compound handler. Cc: Dai Ngo Signed-off-by: Jeff Layton --- nfs4.0/nfs4lib.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index 9b074f02b91f..eddcd862bc2f 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -338,12 +338,21 @@ class NFS4Client(rpc.RPCClient): un_p = self.nfs4unpacker p.reset() p.pack_COMPOUND4args(compoundargs) - res = self.call(NFSPROC4_COMPOUND, p.get_buffer()) - un_p.reset(res) - res = un_p.unpack_COMPOUND4res() - if SHOW_TRAFFIC: - print(res) - un_p.done() + res = None + + # NFS servers can return NFS4ERR_DELAY at any time for any reason. + # Just delay a second and retry the call again in that event. If + # it fails after 10 retries then just give up. + for i in range(1, 10): + res = self.call(NFSPROC4_COMPOUND, p.get_buffer()) + un_p.reset(res) + res = un_p.unpack_COMPOUND4res() + if SHOW_TRAFFIC: + print(res) + un_p.done() + if res.status != NFS4ERR_DELAY: + break + time.sleep(1) # Do some error checking From patchwork Mon Mar 13 11:23:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 13172277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73579C74A4B for ; Mon, 13 Mar 2023 11:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbjCMLYI (ORCPT ); Mon, 13 Mar 2023 07:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjCMLYH (ORCPT ); Mon, 13 Mar 2023 07:24:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEB3629435 for ; Mon, 13 Mar 2023 04:24:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8508A61070 for ; Mon, 13 Mar 2023 11:24:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76D85C4339C; Mon, 13 Mar 2023 11:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678706644; bh=9Bn16TkRKwuNZyh/QyhM6dH7sZeD7Yv8zo7pheE5v5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTpnMmTltbMyneeBZY5/VoBMas/jl3cVh5WiD7hp6tUGBLd+bl4KkV1mQLzDbnc6M AcZPMiq65TkYMRmX4w4OTH1pTB8FF3EB5RCYRZWJsXdjlFVRgiiNB69iICszPBvvkM A4E4+HMtHmTWf/ZT/NN+cviI6lK2mGGGNbSn/viWe83jJlcwz8WX4A+62krjfce/D+ jjDBUzXxG5A6XbQHqxaSRMEVBmqL662jhDE4d7spIvmNVbvUdW3AJCJjZQdBU2R2Aw bCWAo6j42qPd3ebj0+bGsd429v5VuGF4kTqUugtN6uQOElU4JT7xu2VhcSGh/v05Op ncP6d/YNRRWHQ== From: Jeff Layton To: calum.mackay@oracle.com Cc: bfields@fieldses.org, ffilzlnx@mindspring.com, linux-nfs@vger.kernel.org Subject: [pynfs PATCH v2 2/5] examples: add a new example localhost_helper.sh script Date: Mon, 13 Mar 2023 07:23:58 -0400 Message-Id: <20230313112401.20488-3-jlayton@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313112401.20488-1-jlayton@kernel.org> References: <20230313112401.20488-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org It's possible (and pretty common) to run pynfs against the server running on the same host. Add a new serverhelper script for that purpose. Signed-off-by: Jeff Layton --- examples/localhost_helper.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 examples/localhost_helper.sh diff --git a/examples/localhost_helper.sh b/examples/localhost_helper.sh new file mode 100755 index 000000000000..6db123311e7a --- /dev/null +++ b/examples/localhost_helper.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# serverhelper script for running tests against knfsd running on localhost. +# Note that this requires that the running user can use sudo to restart nfsd +# without a password. +# + +# server argument is ignored here +server=$1 +command=$2 +shift; shift + +case $command in +reboot ) + sudo systemctl restart nfs-server.service + ;; +unlink ) + rm $1 + ;; +rename ) + mv $1 $2 + ;; +link ) + ln $1 $2 + ;; +chmod ) + chmod $1 $2 + ;; +esac From patchwork Mon Mar 13 11:23:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 13172276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 819A7C6FD1C for ; Mon, 13 Mar 2023 11:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229504AbjCMLYI (ORCPT ); Mon, 13 Mar 2023 07:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbjCMLYH (ORCPT ); Mon, 13 Mar 2023 07:24:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0EE9303DD for ; Mon, 13 Mar 2023 04:24:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BA4D611DB for ; Mon, 13 Mar 2023 11:24:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3152FC4339B; Mon, 13 Mar 2023 11:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678706645; bh=sVjkQfpECKeMo7VdASMNcHX5iOiyZBe9KE2j7AMXZcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLYb8u55jmPW4rUYgPcAvk2+eN0unMrn6mDzGF3RyiGq98NSsYhVbC9QkISyDuFA8 bFaiExW7sEecokcwEySGB6iYinEHih0IMB+tvDs7EJqI6RPLeTDGmQ2NbxjclHsROS torNRns1rcrU/xvdngOjp2yekA3OwYn79NMiVCkb8CE2HJXZa9J0KLV2pF7fl+C1WX O8TcoxsU6dHgW+E0ac6QSdF7gJWlMZU8QtHJZnpXVR5bKchXPfGRKuh7VdLPbR4mUl Po0xWpJH3mcbdRSR8MhpWMcxT4Bc5XS6ZFcFxh7Qqz5bi2DphKtOiprf+Mw8YuFnLi oxmE3Y38CGcSA== From: Jeff Layton To: calum.mackay@oracle.com Cc: bfields@fieldses.org, ffilzlnx@mindspring.com, linux-nfs@vger.kernel.org Subject: [pynfs PATCH v2 3/5] nfs4.0/testserver.py: don't return an error when tests fail Date: Mon, 13 Mar 2023 07:23:59 -0400 Message-Id: <20230313112401.20488-4-jlayton@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313112401.20488-1-jlayton@kernel.org> References: <20230313112401.20488-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This script was originally changed in eb3ba0b60055 ("Have testserver.py have non-zero exit code if any tests fail"), but the same change wasn't made to the 4.1 testserver.py script. There also wasn't much explanation for it, and it makes it difficult to tell whether the test harness itself failed, or whether there was a failure in a requested test. Stop the 4.0 testserver.py from exiting with an error code when a test fails, so that a successful return means only that the test harness itself worked, not that every requested test passed. Cc: Frank Filz Signed-off-by: Jeff Layton --- nfs4.0/testserver.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index f2c41568e5c7..4f4286daa657 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -387,8 +387,6 @@ def main(): if nfail < 0: sys.exit(3) - if nfail > 0: - sys.exit(2) if __name__ == "__main__": main() From patchwork Mon Mar 13 11:24:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 13172278 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED7D9C7618B for ; Mon, 13 Mar 2023 11:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjCMLYL (ORCPT ); Mon, 13 Mar 2023 07:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbjCMLYJ (ORCPT ); Mon, 13 Mar 2023 07:24:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00072A6ED for ; Mon, 13 Mar 2023 04:24:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90B6EB81042 for ; Mon, 13 Mar 2023 11:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFCB0C433EF; Mon, 13 Mar 2023 11:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678706646; bh=21HKYplHOtIJxCbbTx9Pk5u21FJZ+Ji0N0co6VDdKlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FGwgITaKnzC6qHgp1xND/vl3mckH2cD7mpbB7FQXZ3bbRmVoGrKB3aNrz8VlgS/lt MQbCg8G29dFBGEW85RvydVkRjC2CH18X+gAz23JSPIBD47KS5/+F5bEYfKlUWLTgyO qwZ2zUNppdRq+cBbeN3l7wHUvsoqTqkIJeuOLcbUJVCL71ggyq+JeN423HchrmJzj7 MY7MYN6naHP7PQfQgwrPURLcLUaPWPJXOxu4Ier+g8QzhxG1pNEgxxiKSadZu7Ke17 MyosgMYE3v+M2SyCs2zh8SPPh9vmLzID1uyoJYBPq+lEwq9E+O76gKNXQa1epndi9B loklht7ZIESeQ== From: Jeff Layton To: calum.mackay@oracle.com Cc: bfields@fieldses.org, ffilzlnx@mindspring.com, linux-nfs@vger.kernel.org Subject: [pynfs PATCH v2 4/5] testserver.py: add a new (special) "everything" flag Date: Mon, 13 Mar 2023 07:24:00 -0400 Message-Id: <20230313112401.20488-5-jlayton@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313112401.20488-1-jlayton@kernel.org> References: <20230313112401.20488-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The READMEs for v4.0 and v4.1 are inconsistent here. For v4.0, the "all" flag is supposed to run all of the "standard" tests. For v4.1 "all" is documented to run all of the tests, but it actually doesn't since not every tests has "all" in its FLAGS: field. I really want to be able to run _all_ the tests sometimes. Add a special case new "everything" flag that is automatically added to every test. Signed-off-by: Jeff Layton --- nfs4.1/testmod.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index 11e759d673fd..b3174006a0a3 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -386,6 +386,8 @@ def createtests(testdir): for t in tests: ## if not t.flags_list: ## raise RuntimeError("%s has no flags" % t.fullname) + if "everything" not in t.flags_list: + t.flags_list.append("everything") for f in t.flags_list: if f not in flag_dict: flag_dict[f] = bit From patchwork Mon Mar 13 11:24:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 13172279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBB1FC61DA4 for ; Mon, 13 Mar 2023 11:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjCMLYL (ORCPT ); Mon, 13 Mar 2023 07:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbjCMLYK (ORCPT ); Mon, 13 Mar 2023 07:24:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05875708E for ; Mon, 13 Mar 2023 04:24:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67DECB80FF1 for ; Mon, 13 Mar 2023 11:24:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A4A1C433D2; Mon, 13 Mar 2023 11:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678706647; bh=TlcbceEXHDicqaLW+S5tCvrTm7BgX0Ir1KdlwWzbKs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MlS16jF0JmWyTT3tQ95NiZk/gKDD1NWjitPAZExYprhkoyJ/BXKstlc5q9IV4cz5P l6/UwYm/az073gXsk6soUCn0FUfh4TUjfCOJhwweIyFoHiQn/SqjxXbf0I03PYZoHU DBgpBerRb6BuECfc4kBowT0sJFSVTgqLO1BeK8vnl4i4EEco3kZ0tbjJNvi+hVssBK OVDpb1tsD30Ey3tS/vmLyk6k5v8Tw67aKUylTLvwGeo63KHZZKiiYtoka3aRTFivGF IjXAU3ppvVZuqx3P2HcRv2iZLfdZaA+udq2Q03Y3UYx8OdesTe2mO2RNW5l8Q/1Nby b9LKh2mCbQ2HQ== From: Jeff Layton To: calum.mackay@oracle.com Cc: bfields@fieldses.org, ffilzlnx@mindspring.com, linux-nfs@vger.kernel.org, Frank Filz Subject: [pynfs PATCH v2 5/5] LOCK24: fix the lock_seqid in second lock request Date: Mon, 13 Mar 2023 07:24:01 -0400 Message-Id: <20230313112401.20488-6-jlayton@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313112401.20488-1-jlayton@kernel.org> References: <20230313112401.20488-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This test currently fails against Linux nfsd, but I think it's the test that's wrong. It basically does: open for read read lock unlock open upgrade write lock The write lock above is sent with a lock_seqid of 0, which is wrong. RFC7530/16.10.5 says: o In the case in which the state has been created and the [new lockowner] boolean is true, the server rejects the request with the error NFS4ERR_BAD_SEQID. The only exception is where there is a retransmission of a previous request in which the boolean was true. In this case, the lock_seqid will match the original request, and the response will reflect the final case, below. Since the above is not a retransmission, knfsd is correct to reject this call. This patch fixes the open_sequence object to track the lock seqid and set it correctly in the LOCK request. With this, LOCK24 passes against knfsd. Cc: Frank Filz Fixes: 4299316fb357 (Add LOCK24 test case to test open uprgade/downgrade scenario) Signed-off-by: Jeff Layton Tested-by: Petr Vorel Tested-by: Frank Filz --- nfs4.0/servertests/st_lock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nfs4.0/servertests/st_lock.py b/nfs4.0/servertests/st_lock.py index 468672403ffe..9d650ab017b9 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.lockseqid = 0 def open(self, access): self.fh, self.stateid = self.client.create_confirm(self.owner, access=access, @@ -900,14 +901,17 @@ class open_sequence: 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) + type=type, lockowner=self.lockowner, + lockseqid=self.lockseqid) check(res) if res.status == NFS4_OK: self.lockstateid = res.lockid + self.lockseqid += 1 def unlock(self): res = self.client.unlock_file(1, self.fh, self.lockstateid) if res.status == NFS4_OK: self.lockstateid = res.lockid + self.lockseqid += 1 def testOpenUpgradeLock(t, env): """Try open, lock, open, downgrade, close