NFSv4: Give the lock stateid its own sequence queue

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

for details.

Reported-and-tested-by: Dimitri Puzin <bugs@psycast.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Tested-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Trond Myklebust and committed by Linus Torvalds d0dc3701 3a43e69c

+5 -1
+1
fs/nfs/nfs4_fs.h
··· 115 115 #define NFS_LOCK_INITIALIZED 1 116 116 int ls_flags; 117 117 struct nfs_seqid_counter ls_seqid; 118 + struct rpc_sequence ls_sequence; 118 119 struct nfs_unique_id ls_id; 119 120 nfs4_stateid ls_stateid; 120 121 atomic_t ls_count;
+4 -1
fs/nfs/nfs4state.c
··· 509 509 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL); 510 510 if (lsp == NULL) 511 511 return NULL; 512 - lsp->ls_seqid.sequence = &state->owner->so_sequence; 512 + rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue"); 513 + spin_lock_init(&lsp->ls_sequence.lock); 514 + INIT_LIST_HEAD(&lsp->ls_sequence.list); 515 + lsp->ls_seqid.sequence = &lsp->ls_sequence; 513 516 atomic_set(&lsp->ls_count, 1); 514 517 lsp->ls_owner = fl_owner; 515 518 spin_lock(&clp->cl_lock);