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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-01-17 at 09:32 +1100, NeilBrown wrote:
> 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@xxxxxxxxxx>
> > ---
> >  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;
> 

Good catch. Fixed in my local branch.

-- 
Jeff Layton <jlayton@xxxxxxxxxx>





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux