Pull block fixes from Jens Axboe: "Set of fixes that should go into this round. This pull is larger than I'd like at this time, but there's really no specific reason for that. Some are fixes for issues that went into this merge window, others are not. Anyway, this contains: - Hardware queue limiting for virtio-blk/scsi (Dongli) - Multi-page bvec fixes for lightnvm pblk - Multi-bio dio error fix (Jason) - Remove the cache hint from the io_uring tool side, since we didn't move forward with that (me) - Make io_uring SETUP_SQPOLL root restricted (me) - Fix leak of page in error handling for pc requests (Jérôme) - Fix BFQ regression introduced in this merge window (Paolo) - Fix break logic for bio segment iteration (Ming) - Fix NVMe cancel request error handling (Ming) - NVMe pull request with two fixes (Christoph): - fix the initial CSN for nvme-fc (James) - handle log page offsets properly in the target (Keith)" * tag 'for-linus-20190412' of git://git.kernel.dk/linux-block: block: fix the return errno for direct IO nvmet: fix discover log page when offsets are used nvme-fc: correct csn initialization and increments on error block: do not leak memory in bio_copy_user_iov() lightnvm: pblk: fix crash in pblk_end_partial_read due to multipage bvecs nvme: cancel request synchronously blk-mq: introduce blk_mq_complete_request_sync() scsi: virtio_scsi: limit number of hw queues by nr_cpu_ids virtio-blk: limit number of hw queues by nr_cpu_ids block, bfq: fix use after free in bfq_bfqq_expire io_uring: restrict IORING_SETUP_SQPOLL to root tools/io_uring: remove IOCQE_FLAG_CACHEHIT block: don't use for-inside-for in bio_for_each_segment_all
Showing the changes to include/linux (4 of 20 files). Show all
Unified · Split
| @@ -120,19 +120,23 @@ static inline bool bio_full(struct bio *bio) · 119 unmodified lines | ||
| 120 | 120 | return bio->bi_vcnt >= bio->bi_max_vecs; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | −#define mp_bvec_for_each_segment(bv, bvl, i, iter_all) \ | |
| 124 | − for (bv = bvec_init_iter_all(&iter_all); \ | |
| 125 | − (iter_all.done < (bvl)->bv_len) && \ | |
| 126 | − (mp_bvec_next_segment((bvl), &iter_all), 1); \ | |
| 127 | − iter_all.done += bv->bv_len, i += 1) | |
| 123 | +static inline bool bio_next_segment(const struct bio *bio, | |
| 124 | + struct bvec_iter_all *iter) | |
| 125 | +{ | |
| 126 | + if (iter->idx >= bio->bi_vcnt) | |
| 127 | + return false; | |
| 128 | + | |
| 129 | + bvec_advance(&bio->bi_io_vec[iter->idx], iter); | |
| 130 | + return true; | |
| 131 | +} | |
| 128 | 132 | |
| 129 | 133 | /* |
| 130 | 134 | * drivers should _never_ use the all version - the bio may have been split |
| 131 | 135 | * before it got to the driver and the driver won't own all of it |
| 132 | 136 | */ |
| 133 | −#define bio_for_each_segment_all(bvl, bio, i, iter_all) \ | |
| 134 | − for (i = 0, iter_all.idx = 0; iter_all.idx < (bio)->bi_vcnt; iter_all.idx++) \ | |
| 135 | − mp_bvec_for_each_segment(bvl, &((bio)->bi_io_vec[iter_all.idx]), i, iter_all) | |
| 137 | +#define bio_for_each_segment_all(bvl, bio, i, iter) \ | |
| 138 | + for (i = 0, bvl = bvec_init_iter_all(&iter); \ | |
| 139 | + bio_next_segment((bio), &iter); i++) | |
| 136 | 140 | |
| 137 | 141 | static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter, |
| 138 | 142 | unsigned bytes) |
| @@ -302,6 +302,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list); · 301 unmodified lines | ||
| 302 | 302 | void blk_mq_kick_requeue_list(struct request_queue *q); |
| 303 | 303 | void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs); |
| 304 | 304 | bool blk_mq_complete_request(struct request *rq); |
| 305 | +void blk_mq_complete_request_sync(struct request *rq); | |
| 305 | 306 | bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list, |
| 306 | 307 | struct bio *bio); |
| 307 | 308 | bool blk_mq_queue_stopped(struct request_queue *q); |
| @@ -145,18 +145,18 @@ static inline bool bvec_iter_advance(const struct bio_vec *bv, · 144 unmodified lines | ||
| 145 | 145 | |
| 146 | 146 | static inline struct bio_vec *bvec_init_iter_all(struct bvec_iter_all *iter_all) |
| 147 | 147 | { |
| 148 | − iter_all->bv.bv_page = NULL; | |
| 149 | 148 | iter_all->done = 0; |
| 149 | + iter_all->idx = 0; | |
| 150 | 150 | |
| 151 | 151 | return &iter_all->bv; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | −static inline void mp_bvec_next_segment(const struct bio_vec *bvec, | |
| 155 | − struct bvec_iter_all *iter_all) | |
| 154 | +static inline void bvec_advance(const struct bio_vec *bvec, | |
| 155 | + struct bvec_iter_all *iter_all) | |
| 156 | 156 | { |
| 157 | 157 | struct bio_vec *bv = &iter_all->bv; |
| 158 | 158 | |
| 159 | − if (bv->bv_page) { | |
| 159 | + if (iter_all->done) { | |
| 160 | 160 | bv->bv_page = nth_page(bv->bv_page, 1); |
| 161 | 161 | bv->bv_offset = 0; |
| 162 | 162 | } else { |
| @@ -165,6 +165,12 @@ static inline void mp_bvec_next_segment(const struct bio_vec *bvec, · 2 unmodified lines | ||
| 165 | 165 | } |
| 166 | 166 | bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset, |
| 167 | 167 | bvec->bv_len - iter_all->done); |
| 168 | + iter_all->done += bv->bv_len; | |
| 169 | + | |
| 170 | + if (iter_all->done == bvec->bv_len) { | |
| 171 | + iter_all->idx++; | |
| 172 | + iter_all->done = 0; | |
| 173 | + } | |
| 168 | 174 | } |
| 169 | 175 | |
| 170 | 176 | /* |
| @@ -967,8 +967,13 @@ struct nvme_get_log_page_command { · 966 unmodified lines | ||
| 967 | 967 | __le16 numdl; |
| 968 | 968 | __le16 numdu; |
| 969 | 969 | __u16 rsvd11; |
| 970 | − __le32 lpol; | |
| 971 | − __le32 lpou; | |
| 970 | + union { | |
| 971 | + struct { | |
| 972 | + __le32 lpol; | |
| 973 | + __le32 lpou; | |
| 974 | + }; | |
| 975 | + __le64 lpo; | |
| 976 | + }; | |
| 972 | 977 | __u32 rsvd14[2]; |
| 973 | 978 | }; |
| 974 | 979 | |