Thread (14 messages) 14 messages, 6 authors, 2021-02-25

Re: [PATCH 4/4] block: memory allocations in bounce_clone_bio must not fail

flat view

From: Ming Lei <hidden>
Date: 2021-02-25 02:23:55

On Wed, Feb 24, 2021 at 05:12:36PM +0100, Christoph Hellwig wrote:
On Wed, Feb 24, 2021 at 07:19:52PM +0800, Ming Lei wrote:
quoted
quoted
 	if (bio_is_passthrough(bio_src))
-		bio = bio_kmalloc(GFP_NOIO, bio_segments(bio_src));
+		bio = bio_kmalloc(GFP_NOIO | __GFP_NOFAIL,
+				  bio_segments(bio_src));
bio_kmalloc() still may fail if bio_segments(bio_src) is > UIO_MAXIOV.
Yes, but bio_kmalloc is what is used to allocate the passthrough
requests to start with, so we'd not even make it here.
The original bio_kmalloc() may start with allowed nr_iovecs , but
later more pages are retrieved from iov_iter and added to the bio,
see bio_map_user_iov(). Then bounce_clone_bio() will see too big
bio_segments(bio_src) to be held in UIO_MAXIOV vecs.

This behavior is similar with blkdev_direct_IO().

-- 
Ming
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help