diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-24 14:18:39 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:18 -0400 |
commit | 849b286fd026a6924cc6a4315e446ed88ab983d2 (patch) | |
tree | a8d07243fb453ece5b04078cc6715ec9e78971f3 | |
parent | 65857d5768f7716da539933c2075d384b117812d (diff) |
NFSv4.1: nfs4_proc_layoutreturn must always drop the plh_block_lgets count
Currently it does not do so if the RPC call failed to start. Fix is to
move the decrement of plh_block_lgets into nfs4_layoutreturn_release.
Also remove a redundant test of task->tk_status in nfs4_layoutreturn_done:
if lrp->res.lrs_present is set, then obviously the RPC call succeeded.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8de0435caed..ce1ebff49fd 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6346,7 +6346,6 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) | |||
6346 | { | 6346 | { |
6347 | struct nfs4_layoutreturn *lrp = calldata; | 6347 | struct nfs4_layoutreturn *lrp = calldata; |
6348 | struct nfs_server *server; | 6348 | struct nfs_server *server; |
6349 | struct pnfs_layout_hdr *lo = lrp->args.layout; | ||
6350 | 6349 | ||
6351 | dprintk("--> %s\n", __func__); | 6350 | dprintk("--> %s\n", __func__); |
6352 | 6351 | ||
@@ -6358,19 +6357,20 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) | |||
6358 | rpc_restart_call_prepare(task); | 6357 | rpc_restart_call_prepare(task); |
6359 | return; | 6358 | return; |
6360 | } | 6359 | } |
6361 | spin_lock(&lo->plh_inode->i_lock); | ||
6362 | if (task->tk_status == 0 && lrp->res.lrs_present) | ||
6363 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); | ||
6364 | lo->plh_block_lgets--; | ||
6365 | spin_unlock(&lo->plh_inode->i_lock); | ||
6366 | dprintk("<-- %s\n", __func__); | 6360 | dprintk("<-- %s\n", __func__); |
6367 | } | 6361 | } |
6368 | 6362 | ||
6369 | static void nfs4_layoutreturn_release(void *calldata) | 6363 | static void nfs4_layoutreturn_release(void *calldata) |
6370 | { | 6364 | { |
6371 | struct nfs4_layoutreturn *lrp = calldata; | 6365 | struct nfs4_layoutreturn *lrp = calldata; |
6366 | struct pnfs_layout_hdr *lo = lrp->args.layout; | ||
6372 | 6367 | ||
6373 | dprintk("--> %s\n", __func__); | 6368 | dprintk("--> %s\n", __func__); |
6369 | spin_lock(&lo->plh_inode->i_lock); | ||
6370 | if (lrp->res.lrs_present) | ||
6371 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); | ||
6372 | lo->plh_block_lgets--; | ||
6373 | spin_unlock(&lo->plh_inode->i_lock); | ||
6374 | pnfs_put_layout_hdr(lrp->args.layout); | 6374 | pnfs_put_layout_hdr(lrp->args.layout); |
6375 | kfree(calldata); | 6375 | kfree(calldata); |
6376 | dprintk("<-- %s\n", __func__); | 6376 | dprintk("<-- %s\n", __func__); |