[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1422183476-20611-1-git-send-email-ming.lei@canonical.com>
Date: Sun, 25 Jan 2015 18:57:56 +0800
From: Ming Lei <ming.lei@...onical.com>
To: Jens Axboe <axboe@...com>, linux-kernel@...r.kernel.org
Cc: Ming Lei <ming.lei@...onical.com>
Subject: [PATCH] block: bio: stop to pin pages if bio can't hold more
It doesn't make sense to continue to pin user pages when
bio can't hold more pages.
Also this patch fixes possible double page release issue
when get_user_pages_fast() failure happens just after some
of pages in last round weren't added in the bio.
Signed-off-by: Ming Lei <ming.lei@...onical.com>
---
block/bio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 471d738..fcf0b15 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1365,9 +1365,13 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
cur_page = j;
/*
* release the pages we didn't map into the bio, if any
+ * and stop to pin pages if page can't be added.
*/
- while (j < page_limit)
- page_cache_release(pages[j++]);
+ if (j < page_limit) {
+ while (j < page_limit)
+ page_cache_release(pages[j++]);
+ break;
+ }
}
kfree(pages);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists