summaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 19:26:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 19:26:21 +0000
commitbd5a8444da4bfd877d849fc84349dbe8b5d8e8c3 (patch)
tree960f32220de8775b6d51cbb8ba880c81aa24b095 /fs/locks.c
parentReleasing progress-linux version 6.9.11-1~progress7.99u1. (diff)
downloadlinux-bd5a8444da4bfd877d849fc84349dbe8b5d8e8c3.tar.xz
linux-bd5a8444da4bfd877d849fc84349dbe8b5d8e8c3.zip
Merging upstream version 6.9.12.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/locks.c b/fs/locks.c
index bdd94c3225..9afb16e068 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2570,8 +2570,9 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
error = do_lock_file_wait(filp, cmd, file_lock);
/*
- * Attempt to detect a close/fcntl race and recover by releasing the
- * lock that was just acquired. There is no need to do that when we're
+ * Detect close/fcntl races and recover by zapping all POSIX locks
+ * associated with this file and our files_struct, just like on
+ * filp_flush(). There is no need to do that when we're
* unlocking though, or for OFD locks.
*/
if (!error && file_lock->c.flc_type != F_UNLCK &&
@@ -2586,9 +2587,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
f = files_lookup_fd_locked(files, fd);
spin_unlock(&files->file_lock);
if (f != filp) {
- file_lock->c.flc_type = F_UNLCK;
- error = do_lock_file_wait(filp, cmd, file_lock);
- WARN_ON_ONCE(error);
+ locks_remove_posix(filp, files);
error = -EBADF;
}
}