@@ -175,7 +175,7 @@ locks_get_lock_context(struct inode *inode, int type)
175
175
struct file_lock_context * ctx ;
176
176
177
177
/* paired with cmpxchg() below */
178
- ctx = smp_load_acquire ( & inode -> i_flctx );
178
+ ctx = locks_inode_context ( inode );
179
179
if (likely (ctx ) || type == F_UNLCK )
180
180
goto out ;
181
181
@@ -194,7 +194,7 @@ locks_get_lock_context(struct inode *inode, int type)
194
194
*/
195
195
if (cmpxchg (& inode -> i_flctx , NULL , ctx )) {
196
196
kmem_cache_free (flctx_cache , ctx );
197
- ctx = smp_load_acquire ( & inode -> i_flctx );
197
+ ctx = locks_inode_context ( inode );
198
198
}
199
199
out :
200
200
trace_locks_get_lock_context (inode , type , ctx );
@@ -247,7 +247,7 @@ locks_check_ctx_file_list(struct file *filp, struct list_head *list,
247
247
void
248
248
locks_free_lock_context (struct inode * inode )
249
249
{
250
- struct file_lock_context * ctx = inode -> i_flctx ;
250
+ struct file_lock_context * ctx = locks_inode_context ( inode ) ;
251
251
252
252
if (unlikely (ctx )) {
253
253
locks_check_ctx_lists (inode );
@@ -891,7 +891,7 @@ posix_test_lock(struct file *filp, struct file_lock *fl)
891
891
void * owner ;
892
892
void (* func )(void );
893
893
894
- ctx = smp_load_acquire ( & inode -> i_flctx );
894
+ ctx = locks_inode_context ( inode );
895
895
if (!ctx || list_empty_careful (& ctx -> flc_posix )) {
896
896
fl -> fl_type = F_UNLCK ;
897
897
return ;
@@ -1483,7 +1483,7 @@ int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
1483
1483
new_fl -> fl_flags = type ;
1484
1484
1485
1485
/* typically we will check that ctx is non-NULL before calling */
1486
- ctx = smp_load_acquire ( & inode -> i_flctx );
1486
+ ctx = locks_inode_context ( inode );
1487
1487
if (!ctx ) {
1488
1488
WARN_ON_ONCE (1 );
1489
1489
goto free_lock ;
@@ -1588,7 +1588,7 @@ void lease_get_mtime(struct inode *inode, struct timespec64 *time)
1588
1588
struct file_lock_context * ctx ;
1589
1589
struct file_lock * fl ;
1590
1590
1591
- ctx = smp_load_acquire ( & inode -> i_flctx );
1591
+ ctx = locks_inode_context ( inode );
1592
1592
if (ctx && !list_empty_careful (& ctx -> flc_lease )) {
1593
1593
spin_lock (& ctx -> flc_lock );
1594
1594
fl = list_first_entry_or_null (& ctx -> flc_lease ,
@@ -1634,7 +1634,7 @@ int fcntl_getlease(struct file *filp)
1634
1634
int type = F_UNLCK ;
1635
1635
LIST_HEAD (dispose );
1636
1636
1637
- ctx = smp_load_acquire ( & inode -> i_flctx );
1637
+ ctx = locks_inode_context ( inode );
1638
1638
if (ctx && !list_empty_careful (& ctx -> flc_lease )) {
1639
1639
percpu_down_read (& file_rwsem );
1640
1640
spin_lock (& ctx -> flc_lock );
@@ -1823,7 +1823,7 @@ static int generic_delete_lease(struct file *filp, void *owner)
1823
1823
struct file_lock_context * ctx ;
1824
1824
LIST_HEAD (dispose );
1825
1825
1826
- ctx = smp_load_acquire ( & inode -> i_flctx );
1826
+ ctx = locks_inode_context ( inode );
1827
1827
if (!ctx ) {
1828
1828
trace_generic_delete_lease (inode , NULL );
1829
1829
return error ;
@@ -2563,7 +2563,7 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
2563
2563
* posix_lock_file(). Another process could be setting a lock on this
2564
2564
* file at the same time, but we wouldn't remove that lock anyway.
2565
2565
*/
2566
- ctx = smp_load_acquire ( & inode -> i_flctx );
2566
+ ctx = locks_inode_context ( inode );
2567
2567
if (!ctx || list_empty (& ctx -> flc_posix ))
2568
2568
return ;
2569
2569
@@ -2636,7 +2636,7 @@ void locks_remove_file(struct file *filp)
2636
2636
{
2637
2637
struct file_lock_context * ctx ;
2638
2638
2639
- ctx = smp_load_acquire ( & locks_inode (filp )-> i_flctx );
2639
+ ctx = locks_inode_context ( locks_inode (filp ));
2640
2640
if (!ctx )
2641
2641
return ;
2642
2642
@@ -2684,7 +2684,7 @@ bool vfs_inode_has_locks(struct inode *inode)
2684
2684
struct file_lock_context * ctx ;
2685
2685
bool ret ;
2686
2686
2687
- ctx = smp_load_acquire ( & inode -> i_flctx );
2687
+ ctx = locks_inode_context ( inode );
2688
2688
if (!ctx )
2689
2689
return false;
2690
2690
@@ -2865,7 +2865,7 @@ void show_fd_locks(struct seq_file *f,
2865
2865
struct file_lock_context * ctx ;
2866
2866
int id = 0 ;
2867
2867
2868
- ctx = smp_load_acquire ( & inode -> i_flctx );
2868
+ ctx = locks_inode_context ( inode );
2869
2869
if (!ctx )
2870
2870
return ;
2871
2871
0 commit comments