Commit a87cd408 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Trond Myklebust

[PATCH] Fix file locking yield()

Use cond_resched() instead, and add a comment to explain.
parent 160f035e
...@@ -727,12 +727,16 @@ static int flock_lock_file(struct file *filp, struct file_lock *new_fl) ...@@ -727,12 +727,16 @@ static int flock_lock_file(struct file *filp, struct file_lock *new_fl)
} }
unlock_kernel(); unlock_kernel();
if (found)
yield();
if (new_fl->fl_type == F_UNLCK) if (new_fl->fl_type == F_UNLCK)
return 0; return 0;
/*
* If a higher-priority process was blocked on the old file lock,
* give it the opportunity to lock the file.
*/
if (found)
cond_resched();
lock_kernel(); lock_kernel();
for_each_lock(inode, before) { for_each_lock(inode, before) {
struct file_lock *fl = *before; struct file_lock *fl = *before;
......
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