lockd: fix nlmsvc_notify_blocked locking
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 26 Oct 2010 22:25:30 +0000 (18:25 -0400)
committerArnd Bergmann <arnd@arndb.de>
Wed, 27 Oct 2010 19:39:50 +0000 (21:39 +0200)
nlmsvc_notify_blocked walks the nlm_blocked list,
which requires nlm_blocked_lock.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
fs/lockd/svclock.c

index 6f1ef000975abde05f2fec833b3dfcb6fab563dc..c462d346acbda920a78ef03c153dc088b70ef7f4 100644 (file)
@@ -700,14 +700,16 @@ nlmsvc_notify_blocked(struct file_lock *fl)
        struct nlm_block        *block;
 
        dprintk("lockd: VFS unblock notification for block %p\n", fl);
+       spin_lock(&nlm_blocked_lock);
        list_for_each_entry(block, &nlm_blocked, b_list) {
                if (nlm_compare_locks(&block->b_call->a_args.lock.fl, fl)) {
-                       nlmsvc_insert_block(block, 0);
+                       nlmsvc_insert_block_locked(block, 0);
+                       spin_unlock(&nlm_blocked_lock);
                        svc_wake_up(block->b_daemon);
                        return;
                }
        }
-
+       spin_unlock(&nlm_blocked_lock);
        printk(KERN_WARNING "lockd: notification for unknown block!\n");
 }