All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>,
	David Laight <David.Laight@aculab.com>
Cc: akpm@linux-foundation.org, minchan@kernel.org, jeyu@kernel.org,
	ngupta@vflare.org, sergey.senozhatsky.work@gmail.com,
	rafael@kernel.org, axboe@kernel.dk, tj@kernel.org,
	mbenes@suse.com, jpoimboe@redhat.com, tglx@linutronix.de,
	keescook@chromium.org, jikos@kernel.org, rostedt@goodmis.org,
	peterz@infradead.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/3] zram: fix deadlock with sysfs attribute usage and module removal
Date: Tue, 27 Jul 2021 10:35:10 -0700	[thread overview]
Message-ID: <YQBDzoSohQ0wbLN4@bombadil.infradead.org> (raw)
In-Reply-To: <20210723174919.ka3tzyre432uilf7@garbanzo>

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

  reply	other threads:[~2021-07-27 17:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-03  0:19 [PATCH v6 0/3] zram: fix few sysfs races Luis Chamberlain
2021-07-03  0:19 ` [PATCH v6 1/3] zram: fix crashes with cpu hotplug multistate Luis Chamberlain
2021-07-03  0:19 ` [PATCH v6 2/3] zram: fix deadlock with sysfs attribute usage and module removal Luis Chamberlain
2021-07-10 19:28   ` Andrew Morton
2021-07-11  5:00     ` Greg KH
2021-07-12 23:17     ` Luis Chamberlain
2021-07-21 11:29   ` Greg KH
2021-07-22 22:17     ` Luis Chamberlain
2021-07-23 11:15       ` Greg KH
2021-07-23 17:49         ` Luis Chamberlain
2021-07-27 17:35           ` Luis Chamberlain [this message]
2021-07-03  0:19 ` [PATCH v6 3/3] zram: use ATTRIBUTE_GROUPS Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YQBDzoSohQ0wbLN4@bombadil.infradead.org \
    --to=mcgrof@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.com \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.