diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-11 23:05:07 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:24 -0400 |
commit | b39e625b6e75aa70e26c13f9378756bb5f2af032 (patch) | |
tree | acf17b925b359b051f476c7e9500c4f4d60f5d0c | |
parent | 4a35bd41aff5714deb41c8f14766df3871e2e8f7 (diff) |
NFSv4: Clean up nfs4_call_async()
Use rpc_run_task() instead of doing it ourselves.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 26 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 9 | ||||
-rw-r--r-- | net/sunrpc/sunrpc_syms.c | 1 |
3 files changed, 14 insertions, 22 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8feaf232f2e4..3cc75445a68d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -295,18 +295,6 @@ static void nfs4_opendata_free(struct nfs4_opendata *p) | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | /* Helper for asynchronous RPC calls */ | ||
299 | static int nfs4_call_async(struct rpc_clnt *clnt, | ||
300 | const struct rpc_call_ops *tk_ops, void *calldata) | ||
301 | { | ||
302 | struct rpc_task *task; | ||
303 | |||
304 | if (!(task = rpc_new_task(clnt, RPC_TASK_ASYNC, tk_ops, calldata))) | ||
305 | return -ENOMEM; | ||
306 | rpc_execute(task); | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int nfs4_wait_for_completion_rpc_task(struct rpc_task *task) | 298 | static int nfs4_wait_for_completion_rpc_task(struct rpc_task *task) |
311 | { | 299 | { |
312 | sigset_t oldset; | 300 | sigset_t oldset; |
@@ -1218,6 +1206,8 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state) | |||
1218 | { | 1206 | { |
1219 | struct nfs_server *server = NFS_SERVER(state->inode); | 1207 | struct nfs_server *server = NFS_SERVER(state->inode); |
1220 | struct nfs4_closedata *calldata; | 1208 | struct nfs4_closedata *calldata; |
1209 | struct nfs4_state_owner *sp = state->owner; | ||
1210 | struct rpc_task *task; | ||
1221 | int status = -ENOMEM; | 1211 | int status = -ENOMEM; |
1222 | 1212 | ||
1223 | calldata = kmalloc(sizeof(*calldata), GFP_KERNEL); | 1213 | calldata = kmalloc(sizeof(*calldata), GFP_KERNEL); |
@@ -1237,14 +1227,16 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state) | |||
1237 | calldata->path.mnt = mntget(path->mnt); | 1227 | calldata->path.mnt = mntget(path->mnt); |
1238 | calldata->path.dentry = dget(path->dentry); | 1228 | calldata->path.dentry = dget(path->dentry); |
1239 | 1229 | ||
1240 | status = nfs4_call_async(server->client, &nfs4_close_ops, calldata); | 1230 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); |
1241 | if (status == 0) | 1231 | if (IS_ERR(task)) |
1242 | goto out; | 1232 | return PTR_ERR(task); |
1243 | 1233 | rpc_put_task(task); | |
1244 | nfs_free_seqid(calldata->arg.seqid); | 1234 | return 0; |
1245 | out_free_calldata: | 1235 | out_free_calldata: |
1246 | kfree(calldata); | 1236 | kfree(calldata); |
1247 | out: | 1237 | out: |
1238 | nfs4_put_open_state(state); | ||
1239 | nfs4_put_state_owner(sp); | ||
1248 | return status; | 1240 | return status; |
1249 | } | 1241 | } |
1250 | 1242 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a85138ef67ad..5d7ffbfc3483 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -375,10 +375,11 @@ void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) | |||
375 | spin_unlock(&inode->i_lock); | 375 | spin_unlock(&inode->i_lock); |
376 | spin_unlock(&owner->so_lock); | 376 | spin_unlock(&owner->so_lock); |
377 | 377 | ||
378 | if (oldstate != newstate && nfs4_do_close(path, state) == 0) | 378 | if (oldstate == newstate) { |
379 | return; | 379 | nfs4_put_open_state(state); |
380 | nfs4_put_open_state(state); | 380 | nfs4_put_state_owner(owner); |
381 | nfs4_put_state_owner(owner); | 381 | } else |
382 | nfs4_do_close(path, state); | ||
382 | } | 383 | } |
383 | 384 | ||
384 | /* | 385 | /* |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 73075dec83c0..c46d31ca307b 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
@@ -30,7 +30,6 @@ EXPORT_SYMBOL(rpc_wake_up_next); | |||
30 | EXPORT_SYMBOL(rpc_wake_up_task); | 30 | EXPORT_SYMBOL(rpc_wake_up_task); |
31 | EXPORT_SYMBOL(rpciod_down); | 31 | EXPORT_SYMBOL(rpciod_down); |
32 | EXPORT_SYMBOL(rpciod_up); | 32 | EXPORT_SYMBOL(rpciod_up); |
33 | EXPORT_SYMBOL(rpc_new_task); | ||
34 | EXPORT_SYMBOL(rpc_wake_up_status); | 33 | EXPORT_SYMBOL(rpc_wake_up_status); |
35 | 34 | ||
36 | /* RPC client functions */ | 35 | /* RPC client functions */ |