Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'dm-4.1-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device-mapper fixes from Mike Snitzer:
"Quite a few fixes for DM's blk-mq support thanks to extra DM multipath
testing from Junichi Nomura and Bart Van Assche.

Also fix a casting bug in dm_merge_bvec() that could cause only a
single page to be added to a bio (Joe identified this while testing
dm-cache writeback)"

* tag 'dm-4.1-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm: fix casting bug in dm_merge_bvec()
dm: fix reload failure of 0 path multipath mapping on blk-mq devices
dm: fix false warning in free_rq_clone() for unmapped requests
dm: requeue from blk-mq dm_mq_queue_rq() using BLK_MQ_RQ_QUEUE_BUSY
dm mpath: fix leak of dm_mpath_io structure in blk-mq .queue_rq error path
dm: fix NULL pointer when clone_and_map_rq returns !DM_MAPIO_REMAPPED
dm: run queue on re-queue

+36 -24
+3 -1
drivers/md/dm-mpath.c
··· 429 429 /* blk-mq request-based interface */ 430 430 *__clone = blk_get_request(bdev_get_queue(bdev), 431 431 rq_data_dir(rq), GFP_ATOMIC); 432 - if (IS_ERR(*__clone)) 432 + if (IS_ERR(*__clone)) { 433 433 /* ENOMEM, requeue */ 434 + clear_mapinfo(m, map_context); 434 435 return r; 436 + } 435 437 (*__clone)->bio = (*__clone)->biotail = NULL; 436 438 (*__clone)->rq_disk = bdev->bd_disk; 437 439 (*__clone)->cmd_flags |= REQ_FAILFAST_TRANSPORT;
+9 -7
drivers/md/dm-table.c
··· 820 820 } 821 821 EXPORT_SYMBOL(dm_consume_args); 822 822 823 + static bool __table_type_request_based(unsigned table_type) 824 + { 825 + return (table_type == DM_TYPE_REQUEST_BASED || 826 + table_type == DM_TYPE_MQ_REQUEST_BASED); 827 + } 828 + 823 829 static int dm_table_set_type(struct dm_table *t) 824 830 { 825 831 unsigned i; ··· 858 852 * Determine the type from the live device. 859 853 * Default to bio-based if device is new. 860 854 */ 861 - if (live_md_type == DM_TYPE_REQUEST_BASED || 862 - live_md_type == DM_TYPE_MQ_REQUEST_BASED) 855 + if (__table_type_request_based(live_md_type)) 863 856 request_based = 1; 864 857 else 865 858 bio_based = 1; ··· 908 903 } 909 904 t->type = DM_TYPE_MQ_REQUEST_BASED; 910 905 911 - } else if (hybrid && list_empty(devices) && live_md_type != DM_TYPE_NONE) { 906 + } else if (list_empty(devices) && __table_type_request_based(live_md_type)) { 912 907 /* inherit live MD type */ 913 908 t->type = live_md_type; 914 909 ··· 930 925 931 926 bool dm_table_request_based(struct dm_table *t) 932 927 { 933 - unsigned table_type = dm_table_get_type(t); 934 - 935 - return (table_type == DM_TYPE_REQUEST_BASED || 936 - table_type == DM_TYPE_MQ_REQUEST_BASED); 928 + return __table_type_request_based(dm_table_get_type(t)); 937 929 } 938 930 939 931 bool dm_table_mq_request_based(struct dm_table *t)
+24 -16
drivers/md/dm.c
··· 1082 1082 dm_put(md); 1083 1083 } 1084 1084 1085 - static void free_rq_clone(struct request *clone, bool must_be_mapped) 1085 + static void free_rq_clone(struct request *clone) 1086 1086 { 1087 1087 struct dm_rq_target_io *tio = clone->end_io_data; 1088 1088 struct mapped_device *md = tio->md; 1089 - 1090 - WARN_ON_ONCE(must_be_mapped && !clone->q); 1091 1089 1092 1090 blk_rq_unprep_clone(clone); 1093 1091 ··· 1130 1132 rq->sense_len = clone->sense_len; 1131 1133 } 1132 1134 1133 - free_rq_clone(clone, true); 1135 + free_rq_clone(clone); 1134 1136 if (!rq->q->mq_ops) 1135 1137 blk_end_request_all(rq, error); 1136 1138 else ··· 1149 1151 } 1150 1152 1151 1153 if (clone) 1152 - free_rq_clone(clone, false); 1154 + free_rq_clone(clone); 1153 1155 } 1154 1156 1155 1157 /* ··· 1162 1164 1163 1165 spin_lock_irqsave(q->queue_lock, flags); 1164 1166 blk_requeue_request(q, rq); 1167 + blk_run_queue_async(q); 1165 1168 spin_unlock_irqrestore(q->queue_lock, flags); 1166 1169 } 1167 1170 ··· 1723 1724 struct mapped_device *md = q->queuedata; 1724 1725 struct dm_table *map = dm_get_live_table_fast(md); 1725 1726 struct dm_target *ti; 1726 - sector_t max_sectors; 1727 - int max_size = 0; 1727 + sector_t max_sectors, max_size = 0; 1728 1728 1729 1729 if (unlikely(!map)) 1730 1730 goto out; ··· 1738 1740 max_sectors = min(max_io_len(bvm->bi_sector, ti), 1739 1741 (sector_t) queue_max_sectors(q)); 1740 1742 max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; 1741 - if (unlikely(max_size < 0)) /* this shouldn't _ever_ happen */ 1742 - max_size = 0; 1743 + 1744 + /* 1745 + * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t 1746 + * to the targets' merge function since it holds sectors not bytes). 1747 + * Just doing this as an interim fix for stable@ because the more 1748 + * comprehensive cleanup of switching to sector_t will impact every 1749 + * DM target that implements a ->merge hook. 1750 + */ 1751 + if (max_size > INT_MAX) 1752 + max_size = INT_MAX; 1743 1753 1744 1754 /* 1745 1755 * merge_bvec_fn() returns number of bytes ··· 1755 1749 * max is precomputed maximal io size 1756 1750 */ 1757 1751 if (max_size && ti->type->merge) 1758 - max_size = ti->type->merge(ti, bvm, biovec, max_size); 1752 + max_size = ti->type->merge(ti, bvm, biovec, (int) max_size); 1759 1753 /* 1760 1754 * If the target doesn't support merge method and some of the devices 1761 1755 * provided their merge_bvec method (we know this by looking for the ··· 1977 1971 dm_kill_unmapped_request(rq, r); 1978 1972 return r; 1979 1973 } 1980 - if (IS_ERR(clone)) 1981 - return DM_MAPIO_REQUEUE; 1974 + if (r != DM_MAPIO_REMAPPED) 1975 + return r; 1982 1976 if (setup_clone(clone, rq, tio, GFP_ATOMIC)) { 1983 1977 /* -ENOMEM */ 1984 1978 ti->type->release_clone_rq(clone); ··· 2759 2753 if (dm_table_get_type(map) == DM_TYPE_REQUEST_BASED) { 2760 2754 /* clone request is allocated at the end of the pdu */ 2761 2755 tio->clone = (void *)blk_mq_rq_to_pdu(rq) + sizeof(struct dm_rq_target_io); 2762 - if (!clone_rq(rq, md, tio, GFP_ATOMIC)) 2763 - return BLK_MQ_RQ_QUEUE_BUSY; 2756 + (void) clone_rq(rq, md, tio, GFP_ATOMIC); 2764 2757 queue_kthread_work(&md->kworker, &tio->work); 2765 2758 } else { 2766 2759 /* Direct call is fine since .queue_rq allows allocations */ 2767 - if (map_request(tio, rq, md) == DM_MAPIO_REQUEUE) 2768 - dm_requeue_unmapped_original_request(md, rq); 2760 + if (map_request(tio, rq, md) == DM_MAPIO_REQUEUE) { 2761 + /* Undo dm_start_request() before requeuing */ 2762 + rq_completed(md, rq_data_dir(rq), false); 2763 + return BLK_MQ_RQ_QUEUE_BUSY; 2764 + } 2769 2765 } 2770 2766 2771 2767 return BLK_MQ_RQ_QUEUE_OK;