[nfs-ganesha RFC PATCH v2 08/13] SAL: add a way to check for grace period being enforced cluster-wide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jeff Layton <jlayton@xxxxxxxxxx>

Add a new recovery backend operation to tell whether the grace period
is being fully enforced. Singleton backends that don't define this
operation will just have nfs_grace_enforcing() return true.

Change-Id: I8020723238396efe0949f29e1906c58b0a5e26c9
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 src/SAL/nfs4_recovery.c     | 14 ++++++++++++++
 src/include/sal_functions.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/src/SAL/nfs4_recovery.c b/src/SAL/nfs4_recovery.c
index debc6cab1bdb..400d8b528d26 100644
--- a/src/SAL/nfs4_recovery.c
+++ b/src/SAL/nfs4_recovery.c
@@ -227,6 +227,20 @@ void nfs_maybe_start_grace(void)
 	}
 }
 
+/**
+ * @brief Are all hosts in cluster enforcing the grace period?
+ *
+ * Singleton servers always return true here since the only grace period that
+ * matters is the local one. Clustered backends should check to make sure that
+ * the whole cluster is in grace.
+ */
+bool nfs_grace_enforcing(void)
+{
+	if (recovery_backend->grace_enforcing)
+		return recovery_backend->grace_enforcing();
+	return true;
+}
+
 void nfs_try_lift_grace(void)
 {
 	bool in_grace = true;
diff --git a/src/include/sal_functions.h b/src/include/sal_functions.h
index ac01a6eba497..96a4eb40a50b 100644
--- a/src/include/sal_functions.h
+++ b/src/include/sal_functions.h
@@ -1027,6 +1027,7 @@ struct nfs4_recovery_backend {
 	void (*maybe_start_grace)(void);
 	bool (*try_lift_grace)(void);
 	void (*set_enforcing)(void);
+	bool (*grace_enforcing)(void);
 };
 
 void fs_backend_init(struct nfs4_recovery_backend **);
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux