diff options
| author | Tejun Heo <[email protected]> | 2022-08-28 05:04:32 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2022-09-01 16:08:43 +0000 |
| commit | 3db48aca879db475844182a24d1760ee3d230627 (patch) | |
| tree | 3e65fdb2e204b4b76106784db069a831d93a2952 /fs/kernfs/kernfs-internal.h | |
| parent | devres: remove devm_ioremap_np (diff) | |
| download | kernel-3db48aca879db475844182a24d1760ee3d230627.tar.gz kernel-3db48aca879db475844182a24d1760ee3d230627.zip | |
kernfs: Simply by replacing kernfs_deref_open_node() with of_on()
kernfs_node->attr.open is an RCU pointer to kernfs_open_node. However, RCU
dereference is currently only used in kernfs_notify(). Everywhere else,
either we're holding the lock which protects it or know that the
kernfs_open_node is pinned becaused we have a pointer to a kernfs_open_file
which is hanging off of it.
kernfs_deref_open_node() is used for the latter case - accessing
kernfs_open_node from kernfs_open_file. The lifetime and visibility rules
are simple and clear here. To someone who can access a kernfs_open_file, its
kernfs_open_node is pinned and visible through of->kn->attr.open.
Replace kernfs_deref_open_node() which simpler of_on(). The former takes
both @kn and @of and RCU deref @kn->attr.open while sanity checking with
@of. The latter takes @of and uses protected deref on of->kn->attr.open.
As the return value can't be NULL, remove the error handling in the callers
too.
This shouldn't cause any functional changes.
Cc: Imran Khan <[email protected]>
Tested-by: Chengming Zhou <[email protected]>
Reviewed-by: Chengming Zhou <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'fs/kernfs/kernfs-internal.h')
0 files changed, 0 insertions, 0 deletions
