Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195604
b: refs/heads/master
c: 42b426e
h: refs/heads/master
v: v3
  • Loading branch information
Jing Huang authored and James Bottomley committed Apr 11, 2010
1 parent f7f66b7 commit d7f8987
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b3522f08ec7011aed0abc477bfedd00d189e9cd6
refs/heads/master: 42b426ecb453cf49c3d16cf1d7a5e5d8cab9869d
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/bfa/bfad.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <fcb/bfa_fcb.h>

BFA_TRC_FILE(LDRV, BFAD);
static DEFINE_MUTEX(bfad_mutex);
DEFINE_MUTEX(bfad_mutex);
LIST_HEAD(bfad_list);
static int bfad_inst;
int bfad_supported_fc4s;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/bfa/bfad_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,6 @@ extern struct list_head bfad_list;
extern int bfa_lun_queue_depth;
extern int bfad_supported_fc4s;
extern int bfa_linkup_delay;
extern struct mutex bfad_mutex;

#endif /* __BFAD_DRV_H__ */
13 changes: 9 additions & 4 deletions trunk/drivers/scsi/bfa/bfad_im.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,18 +518,23 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
{
int error = 1;

mutex_lock(&bfad_mutex);
if (!idr_pre_get(&bfad_im_port_index, GFP_KERNEL)) {
mutex_unlock(&bfad_mutex);
printk(KERN_WARNING "idr_pre_get failure\n");
goto out;
}

error = idr_get_new(&bfad_im_port_index, im_port,
&im_port->idr_id);
if (error) {
mutex_unlock(&bfad_mutex);
printk(KERN_WARNING "idr_get_new failure\n");
goto out;
}

mutex_unlock(&bfad_mutex);

im_port->shost = bfad_os_scsi_host_alloc(im_port, bfad);
if (!im_port->shost) {
error = 1;
Expand Down Expand Up @@ -563,16 +568,16 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
out_fc_rel:
scsi_host_put(im_port->shost);
out_free_idr:
mutex_lock(&bfad_mutex);
idr_remove(&bfad_im_port_index, im_port->idr_id);
mutex_unlock(&bfad_mutex);
out:
return error;
}

void
bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
{
unsigned long flags;

bfa_trc(bfad, bfad->inst_no);
bfa_log(bfad->logmod, BFA_LOG_LINUX_SCSI_HOST_FREE,
im_port->shost->host_no);
Expand All @@ -582,9 +587,9 @@ bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
scsi_remove_host(im_port->shost);
scsi_host_put(im_port->shost);

spin_lock_irqsave(&bfad->bfad_lock, flags);
mutex_lock(&bfad_mutex);
idr_remove(&bfad_im_port_index, im_port->idr_id);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
mutex_unlock(&bfad_mutex);
}

static void
Expand Down

0 comments on commit d7f8987

Please sign in to comment.