dm-mpath.c (69cea0d45a618ad4ae74f36386ef1af5128b2b19) | dm-mpath.c (a271a89c6e4773478b1c4f8213dfe8351ea66723) |
---|---|
1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 1607 unchanged lines hidden (view full) --- 1616 if (error == BLK_STS_RESOURCE) 1617 r = DM_ENDIO_DELAY_REQUEUE; 1618 else 1619 r = DM_ENDIO_REQUEUE; 1620 1621 if (pgpath) 1622 fail_path(pgpath); 1623 | 1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 1607 unchanged lines hidden (view full) --- 1616 if (error == BLK_STS_RESOURCE) 1617 r = DM_ENDIO_DELAY_REQUEUE; 1618 else 1619 r = DM_ENDIO_REQUEUE; 1620 1621 if (pgpath) 1622 fail_path(pgpath); 1623 |
1624 if (atomic_read(&m->nr_valid_paths) == 0 && 1625 !must_push_back_rq(m)) { 1626 if (error == BLK_STS_IOERR) 1627 dm_report_EIO(m); 1628 /* complete with the original error */ 1629 r = DM_ENDIO_DONE; | 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); |
1630 } 1631 } 1632 1633 if (pgpath) { 1634 struct path_selector *ps = &pgpath->pg->ps; 1635 1636 if (ps->type->end_io) 1637 ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes, --- 13 unchanged lines hidden (view full) --- 1651 int r = DM_ENDIO_DONE; 1652 1653 if (!*error || !blk_path_error(*error)) 1654 goto done; 1655 1656 if (pgpath) 1657 fail_path(pgpath); 1658 | 1634 } 1635 } 1636 1637 if (pgpath) { 1638 struct path_selector *ps = &pgpath->pg->ps; 1639 1640 if (ps->type->end_io) 1641 ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes, --- 13 unchanged lines hidden (view full) --- 1655 int r = DM_ENDIO_DONE; 1656 1657 if (!*error || !blk_path_error(*error)) 1658 goto done; 1659 1660 if (pgpath) 1661 fail_path(pgpath); 1662 |
1659 if (atomic_read(&m->nr_valid_paths) == 0 && 1660 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { 1661 if (__must_push_back(m)) { 1662 r = DM_ENDIO_REQUEUE; 1663 } else { 1664 dm_report_EIO(m); 1665 *error = BLK_STS_IOERR; | 1663 if (!atomic_read(&m->nr_valid_paths)) { 1664 spin_lock_irqsave(&m->lock, flags); 1665 if (!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { 1666 if (__must_push_back(m)) { 1667 r = DM_ENDIO_REQUEUE; 1668 } else { 1669 dm_report_EIO(m); 1670 *error = BLK_STS_IOERR; 1671 } 1672 spin_unlock_irqrestore(&m->lock, flags); 1673 goto done; |
1666 } | 1674 } |
1667 goto done; | 1675 spin_unlock_irqrestore(&m->lock, flags); |
1668 } 1669 1670 spin_lock_irqsave(&m->lock, flags); 1671 bio_list_add(&m->queued_bios, clone); 1672 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) 1673 queue_work(kmultipathd, &m->process_queued_bios); 1674 spin_unlock_irqrestore(&m->lock, flags); 1675 --- 281 unchanged lines hidden (view full) --- 1957 *bdev = current_pgpath->path.dev->bdev; 1958 r = 0; 1959 } else { 1960 /* pg_init has not started or completed */ 1961 r = -ENOTCONN; 1962 } 1963 } else { 1964 /* No path is available */ | 1676 } 1677 1678 spin_lock_irqsave(&m->lock, flags); 1679 bio_list_add(&m->queued_bios, clone); 1680 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) 1681 queue_work(kmultipathd, &m->process_queued_bios); 1682 spin_unlock_irqrestore(&m->lock, flags); 1683 --- 281 unchanged lines hidden (view full) --- 1965 *bdev = current_pgpath->path.dev->bdev; 1966 r = 0; 1967 } else { 1968 /* pg_init has not started or completed */ 1969 r = -ENOTCONN; 1970 } 1971 } else { 1972 /* No path is available */ |
1973 r = -EIO; 1974 spin_lock_irqsave(&m->lock, flags); |
|
1965 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 1966 r = -ENOTCONN; | 1975 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 1976 r = -ENOTCONN; |
1967 else 1968 r = -EIO; | 1977 spin_unlock_irqrestore(&m->lock, flags); |
1969 } 1970 1971 if (r == -ENOTCONN) { 1972 if (!READ_ONCE(m->current_pg)) { 1973 /* Path status changed, redo selection */ 1974 (void) choose_pgpath(m, 0); 1975 } 1976 spin_lock_irqsave(&m->lock, flags); --- 54 unchanged lines hidden (view full) --- 2031 struct priority_group *pg, *next_pg; 2032 struct pgpath *pgpath; 2033 2034 /* pg_init in progress */ 2035 if (atomic_read(&m->pg_init_in_progress)) 2036 return true; 2037 2038 /* no paths available, for blk-mq: rely on IO mapping to delay requeue */ | 1978 } 1979 1980 if (r == -ENOTCONN) { 1981 if (!READ_ONCE(m->current_pg)) { 1982 /* Path status changed, redo selection */ 1983 (void) choose_pgpath(m, 0); 1984 } 1985 spin_lock_irqsave(&m->lock, flags); --- 54 unchanged lines hidden (view full) --- 2040 struct priority_group *pg, *next_pg; 2041 struct pgpath *pgpath; 2042 2043 /* pg_init in progress */ 2044 if (atomic_read(&m->pg_init_in_progress)) 2045 return true; 2046 2047 /* no paths available, for blk-mq: rely on IO mapping to delay requeue */ |
2039 if (!atomic_read(&m->nr_valid_paths) && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 2040 return (m->queue_mode != DM_TYPE_REQUEST_BASED); | 2048 if (!atomic_read(&m->nr_valid_paths)) { 2049 unsigned long flags; 2050 spin_lock_irqsave(&m->lock, flags); 2051 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { 2052 spin_unlock_irqrestore(&m->lock, flags); 2053 return (m->queue_mode != DM_TYPE_REQUEST_BASED); 2054 } 2055 spin_unlock_irqrestore(&m->lock, flags); 2056 } |
2041 2042 /* Guess which priority_group will be used at next mapping time */ 2043 pg = READ_ONCE(m->current_pg); 2044 next_pg = READ_ONCE(m->next_pg); 2045 if (unlikely(!READ_ONCE(m->current_pgpath) && next_pg)) 2046 pg = next_pg; 2047 2048 if (!pg) { --- 123 unchanged lines hidden --- | 2057 2058 /* Guess which priority_group will be used at next mapping time */ 2059 pg = READ_ONCE(m->current_pg); 2060 next_pg = READ_ONCE(m->next_pg); 2061 if (unlikely(!READ_ONCE(m->current_pgpath) && next_pg)) 2062 pg = next_pg; 2063 2064 if (!pg) { --- 123 unchanged lines hidden --- |