Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20407
b: refs/heads/master
c: 65110b2
h: refs/heads/master
i:
  20405: 80546fe
  20403: e409c1a
  20399: 3d5cb54
v: v3
  • Loading branch information
James Bottomley authored and unknown committed Feb 14, 2006
1 parent 78c1154 commit c6b1c97
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 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: faead26d7a06605add627f29aee73ba654ce11f9
refs/heads/master: 65110b2168950a19cc78b5027ed18cb811fbdae8
26 changes: 4 additions & 22 deletions trunk/drivers/scsi/scsi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,19 +387,12 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
return found_target;
}

struct work_queue_wrapper {
struct work_struct work;
struct scsi_target *starget;
};

static void scsi_target_reap_work(void *data) {
struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
struct scsi_target *starget = wqw->starget;
static void scsi_target_reap_usercontext(void *data)
{
struct scsi_target *starget = data;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
unsigned long flags;

kfree(wqw);

spin_lock_irqsave(shost->host_lock, flags);

if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
Expand Down Expand Up @@ -428,18 +421,7 @@ static void scsi_target_reap_work(void *data) {
*/
void scsi_target_reap(struct scsi_target *starget)
{
struct work_queue_wrapper *wqw =
kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC);

if (!wqw) {
starget_printk(KERN_ERR, starget,
"Failed to allocate memory in scsi_reap_target()\n");
return;
}

INIT_WORK(&wqw->work, scsi_target_reap_work, wqw);
wqw->starget = starget;
schedule_work(&wqw->work);
scsi_execute_in_process_context(scsi_target_reap_usercontext, starget);
}

/**
Expand Down
9 changes: 8 additions & 1 deletion trunk/drivers/scsi/scsi_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ static void scsi_device_cls_release(struct class_device *class_dev)
put_device(&sdev->sdev_gendev);
}

static void scsi_device_dev_release(struct device *dev)
static void scsi_device_dev_release_usercontext(void *data)
{
struct device *dev = data;
struct scsi_device *sdev;
struct device *parent;
struct scsi_target *starget;
Expand All @@ -237,6 +238,7 @@ static void scsi_device_dev_release(struct device *dev)

if (sdev->request_queue) {
sdev->request_queue->queuedata = NULL;
/* user context needed to free queue */
scsi_free_queue(sdev->request_queue);
/* temporary expedient, try to catch use of queue lock
* after free of sdev */
Expand All @@ -252,6 +254,11 @@ static void scsi_device_dev_release(struct device *dev)
put_device(parent);
}

static void scsi_device_dev_release(struct device *dev)
{
scsi_execute_in_process_context(scsi_device_dev_release_usercontext, dev);
}

static struct class sdev_class = {
.name = "scsi_device",
.release = scsi_device_cls_release,
Expand Down

0 comments on commit c6b1c97

Please sign in to comment.