From patchwork Thu Feb 20 06:36:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 3684681 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 59102BF13A for ; Thu, 20 Feb 2014 06:39:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C2A9201B6 for ; Thu, 20 Feb 2014 06:39:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BE592018A for ; Thu, 20 Feb 2014 06:39:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751060AbaBTGjD (ORCPT ); Thu, 20 Feb 2014 01:39:03 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42757 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbaBTGjC (ORCPT ); Thu, 20 Feb 2014 01:39:02 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7B146ABEA; Thu, 20 Feb 2014 06:39:01 +0000 (UTC) From: Neil Brown To: Steve Dickson Date: Thu, 20 Feb 2014 17:36:48 +1100 Subject: [PATCH 3/4] nfsd: set nlm grace time to make NFSv4 grace time Cc: linux-nfs@vger.kernel.org Message-ID: <20140220063648.6548.44668.stgit@notabene.brown> In-Reply-To: <20140220063616.6548.42556.stgit@notabene.brown> References: <20140220063616.6548.42556.stgit@notabene.brown> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These two values are conceptually very similar, so it probably makes sense to set them to the same value at the same time. Signed-off-by: NeilBrown --- utils/nfsd/nfsd.man | 3 ++- utils/nfsd/nfssvc.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man index 58b53cbff009..c6d3ffbd3675 100644 --- a/utils/nfsd/nfsd.man +++ b/utils/nfsd/nfsd.man @@ -89,7 +89,8 @@ clients need to confirm their state with the server. Valid range is from 10 to 3600 seconds. .TP .B \-G " or " \-\-grace-time seconds -Set the grace-time used for NFSv4. New file open requests will not be +Set the grace-time used for NFSv4 and NLM (for NFSv2 and NFSv3). +New file open requests (NFSv4) and new file locks (NLM) will not be allowed until after this time has passed to allow clients to recover state. .TP .I nproc diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c index 337ab169c194..5e14cce58053 100644 --- a/utils/nfsd/nfssvc.c +++ b/utils/nfsd/nfssvc.c @@ -317,6 +317,14 @@ nfssvc_set_time(const char *type, const int seconds) xlog(L_ERROR, "Unable to set nfsv4%stime: %m", type); close(fd); } + if (strcmp(type, "grace") == 0) { + /* set same value for lockd */ + fd = open("/proc/sys/fs/nfs/nlm_grace_period", O_WRONLY); + if (fd >= 0) { + write(fd, nbuf, strlen(nbuf)); + close(fd); + } + } } void