From 61143db929932fa0078d54eb9ed8b0e207aa2843 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Wed, 11 Jun 2014 16:36:52 -0400 Subject: [PATCH] Fix fstrim on dm-thin volume data (rhbz 1106856) --- ...y-to-reflect-the-thin-pool-blocksize.patch | 43 +++++++++++++++++++ kernel.spec | 7 +++ 2 files changed, 50 insertions(+) create mode 100644 dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch diff --git a/dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch b/dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch new file mode 100644 index 000000000..2994fc002 --- /dev/null +++ b/dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch @@ -0,0 +1,43 @@ +Bugzilla: 1106856 +Upstream-status: 3.16 and CC'd to stable + +From 4adc9ea8915ff9904c3279b1b36478482d1c0825 Mon Sep 17 00:00:00 2001 +From: Lukas Czerner +Date: Wed, 11 Jun 2014 12:28:43 -0400 +Subject: dm thin: update discard_granularity to reflect the thin-pool + blocksize + +DM thinp already checks whether the discard_granularity of the data +device is a factor of the thin-pool block size. But when using the +dm-thin-pool's discard passdown support, DM thinp was not selecting the +max of the underlying data device's discard_granularity and the +thin-pool's block size. + +Update set_discard_limits() to set discard_granularity to the max of +these values. This enables blkdev_issue_discard() to properly align the +discards that are sent to the DM thin device on a full block boundary. +As such each discard will now cover an entire DM thin-pool block and the +block will be reclaimed. + +Reported-by: Zdenek Kabelac +Signed-off-by: Lukas Czerner +Signed-off-by: Mike Snitzer +Cc: stable@vger.kernel.org + +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c +index a0bdd56..fc9c848 100644 +--- a/drivers/md/dm-thin.c ++++ b/drivers/md/dm-thin.c +@@ -3094,7 +3094,8 @@ static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits) + */ + if (pt->adjusted_pf.discard_passdown) { + data_limits = &bdev_get_queue(pt->data_dev->bdev)->limits; +- limits->discard_granularity = data_limits->discard_granularity; ++ limits->discard_granularity = max(data_limits->discard_granularity, ++ pool->sectors_per_block << SECTOR_SHIFT); + } else + limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; + } +-- +cgit v0.10.1 + diff --git a/kernel.spec b/kernel.spec index 7e3d89806..3683badc9 100644 --- a/kernel.spec +++ b/kernel.spec @@ -731,6 +731,9 @@ Patch25098: e1000e-Failure-to-write-SHRA-turns-on-PROMISC-mode.patch #rhbz 1099761 Patch25099: NFS-populate-net-in-mount-data-when-remounting.patch +#rhbz 1106856 +Patch25100: dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch + # END OF PATCH DEFINITIONS %endif @@ -1430,6 +1433,9 @@ ApplyPatch e1000e-Failure-to-write-SHRA-turns-on-PROMISC-mode.patch #rhbz 1099761 ApplyPatch NFS-populate-net-in-mount-data-when-remounting.patch +#rhbz 1106856 +ApplyPatch dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch + # END OF PATCH APPLICATIONS %endif @@ -2243,6 +2249,7 @@ fi # || || %changelog * Wed Jun 11 2014 Josh Boyer +- Fix fstrim on dm-thin volume data (rhbz 1106856) - Fix NFS NULL pointer deref with ipv6 (rhbz 1099761) - Fix promisc mode on certain e1000e cards (rhbz 1064516) - Fix i915 backlight issue on gen4 (rhbz 1094066)