public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* NFSv4: Give the lock stateid its own sequence queue
@ 2008-01-10 21:07 Trond Myklebust
  2008-01-10 21:25 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2008-01-10 21:07 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Sharing the open sequence queue causes a deadlock when we try to take both
a lock sequence id and and open sequence id.

This fixes the regression reported by Dimitri Puzin and Jeff Garzik:
See http://bugzilla.kernel.org/show_bug.cgi?id=9712

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 fs/nfs/nfs4_fs.h   |    1 +
 fs/nfs/nfs4state.c |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b35069a..bd1b9d6 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -115,6 +115,7 @@ struct nfs4_lock_state {
 #define NFS_LOCK_INITIALIZED 1
 	int			ls_flags;
 	struct nfs_seqid_counter	ls_seqid;
+	struct rpc_sequence	ls_sequence;
 	struct nfs_unique_id	ls_id;
 	nfs4_stateid		ls_stateid;
 	atomic_t		ls_count;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 23a9a36..5a39c6f 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -509,7 +509,10 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
 	lsp = kzalloc(sizeof(*lsp), GFP_KERNEL);
 	if (lsp == NULL)
 		return NULL;
-	lsp->ls_seqid.sequence = &state->owner->so_sequence;
+	rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue");
+	spin_lock_init(&lsp->ls_sequence.lock);
+	INIT_LIST_HEAD(&lsp->ls_sequence.list);
+	lsp->ls_seqid.sequence = &lsp->ls_sequence;
 	atomic_set(&lsp->ls_count, 1);
 	lsp->ls_owner = fl_owner;
 	spin_lock(&clp->cl_lock);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: NFSv4: Give the lock stateid its own sequence queue
  2008-01-10 21:07 NFSv4: Give the lock stateid its own sequence queue Trond Myklebust
@ 2008-01-10 21:25 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2008-01-10 21:25 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Linus Torvalds, Andrew Morton, linux-kernel

Trond Myklebust wrote:
> Sharing the open sequence queue causes a deadlock when we try to take both
> a lock sequence id and and open sequence id.
> 
> This fixes the regression reported by Dimitri Puzin and Jeff Garzik:
> See http://bugzilla.kernel.org/show_bug.cgi?id=9712
> 
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Tested-by: Jeff Garzik <jgarzik@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-10 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-10 21:07 NFSv4: Give the lock stateid its own sequence queue Trond Myklebust
2008-01-10 21:25 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox