Commit 101070ca authored by Trond Myklebust's avatar Trond Myklebust

NFS: Ensure that the asynchronous RPC calls complete on nfsiod.

We want to ensure that rpc_call_ops that involve mntput() are run on nfsiod
rather than on rpciod, so that they don't deadlock when the resulting
umount calls rpc_shutdown_client(). Hence we specify that read, write and
commit calls must complete on nfsiod.
Ditto for NFSv4 open, lock, locku and close asynchronous calls.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 5746006f
...@@ -280,6 +280,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, ...@@ -280,6 +280,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
.rpc_client = NFS_CLIENT(inode), .rpc_client = NFS_CLIENT(inode),
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs_read_direct_ops, .callback_ops = &nfs_read_direct_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
unsigned int pgbase; unsigned int pgbase;
...@@ -446,6 +447,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) ...@@ -446,6 +447,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
struct rpc_task_setup task_setup_data = { struct rpc_task_setup task_setup_data = {
.rpc_client = NFS_CLIENT(inode), .rpc_client = NFS_CLIENT(inode),
.callback_ops = &nfs_write_direct_ops, .callback_ops = &nfs_write_direct_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
...@@ -537,6 +539,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) ...@@ -537,6 +539,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs_commit_direct_ops, .callback_ops = &nfs_commit_direct_ops,
.callback_data = data, .callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
...@@ -683,6 +686,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, ...@@ -683,6 +686,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
.rpc_client = NFS_CLIENT(inode), .rpc_client = NFS_CLIENT(inode),
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs_write_direct_ops, .callback_ops = &nfs_write_direct_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
size_t wsize = NFS_SERVER(inode)->wsize; size_t wsize = NFS_SERVER(inode)->wsize;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "nfs4_fs.h" #include "nfs4_fs.h"
#include "delegation.h" #include "delegation.h"
#include "internal.h"
#include "iostat.h" #include "iostat.h"
#define NFSDBG_FACILITY NFSDBG_PROC #define NFSDBG_FACILITY NFSDBG_PROC
...@@ -773,6 +774,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) ...@@ -773,6 +774,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs4_open_confirm_ops, .callback_ops = &nfs4_open_confirm_ops,
.callback_data = data, .callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
int status; int status;
...@@ -910,6 +912,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) ...@@ -910,6 +912,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs4_open_ops, .callback_ops = &nfs4_open_ops,
.callback_data = data, .callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
int status; int status;
...@@ -1315,6 +1318,7 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait) ...@@ -1315,6 +1318,7 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
.rpc_client = server->client, .rpc_client = server->client,
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs4_close_ops, .callback_ops = &nfs4_close_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
int status = -ENOMEM; int status = -ENOMEM;
...@@ -3235,6 +3239,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, ...@@ -3235,6 +3239,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
.rpc_client = NFS_CLIENT(lsp->ls_state->inode), .rpc_client = NFS_CLIENT(lsp->ls_state->inode),
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs4_locku_ops, .callback_ops = &nfs4_locku_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
...@@ -3419,6 +3424,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f ...@@ -3419,6 +3424,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
.rpc_client = NFS_CLIENT(state->inode), .rpc_client = NFS_CLIENT(state->inode),
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs4_lock_ops, .callback_ops = &nfs4_lock_ops,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC, .flags = RPC_TASK_ASYNC,
}; };
int ret; int ret;
......
...@@ -177,6 +177,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, ...@@ -177,6 +177,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = call_ops, .callback_ops = call_ops,
.callback_data = data, .callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = RPC_TASK_ASYNC | swap_flags, .flags = RPC_TASK_ASYNC | swap_flags,
}; };
......
...@@ -803,6 +803,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, ...@@ -803,6 +803,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = call_ops, .callback_ops = call_ops,
.callback_data = data, .callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = flags, .flags = flags,
.priority = priority, .priority = priority,
}; };
...@@ -1187,6 +1188,7 @@ static void nfs_commit_rpcsetup(struct list_head *head, ...@@ -1187,6 +1188,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
.rpc_message = &msg, .rpc_message = &msg,
.callback_ops = &nfs_commit_ops, .callback_ops = &nfs_commit_ops,
.callback_data = data, .callback_data = data,
.workqueue = nfsiod_workqueue,
.flags = flags, .flags = flags,
.priority = priority, .priority = priority,
}; };
......
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