lkml.org 
[lkml]   [2021]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 2/3] zram: fix deadlock with sysfs attribute usage and module removal
On Fri, Jul 23, 2021 at 10:49:19AM -0700, Luis Chamberlain wrote:
> We are talking about sysfs files and you're argument is that
> try_module_get() should lock the module, and so cannot be used
> in sysfs files. My point is that such module lock is inferred:
>
> 1) Sysfs files are created by a module, that same module is responsible
> for removing the same sysfs files.
> 2) The module can only be removed and gone, once *all* sysfs files are
> removed first.
> 3) If any of the module's sysfs files are present the module must
> still be present
> 4) kernfs ensures that if a file is opened the file will not be
> removed until any pending operation completes
> 5) If a sysfs file is used to write something, that means the
> sysfs file has not yet been removed, and we know it will
> remain in existance throughout its entire operation
> 6) When a sysfs file operation is being run, the module must
> always exist

Greg,

I'm inclined to believe my original generic solution would be better
again [0]. Specially since we can drop the dev_type_get() / dev_type_put()
stuff.

Thoughts?

[0] https://lore.kernel.org/linux-block/20210401235925.GR4332@42.do-not-panic.com/

Luis

\
 
 \ /
  Last update: 2021-07-27 19:36    [W:0.108 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site