On Mon, Jun 15, 2009 at 02:25:50PM -0700, Andrew Morton wrote: > On Mon, 15 Jun 2009 15:39:55 -0500 > "Mike Miller (OS Dev)" <mikem@xxxxxxxxxxxxxxxxxxxxxxx> wrote: > > > I'm getting reports that the driver hangs in the scan thread during rmmod. I > > call kthread_stop in cciss_remove_one. Do I also neesd to call complete()? > > Yep. > > static int scan_thread(void *data) > { > ctlr_info_t *h = data; > int rc; > DECLARE_COMPLETION_ONSTACK(wait); > h->rescan_wait = &wait; > > for (;;) { > rc = wait_for_completion_interruptible(&wait); > if (kthread_should_stop()) > break; > if (!rc) > rebuild_lun_table(h, 0); > } > return 0; > } > > Two things will cause that wait_for_completion_interruptible() to > return: a complete() and a signal_pending(). But this is a kernel > thread, and kernel threads start out with all signals blocked. > > > During my testing everything seemed to working OK. > > That's odd. Yeah, I guess so. Here's a patch to fix that problem. I add a call to complete to cciss_remove_one to stop the thread for rmmod. Please consider this for inclusion. Or should I submit separately from this mail? Signed-off-by: Mike Miller <mike.miller@xxxxxx> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4d4d5e0..e51a0b2 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -3935,6 +3935,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) return; } + complete(hba[i]->rescan_wait); kthread_stop(hba[i]->cciss_scan_thread); remove_proc_entry(hba[i]->devname, proc_cciss); -- To unsubscribe from this list: 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