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

Pull block fixes from Jens Axboe:
"A few fixes that should go into this release. This contains:

- MD pull request from Song, fixing a recovery OOM issue (Alexei)

- Fix for a sync related stall (Jianchao)

- Dummy callback for timeouts (Tetsuo)

- IDE atapi sense ordering fix (me)"

* tag 'for-linus-20190202' of git://git.kernel.dk/linux-block:
ide: ensure atapi sense request aren't preempted
blk-mq: fix a hung issue when fsync
block: pass no-op callback to INIT_WORK().
md/raid5: fix 'out of memory' during raid cache recovery

+93 -53
+5 -1
block/blk-core.c
··· 462 462 kblockd_schedule_work(&q->timeout_work); 463 463 } 464 464 465 + static void blk_timeout_work(struct work_struct *work) 466 + { 467 + } 468 + 465 469 /** 466 470 * blk_alloc_queue_node - allocate a request queue 467 471 * @gfp_mask: memory allocation flags ··· 509 505 timer_setup(&q->backing_dev_info->laptop_mode_wb_timer, 510 506 laptop_mode_timer_fn, 0); 511 507 timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); 512 - INIT_WORK(&q->timeout_work, NULL); 508 + INIT_WORK(&q->timeout_work, blk_timeout_work); 513 509 INIT_LIST_HEAD(&q->icq_list); 514 510 #ifdef CONFIG_BLK_CGROUP 515 511 INIT_LIST_HEAD(&q->blkg_list);
+1 -1
block/blk-flush.c
··· 335 335 blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error); 336 336 spin_unlock_irqrestore(&fq->mq_flush_lock, flags); 337 337 338 - blk_mq_run_hw_queue(hctx, true); 338 + blk_mq_sched_restart(hctx); 339 339 } 340 340 341 341 /**
+8 -1
drivers/ide/ide-atapi.c
··· 235 235 236 236 int ide_queue_sense_rq(ide_drive_t *drive, void *special) 237 237 { 238 - struct request *sense_rq = drive->sense_rq; 238 + ide_hwif_t *hwif = drive->hwif; 239 + struct request *sense_rq; 240 + unsigned long flags; 241 + 242 + spin_lock_irqsave(&hwif->lock, flags); 239 243 240 244 /* deferred failure from ide_prep_sense() */ 241 245 if (!drive->sense_rq_armed) { 242 246 printk(KERN_WARNING PFX "%s: error queuing a sense request\n", 243 247 drive->name); 248 + spin_unlock_irqrestore(&hwif->lock, flags); 244 249 return -ENOMEM; 245 250 } 246 251 252 + sense_rq = drive->sense_rq; 247 253 ide_req(sense_rq)->special = special; 248 254 drive->sense_rq_armed = false; 249 255 250 256 drive->hwif->rq = NULL; 251 257 252 258 ide_insert_request_head(drive, sense_rq); 259 + spin_unlock_irqrestore(&hwif->lock, flags); 253 260 return 0; 254 261 } 255 262 EXPORT_SYMBOL_GPL(ide_queue_sense_rq);
+31 -30
drivers/ide/ide-io.c
··· 68 68 } 69 69 70 70 if (!blk_update_request(rq, error, nr_bytes)) { 71 - if (rq == drive->sense_rq) 71 + if (rq == drive->sense_rq) { 72 72 drive->sense_rq = NULL; 73 + drive->sense_rq_active = false; 74 + } 73 75 74 76 __blk_mq_end_request(rq, error); 75 77 return 0; ··· 453 451 blk_mq_delay_run_hw_queue(q->queue_hw_ctx[0], 3); 454 452 } 455 453 456 - /* 457 - * Issue a new request to a device. 458 - */ 459 - blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, 460 - const struct blk_mq_queue_data *bd) 454 + blk_status_t ide_issue_rq(ide_drive_t *drive, struct request *rq, 455 + bool local_requeue) 461 456 { 462 - ide_drive_t *drive = hctx->queue->queuedata; 463 - ide_hwif_t *hwif = drive->hwif; 457 + ide_hwif_t *hwif = drive->hwif; 464 458 struct ide_host *host = hwif->host; 465 - struct request *rq = bd->rq; 466 459 ide_startstop_t startstop; 467 460 468 461 if (!blk_rq_is_passthrough(rq) && !(rq->rq_flags & RQF_DONTPREP)) { ··· 470 473 471 474 if (ide_lock_host(host, hwif)) 472 475 return BLK_STS_DEV_RESOURCE; 473 - 474 - blk_mq_start_request(rq); 475 476 476 477 spin_lock_irq(&hwif->lock); 477 478 ··· 504 509 } 505 510 hwif->cur_dev = drive; 506 511 drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); 507 - 508 - /* 509 - * we know that the queue isn't empty, but this can happen 510 - * if ->prep_rq() decides to kill a request 511 - */ 512 - if (!rq) { 513 - rq = bd->rq; 514 - if (!rq) { 515 - ide_unlock_port(hwif); 516 - goto out; 517 - } 518 - } 519 512 520 513 /* 521 514 * Sanity: don't accept a request that isn't a PM request ··· 543 560 } 544 561 } else { 545 562 plug_device: 563 + if (local_requeue) 564 + list_add(&rq->queuelist, &drive->rq_list); 546 565 spin_unlock_irq(&hwif->lock); 547 566 ide_unlock_host(host); 548 - ide_requeue_and_plug(drive, rq); 567 + if (!local_requeue) 568 + ide_requeue_and_plug(drive, rq); 549 569 return BLK_STS_OK; 550 570 } 551 571 ··· 557 571 if (rq == NULL) 558 572 ide_unlock_host(host); 559 573 return BLK_STS_OK; 574 + } 575 + 576 + /* 577 + * Issue a new request to a device. 578 + */ 579 + blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, 580 + const struct blk_mq_queue_data *bd) 581 + { 582 + ide_drive_t *drive = hctx->queue->queuedata; 583 + ide_hwif_t *hwif = drive->hwif; 584 + 585 + spin_lock_irq(&hwif->lock); 586 + if (drive->sense_rq_active) { 587 + spin_unlock_irq(&hwif->lock); 588 + return BLK_STS_DEV_RESOURCE; 589 + } 590 + spin_unlock_irq(&hwif->lock); 591 + 592 + blk_mq_start_request(bd->rq); 593 + return ide_issue_rq(drive, bd->rq, false); 560 594 } 561 595 562 596 static int drive_is_ready(ide_drive_t *drive) ··· 899 893 900 894 void ide_insert_request_head(ide_drive_t *drive, struct request *rq) 901 895 { 902 - ide_hwif_t *hwif = drive->hwif; 903 - unsigned long flags; 904 - 905 - spin_lock_irqsave(&hwif->lock, flags); 896 + drive->sense_rq_active = true; 906 897 list_add_tail(&rq->queuelist, &drive->rq_list); 907 - spin_unlock_irqrestore(&hwif->lock, flags); 908 - 909 898 kblockd_schedule_work(&drive->rq_work); 910 899 } 911 900 EXPORT_SYMBOL_GPL(ide_insert_request_head);
+2
drivers/ide/ide-park.c
··· 54 54 scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; 55 55 scsi_req(rq)->cmd_len = 1; 56 56 ide_req(rq)->type = ATA_PRIV_MISC; 57 + spin_lock_irq(&hwif->lock); 57 58 ide_insert_request_head(drive, rq); 59 + spin_unlock_irq(&hwif->lock); 58 60 59 61 out: 60 62 return;
+16 -7
drivers/ide/ide-probe.c
··· 1159 1159 ide_drive_t *drive = container_of(work, ide_drive_t, rq_work); 1160 1160 ide_hwif_t *hwif = drive->hwif; 1161 1161 struct request *rq; 1162 + blk_status_t ret; 1162 1163 LIST_HEAD(list); 1163 1164 1165 + blk_mq_quiesce_queue(drive->queue); 1166 + 1167 + ret = BLK_STS_OK; 1164 1168 spin_lock_irq(&hwif->lock); 1165 - if (!list_empty(&drive->rq_list)) 1166 - list_splice_init(&drive->rq_list, &list); 1169 + while (!list_empty(&drive->rq_list)) { 1170 + rq = list_first_entry(&drive->rq_list, struct request, queuelist); 1171 + list_del_init(&rq->queuelist); 1172 + 1173 + spin_unlock_irq(&hwif->lock); 1174 + ret = ide_issue_rq(drive, rq, true); 1175 + spin_lock_irq(&hwif->lock); 1176 + } 1167 1177 spin_unlock_irq(&hwif->lock); 1168 1178 1169 - while (!list_empty(&list)) { 1170 - rq = list_first_entry(&list, struct request, queuelist); 1171 - list_del_init(&rq->queuelist); 1172 - blk_execute_rq_nowait(drive->queue, rq->rq_disk, rq, true, NULL); 1173 - } 1179 + blk_mq_unquiesce_queue(drive->queue); 1180 + 1181 + if (ret != BLK_STS_OK) 1182 + kblockd_schedule_work(&drive->rq_work); 1174 1183 } 1175 1184 1176 1185 static const u8 ide_hwif_to_major[] =
+22 -11
drivers/md/raid5-cache.c
··· 1935 1935 } 1936 1936 1937 1937 static struct stripe_head * 1938 - r5c_recovery_alloc_stripe(struct r5conf *conf, 1939 - sector_t stripe_sect) 1938 + r5c_recovery_alloc_stripe( 1939 + struct r5conf *conf, 1940 + sector_t stripe_sect, 1941 + int noblock) 1940 1942 { 1941 1943 struct stripe_head *sh; 1942 1944 1943 - sh = raid5_get_active_stripe(conf, stripe_sect, 0, 1, 0); 1945 + sh = raid5_get_active_stripe(conf, stripe_sect, 0, noblock, 0); 1944 1946 if (!sh) 1945 1947 return NULL; /* no more stripe available */ 1946 1948 ··· 2152 2150 stripe_sect); 2153 2151 2154 2152 if (!sh) { 2155 - sh = r5c_recovery_alloc_stripe(conf, stripe_sect); 2153 + sh = r5c_recovery_alloc_stripe(conf, stripe_sect, 1); 2156 2154 /* 2157 2155 * cannot get stripe from raid5_get_active_stripe 2158 2156 * try replay some stripes ··· 2161 2159 r5c_recovery_replay_stripes( 2162 2160 cached_stripe_list, ctx); 2163 2161 sh = r5c_recovery_alloc_stripe( 2164 - conf, stripe_sect); 2162 + conf, stripe_sect, 1); 2165 2163 } 2166 2164 if (!sh) { 2165 + int new_size = conf->min_nr_stripes * 2; 2167 2166 pr_debug("md/raid:%s: Increasing stripe cache size to %d to recovery data on journal.\n", 2168 2167 mdname(mddev), 2169 - conf->min_nr_stripes * 2); 2170 - raid5_set_cache_size(mddev, 2171 - conf->min_nr_stripes * 2); 2172 - sh = r5c_recovery_alloc_stripe(conf, 2173 - stripe_sect); 2168 + new_size); 2169 + ret = raid5_set_cache_size(mddev, new_size); 2170 + if (conf->min_nr_stripes <= new_size / 2) { 2171 + pr_err("md/raid:%s: Cannot increase cache size, ret=%d, new_size=%d, min_nr_stripes=%d, max_nr_stripes=%d\n", 2172 + mdname(mddev), 2173 + ret, 2174 + new_size, 2175 + conf->min_nr_stripes, 2176 + conf->max_nr_stripes); 2177 + return -ENOMEM; 2178 + } 2179 + sh = r5c_recovery_alloc_stripe( 2180 + conf, stripe_sect, 0); 2174 2181 } 2175 2182 if (!sh) { 2176 2183 pr_err("md/raid:%s: Cannot get enough stripes due to memory pressure. Recovery failed.\n", 2177 - mdname(mddev)); 2184 + mdname(mddev)); 2178 2185 return -ENOMEM; 2179 2186 } 2180 2187 list_add_tail(&sh->lru, cached_stripe_list);
+6 -2
drivers/md/raid5.c
··· 6369 6369 int 6370 6370 raid5_set_cache_size(struct mddev *mddev, int size) 6371 6371 { 6372 + int result = 0; 6372 6373 struct r5conf *conf = mddev->private; 6373 6374 6374 6375 if (size <= 16 || size > 32768) ··· 6386 6385 6387 6386 mutex_lock(&conf->cache_size_mutex); 6388 6387 while (size > conf->max_nr_stripes) 6389 - if (!grow_one_stripe(conf, GFP_KERNEL)) 6388 + if (!grow_one_stripe(conf, GFP_KERNEL)) { 6389 + conf->min_nr_stripes = conf->max_nr_stripes; 6390 + result = -ENOMEM; 6390 6391 break; 6392 + } 6391 6393 mutex_unlock(&conf->cache_size_mutex); 6392 6394 6393 - return 0; 6395 + return result; 6394 6396 } 6395 6397 EXPORT_SYMBOL(raid5_set_cache_size); 6396 6398
+2
include/linux/ide.h
··· 615 615 616 616 /* current sense rq and buffer */ 617 617 bool sense_rq_armed; 618 + bool sense_rq_active; 618 619 struct request *sense_rq; 619 620 struct request_sense sense_data; 620 621 ··· 1220 1219 extern void ide_timer_expiry(struct timer_list *t); 1221 1220 extern irqreturn_t ide_intr(int irq, void *dev_id); 1222 1221 extern blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *, const struct blk_mq_queue_data *); 1222 + extern blk_status_t ide_issue_rq(ide_drive_t *, struct request *, bool); 1223 1223 extern void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq); 1224 1224 1225 1225 void ide_init_disk(struct gendisk *, ide_drive_t *);