From: johnb@codexdigital.com (John Beard)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Block device driver: how to terminate the block device if media disappears?
Date: Thu, 13 Dec 2012 15:31:24 +0000 [thread overview]
Message-ID: <50C9F4CC.7090702@codexdigital.com> (raw)
Hi,
I have block driver for a hot-pluggable device PCIe storage device on
kernel version 2.6.43 (which I know isn't a mainline kernel version, but
it's what I am required to build against). The driver itself is
relatively simple and implements the following block operations:
static struct block_device_operations mydev_ops = {
.owner = THIS_MODULE,
.open = mydev_open,
.release = mydev_release,
.getgeo = mydev_getgeo,
.ioctl = mydev_ioctl
};
and the following PCI driver structure:
static struct pci_driver mydev_driver = {
.name = DRIVER_NAME,
.probe = mydev_pci_init_one,
.remove = mydev_pci_remove_one,
.id_table = mydev_pci_tbl,
};
As well as a request_fn with the following signature:
static void mydev_submit_req(struct request_queue *q);
Whenever I get IO requests, there is the expected pattern of "open, IO,
release", and everything works OK.
However, if the device is physically removed during IO, I never seem to
get a "release", just "open, IO, hang". I believe (but I don't know),
that this is preventing del_gendisk() from completing, thus hanging the
cleanup of the driver, which is triggered by mydev_pci_remove_one() upon
the removal of the device.
I am ending all requests on the queue once an eject happens, but it
still doesn't seem to cause a release.
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)?
Thanks in advance for any pointers to a solution and apologies to the
IRC folks for annoying them with the same question!
John Beard
next reply other threads:[~2012-12-13 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-13 15:31 John Beard [this message]
2012-12-21 18:23 ` Block device driver: how to terminate the block device if media disappears? Ezequiel Garcia
2013-01-07 10:49 ` John Beard
2013-01-12 17:39 ` Ezequiel Garcia
2013-01-12 17:56 ` anish kumar
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=50C9F4CC.7090702@codexdigital.com \
--to=johnb@codexdigital.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).