Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\locks.c Create Date:2022-07-28 20:25:30
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:revoke all outstanding leases on file

Proto:int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)

Type:int

Parameter:

TypeParameterName
struct inode *inode
unsigned intmode
unsigned inttype
1580  error = 0
1584  want_write = (mode & O_ACCMODE) != O_RDONLY
1585  LIST_HEAD(dispose)
1587  new_fl = Allocate a file_lock initialised to this type of lease
1588  If IS_ERR(new_fl) Then Return PTR_ERR(new_fl)
1590  fl_flags = type
1593  ctx = smp_load_acquire( & i_flctx)
1594  If Not ctx Then
1595  WARN_ON_ONCE(1)
1596  Go to free_lock
1599  percpu_down_read( & file_rwsem)
1600  spin_lock( & flc_lock)
1602  time_out_leases(inode, & dispose)
1604  If Not any_leases_conflict(inode, new_fl) Then Go to out
1607  break_time = 0
1608  If lease_break_time > 0 Then
1609  break_time = jiffies + lease_break_time * HZ
1610  If break_time == 0 Then break_time++
1615  If Not leases_conflict(fl, new_fl) Then Continue
1617  If want_write Then
1618  If fl_flags & Lease is being broken Then Continue
1622  Else
1623  If lease_breaking(fl) Then Continue
1628  If lm_break(fl) Then locks_delete_lock_ctx(fl, & dispose)
1632  If list_empty - tests whether a list is empty*@head: the list to test. Then Go to out
1635  If mode & O_NONBLOCK Then
1636  trace_break_lease_noblock(inode, new_fl)
1637  error = -EWOULDBLOCK
1638  Go to out
1641  restart :
1642  fl = list_first_entry - get the first element from a list*@ptr: the list head to take the element from.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.* Note, that list is expected to be not empty.( & flc_lease, structfile_lock, fl_list)
1643  break_time = for lease breaks:
1644  If break_time != 0 Then break_time -= jiffies
1646  If break_time == 0 Then break_time++
1648  Must be called with flc_lock held.
1649  trace_break_lease_block(inode, new_fl)
1650  spin_unlock( & flc_lock)
1651  percpu_up_read( & file_rwsem)
1653  locks_dispose_list( & dispose)
1654  error = wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses*@wq_head: the waitqueue to wait on*@condition: a C expression for the event to wait for*@timeout: timeout, in jiffies* The process is put to sleep (fl_wait, ! The lock, that is blocking us , break_time)
1657  percpu_down_read( & file_rwsem)
1658  spin_lock( & flc_lock)
1659  trace_break_lease_unblock(inode, new_fl)
1660  locks_delete_lock - stop waiting for a file lock*@waiter: the lock which was waiting* lockd/nfsd need to disconnect the lock while working on it.
1661  If error >= 0 Then
1666  If error == 0 Then time_out_leases(inode, & dispose)
1668  If any_leases_conflict(inode, new_fl) Then Go to restart
1670  error = 0
1672  out :
1673  spin_unlock( & flc_lock)
1674  percpu_up_read( & file_rwsem)
1675  locks_dispose_list( & dispose)
1676  free_lock :
1677  Free a lock which is not in use.
1678  Return error
Caller
NameDescribe
break_lease
break_deleg
break_layout