Merge tag ‘for-5.2/dm-fix-1’ of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm [Linux 5.2]

Merge tag ‘for-5.2/dm-fix-1’ of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm [Linux 5.2]

This Linux kernel change "Merge tag ‘for-5.2/dm-fix-1’ of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm" is included in the Linux 5.2 release. This change is authored by Linus Torvalds <torvalds [at] linux-foundation.org> on Wed May 22 08:10:35 2019 -0700. The commit for this change in Linux stable tree is 86f9e56 (patch). Other info about this change: Merge: 9c7db50 51b86f9

Merge tag 'for-5.2/dm-fix-1' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fix from Mike Snitzer:
 "Fix a particularly glaring oversight in a DM core commit from 5.1 that
  doesn't properly trim special IOs (e.g. discards) relative to
  corresponding target's max_io_len_target_boundary()"

* tag 'for-5.2/dm-fix-1' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm: make sure to obey max_io_len_target_boundary

There is no are 0 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 1fb1333..997385c 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1469,7 +1469,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
@@ -1480,6 +1480,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;

Leave a Reply

Your email address will not be published. Required fields are marked *