aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorPeng Tao <tao.peng@primarydata.com>2014-11-09 19:35:38 -0500
committerTom Haynes <loghyr@primarydata.com>2015-02-03 14:06:48 -0500
commitceb11e13df3e78b450730c615037133c57b90c3b (patch)
treef9b179f9226e9b38c31373c6a2983f7599367da7 /fs/nfs
parent48d635f14a544c2b3ca870d2c7349b41160496d2 (diff)
pnfs: allow LD to ask to resend read through pnfs
If current IO cannot be completed due to some transient errors, LD may want to ask generic layer to resend the request through pnfs again. Signed-off-by: Peng Tao <tao.peng@primarydata.com> Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c15
-rw-r--r--fs/nfs/pnfs.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index b822b1749643..685af4fb39ca 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1880,15 +1880,28 @@ pnfs_try_to_read_data(struct nfs_pgio_header *hdr,
1880 return trypnfs; 1880 return trypnfs;
1881} 1881}
1882 1882
1883/* Resend all requests through pnfs. */
1884int pnfs_read_resend_pnfs(struct nfs_pgio_header *hdr)
1885{
1886 struct nfs_pageio_descriptor pgio;
1887
1888 nfs_pageio_init_read(&pgio, hdr->inode, false, hdr->completion_ops);
1889 return nfs_pageio_resend(&pgio, hdr);
1890}
1891EXPORT_SYMBOL_GPL(pnfs_read_resend_pnfs);
1892
1883static void 1893static void
1884pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) 1894pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr)
1885{ 1895{
1886 const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; 1896 const struct rpc_call_ops *call_ops = desc->pg_rpc_callops;
1887 struct pnfs_layout_segment *lseg = desc->pg_lseg; 1897 struct pnfs_layout_segment *lseg = desc->pg_lseg;
1888 enum pnfs_try_status trypnfs; 1898 enum pnfs_try_status trypnfs;
1899 int err = 0;
1889 1900
1890 trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg); 1901 trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg);
1891 if (trypnfs == PNFS_NOT_ATTEMPTED) 1902 if (trypnfs == PNFS_TRY_AGAIN)
1903 err = pnfs_read_resend_pnfs(hdr);
1904 if (trypnfs == PNFS_NOT_ATTEMPTED || err)
1892 pnfs_read_through_mds(desc, hdr); 1905 pnfs_read_through_mds(desc, hdr);
1893} 1906}
1894 1907
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index a0ab81cc9cf3..84c25cd476f8 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -72,6 +72,7 @@ struct pnfs_layout_segment {
72enum pnfs_try_status { 72enum pnfs_try_status {
73 PNFS_ATTEMPTED = 0, 73 PNFS_ATTEMPTED = 0,
74 PNFS_NOT_ATTEMPTED = 1, 74 PNFS_NOT_ATTEMPTED = 1,
75 PNFS_TRY_AGAIN = 2,
75}; 76};
76 77
77#ifdef CONFIG_NFS_V4_1 78#ifdef CONFIG_NFS_V4_1
@@ -268,6 +269,7 @@ int _pnfs_return_layout(struct inode *);
268int pnfs_commit_and_return_layout(struct inode *); 269int pnfs_commit_and_return_layout(struct inode *);
269void pnfs_ld_write_done(struct nfs_pgio_header *); 270void pnfs_ld_write_done(struct nfs_pgio_header *);
270void pnfs_ld_read_done(struct nfs_pgio_header *); 271void pnfs_ld_read_done(struct nfs_pgio_header *);
272int pnfs_read_resend_pnfs(struct nfs_pgio_header *);
271struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, 273struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
272 struct nfs_open_context *ctx, 274 struct nfs_open_context *ctx,
273 loff_t pos, 275 loff_t pos,