Skip to content

Commit

Permalink
NFSv4.1 set RPC_TASK_SOFTCONN for filelayout DS RPC calls
Browse files Browse the repository at this point in the history
RPC_TASK_SOFTCONN returns connection errors to the caller which allows the pNFS
file layout to quickly try the MDS or perhaps another DS.

Signed-off-by: Andy Adamson <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
androsadamson authored and Trond Myklebust committed May 19, 2012
1 parent 90fecfc commit 9f0ec17
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions fs/nfs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
const struct nfs_pgio_completion_ops *compl_ops);
extern int nfs_initiate_read(struct rpc_clnt *clnt,
struct nfs_read_data *data,
const struct rpc_call_ops *call_ops);
const struct rpc_call_ops *call_ops, int flags);
extern void nfs_read_prepare(struct rpc_task *task, void *calldata);
extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc,
struct nfs_pgio_header *hdr);
Expand All @@ -326,13 +326,13 @@ extern void nfs_commit_free(struct nfs_commit_data *p);
extern int nfs_initiate_write(struct rpc_clnt *clnt,
struct nfs_write_data *data,
const struct rpc_call_ops *call_ops,
int how);
int how, int flags);
extern void nfs_write_prepare(struct rpc_task *task, void *calldata);
extern void nfs_commit_prepare(struct rpc_task *task, void *calldata);
extern int nfs_initiate_commit(struct rpc_clnt *clnt,
struct nfs_commit_data *data,
const struct rpc_call_ops *call_ops,
int how);
int how, int flags);
extern void nfs_init_commit(struct nfs_commit_data *data,
struct list_head *head,
struct pnfs_layout_segment *lseg,
Expand Down
10 changes: 6 additions & 4 deletions fs/nfs/nfs4filelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ filelayout_read_pagelist(struct nfs_read_data *data)

/* Perform an asynchronous read to ds */
status = nfs_initiate_read(ds->ds_clp->cl_rpcclient, data,
&filelayout_read_call_ops);
&filelayout_read_call_ops, RPC_TASK_SOFTCONN);
BUG_ON(status != 0);
return PNFS_ATTEMPTED;
}
Expand Down Expand Up @@ -441,7 +441,8 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)

/* Perform an asynchronous write */
status = nfs_initiate_write(ds->ds_clp->cl_rpcclient, data,
&filelayout_write_call_ops, sync);
&filelayout_write_call_ops, sync,
RPC_TASK_SOFTCONN);
BUG_ON(status != 0);
return PNFS_ATTEMPTED;
}
Expand Down Expand Up @@ -966,7 +967,8 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how)
if (fh)
data->args.fh = fh;
return nfs_initiate_commit(ds->ds_clp->cl_rpcclient, data,
&filelayout_commit_call_ops, how);
&filelayout_commit_call_ops, how,
RPC_TASK_SOFTCONN);
}

static int
Expand Down Expand Up @@ -1120,7 +1122,7 @@ filelayout_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
if (!data->lseg) {
nfs_init_commit(data, mds_pages, NULL, cinfo);
nfs_initiate_commit(NFS_CLIENT(inode), data,
data->mds_ops, how);
data->mds_ops, how, 0);
} else {
struct pnfs_commit_bucket *buckets;

Expand Down
6 changes: 3 additions & 3 deletions fs/nfs/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr)

int nfs_initiate_read(struct rpc_clnt *clnt,
struct nfs_read_data *data,
const struct rpc_call_ops *call_ops)
const struct rpc_call_ops *call_ops, int flags)
{
struct inode *inode = data->header->inode;
int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0;
Expand All @@ -223,7 +223,7 @@ int nfs_initiate_read(struct rpc_clnt *clnt,
.callback_ops = call_ops,
.callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC | swap_flags,
.flags = RPC_TASK_ASYNC | swap_flags | flags,
};

/* Set up the initial task struct. */
Expand Down Expand Up @@ -272,7 +272,7 @@ static int nfs_do_read(struct nfs_read_data *data,
{
struct inode *inode = data->header->inode;

return nfs_initiate_read(NFS_CLIENT(inode), data, call_ops);
return nfs_initiate_read(NFS_CLIENT(inode), data, call_ops, 0);
}

static int
Expand Down
13 changes: 7 additions & 6 deletions fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ static int flush_task_priority(int how)
int nfs_initiate_write(struct rpc_clnt *clnt,
struct nfs_write_data *data,
const struct rpc_call_ops *call_ops,
int how)
int how, int flags)
{
struct inode *inode = data->header->inode;
int priority = flush_task_priority(how);
Expand All @@ -933,7 +933,7 @@ int nfs_initiate_write(struct rpc_clnt *clnt,
.callback_ops = call_ops,
.callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC,
.flags = RPC_TASK_ASYNC | flags,
.priority = priority,
};
int ret = 0;
Expand Down Expand Up @@ -1009,7 +1009,7 @@ static int nfs_do_write(struct nfs_write_data *data,
{
struct inode *inode = data->header->inode;

return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how);
return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0);
}

static int nfs_do_multiple_writes(struct list_head *head,
Expand Down Expand Up @@ -1394,7 +1394,7 @@ EXPORT_SYMBOL_GPL(nfs_commitdata_release);

int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data,
const struct rpc_call_ops *call_ops,
int how)
int how, int flags)
{
struct rpc_task *task;
int priority = flush_task_priority(how);
Expand All @@ -1410,7 +1410,7 @@ int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data,
.callback_ops = call_ops,
.callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC,
.flags = RPC_TASK_ASYNC | flags,
.priority = priority,
};
/* Set up the initial task struct. */
Expand Down Expand Up @@ -1499,7 +1499,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how,
/* Set up the argument struct */
nfs_init_commit(data, head, NULL, cinfo);
atomic_inc(&cinfo->mds->rpcs_out);
return nfs_initiate_commit(NFS_CLIENT(inode), data, data->mds_ops, how);
return nfs_initiate_commit(NFS_CLIENT(inode), data, data->mds_ops,
how, 0);
out_bad:
nfs_retry_commit(head, NULL, cinfo);
cinfo->completion_ops->error_cleanup(NFS_I(inode));
Expand Down

0 comments on commit 9f0ec17

Please sign in to comment.