From: Mike Snitzer <[email-masked]>

The dm thin targets claim to support the zeroing of discarded
data areas.  This turns out to be incorrect so always set
ti->discard_zeroes_data_unsupported.

The thin pool target will zero blocks when they are allocated if the
skip_block_zeroing feature is not specified.  But if a thin pool block is
partially discarded then there is no guarantee that the discarded data
will get zeroed on the next allocation of the block.  The block layer
may send a discard that only partially covers a block.  Due to this thin
devices cannot claim discards will always zero data.

Signed-off-by: Mike Snitzer <[email-masked]>
Cc: [email-masked] # 3.4+
---
 drivers/md/dm-thin.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/md/dm-thin.c
===================================================================
--- linux.orig/drivers/md/dm-thin.c
+++ linux/drivers/md/dm-thin.c
@@ -2288,6 +2288,7 @@ static int pool_ctr(struct dm_target *ti
 		 * thin devices' discard limits consistent).
 		 */
 		ti->discards_supported = true;
+		ti->discard_zeroes_data_unsupported = true;
 	}
 	ti->private = pt;
 
@@ -2759,7 +2760,6 @@ static void set_discard_limits(struct po
 	 * boundary is not sent to this target.
 	 */
 	limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
-	limits->discard_zeroes_data = pool->pf.zero_new_blocks;
 }
 
 static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits)