Skip to content

kernfs: switch global kernfs_rwsem lock to per-fs lock

Ian Kent requested to merge raven-au/centos-stream-9:bz2186094-kernfs into main

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2186094

Upstream status: Linus

Originally the kernfs lock was changed to a read/write semaphore to improve concurrency in the kernfs file system.

An additional RHEL-8 change switched the read/write semaphore to be per file system lock in order to further improve concurrency in kernfs as it underpins several distinct file systems. There were several additional bug fix patches for the original change that were also included.

In RHEL-9 bug 2152737 has already merged the per-fs lock changes and bug fix changes so they aren't needed to bring RHEL-9 into sync with RHEL-8.

However there are two additional patches from the RHEL-8 bug that weren't included at the time.

These two patches remove the use of a spin lock in kernfs_dop_revalidate() and kernfs_iop_permission() as well as in kernfs_iop_getattr(). From the bug we can see that both kernfs_dop_revalidate() and kernfs_iop_permission() are contented functions and we need every bit of help we can get.

So apart from keeping RHEL-8 and RHEL-9 in sync the change is also important in helping with the reported problem.

Signed-off-by: Ian Kent ikent@redhat.com

Edited by Ian Kent

Merge request reports