Re: [RFC] How to fix an async scan - rmmod race?

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


On Fri, 2012-04-06 at 11:54 +0200, Tomas Henzl wrote:
> > Tomas's bug occurs when drivers use scsi_scan_host, use the async scsi
> > device scanning, and then rmmod the LLD while the scan is still in progress.
> >
> > I think a general problem that we might hit similar to Tomas's issue is
> > when scanning from userspace then rmmoding the driver. Maybe that means
> > we need a more generic fix? Or, maybe that could be handled by having
> > scsi_scan() do a try_module_get before scanning.
> I like this idea(try_module_get) it is easy/elegant and it is used in scsi_rescan_device,
> but a scan can take a lot of time and during that time the driver couldn't be removed.
> When a flag in scsi_remove_host is set then the scan can be cancelled, if the user 
> rmmods the driver.

This is my preferred solution too.  The rule for async stuff is either
cancel or wait and since we can't cancel, we need to ensure the wait by
holding the module until the async event has finished.

Since the whole of the host scan must complete, we need to hold the
module across that, but I bet we also need to hold it across user
triggered target scans as well.

James


--
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


[SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Photos]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

Add to Google Powered by Linux