From 58533aeccead3c0a2a1d989f5e1df5f2d8c09702 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 9 Apr 2015 20:13:50 -0400 Subject: [PATCH] dm thin: fix to consistently zero-fill reads to unprovisioned blocks [ Upstream commit 5f027a3bf184d1d36e68745f7cd3718a8b879cc0 ] It was always intended that a read to an unprovisioned block will return zeroes regardless of whether the pool is in read-only or read-write mode. thin_bio_map() was inconsistent with its handling of such reads when the pool is in read-only mode, it now properly zero-fills the bios it returns in response to unprovisioned block reads. Eliminate thin_bio_map()'s special read-only mode handling of -ENODATA and just allow the IO to be deferred to the worker which will result in pool->process_bio() handling the IO (which already properly zero-fills reads to unprovisioned blocks). Reported-by: Eric Sandeen Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/md/dm-thin.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index ac6b0ff..0801e35 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -2003,17 +2003,6 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) return DM_MAPIO_REMAPPED; case -ENODATA: - if (get_pool_mode(tc->pool) == PM_READ_ONLY) { - /* - * This block isn't provisioned, and we have no way - * of doing so. - */ - handle_unserviceable_bio(tc->pool, bio); - cell_defer_no_holder_no_free(tc, &cell1); - return DM_MAPIO_SUBMITTED; - } - /* fall through */ - case -EWOULDBLOCK: /* * In future, the failed dm_thin_find_block above could -- 2.7.4