On Mon, Jun 15, 2009 at 03:41:50PM -0700, Andrew Morton wrote: > On Mon, 15 Jun 2009 17:17:35 -0500 > "Mike Miller (OS Dev)" <mikem@xxxxxxxxxxxxxxxxxxxxxxx> wrote: > > > 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? > > Well it's a bit crappy - someone need to cook up a suitable title and > write a suitable changelog. I'd prefer that it be you ;) > > <writes a title and changelog. Sigh> > > > 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); > > Has this been confirmed to fix things? Apparently, not. I'm still having issues. I'm sure this worked before my patch was finally accepted. That's why I made the thread interruptible. Now I see an article on LWN saying that kthread_stop doesn't use signals. It says call kthread_should_stop periodically, which I do. How else to stop a thread??? http://lwn.net/Articles/118935/ > > This is needed in 2.6.30.x, yes? Yes, this is needed in 2.6.30.x. I'm working it. Will submit a proper patch with changelog when complete. Sorry for the inconvenience. -- 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