From: Minchan Kim <minchan@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: ngupta@vflare.org, sergey.senozhatsky.work@gmail.com,
axboe@kernel.dk, 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 v2 2/4] zram: avoid disksize setting when device is being claimed
Date: Wed, 19 May 2021 12:56:17 -0700 [thread overview]
Message-ID: <YKVtYfOM3RkS3gQh@google.com> (raw)
In-Reply-To: <20210423011108.11988-3-mcgrof@kernel.org>
On Fri, Apr 23, 2021 at 01:11:06AM +0000, Luis Chamberlain wrote:
> As with other areas of the zram diver, check if the zram
> block device is being claimed but do it early to avoid
> trying to set something up for a zram device which may
> be on its way out.
I guess you're talking about zram_remove race with disksize_store.
Please add some code sequence diagram like previous patch, which
makes thing more clear.
Otherwise, looks good to me.
>
> This doesn't fix a known crash, however the potential for
> an issue issue is found through code inspection.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
> drivers/block/zram/zram_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 431b60cd85c1..6051d20b88c3 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1729,7 +1729,7 @@ static ssize_t disksize_store(struct device *dev,
>
> mutex_lock(&zram_index_mutex);
>
> - if (!zram_up) {
> + if (!zram_up || zram->claim) {
> err = -ENODEV;
> goto out;
> }
> --
> 2.27.0
>
next prev parent reply other threads:[~2021-05-19 19:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 1:11 [PATCH v2 0/4] zram: fix few sysfs races Luis Chamberlain
2021-04-23 1:11 ` [PATCH v2 1/4] zram: fix crashes due to use of cpu hotplug multistate Luis Chamberlain
2021-05-19 19:54 ` Minchan Kim
2021-04-23 1:11 ` [PATCH v2 2/4] zram: avoid disksize setting when device is being claimed Luis Chamberlain
2021-05-19 19:56 ` Minchan Kim [this message]
2021-04-23 1:11 ` [PATCH v2 3/4] zram: fix deadlock with sysfs attribute usage and driver removal Luis Chamberlain
2021-04-23 1:11 ` [PATCH v2 4/4] zram: fix possible races between sysfs use and bdev access Luis Chamberlain
2021-05-19 20:09 ` [PATCH v2 0/4] zram: fix few sysfs races Minchan Kim
2021-05-19 20:20 ` Luis Chamberlain
2021-05-21 20:01 ` Greg Kroah-Hartman
2021-05-21 20:16 ` Luis Chamberlain
2021-05-21 20:45 ` Greg Kroah-Hartman
2021-05-21 21:08 ` Luis Chamberlain
2021-05-22 7:48 ` Greg Kroah-Hartman
2021-05-25 1:16 ` Luis Chamberlain
2021-05-25 7:41 ` Greg Kroah-Hartman
2021-06-21 23:19 ` 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=YKVtYfOM3RkS3gQh@google.com \
--to=minchan@kernel.org \
--cc=axboe@kernel.dk \
--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=mcgrof@kernel.org \
--cc=ngupta@vflare.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox