Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2808682pxj; Sun, 23 May 2021 11:31:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfn9Fz00YC8Zrm/s+mVz3Pe795cBUzNV7PZiLlOGGPmvg+kCq9qM8H0iUKm5DGINxgbVlz X-Received: by 2002:a05:6402:3546:: with SMTP id f6mr21973704edd.267.1621794703034; Sun, 23 May 2021 11:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621794703; cv=none; d=google.com; s=arc-20160816; b=argfhwaR3bkoahH+rCYqsGhv1ZiaYK5QolKwA0R6IAuQv2TniWnSJI1RIRp4rT1QoW zyVZgN9fQrOndNEl4OqZpqqzIj1zU2NGe+p/dEoxNV4odDDBNuZEM0WibyLgHfhDNsHW cavY0TuUZRTy9ssJcirEYIXPhcO62/WNwqTtPc+cKLjs5xGIAiiTJ2sZmPPLvg1Fi2CO JPt+pqCIbqKcfeF9M7oR9VDoiBkuJrSt8vzgtFNgVpBuvAqY355hM6zqETyuC66gos/w d/G4Ht5wXMTuGnfM65nQHQ3jnHYgkGyCcpn2yEPoKZaKiHd21m+G90l/FxQevH4DAXGV xiiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=/TMokTRYdrIiwAh6Qc6o71xaE1jHlMIFOkO+/hJrdx4=; b=pvNVpOGGvkXv63P9QCZAun6UPBEd3dKD834QyWP3yseWcKDqdCDNQfEOc9CD7YDu5A USlJ6tBYZD9f1bOmGQIchs0eVOu3QiEHLRH9QidzYVxc3657UQuTdxGehokmSbpX63tf eyo6Jf4HjITm5g+4JunCBdqT8XGh1vO3hJKl6XmQjoD+HFgDScR7l9o5qfna1cYHuLmi sh7iQxM3BgORNpoaFn/9tq+TOhVG8D9UC7W744Aq9Mo1DbgdzRivcKF2eQQYmIb3pxx7 tW9XBcrIwkkYh2UfdbXJ5pdEEMPB9W+4n6JZhcBsshpLNXFweksIiSrdjNiW8GeI82JC KHyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kz8S3AJM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yh21si14842773ejb.150.2021.05.23.11.31.16; Sun, 23 May 2021 11:31:43 -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=@redhat.com header.s=mimecast20190719 header.b=Kz8S3AJM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231874AbhEWS2x (ORCPT + 99 others); Sun, 23 May 2021 14:28:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59013 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbhEWS2x (ORCPT ); Sun, 23 May 2021 14:28:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621794446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/TMokTRYdrIiwAh6Qc6o71xaE1jHlMIFOkO+/hJrdx4=; b=Kz8S3AJM4HZAhQE4K8GcK9miTkvhj6G74sH7f2r/37eg/kjESIt7ZSOT6HeSC0QPrxBJ6g 1DAfNusN48vpxS2jpNjtC6XwhLlIXo18nTkcGf2ymjd0LtQNbSRtn0OHH4wGmp5/CmElrE ciOd1pq32kfudEp6DY5WmA2rO2Pb6fY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538-ymeF_c1cPlei3YkMnTf4Mg-1; Sun, 23 May 2021 14:27:22 -0400 X-MC-Unique: ymeF_c1cPlei3YkMnTf4Mg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D1318015C6; Sun, 23 May 2021 18:27:21 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-112-73.phx2.redhat.com [10.3.112.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69B975D9F0; Sun, 23 May 2021 18:27:20 +0000 (UTC) Subject: Re: [PATCH nfs-utils 1/2] Remove 'force' arg from cache_flush() To: NeilBrown Cc: Petr Vorel , "J . Bruce Fields" , linux-nfs@vger.kernel.org, Chuck Lever , Alexey Kodanev References: <20210422191803.31511-1-pvorel@suse.cz> <20210422202334.GB25415@fieldses.org> <162035212343.24322.12361160756597283121@noble.neil.brown.name> <162122673178.19062.96081788305923933@noble.neil.brown.name> <289c5819-917a-39a7-9aa4-2a27ae7248c0@RedHat.com> <162156113063.19062.9406037279407040033@noble.neil.brown.name> <162156122215.19062.11710239266795260824@noble.neil.brown.name> From: Steve Dickson Message-ID: <9a370e4b-6cdc-66a4-6a08-715fc4e4983a@RedHat.com> Date: Sun, 23 May 2021 14:30:17 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <162156122215.19062.11710239266795260824@noble.neil.brown.name> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 5/20/21 9:40 PM, NeilBrown wrote: > > Since v4.17 the timestamp written to 'flush' is ignored, > so there isn't much point choosing too precisely. > > For kernels since v4.3-rc3-13-g778620364ef5 it is safe > to write 1 second beyond the current time. > > For earlier kernels, nothing is really safe (even the current > behaviour), but writing one second beyond the current time isn't too bad > in the unlikely case the people use a new nfs-utils on a 5 year old > kernel. > > This remove a dependency for libnfs.a on 'etab' being declare, > so svcgssd no longer needs to declare it. > > Signed-off-by: NeilBrown Committed... (tag: nfs-utils-2-5-4-rc4) steved. > --- > support/export/auth.c | 2 +- > support/include/nfslib.h | 2 +- > support/nfs/cacheio.c | 17 ++++++++--------- > utils/exportfs/exportfs.c | 4 ++-- > utils/gssd/svcgssd.c | 1 - > 5 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/support/export/auth.c b/support/export/auth.c > index cea376300d01..17bdfc83748e 100644 > --- a/support/export/auth.c > +++ b/support/export/auth.c > @@ -80,7 +80,7 @@ check_useipaddr(void) > use_ipaddr = 0; > > if (use_ipaddr != old_use_ipaddr) > - cache_flush(1); > + cache_flush(); > } > > unsigned int > diff --git a/support/include/nfslib.h b/support/include/nfslib.h > index 84d8270b330f..58eeb3382fcc 100644 > --- a/support/include/nfslib.h > +++ b/support/include/nfslib.h > @@ -132,7 +132,7 @@ int wildmat(char *text, char *pattern); > > int qword_get(char **bpp, char *dest, int bufsize); > int qword_get_int(char **bpp, int *anint); > -void cache_flush(int force); > +void cache_flush(void); > void qword_add(char **bpp, int *lp, char *str); > void qword_addhex(char **bpp, int *lp, char *buf, int blen); > void qword_addint(char **bpp, int *lp, int n); > diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c > index 70ead94d64f0..73f4be4af9f9 100644 > --- a/support/nfs/cacheio.c > +++ b/support/nfs/cacheio.c > @@ -32,8 +32,6 @@ > #include > #include > > -extern struct state_paths etab; > - > void qword_add(char **bpp, int *lp, char *str) > { > char *bp = *bpp; > @@ -213,7 +211,7 @@ int qword_get_uint(char **bpp, unsigned int *anint) > */ > > void > -cache_flush(int force) > +cache_flush(void) > { > struct stat stb; > int c; > @@ -234,12 +232,13 @@ cache_flush(int force) > NULL > }; > now = time(0); > - if (force || > - stat(etab.statefn, &stb) != 0 || > - stb.st_mtime > now) > - stb.st_mtime = time(0); > - > - sprintf(stime, "%" PRId64 "\n", (int64_t)stb.st_mtime); > + > + /* Since v4.16-rc2-3-g3b68e6ee3cbd the timestamp written is ignored. > + * It is safest always to flush caches if there is any doubt. > + * For earlier kernels, writing the next second from now is > + * the best we can do. > + */ > + sprintf(stime, "%" PRId64 "\n", (int64_t)now+1); > for (c=0; cachelist[c]; c++) { > int fd; > sprintf(path, "/proc/net/rpc/%s/flush", cachelist[c]); > diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c > index bc76aaaf8714..d586296796a9 100644 > --- a/utils/exportfs/exportfs.c > +++ b/utils/exportfs/exportfs.c > @@ -188,7 +188,7 @@ main(int argc, char **argv) > > if (optind == argc && ! f_all) { > if (force_flush) { > - cache_flush(1); > + cache_flush(); > free_state_path_names(&etab); > return 0; > } else { > @@ -235,7 +235,7 @@ main(int argc, char **argv) > unexportfs(argv[i], f_verbose); > } > xtab_export_write(); > - cache_flush(force_flush); > + cache_flush(); > free_state_path_names(&etab); > export_freeall(); > > diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c > index 3ab2100b66bb..881207b3e8a2 100644 > --- a/utils/gssd/svcgssd.c > +++ b/utils/gssd/svcgssd.c > @@ -67,7 +67,6 @@ > #include "misc.h" > #include "svcgssd_krb5.h" > > -struct state_paths etab; /* from cacheio.c */ > static bool signal_received = false; > static struct event_base *evbase = NULL; > static int nullrpc_fd = -1; >