From: Trond Myklebust Subject: [PATCH] fix hangs in posix_locks_deadlock(). Date: Mon, 20 Sep 2004 11:58:28 -0700 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1095706707.7092.27.camel@lade.trondhjem.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Linux Filesystem Development Return-path: Received: from pat.uio.no ([129.240.130.16]:49630 "EHLO pat.uio.no") by vger.kernel.org with ESMTP id S266657AbUITS6k (ORCPT ); Mon, 20 Sep 2004 14:58:40 -0400 To: Linus Torvalds , Andrew Morton List-Id: linux-fsdevel.vger.kernel.org "blocked_list" may contain both leases and flock locks in addition to posix locks. Signed-off-by: Trond Myklebust --- locks.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: linux-2.6.9-rc2-up/fs/locks.c =================================================================== --- linux-2.6.9-rc2-up.orig/fs/locks.c 2004-09-19 13:55:33.680258334 -0700 +++ linux-2.6.9-rc2-up/fs/locks.c 2004-09-19 15:37:32.595634679 -0700 @@ -634,14 +634,13 @@ int posix_locks_deadlock(struct file_lock *caller_fl, struct file_lock *block_fl) { - struct list_head *tmp; + struct file_lock *fl; next_task: if (posix_same_owner(caller_fl, block_fl)) return 1; - list_for_each(tmp, &blocked_list) { - struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link); - if (posix_same_owner(fl, block_fl)) { + list_for_each_entry(fl, &blocked_list, fl_link) { + if (IS_POSIX(fl) && posix_same_owner(fl, block_fl)) { fl = fl->fl_next; block_fl = fl; goto next_task;