From: Jerome Marchand <jmarchan@redhat.com>
To: Nitin Gupta <ngupta@vflare.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
Linux Kernel List <linux-kernel@vger.kernel.org>,
Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH 1/2] staging: zram: fix zram locking
Date: Thu, 08 Sep 2011 10:05:40 +0200 [thread overview]
Message-ID: <4E687754.1040005@redhat.com> (raw)
In-Reply-To: <4E681BC9.4010901@vflare.org>
On 09/08/2011 03:35 AM, Nitin Gupta wrote:
> On 09/06/2011 09:02 AM, Jerome Marchand wrote:
>> Currently init_lock only prevents concurrent execution of zram_init_device()
>> and zram_reset_device() but not zram_make_request() nor sysfs store functions.
>>
>
> zram_make_request() initializes the device first time it is used and
> from then on no sysfs config writes are allowed till the device is reset
> -- for example, you cannot change disksize while a disk is in
> initialized state. So, I could not understand why we need to protect
> zram_make_request vs sysfs stores.
This is true for disksize_store() (which can race with zram_init_device(), thus
the write lock in it), not for reset_store(), which obviously can happen in
initialized state. I have actually hit those races with the following
reproducer:
---
#! /bin/sh
while true; do
for i in `seq 0 9`; do
echo 1 > /sys/block/zram0/reset&
echo $((1024*1024*500)) > /sys/block/zram0/disksize&
for i in `seq 1 10`; do
dd if=/dev/zero of=/dev/zram0 bs=4k count=1 2>/dev/null;
done
done;
wait;
done
>
> Thanks,
> Nitin
>
>
>
prev parent reply other threads:[~2011-09-08 8:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 13:02 [PATCH 1/2] staging: zram: fix zram locking Jerome Marchand
2011-09-06 13:02 ` [PATCH 2/2] staging: zram: prevent accessing an unallocated table when init fails early Jerome Marchand
2011-09-08 1:35 ` [PATCH 1/2] staging: zram: fix zram locking Nitin Gupta
2011-09-08 8:05 ` Jerome Marchand [this message]
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=4E687754.1040005@redhat.com \
--to=jmarchan@redhat.com \
--cc=gregkh@suse.de \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ngupta@vflare.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.