diff options
| author | Pavel Begunkov <asml.silence@gmail.com> | 2025-10-16 14:23:23 +0100 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-10-20 10:37:56 -0600 |
| commit | 5b6d8a032e807c48a843fb81d9e3d74391f731ea (patch) | |
| tree | 19b56c57b2acef182ee31f5ab914661b8a0c6adc /io_uring/memmap.c | |
| parent | dec10a1ad1d5f9d46e7f6e7c8b414a805e00717c (diff) | |
io_uring: only publish fully handled mem region
io_register_mem_region() can try to remove a region right after
publishing it. This non-atomicity is annoying. Do it in two steps
similar to io_register_mem_region(), create memory first and publish it
once the rest of the handling is done. Remove now unused
io_create_region_mmap_safe(), which was assumed to be a temporary
solution from day one.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/memmap.c')
| -rw-r--r-- | io_uring/memmap.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/io_uring/memmap.c b/io_uring/memmap.c index 2e99dffddfc5..aa388ecd4754 100644 --- a/io_uring/memmap.c +++ b/io_uring/memmap.c @@ -234,27 +234,6 @@ out_free: return ret; } -int io_create_region_mmap_safe(struct io_ring_ctx *ctx, struct io_mapped_region *mr, - struct io_uring_region_desc *reg, - unsigned long mmap_offset) -{ - struct io_mapped_region tmp_mr; - int ret; - - memcpy(&tmp_mr, mr, sizeof(tmp_mr)); - ret = io_create_region(ctx, &tmp_mr, reg, mmap_offset); - if (ret) - return ret; - - /* - * Once published mmap can find it without holding only the ->mmap_lock - * and not ->uring_lock. - */ - guard(mutex)(&ctx->mmap_lock); - memcpy(mr, &tmp_mr, sizeof(tmp_mr)); - return 0; -} - static struct io_mapped_region *io_mmap_get_region(struct io_ring_ctx *ctx, loff_t pgoff) { |