lkml.org 
[lkml]   [2014]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] zram: correct offset usage in zram_bio_discard
From
On Wed, Apr 23, 2014 at 11:08 AM, Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> On Wed, Apr 23, 2014 at 10:32:30AM +0800, Weijie Yang wrote:
>> On Wed, Apr 23, 2014 at 3:55 AM, Andrew Morton
>> <akpm@linux-foundation.org> wrote:
>> > On Tue, 22 Apr 2014 11:14:02 +0800 Weijie Yang <weijie.yang@samsung.com> wrote:
>> >
>> >> we want to skip the logical block which is partially covered by
>> >> the discard bio, so check the remaining size and subtract it if
>> >> there is a need to goto the next logical block.
>> >>
>> >> This patch corrects the offset usage in zram_bio_discard.
>> >>
>> >
>> > What were the end-user visible effects of the bug?
>> >
>> > Please always include this information when fixing something so that
>> > others can work out which kernel(s) need patching.
>> >
>>
>> Thanks for your advise, I will resend this patch and add the end-user
>> visible effect information.
>
> Thanks for fixing it.
>
> As far as I understand, there is no end-user visible effect, because
> request size is alway PAGE_SIZE aligned and if n < PAGE_SIZE,
> no real operation happens. Am I missing?

The zram only limit ZRAM_LOGICAL_BLOCK_SIZE(4K) aligned,
not PAGE_SIZE aligned.

Consider the following scenario:
on some architecture or config, PAGE_SIZE is 64K for example
filesystem is set up on zram disk without PAGE_SIZE aligned.
a discard bio leads to a offset = 4K, size=72K
normally, it should not really discard any physical block as it partially
cover two physical blocks.
However, with the current offset usage, it will discard the second
physical block and free its memory, which will cause filesystem breakdown.

regards,

> Anyway,
>
> Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> Thanks.


\
 
 \ /
  Last update: 2014-04-23 06:41    [W:0.048 / U:1.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site