[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YQBDzoSohQ0wbLN4@bombadil.infradead.org>
Date: Tue, 27 Jul 2021 10:35:10 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Greg KH <gregkh@...uxfoundation.org>,
David Laight <David.Laight@...lab.com>
Cc: akpm@...ux-foundation.org, minchan@...nel.org, jeyu@...nel.org,
ngupta@...are.org, sergey.senozhatsky.work@...il.com,
rafael@...nel.org, axboe@...nel.dk, tj@...nel.org, mbenes@...e.com,
jpoimboe@...hat.com, tglx@...utronix.de, keescook@...omium.org,
jikos@...nel.org, rostedt@...dmis.org, peterz@...radead.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [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
Powered by blists - more mailing lists