NLM: Fix a circular lock dependency in lockd
commit2c0cf342f6fc11e6de814464c035a37d8c17fb17
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 25 Sep 2007 19:56:00 +0000 (25 15:56 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 10 Oct 2007 17:50:16 +0000 (10 10:50 -0700)
tree33746e8e9a778444ba51a0ab8991da69db860c47
parentb73222fc44b587f1dbf08e3c47370735ef0e67f7
NLM: Fix a circular lock dependency in lockd

commit 255129d1e9ca0ed3d69d5517fae3e03d7ab4b806 in upstream.

The problem is that the garbage collector for the 'host' structures
nlm_gc_hosts(), holds nlm_host_mutex while calling down to
nlmsvc_mark_resources, which, eventually takes the file->f_mutex.

We cannot therefore call nlmsvc_lookup_host() from within
nlmsvc_create_block, since the caller will already hold file->f_mutex, so
the attempt to grab nlm_host_mutex may deadlock.

Fix the problem by calling nlmsvc_lookup_host() outside the file->f_mutex.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/lockd/svclock.c