Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3633876ybl; Mon, 27 Jan 2020 07:35:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwtMcwPZGArDH4v7P47sXX/5hRl8KMJ0zurnycXG5EQsouM5ozgyKhYPB5OrAz/HXCs60oi X-Received: by 2002:a54:408f:: with SMTP id i15mr7319383oii.64.1580139305524; Mon, 27 Jan 2020 07:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580139305; cv=none; d=google.com; s=arc-20160816; b=Cq1eYnmKlab+n8KKHpZXrgTMiqut59auezgq9YOsy3qPn5y5UL4M7Iozhk+vdNNjQi sTHoJfoGN4n+oAodwOIqQok1zzlVnDFFOKcHBxC7GzpaN35D26IV5kmTzSGEra1dJT1G d73ZuvQIOxwtkBYRN1rSz2ophdWVhN93CieF+3SmCDnG+5Y2AJ/4Q2TAc62bj8b6H/QN 42msT4GkY2PxHSYqidqSfcGku0KpK4SOIswaCienClDGoJ15qkLxwArtl/a4nhsoWG1R BUzVprP8FSxYtGGYCOhUUsbrJ/j5soOg8YZ26G3aPZJf3QbV/SkY+FFAAsmG0cVx/nsw kSog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lVUnJMfjmuGw+lU9thhl2oSy8uhsumVUEINYmzwWOXs=; b=b5gc+Q00GTYOiVmjYnnn89PQUfyCrACFi0UCkVj5BwQkTYYxoqe6/u5VPzRfZFReEq eHlKaV12UtgZ84DB2D4JscUeTGOuszPy78WPbaCWAfFYEqmiFF4kWXiRjhsDIesYlHz7 WwsSn/jvszeULUKB5YhuJgY+s1wz16DoK5AI4WyTcoKz3BWbbJVycFo2Qa7KCjy+c0uL 9Fdt3yhee3ZYPCpg0pQC4QQ6iRVOTsTFyxgUDcxugHecj/+9tIAfXLlNF+NP4qnOgq21 hEG4w7l3Txfx83BTsq5Bbfx5XEjqhIIIQuD1gz9ZDN0l+GpoBtWk7WIC+mKnJ1o7Ns8D tgAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dhW2ulZ3; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si7034614otq.317.2020.01.27.07.34.44; Mon, 27 Jan 2020 07:35:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dhW2ulZ3; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728783AbgA0Pen (ORCPT + 99 others); Mon, 27 Jan 2020 10:34:43 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:39345 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729085AbgA0Pem (ORCPT ); Mon, 27 Jan 2020 10:34:42 -0500 Received: by mail-qv1-f67.google.com with SMTP id y8so4649762qvk.6; Mon, 27 Jan 2020 07:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lVUnJMfjmuGw+lU9thhl2oSy8uhsumVUEINYmzwWOXs=; b=dhW2ulZ3P+R6T8JKYFAot0I7g6GZMnILoApLkWciTMODTNGvU4ZP3Z8ZyZK0jrGcJ1 Z49HE8HhMLUBfclgQpkI7XxfdaOKAF/Pm7CDmY/JEKCe5m0x9GDP8EKUBI61qzBV8KlV /vBBgyNk51PMMVjRHsqiLg4uV9tILW3R81Y46qqUHrfX+f449TuDoyxUWSfgahwyzGYo idGlVOi8JhjcgTCCIkMXDoWZivykddRJ3C/pJaTwcHG/ezptCPi6WaNB+LXtQgNXDFOS 9/8HIFL1tPZ+9qDt7eXC16fCpXin1aItCZsG4zpjP9nhQQWJYfGvrzok5sudEY8mZGJ+ 4jKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lVUnJMfjmuGw+lU9thhl2oSy8uhsumVUEINYmzwWOXs=; b=RHo3YP6ayOw1EwdMhas6x/K3SGsgngS+PRISsGfSnYNXXENm2maqI1Ogc+VbSDiza+ 7qBlqgrNWOB6z6nobtq+RIO6/dzxhgSmT1owG9MVqCWYNJnhBapgIQbUT3bH8aKrbQu2 AxHW3pm2l68wxSM54Ds+8n4CJdR370PC7Qal1NQ8F+lUAWIxd48tAG/yBzjM4YxidE31 csazbLesoZ8nJmuQzSnuie/ENZlvWIyxoSbXyE1bcKR5BD/bNV2zpFk+iMcKoFNTwCJY A0nR6Z1/PKJyS2YpTcaJlLshufzZjjo1oPnh1yDmSmJKmOMgxihltrHfvkbmlIkjOkIJ J+Jw== X-Gm-Message-State: APjAAAV9zwgvIys3tSsoQ4Ok/aLGB09KYIEhIDct3T3fYYK/qHrDIW9c jhPfSZAE9MteWYzOnsWlwRefnYeqXFhcT7F3jSI= X-Received: by 2002:a05:6214:b23:: with SMTP id w3mr17432626qvj.181.1580139281556; Mon, 27 Jan 2020 07:34:41 -0800 (PST) MIME-Version: 1.0 References: <025801d5bf24$aa242100$fe6c6300$@gmail.com> <084f01d5cfba$bc5c4d10$3514e730$@gmail.com> <49e7b99bd1451a0dbb301915f655c73b3d9354df.camel@netapp.com> <6B5432AC-73BA-465E-98FC-82BFD0E817FD@oracle.com> In-Reply-To: <6B5432AC-73BA-465E-98FC-82BFD0E817FD@oracle.com> From: Robert Milkowski Date: Mon, 27 Jan 2020 15:34:30 +0000 Message-ID: Subject: Re: [PATCH v3] NFSv4.0: nfs4_do_fsinfo() should not do implicit lease renewals To: Chuck Lever Cc: Trond Myklebust , Anna Schumaker , Linux NFS Mailing List , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, 27 Jan 2020 at 15:05, Chuck Lever wrote: > > > > > On Jan 27, 2020, at 9:45 AM, Robert Milkowski wrote: > > > > On Thu, 23 Jan 2020 at 19:08, Trond Myklebust wrote: > >> > >> On Wed, 2020-01-22 at 19:10 +0000, Schumaker, Anna wrote: > >>> Hi Robert, > >>> > >>> On Mon, 2020-01-20 at 17:55 +0000, Robert Milkowski wrote: > >>>>> -----Original Message----- > >>>>> From: Chuck Lever > >>>>> Sent: 30 December 2019 15:37 > >>>>> To: Robert Milkowski > >>>>> Cc: Linux NFS Mailing List ; Trond > >>>>> Myklebust > >>>>> ; Anna Schumaker > >>>>> ; linux-kernel@vger.kernel.org > >>>>> Subject: Re: [PATCH v3] NFSv4.0: nfs4_do_fsinfo() should not do > >>>>> implicit > >>>>> lease renewals > >>>>> > >>>>> > >>>>> > >>>>>> On Dec 30, 2019, at 10:20 AM, Robert Milkowski < > >>>>>> rmilkowski@gmail.com> > >>>>> wrote: > >>>>>> From: Robert Milkowski > >>>>>> > >>>>>> Currently, each time nfs4_do_fsinfo() is called it will do an > >>>>>> implicit > >>>>>> NFS4 lease renewal, which is not compliant with the NFS4 > >>>>> specification. > >>>>>> This can result in a lease being expired by an NFS server. > >>>>>> > >>>>>> Commit 83ca7f5ab31f ("NFS: Avoid PUTROOTFH when managing > >>>>>> leases") > >>>>>> introduced implicit client lease renewal in nfs4_do_fsinfo(), > >>>>>> which > >>>>>> can result in the NFSv4.0 lease to expire on a server side, and > >>>>>> servers returning NFS4ERR_EXPIRED or NFS4ERR_STALE_CLIENTID. > >>>>>> > >>>>>> This can easily be reproduced by frequently unmounting a sub- > >>>>>> mount, > >>>>>> then stat'ing it to get it mounted again, which will delay or > >>>>>> even > >>>>>> completely prevent client from sending RENEW operations if no > >>>>>> other > >>>>>> NFS operations are issued. Eventually nfs server will expire > >>>>>> client's > >>>>>> lease and return an error on file access or next RENEW. > >>>>>> > >>>>>> This can also happen when a sub-mount is automatically > >>>>>> unmounted due > >>>>>> to inactivity (after nfs_mountpoint_expiry_timeout), then it is > >>>>>> mounted again via stat(). This can result in a short window > >>>>>> during > >>>>>> which client's lease will expire on a server but not on a > >>>>>> client. > >>>>>> This specific case was observed on production systems. > >>>>>> > >>>>>> This patch makes an explicit lease renewal instead of an > >>>>>> implicit one, > >>>>>> by adding RENEW to a compound operation issued by > >>>>>> nfs4_do_fsinfo(), > >>>>>> similarly to NFSv4.1 which adds SEQUENCE operation. > >>>>>> > >>>>>> Fixes: 83ca7f5ab31f ("NFS: Avoid PUTROOTFH when managing > >>>>>> leases") > >>>>>> Signed-off-by: Robert Milkowski > >>>>> > >>>>> Reviewed-by: Chuck Lever > >>>>> > >>>>> > >>>> > >>>> How do we progress it further? > >>> > >>> Thanks for following up! I have the patch included in my linux-next > >>> branch for > >>> the next merge window. > >> > >> NACK. This is the wrong way to solve the problem. Lease renewal in > >> NFSv4 does not need to be tied to fsinfo. It creates an unnecessary > >> extra error condition that has absolutely nothing to do with the > >> functionality of retrieving per-filesystem attributes. > > > > Well, we also do it for NFSv4.1+ with the SEQUENCE operation being > > send by fsinfo, and as Chuck pointed out > > it makes sense to do similarly for 4.0, which is what this patch does. > > I did say that. > > However, I can see that for NFSv4.1+, the client code handling the > SEQUENCE response will update cl_last_renewal. It does not need to > be done in the fsinfo code. I think it is the case, yes. > > The NFSv4.0 behavior should be correct if cl_last_renewal is not > updated. That should force the client to send a separate RENEW > operation so that both the client and server agree that the lease > is active. > I was thinking about removing the call to update the last renewal entirely in do_fsinfo(), however as briefly discussed back in Dec there is an issue with cl_last_renewal initialization on initial mount in 4.0 I observed it to be 0, as nfs4_setup_state_renewal() calls nfs4_proc_get_lease_time() on initial mount and if no error it calls nfs4_set_lease_period(). However with sec=krb the call to nfs4_proc_get_lease_time() returns NFS4ERR_WRONGSEC) during initial mount (which seems to be ok), which results in not setting cl_last_renewal, which iirc prevented scheduling RENEW operations altogether. As discussed then, this is really a separate issue which should be fixed separately. Once fixed then fsinfo() shouldn't need to set cl_last_renewal at all, still sending RENEW in fsinfo() seems like a good idea to make it more inline with what we do for 4.1. > If I understand Trond correctly? > The problem with what Trond proposed is that it seems to go against the rfc, although it should fix the initialization issue. -- Robert Milkowski