Re: 2.6.16-rc1 crash in scsi_target_reap_work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 On Mon, Feb 06, James Bottomley wrote:

> On Mon, 2006-02-06 at 23:04 +0100, Olaf Hering wrote:
> > I need help on this one.
> > What I have so far (via git-bisect) is:
> 
> My guess would be this patch:
> 
> 
> commit
> 863a930a40eb7f2d18534c2c166b22582f5c6cfd
> [SCSI] fix scsi_reap_target() device_del from atomic context

I'm testing this patch now.

+++ linux-2.6.16-rc2-olh/drivers/scsi/scsi_scan.c
@@ -428,18 +428,19 @@ static void scsi_target_reap_work(void *
  */
 void scsi_target_reap(struct scsi_target *starget)
 {
-       struct work_queue_wrapper *wqw = 
-               kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC);
+       struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
+       unsigned long flags;
+       spin_lock_irqsave(shost->host_lock, flags);
 
-       if (!wqw) {
-               starget_printk(KERN_ERR, starget,
-                              "Failed to allocate memory in scsi_reap_target()\n");
+       if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
+               list_del_init(&starget->siblings);
+               spin_unlock_irqrestore(shost->host_lock, flags);
+               device_del(&starget->dev);
+               transport_unregister_device(&starget->dev);
+               put_device(&starget->dev);
                return;
        }
-
-       INIT_WORK(&wqw->work, scsi_target_reap_work, wqw);
-       wqw->starget = starget;
-       schedule_work(&wqw->work);
+       spin_unlock_irqrestore(shost->host_lock, flags);
 }
 
 /**



-- 
short story of a lazy sysadmin:
 alias appserv=wotan
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux