diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-07 21:35:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-07 21:35:14 -0400 |
commit | 39171c86f1c47320de51796d58eb7a5533135a4a (patch) | |
tree | 92c4218c0f9591257632ee86edafe25d14d1ec8d | |
parent | f0943013068599fcbe29bf534f439ef2b6f09003 (diff) | |
parent | aa0cd28d057fd4cb686fbdd2475a6a3f609dd581 (diff) |
Merge tag 'dm-4.2-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer:
- stable fix for a dm_merge_bvec() regression on 32 bit Fedora systems.
- fix for a 4.2 DM thinp discard regression due to inability to
properly delete a range of blocks in a data mapping btree.
* tag 'dm-4.2-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm btree remove: fix bug in remove_one()
dm: fix dm_merge_bvec regression on 32 bit systems
-rw-r--r-- | drivers/md/dm.c | 27 | ||||
-rw-r--r-- | drivers/md/persistent-data/dm-btree-remove.c | 1 |
2 files changed, 11 insertions, 17 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index ab37ae114e94..0d7ab20c58df 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -1729,7 +1729,8 @@ static int dm_merge_bvec(struct request_queue *q, | |||
1729 | struct mapped_device *md = q->queuedata; | 1729 | struct mapped_device *md = q->queuedata; |
1730 | struct dm_table *map = dm_get_live_table_fast(md); | 1730 | struct dm_table *map = dm_get_live_table_fast(md); |
1731 | struct dm_target *ti; | 1731 | struct dm_target *ti; |
1732 | sector_t max_sectors, max_size = 0; | 1732 | sector_t max_sectors; |
1733 | int max_size = 0; | ||
1733 | 1734 | ||
1734 | if (unlikely(!map)) | 1735 | if (unlikely(!map)) |
1735 | goto out; | 1736 | goto out; |
@@ -1742,18 +1743,10 @@ static int dm_merge_bvec(struct request_queue *q, | |||
1742 | * Find maximum amount of I/O that won't need splitting | 1743 | * Find maximum amount of I/O that won't need splitting |
1743 | */ | 1744 | */ |
1744 | max_sectors = min(max_io_len(bvm->bi_sector, ti), | 1745 | max_sectors = min(max_io_len(bvm->bi_sector, ti), |
1745 | (sector_t) queue_max_sectors(q)); | 1746 | (sector_t) BIO_MAX_SECTORS); |
1746 | max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; | 1747 | max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; |
1747 | 1748 | if (max_size < 0) | |
1748 | /* | 1749 | max_size = 0; |
1749 | * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t | ||
1750 | * to the targets' merge function since it holds sectors not bytes). | ||
1751 | * Just doing this as an interim fix for stable@ because the more | ||
1752 | * comprehensive cleanup of switching to sector_t will impact every | ||
1753 | * DM target that implements a ->merge hook. | ||
1754 | */ | ||
1755 | if (max_size > INT_MAX) | ||
1756 | max_size = INT_MAX; | ||
1757 | 1750 | ||
1758 | /* | 1751 | /* |
1759 | * merge_bvec_fn() returns number of bytes | 1752 | * merge_bvec_fn() returns number of bytes |
@@ -1761,13 +1754,13 @@ static int dm_merge_bvec(struct request_queue *q, | |||
1761 | * max is precomputed maximal io size | 1754 | * max is precomputed maximal io size |
1762 | */ | 1755 | */ |
1763 | if (max_size && ti->type->merge) | 1756 | if (max_size && ti->type->merge) |
1764 | max_size = ti->type->merge(ti, bvm, biovec, (int) max_size); | 1757 | max_size = ti->type->merge(ti, bvm, biovec, max_size); |
1765 | /* | 1758 | /* |
1766 | * If the target doesn't support merge method and some of the devices | 1759 | * If the target doesn't support merge method and some of the devices |
1767 | * provided their merge_bvec method (we know this by looking for the | 1760 | * provided their merge_bvec method (we know this by looking at |
1768 | * max_hw_sectors that dm_set_device_limits may set), then we can't | 1761 | * queue_max_hw_sectors), then we can't allow bios with multiple vector |
1769 | * allow bios with multiple vector entries. So always set max_size | 1762 | * entries. So always set max_size to 0, and the code below allows |
1770 | * to 0, and the code below allows just one page. | 1763 | * just one page. |
1771 | */ | 1764 | */ |
1772 | else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9) | 1765 | else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9) |
1773 | max_size = 0; | 1766 | max_size = 0; |
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index 9836c0ae897c..9ca9eccd512f 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
@@ -689,6 +689,7 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, | |||
689 | value_ptr(n, index)); | 689 | value_ptr(n, index)); |
690 | 690 | ||
691 | delete_at(n, index); | 691 | delete_at(n, index); |
692 | keys[last_level] = k + 1ull; | ||
692 | 693 | ||
693 | } else | 694 | } else |
694 | r = -ENODATA; | 695 | r = -ENODATA; |