| From 2de09cf3f91e4ba9858b548a783036267146e4ac Mon Sep 17 00:00:00 2001 |
| From: Christoph Hellwig <hch@lst.de> |
| Date: Sat, 27 Jun 2020 09:31:46 +0200 |
| Subject: [PATCH] dm: use bio_uninit instead of bio_disassociate_blkg |
| |
| commit 382761dc6312965a11f82f2217e16ec421bf17ae upstream. |
| |
| bio_uninit is the proper API to clean up a BIO that has been allocated |
| on stack or inside a structure that doesn't come from the BIO allocator. |
| Switch dm to use that instead of bio_disassociate_blkg, which really is |
| an implementation detail. Note that the bio_uninit calls are also moved |
| to the two callers of __send_empty_flush, so that they better pair with |
| the bio_init calls used to initialize them. |
| |
| Signed-off-by: Christoph Hellwig <hch@lst.de> |
| Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> |
| Signed-off-by: Mike Snitzer <snitzer@redhat.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
| index fecefe9a7302..9e7765ea73a9 100644 |
| --- a/drivers/md/dm.c |
| +++ b/drivers/md/dm.c |
| @@ -1440,9 +1440,6 @@ static int __send_empty_flush(struct clone_info *ci) |
| BUG_ON(bio_has_data(ci->bio)); |
| while ((ti = dm_table_get_target(ci->map, target_nr++))) |
| __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); |
| - |
| - bio_disassociate_blkg(ci->bio); |
| - |
| return 0; |
| } |
| |
| @@ -1630,6 +1627,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, |
| ci.bio = &flush_bio; |
| ci.sector_count = 0; |
| error = __send_empty_flush(&ci); |
| + bio_uninit(ci.bio); |
| /* dec_pending submits any data associated with flush */ |
| } else if (bio_op(bio) == REQ_OP_ZONE_RESET) { |
| ci.bio = bio; |
| @@ -1704,6 +1702,7 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map, |
| ci.bio = &flush_bio; |
| ci.sector_count = 0; |
| error = __send_empty_flush(&ci); |
| + bio_uninit(ci.bio); |
| /* dec_pending submits any data associated with flush */ |
| } else { |
| struct dm_target_io *tio; |
| -- |
| 2.27.0 |
| |