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 branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block IO fixes from Jens Axboe:
"Three small fixes that have been queued up and tested for this series:

- A bug fix for xen-blkfront from Bob Liu, fixing an issue with
incomplete requests during migration.

- A fix for an ancient issue in retrieving the IO priority of a
different PID than self, preventing that task from going away while
we access it. From Omar.

- A writeback fix from Tahsin, fixing a case where we'd call ihold()
with a zero ref count inode"

* 'for-linus' of git://git.kernel.dk/linux-block:
block: fix use-after-free in sys_ioprio_get()
writeback: inode cgroup wb switch should not call ihold()
xen-blkfront: save uncompleted reqs in blkfront_resume()

+43 -52
+2
block/ioprio.c
··· 150 150 if (ret) 151 151 goto out; 152 152 ret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM); 153 + task_lock(p); 153 154 if (p->io_context) 154 155 ret = p->io_context->ioprio; 156 + task_unlock(p); 155 157 out: 156 158 return ret; 157 159 }
+40 -51
drivers/block/xen-blkfront.c
··· 207 207 struct blk_mq_tag_set tag_set; 208 208 struct blkfront_ring_info *rinfo; 209 209 unsigned int nr_rings; 210 + /* Save uncomplete reqs and bios for migration. */ 211 + struct list_head requests; 212 + struct bio_list bio_list; 210 213 }; 211 214 212 215 static unsigned int nr_minors; ··· 2005 2002 { 2006 2003 unsigned int i, r_index; 2007 2004 struct request *req, *n; 2008 - struct blk_shadow *copy; 2009 2005 int rc; 2010 2006 struct bio *bio, *cloned_bio; 2011 - struct bio_list bio_list, merge_bio; 2012 2007 unsigned int segs, offset; 2013 2008 int pending, size; 2014 2009 struct split_bio *split_bio; 2015 - struct list_head requests; 2016 2010 2017 2011 blkfront_gather_backend_features(info); 2018 2012 segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; 2019 2013 blk_queue_max_segments(info->rq, segs); 2020 - bio_list_init(&bio_list); 2021 - INIT_LIST_HEAD(&requests); 2022 2014 2023 2015 for (r_index = 0; r_index < info->nr_rings; r_index++) { 2024 - struct blkfront_ring_info *rinfo; 2025 - 2026 - rinfo = &info->rinfo[r_index]; 2027 - /* Stage 1: Make a safe copy of the shadow state. */ 2028 - copy = kmemdup(rinfo->shadow, sizeof(rinfo->shadow), 2029 - GFP_NOIO | __GFP_REPEAT | __GFP_HIGH); 2030 - if (!copy) 2031 - return -ENOMEM; 2032 - 2033 - /* Stage 2: Set up free list. */ 2034 - memset(&rinfo->shadow, 0, sizeof(rinfo->shadow)); 2035 - for (i = 0; i < BLK_RING_SIZE(info); i++) 2036 - rinfo->shadow[i].req.u.rw.id = i+1; 2037 - rinfo->shadow_free = rinfo->ring.req_prod_pvt; 2038 - rinfo->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; 2016 + struct blkfront_ring_info *rinfo = &info->rinfo[r_index]; 2039 2017 2040 2018 rc = blkfront_setup_indirect(rinfo); 2041 - if (rc) { 2042 - kfree(copy); 2019 + if (rc) 2043 2020 return rc; 2044 - } 2045 - 2046 - for (i = 0; i < BLK_RING_SIZE(info); i++) { 2047 - /* Not in use? */ 2048 - if (!copy[i].request) 2049 - continue; 2050 - 2051 - /* 2052 - * Get the bios in the request so we can re-queue them. 2053 - */ 2054 - if (copy[i].request->cmd_flags & 2055 - (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { 2056 - /* 2057 - * Flush operations don't contain bios, so 2058 - * we need to requeue the whole request 2059 - */ 2060 - list_add(&copy[i].request->queuelist, &requests); 2061 - continue; 2062 - } 2063 - merge_bio.head = copy[i].request->bio; 2064 - merge_bio.tail = copy[i].request->biotail; 2065 - bio_list_merge(&bio_list, &merge_bio); 2066 - copy[i].request->bio = NULL; 2067 - blk_end_request_all(copy[i].request, 0); 2068 - } 2069 - 2070 - kfree(copy); 2071 2021 } 2072 2022 xenbus_switch_state(info->xbdev, XenbusStateConnected); 2073 2023 ··· 2035 2079 kick_pending_request_queues(rinfo); 2036 2080 } 2037 2081 2038 - list_for_each_entry_safe(req, n, &requests, queuelist) { 2082 + list_for_each_entry_safe(req, n, &info->requests, queuelist) { 2039 2083 /* Requeue pending requests (flush or discard) */ 2040 2084 list_del_init(&req->queuelist); 2041 2085 BUG_ON(req->nr_phys_segments > segs); ··· 2043 2087 } 2044 2088 blk_mq_kick_requeue_list(info->rq); 2045 2089 2046 - while ((bio = bio_list_pop(&bio_list)) != NULL) { 2090 + while ((bio = bio_list_pop(&info->bio_list)) != NULL) { 2047 2091 /* Traverse the list of pending bios and re-queue them */ 2048 2092 if (bio_segments(bio) > segs) { 2049 2093 /* ··· 2089 2133 { 2090 2134 struct blkfront_info *info = dev_get_drvdata(&dev->dev); 2091 2135 int err = 0; 2136 + unsigned int i, j; 2092 2137 2093 2138 dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename); 2139 + 2140 + bio_list_init(&info->bio_list); 2141 + INIT_LIST_HEAD(&info->requests); 2142 + for (i = 0; i < info->nr_rings; i++) { 2143 + struct blkfront_ring_info *rinfo = &info->rinfo[i]; 2144 + struct bio_list merge_bio; 2145 + struct blk_shadow *shadow = rinfo->shadow; 2146 + 2147 + for (j = 0; j < BLK_RING_SIZE(info); j++) { 2148 + /* Not in use? */ 2149 + if (!shadow[j].request) 2150 + continue; 2151 + 2152 + /* 2153 + * Get the bios in the request so we can re-queue them. 2154 + */ 2155 + if (shadow[j].request->cmd_flags & 2156 + (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { 2157 + /* 2158 + * Flush operations don't contain bios, so 2159 + * we need to requeue the whole request 2160 + */ 2161 + list_add(&shadow[j].request->queuelist, &info->requests); 2162 + continue; 2163 + } 2164 + merge_bio.head = shadow[j].request->bio; 2165 + merge_bio.tail = shadow[j].request->biotail; 2166 + bio_list_merge(&info->bio_list, &merge_bio); 2167 + shadow[j].request->bio = NULL; 2168 + blk_mq_end_request(shadow[j].request, 0); 2169 + } 2170 + } 2094 2171 2095 2172 blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); 2096 2173
+1 -1
fs/fs-writeback.c
··· 483 483 goto out_free; 484 484 } 485 485 inode->i_state |= I_WB_SWITCH; 486 + __iget(inode); 486 487 spin_unlock(&inode->i_lock); 487 488 488 - ihold(inode); 489 489 isw->inode = inode; 490 490 491 491 atomic_inc(&isw_nr_in_flight);