diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2026-08-20 16:00:56 +0200 |
|---|---|---|
| committer | Andreas Gruenbacher <agruenba@redhat.com> | 2026-09-11 15:07:45 +0200 |
| commit | 51b812f668e252d19bc80b1956bdd796aef56121 (patch) | |
| tree | d9bddeaa14f562b997cd4438fdac8684eaed1ed9 /tools/lib/python | |
| parent | b2ac87810d6027fa0823d9158c7477feeaed3e1a (diff) | |
| download | linux-next-51b812f668e252d19bc80b1956bdd796aef56121.tar.gz linux-next-51b812f668e252d19bc80b1956bdd796aef56121.zip | |
gfs2: annotate i_gl with __rcu
ip->i_gl is always set over the lifetime of a gfs2 inode; it is
initialized at inode create time and torn down during evict.
However, gfs2_permission() can be called on an inode in non-blocking
mode, when the inode may already be undergoing evict. So far, to make
that work, we have been using rcu_dereference_check() in
gfs2_permission() and rcu_assign_pointer() in gfs2_evict_inode().
However, ip->i_gl wasn't marked as __rcu so far.
rcu_dereference_check() and rcu_assign_pointer() expect __rcu pointer
arguments, and sparse complains when regular pointers are passed to
those functions:
fs/gfs2/super.c:1516:17: error: incompatible types in comparison expression (different address spaces):
fs/gfs2/super.c:1516:17: struct gfs2_glock [noderef] __rcu *
fs/gfs2/super.c:1516:17: struct gfs2_glock *
fs/gfs2/inode.c:1988:14: error: incompatible types in comparison expression (different address spaces):
fs/gfs2/inode.c:1988:14: struct gfs2_glock [noderef] __rcu *
fs/gfs2/inode.c:1988:14: struct gfs2_glock *
To fix those errors, turn ip->i_gl into a __rcu variable. Use
rcu_assign_pointer() to assign to it, and rcu_dereference_protected() to
access it when the pointer is known to be valid.
Make sure not to use gfs2_inode_glock() in gfs2_permission().
Based on a patch from Adrian Garcia Casado <adriangarciacasado42@gmail.com>.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
