[lkml]   [2022]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RESEND PATCH v7 7/8] kernfs: Replace per-fs rwsem with hashed rwsems.
On Mon, Mar 21, 2022 at 12:57:07PM +1100, Imran Khan wrote:

> Yes. My earlier approach is wrong.
> This patch set has also introduced a per-fs mutex (kernfs_rm_mutex)
> which should fix the problem of inconsistent tree view as far as
> kernfs_get_path is concerned.
> Acquiring kernfs_rm_mutex before invoking kernfs_get_path in
> kernfs_getlink will ensure that kernfs_get_path will get a consistent
> view of ->parent of nodes from root to target. This is because acquiring
> kernfs_rm_mutex will ensure that __kernfs_remove does not remove any
> kernfs_node(or parent of kernfs_node). Further it ensures that
> kernfs_rename_ns does not move any kernfs_node. So far I have not used
> per-fs mutex in kernfs_rename_ns but I can make this change in next
> version. So following change on top of current patch set should fix
> this issue of ->parent change in the middle of kernfs_get_path.

I think it's a massive overkill. Look at kernfs_get_target_path() -
nothing in it is blocking. And you already have kernfs_rename_lock,
stabilizing the tree topology. Turn it into rwlock if you wish,
with that thing being a reader and existing users - writers.
And don't bother with further scaling, until and unless you see a real
contention on it.

 \ /
  Last update: 2022-03-21 08:31    [W:0.085 / U:1.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site