Commit 19c631d4 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] fix posix_locks_deadlock()

The "blocked_list" used for POSIX deadlock detection should only contain
POSIX locks, or posix_locks_deadlock() can get confused.

As I've noted before (but never posted a patch), we should probably stop
checking for deadlock.  POSIX says it's optional for an implementation
to check for deadlock, and since the change to match on tgid, we can
report a deadlock when none exists.

[ Further explanation for Linus: POSIX locks and BSD locks don't block
  each other, so checking that the blocker is a POSIX lock also implies
  that the waiter is a POSIX lock. ]
parent df60db4e
...@@ -463,7 +463,8 @@ static void locks_insert_block(struct file_lock *blocker, ...@@ -463,7 +463,8 @@ static void locks_insert_block(struct file_lock *blocker,
} }
list_add_tail(&waiter->fl_block, &blocker->fl_block); list_add_tail(&waiter->fl_block, &blocker->fl_block);
waiter->fl_next = blocker; waiter->fl_next = blocker;
list_add(&waiter->fl_link, &blocked_list); if (IS_POSIX(blocker))
list_add(&waiter->fl_link, &blocked_list);
} }
/* Wake up processes blocked waiting for blocker. /* Wake up processes blocked waiting for blocker.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment