summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-09-23 16:16:06 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-10-11 17:23:38 -0400
commite2e115d18b76467274d8f818f8828ba168f9c80b (patch)
tree755fcb8bc56789ea6db0dc1316bdec8298cf1505 /block
parent629e42bcc3d0bc04b4e0e40ef3f831507a4693bd (diff)
don't rely upon subsequent bio_add_pc_page() calls failing
... they might actually succeed in some cases (when we are at the queue-imposed segments limit, the next page is not mergable with the last one we'd got in, but the first page covered by the next iovec *is* mergable). Make sure that once it's failed, we are done with that bio. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/bio.c b/block/bio.c
index 5dbc5e90d716..fe40948d62af 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1380,10 +1380,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
if (n > bytes)
n = bytes;
- /*
- * sorry...
- */
- if (bio_add_pc_page(q, bio, pages[j], n, offs) < n)
+ if (!bio_add_pc_page(q, bio, pages[j], n, offs))
break;
/*
@@ -1405,6 +1402,9 @@ struct bio *bio_map_user_iov(struct request_queue *q,
while (j < npages)
put_page(pages[j++]);
kvfree(pages);
+ /* couldn't stuff something into bio? */
+ if (bytes)
+ break;
}
bio_set_flag(bio, BIO_USER_MAPPED);