diff options
author | Mike Snitzer <snitzer@redhat.com> | 2020-06-10 22:51:32 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2020-07-13 17:47:32 +0200 |
commit | 73265f3ffdc90f0e27b79fbcba8530c75c74ef12 (patch) | |
tree | 7afcb4c305f93e67a04e04a4f730bd53db4008b0 /drivers/md/dm-mpath.c | |
parent | dm mpath: take m->lock spinlock when testing QUEUE_IF_NO_PATH (diff) | |
download | linux-73265f3ffdc90f0e27b79fbcba8530c75c74ef12.tar.xz linux-73265f3ffdc90f0e27b79fbcba8530c75c74ef12.zip |
dm mpath: push locking down to must_push_back_rq()
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r-- | drivers/md/dm-mpath.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index bf5175805b1d..87b6a2c98c73 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -472,7 +472,14 @@ static bool __must_push_back(struct multipath *m) static bool must_push_back_rq(struct multipath *m) { - return test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags) || __must_push_back(m); + unsigned long flags; + bool ret; + + spin_lock_irqsave(&m->lock, flags); + ret = (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags) || __must_push_back(m)); + spin_unlock_irqrestore(&m->lock, flags); + + return ret; } /* @@ -1621,16 +1628,12 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone, if (pgpath) fail_path(pgpath); - if (!atomic_read(&m->nr_valid_paths)) { - unsigned long flags; - spin_lock_irqsave(&m->lock, flags); - if (!must_push_back_rq(m)) { - if (error == BLK_STS_IOERR) - dm_report_EIO(m); - /* complete with the original error */ - r = DM_ENDIO_DONE; - } - spin_unlock_irqrestore(&m->lock, flags); + if (!atomic_read(&m->nr_valid_paths) && + !must_push_back_rq(m)) { + if (error == BLK_STS_IOERR) + dm_report_EIO(m); + /* complete with the original error */ + r = DM_ENDIO_DONE; } } |