Re: sysctl question

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 28 Jan 2009 15:21:17 -0500
On Wednesday 28 January 2009 2:33:18 pm Roman Divacky wrote:
> hi
> 
> we dont need Giant to be held for sysctl_ctx_init/SYSCTL_ADD_*, right?

Ugh, it looks like the sysctl tree locking is woefully inadequate, so we 
aren't quite ready for this yet.

> if that's true, is this ok for commit?
> 
> Index: cam/scsi/scsi_da.c
> ===================================================================
> --- cam/scsi/scsi_da.c	(revision 187838)
> +++ cam/scsi/scsi_da.c	(working copy)
> _at__at_ -1086,7 +1086,6 _at__at_
>  	snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number);
>  	snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number);
>  
> -	mtx_lock(&Giant);
>  	sysctl_ctx_init(&softc->sysctl_ctx);
>  	softc->flags |= DA_FLAG_SCTX_INIT;
>  	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
> _at__at_ -1094,7 +1093,6 _at__at_
>  		CTLFLAG_RD, 0, tmpstr);
>  	if (softc->sysctl_tree == NULL) {
>  		printf("dasysctlinit: unable to allocate sysctl tree\n");
> -		mtx_unlock(&Giant);
>  		cam_periph_release(periph);
>  		return;
>  	}
> _at__at_ -1108,7 +1106,6 _at__at_
>  		&softc->minimum_cmd_size, 0, dacmdsizesysctl, "I",
>  		"Minimum CDB size");
>  
> -	mtx_unlock(&Giant);
>  	cam_periph_release(periph);
>  }
>  
> Index: cam/scsi/scsi_cd.c
> ===================================================================
> --- cam/scsi/scsi_cd.c	(revision 187838)
> +++ cam/scsi/scsi_cd.c	(working copy)
> _at__at_ -555,8 +555,6 _at__at_
>  	snprintf(tmpstr, sizeof(tmpstr), "CAM CD unit %d", periph->unit_number);
>  	snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number);
>  
> -	mtx_lock(&Giant);
> -
>  	sysctl_ctx_init(&softc->sysctl_ctx);
>  	softc->flags |= CD_FLAG_SCTX_INIT;
>  	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
> _at__at_ -565,7 +563,6 _at__at_
>  
>  	if (softc->sysctl_tree == NULL) {
>  		printf("cdsysctlinit: unable to allocate sysctl tree\n");
> -		mtx_unlock(&Giant);
>  		cam_periph_release(periph);
>  		return;
>  	}
> _at__at_ -579,7 +576,6 _at__at_
>  		&softc->minimum_command_size, 0, cdcmdsizesysctl, "I",
>  		"Minimum CDB size");
>  
> -	mtx_unlock(&Giant);
>  	cam_periph_release(periph);
>  }
>  
> 
> thnx!
> 
>    roman
> 



-- 
John Baldwin
Received on Wed Jan 28 2009 - 19:41:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:41 UTC