@@ -203,6 +203,9 @@ static void reaper_run(struct fridgethr_context *ctx)
SetNameFunction("reaper");
+ /* see if we need to start a grace period */
+ nfs_maybe_start_grace();
+
/*
* Try to lift the grace period, unless we're shutting down.
* Ordinarily, we'd take the mutex to check this, but this is just a
@@ -198,6 +198,21 @@ bool nfs_in_grace(void)
return atomic_fetch_time_t(¤t_grace);
}
+/**
+ * @brief Enter the grace period if another node in the cluster needs it
+ *
+ * Singleton servers generally won't use this operation. Clustered servers
+ * call this function to check whether another node might need a grace period.
+ */
+void nfs_maybe_start_grace(void)
+{
+ if (recovery_backend->maybe_start_grace) {
+ if (nfs_in_grace())
+ return;
+ recovery_backend->maybe_start_grace();
+ }
+}
+
void nfs_try_lift_grace(void)
{
bool in_grace = true;
@@ -976,6 +976,7 @@ void blocked_lock_polling(struct fridgethr_context *ctx);
void nfs_start_grace(nfs_grace_start_t *gsp);
bool nfs_in_grace(void);
bool simple_try_lift_grace(void);
+void nfs_maybe_start_grace(void);
void nfs_try_lift_grace(void);
void nfs4_add_clid(nfs_client_id_t *);
void nfs4_rm_clid(nfs_client_id_t *);
@@ -1023,6 +1024,7 @@ struct nfs4_recovery_backend {
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 (*maybe_start_grace)(void);
bool (*try_lift_grace)(void);
};