LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Need help on block device error handling.
@ 2007-05-03 21:06 Grant Likely
  0 siblings, 0 replies; only message in thread
From: Grant Likely @ 2007-05-03 21:06 UTC (permalink / raw)
  To: Linux Kernel Mailing List

I've got a device driver for the Xilinx SystemACE CompactFlash
interface that I'm working on and I'm having problems adding error
handling and notification.  Specifically, I need to deal with the case
where the CF card might get pulled out by the user at any time without
notice.  While this situation will obviously result in data loss, I
need to make sure that the system is able to recover gracefully (ie.
the user will be ticked if it hangs or crashes.  :)

So, here are my questions.
- When a new CF is inserted/removed, how should I notify the
block/filesystem layer?
- If the CF is removed mid-transfer, how do I abort all pending bios
and block new requests?  What is the impact on user space processes
using the device, will they get signaled?

AFAICT, I've got two options.  One is to use the media_changed() and
revalidate_disk() so the block layer can determine when things have
changed.  However, I cannot figure out how to force all activity to
stop when the CF is removed while the device is still open.

The other seems to be not call add_gendisk() until media is inserted,
and then call del_gendisk() when it is removed, but I don't know if
this is safe, and it still doesn't solve the problem of cancling
pending transactions and forcing the block layer to close the device.

Should I be using invalidate_partition() for this?

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-03 21:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-03 21:06 Need help on block device error handling Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).