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:generic_add_lease

Proto:static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv)

Type:int

Parameter:

TypeParameterName
struct file *filp
longarg
struct file_lock **flp
void **priv
1808  my_fl = NULL
1809  inode = locks_inode(filp)
1811  is_deleg = fl_flags & NFSv4 delegation
1813  LIST_HEAD(dispose)
1815  lease = flp
1816  trace_generic_add_lease(inode, lease)
1819  ctx = locks_get_lock_context(inode, arg)
1820  If Not ctx Then Return -ENOMEM
1831  If is_deleg && Not inode_trylock(inode) Then Return -EAGAIN
1834  If is_deleg && arg == F_WRLCK Then
1836  inode_unlock(inode)
1837  WARN_ON_ONCE(1)
1838  Return -EINVAL
1841  percpu_down_read( & file_rwsem)
1842  spin_lock( & flc_lock)
1843  time_out_leases(inode, & dispose)
1844  error = heck_conflicting_open - see if the given file points to an inode that has* an existing open that would conflict with the* desired lease
1845  If error Then Go to out
1856  error = -EAGAIN
1858  If fl_file == filp && fl_owner == fl_owner Then
1860  my_fl = fl
1861  Continue
1868  If arg == F_WRLCK Then Go to out
1874  If fl_flags & Lease is being broken Then Go to out
1878  If (my_fl != NULL) Then
1879  lease = my_fl
1880  error = lm_change(lease, arg, & dispose)
1881  If error Then Go to out
1883  Go to out_setup
1886  error = -EINVAL
1887  If Not leases_enable Then Go to out
1890  locks_insert_lock_ctx(lease, & flc_lease)
1900  smp_mb()
1901  error = heck_conflicting_open - see if the given file points to an inode that has* an existing open that would conflict with the* desired lease
1902  If error Then
1903  locks_unlink_lock_ctx(lease)
1904  Go to out
1907  out_setup :
1908  If lm_setup Then lm_setup(lease, priv)
1910  out :
1911  spin_unlock( & flc_lock)
1912  percpu_up_read( & file_rwsem)
1913  locks_dispose_list( & dispose)
1914  If is_deleg Then inode_unlock(inode)
1916  If Not error && Not my_fl Then * flp = NULL
1918  Return error
Caller
NameDescribe
generic_setleasegeneric_setlease - sets a lease on an open file*@filp: file pointer*@arg: type of lease to obtain*@flp: input - file_lock to use, output - file_lock inserted*@priv: private data for lm_setup (may be NULL if lm_setup* doesn't require it)* The (input)