diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-22 15:32:00 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 14:32:41 -0500 |
commit | 4d0ac22109740c36174c5aac630876b2af0f6943 (patch) | |
tree | 991f5605fcf9b6893efd2cb309c003e6e8b4ed48 /fs/nfs | |
parent | 37e9ed22b1552fa94ee7db2901a5e7d8bdf60b15 (diff) |
pNFS/flexfiles: Ensure we record layoutstats even if RPC is terminated early
Currently, we will only record the layoutstats correctly if the
RPC call successfully obtains a slot. If we exit before that
happens, then we may find ourselves starting the busy timer through
the call in ff_layout_(read|write)_prepare_layoutstats, but never stopping it.
The same thing happens if we're doing DA-DS.
The fix is to ensure that we catch these cases in the rpc_release()
callback.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 9257679a15ba..2981cd190bfd 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c | |||
@@ -1397,6 +1397,15 @@ static void ff_layout_read_count_stats(struct rpc_task *task, void *data) | |||
1397 | &NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_READ]); | 1397 | &NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_READ]); |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | static void ff_layout_read_release(void *data) | ||
1401 | { | ||
1402 | struct nfs_pgio_header *hdr = data; | ||
1403 | |||
1404 | ff_layout_read_record_layoutstats_done(&hdr->task, hdr); | ||
1405 | pnfs_generic_rw_release(data); | ||
1406 | } | ||
1407 | |||
1408 | |||
1400 | static int ff_layout_write_done_cb(struct rpc_task *task, | 1409 | static int ff_layout_write_done_cb(struct rpc_task *task, |
1401 | struct nfs_pgio_header *hdr) | 1410 | struct nfs_pgio_header *hdr) |
1402 | { | 1411 | { |
@@ -1564,6 +1573,14 @@ static void ff_layout_write_count_stats(struct rpc_task *task, void *data) | |||
1564 | &NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_WRITE]); | 1573 | &NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_WRITE]); |
1565 | } | 1574 | } |
1566 | 1575 | ||
1576 | static void ff_layout_write_release(void *data) | ||
1577 | { | ||
1578 | struct nfs_pgio_header *hdr = data; | ||
1579 | |||
1580 | ff_layout_write_record_layoutstats_done(&hdr->task, hdr); | ||
1581 | pnfs_generic_rw_release(data); | ||
1582 | } | ||
1583 | |||
1567 | static void ff_layout_commit_record_layoutstats_start(struct rpc_task *task, | 1584 | static void ff_layout_commit_record_layoutstats_start(struct rpc_task *task, |
1568 | struct nfs_commit_data *cdata) | 1585 | struct nfs_commit_data *cdata) |
1569 | { | 1586 | { |
@@ -1630,46 +1647,54 @@ static void ff_layout_commit_count_stats(struct rpc_task *task, void *data) | |||
1630 | &NFS_CLIENT(cdata->inode)->cl_metrics[NFSPROC4_CLNT_COMMIT]); | 1647 | &NFS_CLIENT(cdata->inode)->cl_metrics[NFSPROC4_CLNT_COMMIT]); |
1631 | } | 1648 | } |
1632 | 1649 | ||
1650 | static void ff_layout_commit_release(void *data) | ||
1651 | { | ||
1652 | struct nfs_commit_data *cdata = data; | ||
1653 | |||
1654 | ff_layout_commit_record_layoutstats_done(&cdata->task, cdata); | ||
1655 | pnfs_generic_commit_release(data); | ||
1656 | } | ||
1657 | |||
1633 | static const struct rpc_call_ops ff_layout_read_call_ops_v3 = { | 1658 | static const struct rpc_call_ops ff_layout_read_call_ops_v3 = { |
1634 | .rpc_call_prepare = ff_layout_read_prepare_v3, | 1659 | .rpc_call_prepare = ff_layout_read_prepare_v3, |
1635 | .rpc_call_done = ff_layout_read_call_done, | 1660 | .rpc_call_done = ff_layout_read_call_done, |
1636 | .rpc_count_stats = ff_layout_read_count_stats, | 1661 | .rpc_count_stats = ff_layout_read_count_stats, |
1637 | .rpc_release = pnfs_generic_rw_release, | 1662 | .rpc_release = ff_layout_read_release, |
1638 | }; | 1663 | }; |
1639 | 1664 | ||
1640 | static const struct rpc_call_ops ff_layout_read_call_ops_v4 = { | 1665 | static const struct rpc_call_ops ff_layout_read_call_ops_v4 = { |
1641 | .rpc_call_prepare = ff_layout_read_prepare_v4, | 1666 | .rpc_call_prepare = ff_layout_read_prepare_v4, |
1642 | .rpc_call_done = ff_layout_read_call_done, | 1667 | .rpc_call_done = ff_layout_read_call_done, |
1643 | .rpc_count_stats = ff_layout_read_count_stats, | 1668 | .rpc_count_stats = ff_layout_read_count_stats, |
1644 | .rpc_release = pnfs_generic_rw_release, | 1669 | .rpc_release = ff_layout_read_release, |
1645 | }; | 1670 | }; |
1646 | 1671 | ||
1647 | static const struct rpc_call_ops ff_layout_write_call_ops_v3 = { | 1672 | static const struct rpc_call_ops ff_layout_write_call_ops_v3 = { |
1648 | .rpc_call_prepare = ff_layout_write_prepare_v3, | 1673 | .rpc_call_prepare = ff_layout_write_prepare_v3, |
1649 | .rpc_call_done = ff_layout_write_call_done, | 1674 | .rpc_call_done = ff_layout_write_call_done, |
1650 | .rpc_count_stats = ff_layout_write_count_stats, | 1675 | .rpc_count_stats = ff_layout_write_count_stats, |
1651 | .rpc_release = pnfs_generic_rw_release, | 1676 | .rpc_release = ff_layout_write_release, |
1652 | }; | 1677 | }; |
1653 | 1678 | ||
1654 | static const struct rpc_call_ops ff_layout_write_call_ops_v4 = { | 1679 | static const struct rpc_call_ops ff_layout_write_call_ops_v4 = { |
1655 | .rpc_call_prepare = ff_layout_write_prepare_v4, | 1680 | .rpc_call_prepare = ff_layout_write_prepare_v4, |
1656 | .rpc_call_done = ff_layout_write_call_done, | 1681 | .rpc_call_done = ff_layout_write_call_done, |
1657 | .rpc_count_stats = ff_layout_write_count_stats, | 1682 | .rpc_count_stats = ff_layout_write_count_stats, |
1658 | .rpc_release = pnfs_generic_rw_release, | 1683 | .rpc_release = ff_layout_write_release, |
1659 | }; | 1684 | }; |
1660 | 1685 | ||
1661 | static const struct rpc_call_ops ff_layout_commit_call_ops_v3 = { | 1686 | static const struct rpc_call_ops ff_layout_commit_call_ops_v3 = { |
1662 | .rpc_call_prepare = ff_layout_commit_prepare_v3, | 1687 | .rpc_call_prepare = ff_layout_commit_prepare_v3, |
1663 | .rpc_call_done = ff_layout_commit_done, | 1688 | .rpc_call_done = ff_layout_commit_done, |
1664 | .rpc_count_stats = ff_layout_commit_count_stats, | 1689 | .rpc_count_stats = ff_layout_commit_count_stats, |
1665 | .rpc_release = pnfs_generic_commit_release, | 1690 | .rpc_release = ff_layout_commit_release, |
1666 | }; | 1691 | }; |
1667 | 1692 | ||
1668 | static const struct rpc_call_ops ff_layout_commit_call_ops_v4 = { | 1693 | static const struct rpc_call_ops ff_layout_commit_call_ops_v4 = { |
1669 | .rpc_call_prepare = ff_layout_commit_prepare_v4, | 1694 | .rpc_call_prepare = ff_layout_commit_prepare_v4, |
1670 | .rpc_call_done = ff_layout_commit_done, | 1695 | .rpc_call_done = ff_layout_commit_done, |
1671 | .rpc_count_stats = ff_layout_commit_count_stats, | 1696 | .rpc_count_stats = ff_layout_commit_count_stats, |
1672 | .rpc_release = pnfs_generic_commit_release, | 1697 | .rpc_release = ff_layout_commit_release, |
1673 | }; | 1698 | }; |
1674 | 1699 | ||
1675 | static enum pnfs_try_status | 1700 | static enum pnfs_try_status |