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 <jlay...@kernel.org>
> ---
>  fs/locks.c | 132 
> ++++++++++++++++++++++++++++++++-----------------------------
>  1 file changed, 70 insertions(+), 62 deletions(-)
> 


>  
>  /* 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

Reply via email to