[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DF24A76.50703@vflare.org>
Date: Fri, 10 Jun 2011 09:46:46 -0700
From: Nitin Gupta <ngupta@...are.org>
To: Jerome Marchand <jmarchan@...hat.com>
CC: Greg Kroah-Hartman <gregkh@...e.de>,
Linux Kernel List <linux-kernel@...r.kernel.org>,
Robert Jennings <rcj@...ux.vnet.ibm.com>,
Jeff Moyer <jmoyer@...hat.com>
Subject: Re: [PATCH 4/4] Staging: zram: Replace mutex lock by a R/W semaphore
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@...hat.com>
Reviewed-by: Nitin Gupta <ngupta@...are.org>
Thanks,
Nitin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists