Commit def6ed7e authored by Andy Adamson's avatar Andy Adamson Committed by Benny Halevy

nfs41 write sequence setup done support

Separate write calls from nfs41: sequence setup/done support

Implement the write rpc_call_prepare method for
asynchronuos nfs rpcs, call nfs41_setup_sequence from
respective rpc_call_validate_args methods.

Call nfs4_sequence_done from respective rpc_call_done methods.

Note that we need to pass a pointer to the nfs_server in calls data
for passing on to nfs4_sequence_done.
Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[pnfs: client data server write validate and release]
Signed-off-by: default avatarAndy Adamson <andros@umich.edu>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[move the nfs4_sequence_free_slot call in nfs_readpage_retry from]
[nfs41: separate free slot from sequence done
Signed-off-by: default avatarAndy Adamson <andros@umich.edu>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[nfs41: Support sessions with O_DIRECT.]
Signed-off-by: default avatarDean Hildebrand <dhildeb@us.ibm.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[nfs41: nfs4_sequence_free_slot use nfs_client for data server]
Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent f11c88af
...@@ -676,6 +676,9 @@ static void nfs_direct_write_release(void *calldata) ...@@ -676,6 +676,9 @@ static void nfs_direct_write_release(void *calldata)
} }
static const struct rpc_call_ops nfs_write_direct_ops = { static const struct rpc_call_ops nfs_write_direct_ops = {
#if defined(CONFIG_NFS_V4_1)
.rpc_call_prepare = nfs_write_prepare,
#endif /* CONFIG_NFS_V4_1 */
.rpc_call_done = nfs_direct_write_result, .rpc_call_done = nfs_direct_write_result,
.rpc_release = nfs_direct_write_release, .rpc_release = nfs_direct_write_release,
}; };
......
...@@ -209,6 +209,9 @@ extern int nfs4_path_walk(struct nfs_server *server, ...@@ -209,6 +209,9 @@ extern int nfs4_path_walk(struct nfs_server *server,
/* read.c */ /* read.c */
extern void nfs_read_prepare(struct rpc_task *task, void *calldata); extern void nfs_read_prepare(struct rpc_task *task, void *calldata);
/* write.c */
extern void nfs_write_prepare(struct rpc_task *task, void *calldata);
/* nfs4proc.c */ /* nfs4proc.c */
extern int _nfs4_call_sync(struct nfs_server *server, extern int _nfs4_call_sync(struct nfs_server *server,
struct rpc_message *msg, struct rpc_message *msg,
......
...@@ -2890,6 +2890,10 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) ...@@ -2890,6 +2890,10 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{ {
struct inode *inode = data->inode; struct inode *inode = data->inode;
/* slot is freed in nfs_writeback_done */
nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
task->tk_status);
if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) { if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) {
rpc_restart_call(task); rpc_restart_call(task);
return -EAGAIN; return -EAGAIN;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "delegation.h" #include "delegation.h"
#include "internal.h" #include "internal.h"
#include "iostat.h" #include "iostat.h"
#include "nfs4_fs.h"
#define NFSDBG_FACILITY NFSDBG_PAGECACHE #define NFSDBG_FACILITY NFSDBG_PAGECACHE
...@@ -1050,7 +1051,23 @@ static void nfs_writeback_release_partial(void *calldata) ...@@ -1050,7 +1051,23 @@ static void nfs_writeback_release_partial(void *calldata)
nfs_writedata_release(calldata); nfs_writedata_release(calldata);
} }
#if defined(CONFIG_NFS_V4_1)
void nfs_write_prepare(struct rpc_task *task, void *calldata)
{
struct nfs_write_data *data = calldata;
struct nfs_client *clp = (NFS_SERVER(data->inode))->nfs_client;
if (nfs4_setup_sequence(clp, &data->args.seq_args,
&data->res.seq_res, 1, task))
return;
rpc_call_start(task);
}
#endif /* CONFIG_NFS_V4_1 */
static const struct rpc_call_ops nfs_write_partial_ops = { static const struct rpc_call_ops nfs_write_partial_ops = {
#if defined(CONFIG_NFS_V4_1)
.rpc_call_prepare = nfs_write_prepare,
#endif /* CONFIG_NFS_V4_1 */
.rpc_call_done = nfs_writeback_done_partial, .rpc_call_done = nfs_writeback_done_partial,
.rpc_release = nfs_writeback_release_partial, .rpc_release = nfs_writeback_release_partial,
}; };
...@@ -1113,6 +1130,9 @@ static void nfs_writeback_release_full(void *calldata) ...@@ -1113,6 +1130,9 @@ static void nfs_writeback_release_full(void *calldata)
} }
static const struct rpc_call_ops nfs_write_full_ops = { static const struct rpc_call_ops nfs_write_full_ops = {
#if defined(CONFIG_NFS_V4_1)
.rpc_call_prepare = nfs_write_prepare,
#endif /* CONFIG_NFS_V4_1 */
.rpc_call_done = nfs_writeback_done_full, .rpc_call_done = nfs_writeback_done_full,
.rpc_release = nfs_writeback_release_full, .rpc_release = nfs_writeback_release_full,
}; };
...@@ -1195,6 +1215,8 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data) ...@@ -1195,6 +1215,8 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
/* Can't do anything about it except throw an error. */ /* Can't do anything about it except throw an error. */
task->tk_status = -EIO; task->tk_status = -EIO;
} }
nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client,
&data->res.seq_res);
return 0; return 0;
} }
......
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