diff options
author | Andy Adamson <andros@netapp.com> | 2011-02-28 20:34:20 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-11 15:38:43 -0500 |
commit | cbdabc7f8bf14ca1d40ab1cb86f64b3bc09716e8 (patch) | |
tree | 16939b96996e8380d91d7e2743e811cf5c49f629 /fs/nfs/nfs4proc.c | |
parent | dc70d7b3189597f313df7bd2da849cfc39063b15 (diff) |
NFSv4.1: filelayout async error handler
Use our own async error handler.
Mark the layout as failed and retry i/o through the MDS on specified errors.
Update the mds_offset in nfs_readpage_retry so that a failed short-read retry
to a DS gets correctly resent through the MDS.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d09623933302..1dc809039448 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3074,15 +3074,10 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
3074 | return err; | 3074 | return err; |
3075 | } | 3075 | } |
3076 | 3076 | ||
3077 | static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) | 3077 | static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data) |
3078 | { | 3078 | { |
3079 | struct nfs_server *server = NFS_SERVER(data->inode); | 3079 | struct nfs_server *server = NFS_SERVER(data->inode); |
3080 | 3080 | ||
3081 | dprintk("--> %s\n", __func__); | ||
3082 | |||
3083 | if (!nfs4_sequence_done(task, &data->res.seq_res)) | ||
3084 | return -EAGAIN; | ||
3085 | |||
3086 | if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { | 3081 | if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { |
3087 | nfs_restart_rpc(task, server->nfs_client); | 3082 | nfs_restart_rpc(task, server->nfs_client); |
3088 | return -EAGAIN; | 3083 | return -EAGAIN; |
@@ -3094,12 +3089,40 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) | |||
3094 | return 0; | 3089 | return 0; |
3095 | } | 3090 | } |
3096 | 3091 | ||
3092 | static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) | ||
3093 | { | ||
3094 | |||
3095 | dprintk("--> %s\n", __func__); | ||
3096 | |||
3097 | if (!nfs4_sequence_done(task, &data->res.seq_res)) | ||
3098 | return -EAGAIN; | ||
3099 | |||
3100 | return data->read_done_cb(task, data); | ||
3101 | } | ||
3102 | |||
3097 | static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg) | 3103 | static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg) |
3098 | { | 3104 | { |
3099 | data->timestamp = jiffies; | 3105 | data->timestamp = jiffies; |
3106 | data->read_done_cb = nfs4_read_done_cb; | ||
3100 | msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ]; | 3107 | msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ]; |
3101 | } | 3108 | } |
3102 | 3109 | ||
3110 | /* Reset the the nfs_read_data to send the read to the MDS. */ | ||
3111 | void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data) | ||
3112 | { | ||
3113 | dprintk("%s Reset task for i/o through\n", __func__); | ||
3114 | put_lseg(data->lseg); | ||
3115 | data->lseg = NULL; | ||
3116 | /* offsets will differ in the dense stripe case */ | ||
3117 | data->args.offset = data->mds_offset; | ||
3118 | data->ds_clp = NULL; | ||
3119 | data->args.fh = NFS_FH(data->inode); | ||
3120 | data->read_done_cb = nfs4_read_done_cb; | ||
3121 | task->tk_ops = data->mds_ops; | ||
3122 | rpc_task_reset_client(task, NFS_CLIENT(data->inode)); | ||
3123 | } | ||
3124 | EXPORT_SYMBOL_GPL(nfs4_reset_read); | ||
3125 | |||
3103 | static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) | 3126 | static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) |
3104 | { | 3127 | { |
3105 | struct inode *inode = data->inode; | 3128 | struct inode *inode = data->inode; |