4.x device failure?

Scott Long scottl at samsco.org
Mon Sep 13 10:28:04 PDT 2004


Sam wrote:
> Hello,
> 
> I'm testing out my AoE driver and have a question about
> how to handle device failure.  I have a function,
> aoedev_down, that fails all outstanding bufs and if the
> device is currently open, calls disk_invalidate and flags
> the device for destruction on close.  This function
> is also called on module unload, once per device.  The
> module unload will wait until all devices are closed
> before returning.
> 
> The test I'm running is to mount an AoE device and unload
> the AoE module.  The mount persists (while AoE unload
> waits) and upon umount I get a panic and eventual hang
> syncing disks.  I would have thought that calling
> disk_invalidate would cause anyone depending on that
> disk to see it as gone, but that's apparently not so.
> I never see the close.
> 
> Surely there's a way to pull a disk out from under
> those that have it open without a panic?  Opinions?
> 
> Cheers,
> 
> Sam
> 

Are you calling disk_destroy()?  disk_invalidate() only frees
the disk slice objects, it doesn't actually remove the disk
object and cdevsw.  You also need to manually track opens in
your disk driver and only call disk_destroy() once all references
are closed.  What panic are you getting?

Scott


More information about the freebsd-arch mailing list