From: Nitin Gupta <ngupta@vflare.org>
To: Jerome Marchand <jmarchan@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
Linux Kernel List <linux-kernel@vger.kernel.org>,
Robert Jennings <rcj@linux.vnet.ibm.com>,
Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH 4/4] Staging: zram: Replace mutex lock by a R/W semaphore
Date: Fri, 10 Jun 2011 09:46:46 -0700 [thread overview]
Message-ID: <4DF24A76.50703@vflare.org> (raw)
In-Reply-To: <1307712529-9757-4-git-send-email-jmarchan@redhat.com>
On 06/10/2011 06:28 AM, Jerome Marchand wrote:
> Currently, nothing protects zram table from concurrent access.
> For instance, ZRAM_UNCOMPRESSED bit can be cleared by zram_free_page()
> called from a concurrent write between the time ZRAM_UNCOMPRESSED has
> been set and the time it is tested to unmap KM_USER0 in
> zram_bvec_write(). This ultimately leads to kernel panic.
>
> Also, a read request can occurs when the page has been freed by a
> running write request and before it has been updated, leading to
> zero filled block being incorrectly read and "Read before write"
> error message.
>
> This patch replace the current mutex by a rw_semaphore. It extends
> the protection to zram table (currently, only compression buffers are
> protected) and read requests (currently, only write requests are
> protected).
>
These locking issues are probably remnants of earlier versions where
zram could be used only as a swap disks under which case it was not
possible for a read and write on the same sector (page) to happen
concurrently and thus there was no need to protect the table.
> Signed-off-by: Jerome Marchand<jmarchan@redhat.com>
Reviewed-by: Nitin Gupta <ngupta@vflare.org>
Thanks,
Nitin
next prev parent reply other threads:[~2011-06-10 16:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-10 13:28 [PATCH 1/4] Staging: zram: Remove useless offset calculation in handle_uncompressed_page() Jerome Marchand
2011-06-10 13:28 ` [PATCH 2/4] Staging: zram: Refactor zram_read/write() functions Jerome Marchand
2011-06-10 13:28 ` [PATCH 3/4] Staging: zram: allow partial page operations Jerome Marchand
2011-06-10 13:28 ` [PATCH 4/4] Staging: zram: Replace mutex lock by a R/W semaphore Jerome Marchand
2011-06-10 16:46 ` Nitin Gupta [this message]
2011-06-10 16:41 ` [PATCH 3/4] Staging: zram: allow partial page operations Nitin Gupta
2011-06-13 9:42 ` Jerome Marchand
2011-06-14 14:49 ` Jeff Moyer
2011-06-14 16:36 ` Martin K. Petersen
2011-07-01 9:47 ` Jerome Marchand
2011-07-14 3:19 ` Nitin Gupta
2011-07-14 3:25 ` Nitin Gupta
2011-07-14 3:24 ` [PATCH 2/4] Staging: zram: Refactor zram_read/write() functions Nitin Gupta
2011-06-10 16:38 ` [PATCH 1/4] Staging: zram: Remove useless offset calculation in handle_uncompressed_page() Nitin Gupta
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=4DF24A76.50703@vflare.org \
--to=ngupta@vflare.org \
--cc=gregkh@suse.de \
--cc=jmarchan@redhat.com \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rcj@linux.vnet.ibm.com \
/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