Skip to contentSkip to conversation

Add dlm operations placeholders

PATCH New Goldwyn Rodrigues 2 participants 3 messages Sep 6, 2013 – Sep 26, 2013 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 Add dlm operations placeholders

---
 fs/ocfs2/stack_user.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
fs/ocfs2/stack_user.c +28 -2
index 286edf1..1b18193 100644
@@ -799,11 +799,31 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing,
 	return 0;
 }
 
+static void user_recover_prep(void *arg)
+{
+}
+
+static void user_recover_slot(void *arg, struct dlm_slot *slot)
+{
+}
+
+static void user_recover_done(void *arg, struct dlm_slot *slots,
+			      int num_slots, int our_slot,
+			      uint32_t generation)
+{
+}
+
+const struct dlm_lockspace_ops ocfs2_ls_ops = {
+	.recover_prep = user_recover_prep,
+	.recover_slot = user_recover_slot,
+	.recover_done = user_recover_done,
+};
+
 static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
 {
 	dlm_lockspace_t *fsdlm;
 	struct ocfs2_live_connection *uninitialized_var(control);
-	int rc = 0;
+	int rc = 0, ops_rv;
 
 	BUG_ON(conn == NULL);
 
@@ -828,12 +848,18 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
 	}
 
 	rc = dlm_new_lockspace(conn->cc_name, NULL, DLM_LSFL_FS, DLM_LVB_LEN,
-			       NULL, NULL, NULL, &fsdlm);
+			       &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
 	if (rc) {
 		ocfs2_live_connection_drop(control);
 		goto out;
 	}
 
+	if (ops_rv < 0) {
+		printk(KERN_ERR "ocfs2: dlm lockspace ops could not be used. You may be using an older dlm_controld\n");
+		rc = -EINVAL;
+		goto out;
+	}
+
 	conn->cc_private = control;
 	conn->cc_lockspace = fsdlm;
 out:
Signature · 5 lines
1.8.1.4


-- 
Goldwyn
#1 lore raw

PATCH 1/6 Add dlm operations placeholders

This looks good, other than the backwards compatibility issue I mention below.

I see we're goign to get some recovery calllbacks node? Any chance you can give a short description of what their purpose is?

	--Mark
Quoted 49 lines · Goldwyn Rodrigues
---
 fs/ocfs2/stack_user.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
fs/ocfs2/stack_user.c +22 -2
index 286edf1..1b18193 100644
@@ -799,11 +799,31 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing,
 	return 0;
 }
 
+static void user_recover_prep(void *arg)
+{
+}
+
+static void user_recover_slot(void *arg, struct dlm_slot *slot)
+{
+}
+
+static void user_recover_done(void *arg, struct dlm_slot *slots,
+			      int num_slots, int our_slot,
+			      uint32_t generation)
+{
+}
+
+const struct dlm_lockspace_ops ocfs2_ls_ops = {
+	.recover_prep = user_recover_prep,
+	.recover_slot = user_recover_slot,
+	.recover_done = user_recover_done,
+};
+
 static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
 {
 	dlm_lockspace_t *fsdlm;
 	struct ocfs2_live_connection *uninitialized_var(control);
-	int rc = 0;
+	int rc = 0, ops_rv;
 
 	BUG_ON(conn == NULL);
 
@@ -828,12 +848,18 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
 	}
 
 	rc = dlm_new_lockspace(conn->cc_name, NULL, DLM_LSFL_FS, DLM_LVB_LEN,
-			       NULL, NULL, NULL, &fsdlm);
+			       &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);

fs/ocfs2/stack_user.c static int user_cluster_connect(struct ocfs2_cluster_connection *conn) · line 861

Quoted 10 lines
fs/ocfs2/stack_user.c +5 -0
 	if (rc) {
 		ocfs2_live_connection_drop(control);
 		goto out;
 	}
 
+	if (ops_rv < 0) {
+		printk(KERN_ERR "ocfs2: dlm lockspace ops could not be used. You may be using an older dlm_controld\n");
+		rc = -EINVAL;
+		goto out;
+	}

Presumably we're going to figure out how to support all versions of userspace, so this would go?

	--Mark

--
Mark Fasheh

#2 lore raw

PATCH 1/6 Add dlm operations placeholders

Quoted 62 lines · Mark Fasheh

This looks good, other than the backwards compatibility issue I mention below.

I see we're goign to get some recovery calllbacks node? Any chance you can give a short description of what their purpose is?

	--Mark
Quoted 54 lines · Goldwyn Rodrigues
---
  fs/ocfs2/stack_user.c | 30 ++++++++++++++++++++++++++++--
  1 file changed, 28 insertions(+), 2 deletions(-)
fs/ocfs2/stack_user.c +22 -2
index 286edf1..1b18193 100644
@@ -799,11 +799,31 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing,
  	return 0;
  }
 
+static void user_recover_prep(void *arg)
+{
+}
+
+static void user_recover_slot(void *arg, struct dlm_slot *slot)
+{
+}
+
+static void user_recover_done(void *arg, struct dlm_slot *slots,
+			      int num_slots, int our_slot,
+			      uint32_t generation)
+{
+}
+
+const struct dlm_lockspace_ops ocfs2_ls_ops = {
+	.recover_prep = user_recover_prep,
+	.recover_slot = user_recover_slot,
+	.recover_done = user_recover_done,
+};
+
  static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
  {
  	dlm_lockspace_t *fsdlm;
  	struct ocfs2_live_connection *uninitialized_var(control);
-	int rc = 0;
+	int rc = 0, ops_rv;
 
  	BUG_ON(conn == NULL);
 
@@ -828,12 +848,18 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
  	}
 
  	rc = dlm_new_lockspace(conn->cc_name, NULL, DLM_LSFL_FS, DLM_LVB_LEN,
-			       NULL, NULL, NULL, &fsdlm);
+			       &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
  	if (rc) {
  		ocfs2_live_connection_drop(control);
  		goto out;
  	}
 
Quoted 8 lines

fs/ocfs2/stack_user.c static int user_cluster_connect(struct ocfs2_cluster_connection *conn) · line 861

Quoted 5 lines
fs/ocfs2/stack_user.c +5 -0
+	if (ops_rv < 0) {
+		printk(KERN_ERR "ocfs2: dlm lockspace ops could not be used. You may be using an older dlm_controld\n");
+		rc = -EINVAL;
+		goto out;
+	}

Presumably we're going to figure out how to support all versions of userspace, so this would go?

Yes, as I mentioned in the previous mail, this is feasible so we will try to get a new lockspace twice, once with the ops. If that fails, we try without the recovery ops.

Signature · 1 line
Goldwyn