File locking bugfix for v5.1

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJcmgMVAAoJEAAOaEEZVoIVNDsP/iXnT9oNgC0emd4wR4WpkQuK
 s2DOa+fLsAjZT4Ry51rEn1y3I1Xuqew67eO5/gRW0W1kifC3XcCXQq3AX9oRGOVJ
 v3hnO6Dsfw+6pbezYVO/O7fcW3zXK8Hj8sWP+FEDZiSWhCJNcbn2t/fnTh5X67lC
 yUVSBJS8d3MVDb3+KLE4WuILz/dXhfm8zNqR6QGRn5WQkEoR1Tz8q2UO4Gz6P7An
 mGOWjqZHzej+yzDqMyVclPM/ACVnvDiZbpMdi6HXYxIEd0LwK0h4egyBFoPHQ2Xo
 zIFI5qS8zLOZUMxuFvstKy7s9p7ODsOlK66bOLnHCnP+z8ZQ81N6ooXWUSRQzfuh
 a/0v2Iv6EmquIPyGtd/Z89swo+hOLp5bQ11jA123rniBMkNP+/hNMxnRqKaHVS/p
 bXVNP8OrjDyyVCvSicEVMAPPV8ozj3oIYOq0l3olIB6I72I9SMawXVmOV+V0gjl9
 AibRQGS0+1LJzV5IssqeNEoxz2lYCERFJVY9YSD9bMzMQdchj1yAmoFyQcX8Nvyi
 zKKdApArwPaPuI/Mms4f0j/hoEH1rKOWyZMt/qIm7iaNPkJc/8maNk/voJv16Ro/
 NjeiwPEDyduLETfiFSowuSdOztwY7xAO/k434xlj330rZ9/TeWhTtMbEulzNfd9T
 2ctDud95UbhYwxmWyU3F
 =aQ8F
 -----END PGP SIGNATURE-----

Merge tag 'locks-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux

Pull file locking bugfix from Jeff Layton:
 "Just a single fix for a bug that crept into POSIX lock deadlock
  detection in v5.0"

* tag 'locks-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
  locks: wake any locks blocked on request before deadlock check
This commit is contained in:
Linus Torvalds 2019-03-26 10:06:29 -07:00
commit 9798a22df3

View File

@ -1160,6 +1160,11 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request,
*/
error = -EDEADLK;
spin_lock(&blocked_lock_lock);
/*
* Ensure that we don't find any locks blocked on this
* request during deadlock detection.
*/
__locks_wake_up_blocks(request);
if (likely(!posix_locks_deadlock(request, fl))) {
error = FILE_LOCK_DEFERRED;
__locks_insert_block(fl, request,