mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Grant Likely" <grant.likely@secretlab.ca>
To: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Need help on block device error handling.
Date: Thu, 3 May 2007 15:06:21 -0600	[thread overview]
Message-ID: <528646bc0705031406v5560d661m8fa1c3e2ea155ddb@mail.gmail.com> (raw)

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

                 reply	other threads:[~2007-05-03 21:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528646bc0705031406v5560d661m8fa1c3e2ea155ddb@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®