Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F173449793
D60019.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D60019.diff
View Options
diff --git a/sys/dev/nvmf/host/nvmf_ns.c b/sys/dev/nvmf/host/nvmf_ns.c
--- a/sys/dev/nvmf/host/nvmf_ns.c
+++ b/sys/dev/nvmf/host/nvmf_ns.c
@@ -433,14 +433,15 @@
}
}
-void
-nvmf_shutdown_ns(struct nvmf_namespace *ns)
+/* Called with ns->lock held; drops it. */
+static void
+nvmf_ns_abort_pending_bios(struct nvmf_namespace *ns)
{
TAILQ_HEAD(, bio) bios;
struct bio *bio;
- mtx_lock(&ns->lock);
- ns->shutdown = true;
+ mtx_assert(&ns->lock, MA_OWNED);
+
TAILQ_INIT(&bios);
TAILQ_CONCAT(&bios, &ns->pending_bios, bio_queue);
mtx_unlock(&ns->lock);
@@ -456,11 +457,16 @@
}
void
-nvmf_destroy_ns(struct nvmf_namespace *ns)
+nvmf_shutdown_ns(struct nvmf_namespace *ns)
{
- TAILQ_HEAD(, bio) bios;
- struct bio *bio;
+ mtx_lock(&ns->lock);
+ ns->shutdown = true;
+ nvmf_ns_abort_pending_bios(ns);
+}
+void
+nvmf_destroy_ns(struct nvmf_namespace *ns)
+{
if (ns->cdev->si_drv2 != NULL)
destroy_dev(ns->cdev->si_drv2);
destroy_dev(ns->cdev);
@@ -477,18 +483,7 @@
}
/* Abort any pending I/O requests. */
- TAILQ_INIT(&bios);
- TAILQ_CONCAT(&bios, &ns->pending_bios, bio_queue);
- mtx_unlock(&ns->lock);
-
- while (!TAILQ_EMPTY(&bios)) {
- bio = TAILQ_FIRST(&bios);
- TAILQ_REMOVE(&bios, bio, bio_queue);
- bio->bio_error = ECONNABORTED;
- bio->bio_flags |= BIO_ERROR;
- bio->bio_resid = bio->bio_bcount;
- biodone(bio);
- }
+ nvmf_ns_abort_pending_bios(ns);
mtx_destroy(&ns->lock);
free(ns, M_NVMF);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 27, 12:51 AM (10 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39660444
Default Alt Text
D60019.diff (1 KB)
Attached To
Mode
D60019: nvmf: factor out the pending request abort loop
Attached
Detach File
Event Timeline
Log In to Comment