diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 13 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 48 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 2 |
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 */ |
313 | extern void __nfs4_read_done_cb(struct nfs_read_data *); | ||
313 | extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data); | 314 | extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data); |
314 | extern int nfs4_init_client(struct nfs_client *clp, | 315 | extern 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 | ||
3178 | void __nfs4_read_done_cb(struct nfs_read_data *data) | ||
3179 | { | ||
3180 | nfs_invalidate_atime(data->inode); | ||
3181 | } | ||
3182 | |||
3178 | static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data) | 3183 | static 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 | ||
3204 | static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg) | 3210 | static 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 | */ | ||
1060 | int | ||
1061 | pnfs_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 | } | ||
1078 | EXPORT_SYMBOL_GPL(pnfs_ld_write_done); | ||
1079 | |||
1057 | enum pnfs_try_status | 1080 | enum pnfs_try_status |
1058 | pnfs_try_to_write_data(struct nfs_write_data *wdata, | 1081 | pnfs_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 | */ | ||
1107 | int | ||
1108 | pnfs_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 | } | ||
1125 | EXPORT_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 | */ |
1084 | enum pnfs_try_status | 1130 | enum 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); | |||
165 | bool pnfs_roc_drain(struct inode *ino, u32 *barrier); | 165 | bool pnfs_roc_drain(struct inode *ino, u32 *barrier); |
166 | void pnfs_set_layoutcommit(struct nfs_write_data *wdata); | 166 | void pnfs_set_layoutcommit(struct nfs_write_data *wdata); |
167 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); | 167 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); |
168 | int pnfs_ld_write_done(struct nfs_write_data *); | ||
169 | int pnfs_ld_read_done(struct nfs_read_data *); | ||
168 | 170 | ||
169 | /* pnfs_dev.c */ | 171 | /* pnfs_dev.c */ |
170 | struct nfs4_deviceid_node { | 172 | struct nfs4_deviceid_node { |