|
@@ -200,15 +200,10 @@ static struct ocfs2_live_connection *ocfs2_connection_find(const char *name)
|
|
* mount path. Since the VFS prevents multiple calls to
|
|
* mount path. Since the VFS prevents multiple calls to
|
|
* fill_super(), we can't get dupes here.
|
|
* fill_super(), we can't get dupes here.
|
|
*/
|
|
*/
|
|
-static int ocfs2_live_connection_new(struct ocfs2_cluster_connection *conn,
|
|
|
|
- struct ocfs2_live_connection **c_ret)
|
|
|
|
|
|
+static int ocfs2_live_connection_attach(struct ocfs2_cluster_connection *conn,
|
|
|
|
+ struct ocfs2_live_connection *c)
|
|
{
|
|
{
|
|
int rc = 0;
|
|
int rc = 0;
|
|
- struct ocfs2_live_connection *c;
|
|
|
|
-
|
|
|
|
- c = kzalloc(sizeof(struct ocfs2_live_connection), GFP_KERNEL);
|
|
|
|
- if (!c)
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
|
|
mutex_lock(&ocfs2_control_lock);
|
|
mutex_lock(&ocfs2_control_lock);
|
|
c->oc_conn = conn;
|
|
c->oc_conn = conn;
|
|
@@ -222,12 +217,6 @@ static int ocfs2_live_connection_new(struct ocfs2_cluster_connection *conn,
|
|
}
|
|
}
|
|
|
|
|
|
mutex_unlock(&ocfs2_control_lock);
|
|
mutex_unlock(&ocfs2_control_lock);
|
|
-
|
|
|
|
- if (!rc)
|
|
|
|
- *c_ret = c;
|
|
|
|
- else
|
|
|
|
- kfree(c);
|
|
|
|
-
|
|
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -840,12 +829,18 @@ const struct dlm_lockspace_ops ocfs2_ls_ops = {
|
|
static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
|
|
static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
|
|
{
|
|
{
|
|
dlm_lockspace_t *fsdlm;
|
|
dlm_lockspace_t *fsdlm;
|
|
- struct ocfs2_live_connection *uninitialized_var(control);
|
|
|
|
- int rc = 0;
|
|
|
|
|
|
+ struct ocfs2_live_connection *lc;
|
|
|
|
+ int rc;
|
|
|
|
|
|
BUG_ON(conn == NULL);
|
|
BUG_ON(conn == NULL);
|
|
|
|
|
|
- rc = ocfs2_live_connection_new(conn, &control);
|
|
|
|
|
|
+ lc = kzalloc(sizeof(struct ocfs2_live_connection), GFP_KERNEL);
|
|
|
|
+ if (!lc) {
|
|
|
|
+ rc = -ENOMEM;
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rc = ocfs2_live_connection_attach(conn, lc);
|
|
if (rc)
|
|
if (rc)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
@@ -861,20 +856,24 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
|
|
conn->cc_version.pv_major, conn->cc_version.pv_minor,
|
|
conn->cc_version.pv_major, conn->cc_version.pv_minor,
|
|
running_proto.pv_major, running_proto.pv_minor);
|
|
running_proto.pv_major, running_proto.pv_minor);
|
|
rc = -EPROTO;
|
|
rc = -EPROTO;
|
|
- ocfs2_live_connection_drop(control);
|
|
|
|
|
|
+ ocfs2_live_connection_drop(lc);
|
|
|
|
+ lc = NULL;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
rc = dlm_new_lockspace(conn->cc_name, NULL, DLM_LSFL_FS, DLM_LVB_LEN,
|
|
rc = dlm_new_lockspace(conn->cc_name, NULL, DLM_LSFL_FS, DLM_LVB_LEN,
|
|
NULL, NULL, NULL, &fsdlm);
|
|
NULL, NULL, NULL, &fsdlm);
|
|
if (rc) {
|
|
if (rc) {
|
|
- ocfs2_live_connection_drop(control);
|
|
|
|
|
|
+ ocfs2_live_connection_drop(lc);
|
|
|
|
+ lc = NULL;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
- conn->cc_private = control;
|
|
|
|
|
|
+ conn->cc_private = lc;
|
|
conn->cc_lockspace = fsdlm;
|
|
conn->cc_lockspace = fsdlm;
|
|
out:
|
|
out:
|
|
|
|
+ if (rc && lc)
|
|
|
|
+ kfree(lc);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|