]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.19.4/dm-thin-fix-to-consistently-zero-fill-reads-to-unprovisioned-blocks.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.4 / dm-thin-fix-to-consistently-zero-fill-reads-to-unprovisioned-blocks.patch
1 From 5f027a3bf184d1d36e68745f7cd3718a8b879cc0 Mon Sep 17 00:00:00 2001
2 From: Joe Thornber <ejt@redhat.com>
3 Date: Fri, 27 Feb 2015 14:09:12 +0000
4 Subject: dm thin: fix to consistently zero-fill reads to unprovisioned blocks
5
6 From: Joe Thornber <ejt@redhat.com>
7
8 commit 5f027a3bf184d1d36e68745f7cd3718a8b879cc0 upstream.
9
10 It was always intended that a read to an unprovisioned block will return
11 zeroes regardless of whether the pool is in read-only or read-write
12 mode. thin_bio_map() was inconsistent with its handling of such reads
13 when the pool is in read-only mode, it now properly zero-fills the bios
14 it returns in response to unprovisioned block reads.
15
16 Eliminate thin_bio_map()'s special read-only mode handling of -ENODATA
17 and just allow the IO to be deferred to the worker which will result in
18 pool->process_bio() handling the IO (which already properly zero-fills
19 reads to unprovisioned blocks).
20
21 Reported-by: Eric Sandeen <sandeen@redhat.com>
22 Signed-off-by: Joe Thornber <ejt@redhat.com>
23 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/md/dm-thin.c | 11 -----------
28 1 file changed, 11 deletions(-)
29
30 --- a/drivers/md/dm-thin.c
31 +++ b/drivers/md/dm-thin.c
32 @@ -2357,17 +2357,6 @@ static int thin_bio_map(struct dm_target
33 return DM_MAPIO_REMAPPED;
34
35 case -ENODATA:
36 - if (get_pool_mode(tc->pool) == PM_READ_ONLY) {
37 - /*
38 - * This block isn't provisioned, and we have no way
39 - * of doing so.
40 - */
41 - handle_unserviceable_bio(tc->pool, bio);
42 - cell_defer_no_holder(tc, virt_cell);
43 - return DM_MAPIO_SUBMITTED;
44 - }
45 - /* fall through */
46 -
47 case -EWOULDBLOCK:
48 thin_defer_cell(tc, virt_cell);
49 return DM_MAPIO_SUBMITTED;