[Cluster-devel] GPF in dlm_lowcomms_stop

dann frazier dann.frazier at canonical.com
Fri May 4 17:33:17 UTC 2012


On Fri, Mar 30, 2012 at 11:17:56AM -0600, dann frazier wrote:
> On Fri, Mar 30, 2012 at 12:42:40PM -0400, David Teigland wrote:
> > On Fri, Mar 30, 2012 at 11:42:56AM -0400, David Teigland wrote:
> > > Hi Dan, I'm not very familiar with this code either, but I've talked with
> > > Chrissie and she suggested we try something like this:
> 
> Yeah, that's the mechanism I was thinking of as well.
> 
> > A second version that addresses a potentially similar problem in
> > start.
> 
> Oh, good catch! I hadn't considered that path.
> 
> Reviewed-by: dann frazier <dann.frazier at canonical.com>

fyi, we haven't uncovered any problems when testing with this
patch. Are there plans to submit it for the next merge cycle?

       -dann

> > 
> > diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
> > index 133ef6d..5c1b0e3 100644
> > --- a/fs/dlm/lowcomms.c
> > +++ b/fs/dlm/lowcomms.c
> > @@ -142,6 +142,7 @@ struct writequeue_entry {
> >  
> >  static struct sockaddr_storage *dlm_local_addr[DLM_MAX_ADDR_COUNT];
> >  static int dlm_local_count;
> > +static int dlm_allow_conn;
> >  
> >  /* Work queues */
> >  static struct workqueue_struct *recv_workqueue;
> > @@ -710,6 +711,13 @@ static int tcp_accept_from_sock(struct connection *con)
> >  	struct connection *newcon;
> >  	struct connection *addcon;
> >  
> > +	mutex_lock(&connections_lock);
> > +	if (!dlm_allow_conn) {
> > +		mutex_unlock(&connections_lock);
> > +		return -1;
> > +	}
> > +	mutex_unlock(&connections_lock);
> > +
> >  	memset(&peeraddr, 0, sizeof(peeraddr));
> >  	result = sock_create_kern(dlm_local_addr[0]->ss_family, SOCK_STREAM,
> >  				  IPPROTO_TCP, &newsock);
> > @@ -1503,6 +1511,7 @@ void dlm_lowcomms_stop(void)
> >  	   socket activity.
> >  	*/
> >  	mutex_lock(&connections_lock);
> > +	dlm_allow_conn = 0;
> >  	foreach_conn(stop_conn);
> >  	mutex_unlock(&connections_lock);
> >  
> > @@ -1530,7 +1539,7 @@ int dlm_lowcomms_start(void)
> >  	if (!dlm_local_count) {
> >  		error = -ENOTCONN;
> >  		log_print("no local IP address has been set");
> > -		goto out;
> > +		goto fail;
> >  	}
> >  
> >  	error = -ENOMEM;
> > @@ -1538,7 +1547,13 @@ int dlm_lowcomms_start(void)
> >  				      __alignof__(struct connection), 0,
> >  				      NULL);
> >  	if (!con_cache)
> > -		goto out;
> > +		goto fail;
> > +
> > +	error = work_start();
> > +	if (error)
> > +		goto fail_destroy;
> > +
> > +	dlm_allow_conn = 1;
> >  
> >  	/* Start listening */
> >  	if (dlm_config.ci_protocol == 0)
> > @@ -1548,20 +1563,17 @@ int dlm_lowcomms_start(void)
> >  	if (error)
> >  		goto fail_unlisten;
> >  
> > -	error = work_start();
> > -	if (error)
> > -		goto fail_unlisten;
> > -
> >  	return 0;
> >  
> >  fail_unlisten:
> > +	dlm_allow_conn = 0;
> >  	con = nodeid2con(0,0);
> >  	if (con) {
> >  		close_connection(con, false);
> >  		kmem_cache_free(con_cache, con);
> >  	}
> > +fail_destroy:
> >  	kmem_cache_destroy(con_cache);
> > -
> > -out:
> > +fail:
> >  	return error;
> >  }
> 




More information about the Cluster-devel mailing list