Thread (40 messages) 40 messages, 5 authors, 2024-01-17

Re: [PATCH 13/20] filelock: convert __locks_insert_block, conflict and deadlock checks to use file_lock_core

From: NeilBrown <hidden>
Date: 2024-01-16 22:33:12
Also in: ceph-devel, gfs2, linux-cifs, linux-fsdevel, linux-nfs, lkml, ocfs2-devel, v9fs

On Wed, 17 Jan 2024, Jeff Layton wrote:
Have both __locks_insert_block and the deadlock and conflict checking
functions take a struct file_lock_core pointer instead of a struct
file_lock one. Also, change posix_locks_deadlock to return bool.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/locks.c | 132 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 70 insertions(+), 62 deletions(-)
quoted hunk ↗ jump to hunk
 
 /* Must be called with the blocked_lock_lock held! */
-static int posix_locks_deadlock(struct file_lock *caller_fl,
-				struct file_lock *block_fl)
+static bool posix_locks_deadlock(struct file_lock *caller_fl,
+				 struct file_lock *block_fl)
 {
+	struct file_lock_core *caller = &caller_fl->fl_core;
+	struct file_lock_core *blocker = &block_fl->fl_core;
 	int i = 0;
-	struct file_lock_core *flc = &caller_fl->fl_core;
 
 	lockdep_assert_held(&blocked_lock_lock);
 
@@ -1034,16 +1040,16 @@ static int posix_locks_deadlock(struct file_lock *caller_fl,
 	 * This deadlock detector can't reasonably detect deadlocks with
 	 * FL_OFDLCK locks, since they aren't owned by a process, per-se.
 	 */
-	if (IS_OFDLCK(flc))
+	if (IS_OFDLCK(caller))
 		return 0;
      return false;

Thanks,
NeilBrown
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help