Block device driver: how to terminate the block device if media disappears?

anish kumar anish198519851985 at gmail.com
Sat Jan 12 12:56:22 EST 2013


On Sat, 2013-01-12 at 14:39 -0300, Ezequiel Garcia wrote:
> On Mon, Jan 7, 2013 at 7:49 AM, John Beard <johnb at codexdigital.com> wrote:
> > On 21/12/12 18:23, Ezequiel Garcia wrote:
> >
> >> On Thu, Dec 13, 2012 at 12:31 PM, John Beard <johnb at codexdigital.com> wrote:
> >>>
> >>> What is the right way to terminate requests and delete the gendisk in
> >>> the case of physically vanished PCI devices (or even devices in general)?
> >>>
> >>
> >> There are several block driver examples in drivers/block.
> >> Or you might want to take a loot at mtdblock.c, or perhaps
> >> this simple ubiblock implementation:
> >>
> >> http://lwn.net/Articles/525957/
> >
> > Thanks, Ezequiel - sorry for the delay, I haven't had a chance to touch
> > my development computer over the break. The workqueue-based approach
> > from ubiblock.c seems to have solved the problem and the device can now
> > shut down happily once the request queue is emptied in the submit_req
> > call following device removal.
> >
> 
> Great! It's nice to hear the hint helped you.
> 
> FYI, a workqueue should always be preferred over a separate kernel thread,
> unless there is a good reason for the kernel thread.
I was led to believe that the workqueue implementation is based on
kernel thread.
I wonder in which cases kernel thread should be preferred over
workqueue?
> 





More information about the Kernelnewbies mailing list