summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Cline <jcline@redhat.com>2019-05-24 14:25:12 +0000
committerJeremy Cline <jcline@redhat.com>2019-05-24 14:26:45 +0000
commit9e192c5f59f80011c7befdfaceffb16af15b5a75 (patch)
tree7de19158f1debae55e80fe71961850b57b1f1681
parentbfbd62bda582ba95bc03b41b1fbbef95b6d3a1d6 (diff)
downloadkernel-9e192c5f59f80011c7befdfaceffb16af15b5a75.tar.gz
kernel-9e192c5f59f80011c7befdfaceffb16af15b5a75.tar.xz
kernel-9e192c5f59f80011c7befdfaceffb16af15b5a75.zip
Backport the fstrim fix coming in v5.1.5
-rw-r--r--dm-make-sure-to-obey-max_io_len_target_boundary.patch51
-rw-r--r--kernel.spec8
2 files changed, 58 insertions, 1 deletions
diff --git a/dm-make-sure-to-obey-max_io_len_target_boundary.patch b/dm-make-sure-to-obey-max_io_len_target_boundary.patch
new file mode 100644
index 000000000..3dd4d0e61
--- /dev/null
+++ b/dm-make-sure-to-obey-max_io_len_target_boundary.patch
@@ -0,0 +1,51 @@
+From cddb054c69999d655502d7c97d0855ba7ede18ac Mon Sep 17 00:00:00 2001
+From: Michael Lass <bevan@bi-co.net>
+Date: Thu, 23 May 2019 21:07:13 +0200
+Subject: [PATCH] dm: make sure to obey max_io_len_target_boundary
+
+commit 51b86f9a8d1c4bb4e3862ee4b4c5f46072f7520d upstream.
+
+Commit 61697a6abd24 ("dm: eliminate 'split_discard_bios' flag from DM
+target interface") incorrectly removed code from
+__send_changing_extent_only() that is required to impose a per-target IO
+boundary on IO that exceeds max_io_len_target_boundary(). Otherwise
+"special" IO (e.g. DISCARD, WRITE SAME, WRITE ZEROES) can write beyond
+where allowed.
+
+Fix this by restoring the max_io_len_target_boundary() limit in
+__send_changing_extent_only()
+
+Fixes: 61697a6abd24 ("dm: eliminate 'split_discard_bios' flag from DM target interface")
+Cc: stable@vger.kernel.org # 5.1+
+Signed-off-by: Michael Lass <bevan@bi-co.net>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c
+index 043f0761e4a0..08e7d412af95 100644
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -1467,7 +1467,7 @@ static unsigned get_num_write_zeroes_bios(struct dm_target *ti)
+ static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti,
+ unsigned num_bios)
+ {
+- unsigned len = ci->sector_count;
++ unsigned len;
+
+ /*
+ * Even though the device advertised support for this type of
+@@ -1478,6 +1478,8 @@ static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *
+ if (!num_bios)
+ return -EOPNOTSUPP;
+
++ len = min((sector_t)ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
++
+ __send_duplicate_bios(ci, ti, num_bios, &len);
+
+ ci->sector += len;
+--
+2.21.0
+
diff --git a/kernel.spec b/kernel.spec
index fd1a8bf81..3b15e5686 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -42,7 +42,7 @@ Summary: The Linux kernel
# For non-released -rc kernels, this will be appended after the rcX and
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
#
-%global baserelease 300
+%global baserelease 301
%global fedora_build %{baserelease}
# base_sublevel is the kernel version we're starting with and patching
@@ -589,6 +589,9 @@ Patch526: 0001-platform-x86-ideapad-laptop-Remove-no_hw_rfkill_list.patch
# https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-marcel@holtmann.org/
Patch527: Bluetooth-Check-key-sizes-only-when-Secure-Simple-Pa.patch
+# Coming in v5.1.5
+Patch528: dm-make-sure-to-obey-max_io_len_target_boundary.patch
+
# END OF PATCH DEFINITIONS
%endif
@@ -1827,6 +1830,9 @@ fi
#
#
%changelog
+* Fri May 24 2019 Jeremy Cline <jcline@redhat.com> - 5.1.4-301
+- Fix fstrim discarding too many blocks
+
* Wed May 22 2019 Jeremy Cline <jcline@redhat.com> - 5.1.4-300
- Linux v5.1.4
- Fix an issue with Bluetooth 2.0 and earlier devices (rhbz 1711468)