aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2011-05-22 12:52:03 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-05-29 13:53:51 -0400
commitd20581aa4be11407c9eeeb75992df5ef176bba0f (patch)
tree277fdff5bc6ad5a5df105abd092c7179d22554fb /fs
parente51b841dd0be9ff53f740c44c32c32679edcb7c8 (diff)
pnfs: support for non-rpc layout drivers
Non-rpc layout driver such as for objects and blocks implement their own I/O path and error handling logic. Therefore bypass NFS-based error handling for these layout drivers. [fix lseg ref-count bugs, and null de-refs] [Fall out from: non-rpc layout drivers] Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> [get rid of PNFS_USE_RPC_CODE] [get rid of __nfs4_write_done_cb] [revert useless change in nfs4_write_done_cb] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/internal.h1
-rw-r--r--fs/nfs/nfs4proc.c13
-rw-r--r--fs/nfs/pnfs.c48
-rw-r--r--fs/nfs/pnfs.h2
4 files changed, 60 insertions, 4 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index ce118ce885dd..bcf0f0ff5eeb 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -310,6 +310,7 @@ extern int nfs_migrate_page(struct address_space *,
310#endif 310#endif
311 311
312/* nfs4proc.c */ 312/* nfs4proc.c */
313extern void __nfs4_read_done_cb(struct nfs_read_data *);
313extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data); 314extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data);
314extern int nfs4_init_client(struct nfs_client *clp, 315extern int nfs4_init_client(struct nfs_client *clp,
315 const struct rpc_timeout *timeparms, 316 const struct rpc_timeout *timeparms,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index cf1b339c3937..92c8bc4b5f97 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3175,6 +3175,11 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
3175 return err; 3175 return err;
3176} 3176}
3177 3177
3178void __nfs4_read_done_cb(struct nfs_read_data *data)
3179{
3180 nfs_invalidate_atime(data->inode);
3181}
3182
3178static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data) 3183static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data)
3179{ 3184{
3180 struct nfs_server *server = NFS_SERVER(data->inode); 3185 struct nfs_server *server = NFS_SERVER(data->inode);
@@ -3184,7 +3189,7 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data)
3184 return -EAGAIN; 3189 return -EAGAIN;
3185 } 3190 }
3186 3191
3187 nfs_invalidate_atime(data->inode); 3192 __nfs4_read_done_cb(data);
3188 if (task->tk_status > 0) 3193 if (task->tk_status > 0)
3189 renew_lease(server, data->timestamp); 3194 renew_lease(server, data->timestamp);
3190 return 0; 3195 return 0;
@@ -3198,7 +3203,8 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
3198 if (!nfs4_sequence_done(task, &data->res.seq_res)) 3203 if (!nfs4_sequence_done(task, &data->res.seq_res))
3199 return -EAGAIN; 3204 return -EAGAIN;
3200 3205
3201 return data->read_done_cb(task, data); 3206 return data->read_done_cb ? data->read_done_cb(task, data) :
3207 nfs4_read_done_cb(task, data);
3202} 3208}
3203 3209
3204static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg) 3210static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg)
@@ -3243,7 +3249,8 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
3243{ 3249{
3244 if (!nfs4_sequence_done(task, &data->res.seq_res)) 3250 if (!nfs4_sequence_done(task, &data->res.seq_res))
3245 return -EAGAIN; 3251 return -EAGAIN;
3246 return data->write_done_cb(task, data); 3252 return data->write_done_cb ? data->write_done_cb(task, data) :
3253 nfs4_write_done_cb(task, data);
3247} 3254}
3248 3255
3249/* Reset the the nfs_write_data to send the write to the MDS. */ 3256/* Reset the the nfs_write_data to send the write to the MDS. */
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ef535f2a2c74..171662114fdd 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -243,7 +243,7 @@ put_lseg_common(struct pnfs_layout_segment *lseg)
243{ 243{
244 struct inode *inode = lseg->pls_layout->plh_inode; 244 struct inode *inode = lseg->pls_layout->plh_inode;
245 245
246 BUG_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); 246 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
247 list_del_init(&lseg->pls_list); 247 list_del_init(&lseg->pls_list);
248 if (list_empty(&lseg->pls_layout->plh_segs)) { 248 if (list_empty(&lseg->pls_layout->plh_segs)) {
249 set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags); 249 set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags);
@@ -1054,6 +1054,29 @@ pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode)
1054 pgio->pg_test = (ld && ld->pg_test) ? pnfs_write_pg_test : NULL; 1054 pgio->pg_test = (ld && ld->pg_test) ? pnfs_write_pg_test : NULL;
1055} 1055}
1056 1056
1057/*
1058 * Called by non rpc-based layout drivers
1059 */
1060int
1061pnfs_ld_write_done(struct nfs_write_data *data)
1062{
1063 int status;
1064
1065 if (!data->pnfs_error) {
1066 pnfs_set_layoutcommit(data);
1067 data->mds_ops->rpc_call_done(&data->task, data);
1068 data->mds_ops->rpc_release(data);
1069 return 0;
1070 }
1071
1072 dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
1073 data->pnfs_error);
1074 status = nfs_initiate_write(data, NFS_CLIENT(data->inode),
1075 data->mds_ops, NFS_FILE_SYNC);
1076 return status ? : -EAGAIN;
1077}
1078EXPORT_SYMBOL_GPL(pnfs_ld_write_done);
1079
1057enum pnfs_try_status 1080enum pnfs_try_status
1058pnfs_try_to_write_data(struct nfs_write_data *wdata, 1081pnfs_try_to_write_data(struct nfs_write_data *wdata,
1059 const struct rpc_call_ops *call_ops, int how) 1082 const struct rpc_call_ops *call_ops, int how)
@@ -1079,6 +1102,29 @@ pnfs_try_to_write_data(struct nfs_write_data *wdata,
1079} 1102}
1080 1103
1081/* 1104/*
1105 * Called by non rpc-based layout drivers
1106 */
1107int
1108pnfs_ld_read_done(struct nfs_read_data *data)
1109{
1110 int status;
1111
1112 if (!data->pnfs_error) {
1113 __nfs4_read_done_cb(data);
1114 data->mds_ops->rpc_call_done(&data->task, data);
1115 data->mds_ops->rpc_release(data);
1116 return 0;
1117 }
1118
1119 dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
1120 data->pnfs_error);
1121 status = nfs_initiate_read(data, NFS_CLIENT(data->inode),
1122 data->mds_ops);
1123 return status ? : -EAGAIN;
1124}
1125EXPORT_SYMBOL_GPL(pnfs_ld_read_done);
1126
1127/*
1082 * Call the appropriate parallel I/O subsystem read function. 1128 * Call the appropriate parallel I/O subsystem read function.
1083 */ 1129 */
1084enum pnfs_try_status 1130enum pnfs_try_status
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 925d6ef8ba79..0383e66e71f0 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -165,6 +165,8 @@ void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);
165bool pnfs_roc_drain(struct inode *ino, u32 *barrier); 165bool pnfs_roc_drain(struct inode *ino, u32 *barrier);
166void pnfs_set_layoutcommit(struct nfs_write_data *wdata); 166void pnfs_set_layoutcommit(struct nfs_write_data *wdata);
167int pnfs_layoutcommit_inode(struct inode *inode, bool sync); 167int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
168int pnfs_ld_write_done(struct nfs_write_data *);
169int pnfs_ld_read_done(struct nfs_read_data *);
168 170
169/* pnfs_dev.c */ 171/* pnfs_dev.c */
170struct nfs4_deviceid_node { 172struct nfs4_deviceid_node {