aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2012-04-27 17:53:43 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-19 17:54:19 -0400
commit90fecfcb3437dfc9bec4ee3306584dcd6843701b (patch)
treef03e089985c35c396d6705777ce9632a41d55c88 /fs
parent554d458d79fa34acc73bc5128ba7bbf6b3007dfd (diff)
NFSv4.1 cleanup filelayout invalid layout handling
The invalid layout bits are should only be used to block LAYOUTGETs. Do not invalidate a layout on deviceid invalidation. Do not invalidate a layout on un-handled READ, WRITE, COMMIT errors. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4filelayout.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index eebec9a7641a..b9edc8870561 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -148,7 +148,6 @@ wait_on_recovery:
148static int filelayout_read_done_cb(struct rpc_task *task, 148static int filelayout_read_done_cb(struct rpc_task *task,
149 struct nfs_read_data *data) 149 struct nfs_read_data *data)
150{ 150{
151 struct nfs_pgio_header *hdr = data->header;
152 int reset = 0; 151 int reset = 0;
153 152
154 dprintk("%s DS read\n", __func__); 153 dprintk("%s DS read\n", __func__);
@@ -157,10 +156,8 @@ static int filelayout_read_done_cb(struct rpc_task *task,
157 data->ds_clp, &reset) == -EAGAIN) { 156 data->ds_clp, &reset) == -EAGAIN) {
158 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n", 157 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
159 __func__, data->ds_clp, data->ds_clp->cl_session); 158 __func__, data->ds_clp, data->ds_clp->cl_session);
160 if (reset) { 159 if (reset)
161 pnfs_set_lo_fail(hdr->lseg);
162 nfs4_reset_read(task, data); 160 nfs4_reset_read(task, data);
163 }
164 rpc_restart_call_prepare(task); 161 rpc_restart_call_prepare(task);
165 return -EAGAIN; 162 return -EAGAIN;
166 } 163 }
@@ -233,17 +230,14 @@ static void filelayout_read_release(void *data)
233static int filelayout_write_done_cb(struct rpc_task *task, 230static int filelayout_write_done_cb(struct rpc_task *task,
234 struct nfs_write_data *data) 231 struct nfs_write_data *data)
235{ 232{
236 struct nfs_pgio_header *hdr = data->header;
237 int reset = 0; 233 int reset = 0;
238 234
239 if (filelayout_async_handle_error(task, data->args.context->state, 235 if (filelayout_async_handle_error(task, data->args.context->state,
240 data->ds_clp, &reset) == -EAGAIN) { 236 data->ds_clp, &reset) == -EAGAIN) {
241 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n", 237 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
242 __func__, data->ds_clp, data->ds_clp->cl_session); 238 __func__, data->ds_clp, data->ds_clp->cl_session);
243 if (reset) { 239 if (reset)
244 pnfs_set_lo_fail(hdr->lseg);
245 nfs4_reset_write(task, data); 240 nfs4_reset_write(task, data);
246 }
247 rpc_restart_call_prepare(task); 241 rpc_restart_call_prepare(task);
248 return -EAGAIN; 242 return -EAGAIN;
249 } 243 }
@@ -272,10 +266,9 @@ static int filelayout_commit_done_cb(struct rpc_task *task,
272 data->ds_clp, &reset) == -EAGAIN) { 266 data->ds_clp, &reset) == -EAGAIN) {
273 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n", 267 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
274 __func__, data->ds_clp, data->ds_clp->cl_session); 268 __func__, data->ds_clp, data->ds_clp->cl_session);
275 if (reset) { 269 if (reset)
276 prepare_to_resend_writes(data); 270 prepare_to_resend_writes(data);
277 pnfs_set_lo_fail(data->lseg); 271 else
278 } else
279 rpc_restart_call_prepare(task); 272 rpc_restart_call_prepare(task);
280 return -EAGAIN; 273 return -EAGAIN;
281 } 274 }
@@ -393,12 +386,8 @@ filelayout_read_pagelist(struct nfs_read_data *data)
393 j = nfs4_fl_calc_j_index(lseg, offset); 386 j = nfs4_fl_calc_j_index(lseg, offset);
394 idx = nfs4_fl_calc_ds_index(lseg, j); 387 idx = nfs4_fl_calc_ds_index(lseg, j);
395 ds = nfs4_fl_prepare_ds(lseg, idx); 388 ds = nfs4_fl_prepare_ds(lseg, idx);
396 if (!ds) { 389 if (!ds)
397 /* Either layout fh index faulty, or ds connect failed */
398 set_bit(lo_fail_bit(IOMODE_RW), &lseg->pls_layout->plh_flags);
399 set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
400 return PNFS_NOT_ATTEMPTED; 390 return PNFS_NOT_ATTEMPTED;
401 }
402 dprintk("%s USE DS: %s\n", __func__, ds->ds_remotestr); 391 dprintk("%s USE DS: %s\n", __func__, ds->ds_remotestr);
403 392
404 /* No multipath support. Use first DS */ 393 /* No multipath support. Use first DS */
@@ -433,11 +422,8 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)
433 j = nfs4_fl_calc_j_index(lseg, offset); 422 j = nfs4_fl_calc_j_index(lseg, offset);
434 idx = nfs4_fl_calc_ds_index(lseg, j); 423 idx = nfs4_fl_calc_ds_index(lseg, j);
435 ds = nfs4_fl_prepare_ds(lseg, idx); 424 ds = nfs4_fl_prepare_ds(lseg, idx);
436 if (!ds) { 425 if (!ds)
437 set_bit(lo_fail_bit(IOMODE_RW), &lseg->pls_layout->plh_flags);
438 set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
439 return PNFS_NOT_ATTEMPTED; 426 return PNFS_NOT_ATTEMPTED;
440 }
441 dprintk("%s ino %lu sync %d req %Zu@%llu DS: %s\n", __func__, 427 dprintk("%s ino %lu sync %d req %Zu@%llu DS: %s\n", __func__,
442 hdr->inode->i_ino, sync, (size_t) data->args.count, offset, 428 hdr->inode->i_ino, sync, (size_t) data->args.count, offset,
443 ds->ds_remotestr); 429 ds->ds_remotestr);
@@ -969,8 +955,6 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how)
969 idx = calc_ds_index_from_commit(lseg, data->ds_commit_index); 955 idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
970 ds = nfs4_fl_prepare_ds(lseg, idx); 956 ds = nfs4_fl_prepare_ds(lseg, idx);
971 if (!ds) { 957 if (!ds) {
972 set_bit(lo_fail_bit(IOMODE_RW), &lseg->pls_layout->plh_flags);
973 set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
974 prepare_to_resend_writes(data); 958 prepare_to_resend_writes(data);
975 filelayout_commit_release(data); 959 filelayout_commit_release(data);
976 return -EAGAIN; 960 return -EAGAIN;