summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-09-23 14:38:21 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-09-23 14:38:21 -0700
commita969324fe7cc38e4af05eea44fde385a2853c91e (patch)
tree323e7b9ebda8bbc3fc3650c73fe62958adf022cd /drivers
parentbffac4b5435a07bf26604385ae533adff3cccf23 (diff)
parent4c07ae0ad493b7b2d3dd3e53870e594f136ce8a5 (diff)
Merge tag 'for-5.9/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer: - DM core fix for incorrect double bio splitting. Keep "fixing" this because past attempts didn't fully appreciate the liability relative to recursive bio splitting. This fix limits DM's bio splitting to a single method and does _not_ use blk_queue_split() for normal IO. - DM crypt Documentation updates for features added during 5.9 merge. * tag 'for-5.9/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm crypt: document encrypted keyring key option dm crypt: document new no_workqueue flags dm: fix comment in dm_process_bio() dm: fix bio splitting and its bio completion order for regular IO
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 4a40df8af7d3..6ed05ca65a0f 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1724,23 +1724,6 @@ out:
return ret;
}
-static void dm_queue_split(struct mapped_device *md, struct dm_target *ti, struct bio **bio)
-{
- unsigned len, sector_count;
-
- sector_count = bio_sectors(*bio);
- len = min_t(sector_t, max_io_len((*bio)->bi_iter.bi_sector, ti), sector_count);
-
- if (sector_count > len) {
- struct bio *split = bio_split(*bio, len, GFP_NOIO, &md->queue->bio_split);
-
- bio_chain(split, *bio);
- trace_block_split(md->queue, split, (*bio)->bi_iter.bi_sector);
- submit_bio_noacct(*bio);
- *bio = split;
- }
-}
-
static blk_qc_t dm_process_bio(struct mapped_device *md,
struct dm_table *map, struct bio *bio)
{
@@ -1761,21 +1744,21 @@ static blk_qc_t dm_process_bio(struct mapped_device *md,
}
/*
- * If in ->queue_bio we need to use blk_queue_split(), otherwise
+ * If in ->submit_bio we need to use blk_queue_split(), otherwise
* queue_limits for abnormal requests (e.g. discard, writesame, etc)
* won't be imposed.
+ * If called from dm_wq_work() for deferred bio processing, bio
+ * was already handled by following code with previous ->submit_bio.
*/
if (current->bio_list) {
if (is_abnormal_io(bio))
blk_queue_split(&bio);
- else
- dm_queue_split(md, ti, &bio);
+ /* regular IO is split by __split_and_process_bio */
}
if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
return __process_bio(md, map, bio, ti);
- else
- return __split_and_process_bio(md, map, bio);
+ return __split_and_process_bio(md, map, bio);
}
static blk_qc_t dm_submit_bio(struct bio *bio)