2011-01-27 20:36:24

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 1/1] SQUASHME: pnfs: call pnfs_choose_layoutget_stateid under the inode lock

Also, On ther success leg of nfs4_layoutget_prepare plh_outstanding should remain
incremented until the layoutget call is processed.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 59d372a..3cc398c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5427,21 +5427,23 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
* serialize openstateid LAYOUTGETs.
*/
atomic_inc(&nfsi->layout->plh_outstanding);
- spin_unlock(&ino->i_lock);
-
- if (nfs4_setup_sequence(server, NULL, &lgp->args.seq_args,
- &lgp->res.seq_res, 0, task)) {
- goto err_out;
- }
if (pnfs_choose_layoutget_stateid(&lgp->args.stateid,
NFS_I(lgp->args.inode)->layout,
lgp->args.ctx->state)) {
rpc_exit(task, NFS4_OK);
+ goto err_out_locked;
+ }
+ spin_unlock(&ino->i_lock);
+
+ if (nfs4_setup_sequence(server, NULL, &lgp->args.seq_args,
+ &lgp->res.seq_res, 0, task)) {
goto err_out;
}
rpc_call_start(task);
+ return;
err_out:
spin_lock(&ino->i_lock);
+err_out_locked:
atomic_dec(&nfsi->layout->plh_outstanding);
spin_unlock(&ino->i_lock);
}
--
1.7.3.4