aboutsummaryrefslogtreecommitdiff
path: root/module/os/linux/zfs/vdev_disk.c
diff options
context:
space:
mode:
authorRob N <robn@despairlabs.com>2024-04-03 22:17:07 +0000
committerGitHub <noreply@github.com>2024-04-03 22:17:07 +0000
commit917ff75e9510d19968ef3cc5c80b1cd0ef48f84d (patch)
tree9fc2b3438c8924ec44093f69d1dd9ede7bf094ee /module/os/linux/zfs/vdev_disk.c
parenta9a4290173dfdfd25aabd623bc3ccd994126794a (diff)
downloadsrc-917ff75e9510d19968ef3cc5c80b1cd0ef48f84d.tar.gz
src-917ff75e9510d19968ef3cc5c80b1cd0ef48f84d.zip
Diffstat (limited to 'module/os/linux/zfs/vdev_disk.c')
-rw-r--r--module/os/linux/zfs/vdev_disk.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c
index ac8fe6cb1bf9..df5fa067797a 100644
--- a/module/os/linux/zfs/vdev_disk.c
+++ b/module/os/linux/zfs/vdev_disk.c
@@ -755,8 +755,6 @@ vbio_fill_cb(struct page *page, size_t off, size_t len, void *priv)
static void
vbio_submit(vbio_t *vbio, abd_t *abd, uint64_t size)
{
- ASSERT(vbio->vbio_bdev);
-
/*
* We plug so we can submit the BIOs as we go and only unplug them when
* they are fully created and submitted. This is important; if we don't
@@ -774,12 +772,15 @@ vbio_submit(vbio_t *vbio, abd_t *abd, uint64_t size)
vbio->vbio_bio->bi_end_io = vbio_completion;
vbio->vbio_bio->bi_private = vbio;
+ /*
+ * Once submitted, vbio_bio now owns vbio (through bi_private) and we
+ * can't touch it again. The bio may complete and vbio_completion() be
+ * called and free the vbio before this task is run again, so we must
+ * consider it invalid from this point.
+ */
vdev_submit_bio(vbio->vbio_bio);
blk_finish_plug(&plug);
-
- vbio->vbio_bio = NULL;
- vbio->vbio_bdev = NULL;
}
/* IO completion callback */