diff mbox

[nfs-ganesha,RFC,v2,07/13] SAL: add new set_enforcing operation

Message ID 20180503185803.25417-8-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton May 3, 2018, 6:57 p.m. UTC
From: Jeff Layton <jlayton@redhat.com>

Do that whenever we have started enforcing a local grace period.

Change-Id: I559139fc85816cb03171375fdc0e6acc4f2ef9c2
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 src/SAL/nfs4_recovery.c     | 14 ++++++++++++++
 src/include/sal_functions.h |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/SAL/nfs4_recovery.c b/src/SAL/nfs4_recovery.c
index cc4f7cf9facf..debc6cab1bdb 100644
--- a/src/SAL/nfs4_recovery.c
+++ b/src/SAL/nfs4_recovery.c
@@ -110,6 +110,15 @@  nfs_lift_grace_locked(time_t current)
 	}
 }
 
+/*
+ * Report our new state to the cluster
+ */
+static void nfs4_set_enforcing(void)
+{
+	if (recovery_backend->set_enforcing)
+		recovery_backend->set_enforcing();
+}
+
 /**
  * @brief Start grace period
  *
@@ -155,6 +164,11 @@  void nfs_start_grace(nfs_grace_start_t *gsp)
 
 	LogEvent(COMPONENT_STATE, "NFS Server Now IN GRACE, duration %d",
 		 (int)nfs_param.nfsv4_param.grace_period);
+
+	/* Set enforcing flag here */
+	if (!was_grace)
+		nfs4_set_enforcing();
+
 	/*
 	 * If we're just starting the grace period, then load the
 	 * clid database. Don't load it however if we're extending the
diff --git a/src/include/sal_functions.h b/src/include/sal_functions.h
index 2829f574c8e7..ac01a6eba497 100644
--- a/src/include/sal_functions.h
+++ b/src/include/sal_functions.h
@@ -1017,15 +1017,16 @@  typedef rdel_fh_t * (*add_rfh_entry_hook)(clid_entry_t *, char *);
 struct nfs4_recovery_backend {
 	void (*recovery_init)(void);
 	void (*recovery_shutdown)(void);
-	void (*end_grace)(void);
 	void (*recovery_read_clids)(nfs_grace_start_t *gsp,
 				    add_clid_entry_hook add_clid,
 				    add_rfh_entry_hook add_rfh);
 	void (*add_clid)(nfs_client_id_t *);
 	void (*rm_clid)(nfs_client_id_t *);
 	void (*add_revoke_fh)(nfs_client_id_t *, nfs_fh4 *);
+	void (*end_grace)(void);
 	void (*maybe_start_grace)(void);
 	bool (*try_lift_grace)(void);
+	void (*set_enforcing)(void);
 };
 
 void fs_backend_init(struct nfs4_recovery_backend **);