Need help on block device error handling.

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

 



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.
[email protected]
(403) 399-0195
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux