Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3745838pxj; Tue, 15 Jun 2021 07:48:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+vvTHbvl4UIiOSafUMESsoEhTx+XILWUFESAd5IfFPkgkwA9kCKGGgQBAVYnIRZcO2FQq X-Received: by 2002:a05:6402:1911:: with SMTP id e17mr23753976edz.62.1623768522922; Tue, 15 Jun 2021 07:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623768522; cv=none; d=google.com; s=arc-20160816; b=eul7on2QJuVEJpLd1HfgXqxB7HCoQfi2m3S1Om/AMQNcrzmgtWlf3Rg4JW7rpurPNB AEKpTwro+Ki1ErubCvuyXHfddeN3z0lUe6Z2WX5SlMiyy5pv47PIAVj3Pq0Wkr4tmmly hfPjHV9/r1tCyVwI69Qj0TkzgkbnQzgh8XEDnUfa/7UQ4unYZqwjnQi6+c4m8HS6KpjO RsJCvXcjI7EvxT2etoxvrAefOWGXGQI+eklxQRBbyU5dDpLBCC7NA91BCNyK1qjABY0K ZFBKGNHCtpifn8eBGAhc3/nIJiAsNsVUKvtp06ar35tna98dQWoTyPj5QtiGT82FHurt zt1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:from:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date :dkim-signature:dkim-filter; bh=nQ7RGA1XBtP89r9+zMwi3iD+9K6mPYQ/hB7Ed+6qQJY=; b=aJw8F9LXbzBXkuVwAiWk9ee8JjYbRtf8YJnz67XUWINc6SMZJ8kVe82HpWXisR6mMu J0RECnteFTsoSrDMdXDf9ECFaMrhmFj19DOfxvbi8ganY/KWJVAHBmm5YGUECyaQ1nIW 4FeHAAtzu8OXra3lo5c3h+0Zq+XW6wJJ4KOgD0DQP5hy5mzj9HrGWrHC6LtahNOf35am 4tImbObwHq6TkS/XSbgBWhC7CsiZtSF94VM9ELJNdly0YYkOHz0MCm25WEaXjZ6PiCS8 8ahdVPa5LJZJDGV+bT+b997+amiR+fcbCnijU5KfS9i49ZwVfLtSJMJuC57g8xMCzfBs Hwiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=Otdcz7up; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si242369edr.77.2021.06.15.07.48.11; Tue, 15 Jun 2021 07:48:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=Otdcz7up; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbhFOOte (ORCPT + 99 others); Tue, 15 Jun 2021 10:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbhFOOtc (ORCPT ); Tue, 15 Jun 2021 10:49:32 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34324C061574 for ; Tue, 15 Jun 2021 07:47:28 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id 1C02E3F53; Tue, 15 Jun 2021 10:47:24 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 1C02E3F53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1623768444; bh=nQ7RGA1XBtP89r9+zMwi3iD+9K6mPYQ/hB7Ed+6qQJY=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=Otdcz7upV7L3Ywa/c/sCTrtfV17yNKOQzFLSqRLGWooMabpfqWVNnQaED70woTA8B wQVjtTGCeWHV3Csv8bIL3hJT1aj3b9VAEpCCMXSfAN5StDUr5/qP43Svry8IsU5936 Umj+zWOOxiJIoyWoJiDgrdQmap9cywJy5WFOi8U4= Date: Tue, 15 Jun 2021 10:47:24 -0400 To: Calum Mackay Cc: "suy.fnst@fujitsu.com" , "linux-nfs@vger.kernel.org" , "bfields@redhat.com" Subject: Re: [PATCH] pynfs: courtesy: send RECLAIM_COMPLETE before session2 opening the file Message-ID: <20210615144724.GB11877@fieldses.org> References: <91f1d7df-b63c-4aa3-cc03-a8e1cbb2ecb1@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91f1d7df-b63c-4aa3-cc03-a8e1cbb2ecb1@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Jun 14, 2021 at 09:50:34PM +0100, Calum Mackay wrote: > On 10/06/2021 2:01 am, suy.fnst@fujitsu.com wrote: > >The test fails on v5.13-rc5 and old kernels. Because the second session > >doesn't send RECLAIM_COMPLETE before attempting to do a non-reclaim > >open. So the server returns NFS4ERR_GRACE instead of NFS4_OK. > > > > # ./testserver.py ${server_IP}:/nfsroot --rundeps COUR2 > > INFO :rpc.poll:got connection from ('127.0.0.1', 39206), assigned to > > fd=5 > > INFO :rpc.thread:Called connect(('193.168.140.239', 2049)) > > INFO :rpc.poll:Adding 6 generated by another thread > > INFO :test.env:Created client to 193.168.140.239, 2049 > > INFO :test.env:Called do_readdir() > > INFO :test.env:do_readdir() = [entry4(cookie=512, > > name=b'COUR2_1623055313', attrs={})] > > fileb'COUR2_1623119443'created by sess1 > > INFO :test.env:Sleeping for 22 seconds: twice the lease period > > INFO :test.env:Woke up > > session created > > ************************************************** > > COUR2 st_courtesy.testLockSleepLock : > > FAILURE > > OP_OPEN should return NFS4_OK, instead got > > NFS4ERR_GRACE > > ************************************************** > > Command line asked for 1 of 255 tests > > Of those: 0 Skipped, 1 Failed, 0 Warned, 0 Passed > > > >RFC5661, page 567: > >"Whenever a client establishes a new client ID and before it does the > >first non-reclaim operation that obtains a lock, it MUST send a > >RECLAIM_COMPLETE with rca_one_fs set to FALSE, even if there are no > >locks to reclaim. If non-reclaim locking operations are done before > >the RECLAIM_COMPLETE, an NFS4ERR_GRACE error will be returned." > > > >Send RECLAIM_COMPLETE before the file open to let the test pass. > >Signed-off-by: Su Yue > >--- > > nfs4.1/server41tests/st_courtesy.py | 3 +++ > > 1 file changed, 3 insertions(+) > > > >diff --git a/nfs4.1/server41tests/st_courtesy.py b/nfs4.1/server41tests/st_courtesy.py > >index dd911a37772d..3478a9d93dbf 100644 > >--- a/nfs4.1/server41tests/st_courtesy.py > >+++ b/nfs4.1/server41tests/st_courtesy.py > >@@ -74,6 +74,9 @@ def testLockSleepLock(t, env): > > c2 = env.c1.new_client(b"%s_2" % env.testname(t)) > > sess2 = c2.create_session() > >+ res = sess2.compound([op.reclaim_complete(FALSE)]) > >+ check(res) > >+ > > res = open_file(sess2, env.testname(t), access=OPEN4_SHARE_ACCESS_WRITE) > > check(res) > > > > I'd still like to check whether this is the right place to fix this. > > Initially, I was confused as to why the first client "c1" doesn't > face the same issue. A network trace shows that a RECLAIM_COMPLETE > is indeed sent for c1, despite not appearing explicitly in > testLockSleepLock(). Whereas one isn't sent for c2, hence the > problem. > > This is probably because c1 is initialised with: > > 61 sess1 = env.c1.new_client_session(env.testname(t)) > > > and c2 with: > > 74 c2 = env.c1.new_client(b"%s_2" % env.testname(t)) > 75 sess2 = c2.create_session() > > > The c1 case results in a RECLAIM_COMPLETE, but the c2 case does not. > > I'm not yet sure whether that ought to be done in > new_client()/create_session(). If so, then there would be no need to > add it explicitly here. There's definitely cases where clients want to be able to create a new session without sending a new RECLAIM_COMPLETE. Any reason we can't replace those two lines by a single new_client_session()? I'd do either that or just add the explicit RECLAIM_COMPLETE. > [I suspect this was missed in my testing, since the Solaris server I > used may be less strict about requiring the RECLAIM_COMPLETE] That's a server bug: https://datatracker.ietf.org/doc/html/rfc5661#page-173 ... NFS4ERR_GRACE must always be returned to clients attempting a non-reclaim lock request before doing their own global RECLAIM_COMPLETE. I've complained about it before. I had some idea it'd been fixed, maybe not. --b.