diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-12-19 13:08:40 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-12-19 13:08:40 +0800 |
commit | 2cea360fea5e5e1cb69496612466be2b99254096 (patch) | |
tree | 9fa7616bdfab7526cc450b711c605435d42bcbb2 /block | |
parent | fa33cf591e9633ec9bfe83b38ab628569d490a48 (diff) | |
parent | 51f34b615fa526142825db2aa26927be91cf14ca (diff) |
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Diffstat (limited to 'block')
-rw-r--r-- | block/bio.c | 14 | ||||
-rw-r--r-- | block/blk-core.c | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/block/bio.c b/block/bio.c index 68bbc835bacc..63363a689922 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1268,6 +1268,7 @@ struct bio *bio_map_user_iov(struct request_queue *q, int ret, offset; struct iov_iter i; struct iovec iov; + struct bio_vec *bvec; iov_for_each(iov, i, *iter) { unsigned long uaddr = (unsigned long) iov.iov_base; @@ -1312,7 +1313,12 @@ struct bio *bio_map_user_iov(struct request_queue *q, ret = get_user_pages_fast(uaddr, local_nr_pages, (iter->type & WRITE) != WRITE, &pages[cur_page]); - if (ret < local_nr_pages) { + if (unlikely(ret < local_nr_pages)) { + for (j = cur_page; j < page_limit; j++) { + if (!pages[j]) + break; + put_page(pages[j]); + } ret = -EFAULT; goto out_unmap; } @@ -1374,10 +1380,8 @@ struct bio *bio_map_user_iov(struct request_queue *q, return bio; out_unmap: - for (j = 0; j < nr_pages; j++) { - if (!pages[j]) - break; - page_cache_release(pages[j]); + bio_for_each_segment_all(bvec, bio, j) { + put_page(bvec->bv_page); } out: kfree(pages); diff --git a/block/blk-core.c b/block/blk-core.c index 323cc15b155a..d1788778dd06 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -528,8 +528,8 @@ void blk_set_queue_dying(struct request_queue *q) blk_queue_for_each_rl(rl, q) { if (rl->rq_pool) { - wake_up(&rl->wait[BLK_RW_SYNC]); - wake_up(&rl->wait[BLK_RW_ASYNC]); + wake_up_all(&rl->wait[BLK_RW_SYNC]); + wake_up_all(&rl->wait[BLK_RW_ASYNC]); } } } |