Commit 0722dc9f authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

pNFS/flexfiles: Record resend attempts on I/O failure

If the attempt to do pNFS fails, then record what action we
take to recover (resend, reset to pnfs or reset to mds).
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 118b6292
...@@ -1321,7 +1321,6 @@ static int ff_layout_read_done_cb(struct rpc_task *task, ...@@ -1321,7 +1321,6 @@ static int ff_layout_read_done_cb(struct rpc_task *task,
int new_idx = hdr->pgio_mirror_idx; int new_idx = hdr->pgio_mirror_idx;
int err; int err;
trace_nfs4_pnfs_read(hdr, task->tk_status);
if (task->tk_status < 0) if (task->tk_status < 0)
ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx,
hdr->args.offset, hdr->args.count, hdr->args.offset, hdr->args.count,
...@@ -1331,6 +1330,7 @@ static int ff_layout_read_done_cb(struct rpc_task *task, ...@@ -1331,6 +1330,7 @@ static int ff_layout_read_done_cb(struct rpc_task *task,
hdr->ds_clp, hdr->lseg, hdr->ds_clp, hdr->lseg,
hdr->pgio_mirror_idx); hdr->pgio_mirror_idx);
trace_nfs4_pnfs_read(hdr, err);
clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags);
clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags);
switch (err) { switch (err) {
...@@ -1494,7 +1494,6 @@ static int ff_layout_write_done_cb(struct rpc_task *task, ...@@ -1494,7 +1494,6 @@ static int ff_layout_write_done_cb(struct rpc_task *task,
loff_t end_offs = 0; loff_t end_offs = 0;
int err; int err;
trace_nfs4_pnfs_write(hdr, task->tk_status);
if (task->tk_status < 0) if (task->tk_status < 0)
ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx,
hdr->args.offset, hdr->args.count, hdr->args.offset, hdr->args.count,
...@@ -1504,6 +1503,7 @@ static int ff_layout_write_done_cb(struct rpc_task *task, ...@@ -1504,6 +1503,7 @@ static int ff_layout_write_done_cb(struct rpc_task *task,
hdr->ds_clp, hdr->lseg, hdr->ds_clp, hdr->lseg,
hdr->pgio_mirror_idx); hdr->pgio_mirror_idx);
trace_nfs4_pnfs_write(hdr, err);
clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags);
clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags);
switch (err) { switch (err) {
...@@ -1537,7 +1537,6 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, ...@@ -1537,7 +1537,6 @@ static int ff_layout_commit_done_cb(struct rpc_task *task,
{ {
int err; int err;
trace_nfs4_pnfs_commit_ds(data, task->tk_status);
if (task->tk_status < 0) if (task->tk_status < 0)
ff_layout_io_track_ds_error(data->lseg, data->ds_commit_index, ff_layout_io_track_ds_error(data->lseg, data->ds_commit_index,
data->args.offset, data->args.count, data->args.offset, data->args.count,
...@@ -1546,6 +1545,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, ...@@ -1546,6 +1545,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task,
err = ff_layout_async_handle_error(task, NULL, data->ds_clp, err = ff_layout_async_handle_error(task, NULL, data->ds_clp,
data->lseg, data->ds_commit_index); data->lseg, data->ds_commit_index);
trace_nfs4_pnfs_commit_ds(data, err);
switch (err) { switch (err) {
case -NFS4ERR_RESET_TO_PNFS: case -NFS4ERR_RESET_TO_PNFS:
pnfs_generic_prepare_to_resend_writes(data); pnfs_generic_prepare_to_resend_writes(data);
......
...@@ -155,6 +155,9 @@ TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED); ...@@ -155,6 +155,9 @@ TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED);
TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE); TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE);
TRACE_DEFINE_ENUM(NFS4ERR_XDEV); TRACE_DEFINE_ENUM(NFS4ERR_XDEV);
TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS);
TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS);
#define show_nfsv4_errors(error) \ #define show_nfsv4_errors(error) \
__print_symbolic(error, \ __print_symbolic(error, \
{ NFS4_OK, "OK" }, \ { NFS4_OK, "OK" }, \
...@@ -305,7 +308,10 @@ TRACE_DEFINE_ENUM(NFS4ERR_XDEV); ...@@ -305,7 +308,10 @@ TRACE_DEFINE_ENUM(NFS4ERR_XDEV);
{ NFS4ERR_WRONGSEC, "WRONGSEC" }, \ { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
{ NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \ { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
{ NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \ { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
{ NFS4ERR_XDEV, "XDEV" }) { NFS4ERR_XDEV, "XDEV" }, \
/* ***** Internal to Linux NFS client ***** */ \
{ NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \
{ NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" })
#define show_open_flags(flags) \ #define show_open_flags(flags) \
__print_flags(flags, "|", \ __print_flags(flags, "|", \
......
...@@ -79,6 +79,10 @@ enum pnfs_try_status { ...@@ -79,6 +79,10 @@ enum pnfs_try_status {
PNFS_TRY_AGAIN = 2, PNFS_TRY_AGAIN = 2,
}; };
/* error codes for internal use */
#define NFS4ERR_RESET_TO_MDS 12001
#define NFS4ERR_RESET_TO_PNFS 12002
#ifdef CONFIG_NFS_V4_1 #ifdef CONFIG_NFS_V4_1
#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" #define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
...@@ -91,10 +95,6 @@ enum pnfs_try_status { ...@@ -91,10 +95,6 @@ enum pnfs_try_status {
#define NFS4_DEF_DS_RETRANS 5 #define NFS4_DEF_DS_RETRANS 5
#define PNFS_DEVICE_RETRY_TIMEOUT (120*HZ) #define PNFS_DEVICE_RETRY_TIMEOUT (120*HZ)
/* error codes for internal use */
#define NFS4ERR_RESET_TO_MDS 12001
#define NFS4ERR_RESET_TO_PNFS 12002
enum { enum {
NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */
NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment