[openib-general] Re: [PATCH 04/12] SRP: Changing ibsrpdm

Michael S. Tsirkin mst at mellanox.co.il
Mon May 1 07:04:58 PDT 2006


Quoting r. Muli Ben-Yehuda <muli at il.ibm.com>:
> >  static ssize_t srp_create_target(struct class_device *class_dev,
> >  				 const char *buf, size_t count)
> >  {
> >  	struct srp_host *host =
> >  		container_of(class_dev, struct srp_host, class_dev);
> >  	struct Scsi_Host *target_host;
> > -	struct srp_target_port *target;
> > +	struct srp_target_port *target, *existing_target = NULL;
> >  	int ret;
> >  	int i;
> >  
> > +	/* first check if the target already exists */
> > +
> > +	mutex_lock(&host->target_mutex);
> > +	ret = srp_find_target(buf, host, &existing_target);
> > +	if (ret)
> > +		goto unlock_mutex;
> > +
> > +	if (existing_target) {
> > +		/* target already exists */
> > +		spin_lock_irq(existing_target->scsi_host->host_lock);
> 
> why _irq and not _irqsave? Are you sure this code can't ever be called
> with interrupts off via some other path?

Given the mutex_lock above, this better be true.

-- 
MST



More information about the general mailing list