Skip to content

Commit 3e5c673

Browse files
committed
Merge tag 'block-6.0-2022-08-26' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - MD pull request via Song: - Fix for clustered raid (Guoqing Jiang) - req_op fix (Bart Van Assche) - Fix race condition in raid recreate (David Sloan) - loop configuration overflow fix (Siddh) - Fix missing commit_rqs call for certain conditions (Yu) * tag 'block-6.0-2022-08-26' of git://git.kernel.dk/linux-block: md: call __md_stop_writes in md_stop Revert "md-raid: destroy the bitmap after destroying the thread" md: Flush workqueue md_rdev_misc_wq in md_alloc() md/raid10: Fix the data type of an r10_sync_page_io() argument loop: Check for overflow while configuring loop blk-mq: fix io hung due to missing commit_rqs
2 parents 0b0861e + 645b5ed commit 3e5c673

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

block/blk-mq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,8 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
19311931
/* If we didn't flush the entire list, we could have told the driver
19321932
* there was more coming, but that turned out to be a lie.
19331933
*/
1934-
if ((!list_empty(list) || errors) && q->mq_ops->commit_rqs && queued)
1934+
if ((!list_empty(list) || errors || needs_resource ||
1935+
ret == BLK_STS_DEV_RESOURCE) && q->mq_ops->commit_rqs && queued)
19351936
q->mq_ops->commit_rqs(hctx);
19361937
/*
19371938
* Any items that need requeuing? Stuff them into hctx->dispatch,
@@ -2660,14 +2661,14 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
26602661
list_del_init(&rq->queuelist);
26612662
ret = blk_mq_request_issue_directly(rq, list_empty(list));
26622663
if (ret != BLK_STS_OK) {
2664+
errors++;
26632665
if (ret == BLK_STS_RESOURCE ||
26642666
ret == BLK_STS_DEV_RESOURCE) {
26652667
blk_mq_request_bypass_insert(rq, false,
26662668
list_empty(list));
26672669
break;
26682670
}
26692671
blk_mq_end_request(rq, ret);
2670-
errors++;
26712672
} else
26722673
queued++;
26732674
}

drivers/block/loop.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,11 @@ loop_set_status_from_info(struct loop_device *lo,
979979

980980
lo->lo_offset = info->lo_offset;
981981
lo->lo_sizelimit = info->lo_sizelimit;
982+
983+
/* loff_t vars have been assigned __u64 */
984+
if (lo->lo_offset < 0 || lo->lo_sizelimit < 0)
985+
return -EOVERFLOW;
986+
982987
memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE);
983988
lo->lo_file_name[LO_NAME_SIZE-1] = 0;
984989
lo->lo_flags = info->lo_flags;

drivers/md/md.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5620,6 +5620,7 @@ struct mddev *md_alloc(dev_t dev, char *name)
56205620
* removed (mddev_delayed_delete).
56215621
*/
56225622
flush_workqueue(md_misc_wq);
5623+
flush_workqueue(md_rdev_misc_wq);
56235624

56245625
mutex_lock(&disks_mutex);
56255626
mddev = mddev_alloc(dev);
@@ -6238,11 +6239,11 @@ static void mddev_detach(struct mddev *mddev)
62386239
static void __md_stop(struct mddev *mddev)
62396240
{
62406241
struct md_personality *pers = mddev->pers;
6242+
md_bitmap_destroy(mddev);
62416243
mddev_detach(mddev);
62426244
/* Ensure ->event_work is done */
62436245
if (mddev->event_work.func)
62446246
flush_workqueue(md_misc_wq);
6245-
md_bitmap_destroy(mddev);
62466247
spin_lock(&mddev->lock);
62476248
mddev->pers = NULL;
62486249
spin_unlock(&mddev->lock);
@@ -6260,6 +6261,7 @@ void md_stop(struct mddev *mddev)
62606261
/* stop the array and free an attached data structures.
62616262
* This is called from dm-raid
62626263
*/
6264+
__md_stop_writes(mddev);
62636265
__md_stop(mddev);
62646266
bioset_exit(&mddev->bio_set);
62656267
bioset_exit(&mddev->sync_set);

drivers/md/raid10.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,18 +2639,18 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
26392639
}
26402640

26412641
static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector,
2642-
int sectors, struct page *page, int rw)
2642+
int sectors, struct page *page, enum req_op op)
26432643
{
26442644
sector_t first_bad;
26452645
int bad_sectors;
26462646

26472647
if (is_badblock(rdev, sector, sectors, &first_bad, &bad_sectors)
2648-
&& (rw == READ || test_bit(WriteErrorSeen, &rdev->flags)))
2648+
&& (op == REQ_OP_READ || test_bit(WriteErrorSeen, &rdev->flags)))
26492649
return -1;
2650-
if (sync_page_io(rdev, sector, sectors << 9, page, rw, false))
2650+
if (sync_page_io(rdev, sector, sectors << 9, page, op, false))
26512651
/* success */
26522652
return 1;
2653-
if (rw == WRITE) {
2653+
if (op == REQ_OP_WRITE) {
26542654
set_bit(WriteErrorSeen, &rdev->flags);
26552655
if (!test_and_set_bit(WantReplacement, &rdev->flags))
26562656
set_bit(MD_RECOVERY_NEEDED,
@@ -2780,7 +2780,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
27802780
if (r10_sync_page_io(rdev,
27812781
r10_bio->devs[sl].addr +
27822782
sect,
2783-
s, conf->tmppage, WRITE)
2783+
s, conf->tmppage, REQ_OP_WRITE)
27842784
== 0) {
27852785
/* Well, this device is dead */
27862786
pr_notice("md/raid10:%s: read correction write failed (%d sectors at %llu on %pg)\n",
@@ -2814,8 +2814,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
28142814
switch (r10_sync_page_io(rdev,
28152815
r10_bio->devs[sl].addr +
28162816
sect,
2817-
s, conf->tmppage,
2818-
READ)) {
2817+
s, conf->tmppage, REQ_OP_READ)) {
28192818
case 0:
28202819
/* Well, this device is dead */
28212820
pr_notice("md/raid10:%s: unable to read back corrected sectors (%d sectors at %llu on %pg)\n",

0 commit comments

Comments
 (0)