Skip to content

Commit 73265f3

Browse files
committed
dm mpath: push locking down to must_push_back_rq()
Signed-off-by: Mike Snitzer <[email protected]>
1 parent a271a89 commit 73265f3

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

drivers/md/dm-mpath.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,14 @@ static bool __must_push_back(struct multipath *m)
472472

473473
static bool must_push_back_rq(struct multipath *m)
474474
{
475-
return test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags) || __must_push_back(m);
475+
unsigned long flags;
476+
bool ret;
477+
478+
spin_lock_irqsave(&m->lock, flags);
479+
ret = (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags) || __must_push_back(m));
480+
spin_unlock_irqrestore(&m->lock, flags);
481+
482+
return ret;
476483
}
477484

478485
/*
@@ -1621,16 +1628,12 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
16211628
if (pgpath)
16221629
fail_path(pgpath);
16231630

1624-
if (!atomic_read(&m->nr_valid_paths)) {
1625-
unsigned long flags;
1626-
spin_lock_irqsave(&m->lock, flags);
1627-
if (!must_push_back_rq(m)) {
1628-
if (error == BLK_STS_IOERR)
1629-
dm_report_EIO(m);
1630-
/* complete with the original error */
1631-
r = DM_ENDIO_DONE;
1632-
}
1633-
spin_unlock_irqrestore(&m->lock, flags);
1631+
if (!atomic_read(&m->nr_valid_paths) &&
1632+
!must_push_back_rq(m)) {
1633+
if (error == BLK_STS_IOERR)
1634+
dm_report_EIO(m);
1635+
/* complete with the original error */
1636+
r = DM_ENDIO_DONE;
16341637
}
16351638
}
16361639

0 commit comments

Comments
 (0)