[Ocfs2-devel] [PATCH 3/5] Shift allocation ocfs2_live_connection to user_connect()

Andrew Morton akpm at linux-foundation.org
Thu Oct 3 13:28:18 PDT 2013


On Thu, 3 Oct 2013 00:49:59 -0500 Goldwyn Rodrigues <rgoldwyn at suse.de> wrote:

> We perform this because the DLM recovery callbacks will require
> the ocfs2_live_connection structure to record the node information
> when dlm_new_lockspace() is updated.
> 
> ...
>
>  static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
>  {
>  	dlm_lockspace_t *fsdlm;
> -	struct ocfs2_live_connection *uninitialized_var(control);
> +	struct ocfs2_live_connection *lc = NULL;
>  	int rc = 0;

Neither of the above initializations are needed.  Presumably trhe
compiler will jsut remove the code, but it's a bit strange.


>  	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_new(conn, lc);
>  	if (rc)
>  		goto out;
>   ...
>



More information about the Ocfs2-devel mailing list