lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 28 May 2020 10:55:50 +0800
From:   Chao Yu <yuchao0@...wei.com>
To:     Sahitya Tummala <stummala@...eaurora.org>,
        Jaegeuk Kim <jaegeuk@...nel.org>,
        <linux-f2fs-devel@...ts.sourceforge.net>
CC:     <linux-kernel@...r.kernel.org>
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix retry logic in
 f2fs_write_cache_pages()

On 2020/5/28 10:45, Chao Yu wrote:
> On 2020/5/27 10:20, Sahitya Tummala wrote:
>> In case a compressed file is getting overwritten, the current retry
>> logic doesn't include the current page to be retried now as it sets
>> the new start index as 0 and new end index as writeback_index - 1.
>> This causes the corresponding cluster to be uncompressed and written
>> as normal pages without compression. Fix this by allowing writeback to
>> be retried for the current page as well (in case of compressed page
>> getting retried due to index mismatch with cluster index). So that
>> this cluster can be written compressed in case of overwrite.
>>
>> Signed-off-by: Sahitya Tummala <stummala@...eaurora.org>
>> ---
>>  fs/f2fs/data.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index 4af5fcd..bfd1df4 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -3024,7 +3024,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
>>  	if ((!cycled && !done) || retry) {
> 
> IMO, we add retry logic in wrong place, you can see that cycled value is
> zero only if wbc->range_cyclic is true, in that case writeback_index is valid.
> 
> However if retry is true and wbc->range_cyclic is false, then writeback_index
> would be uninitialized variable.
> 
> Thoughts?
> 
> Thanks,
> 
>>  		cycled = 1;
>>  		index = 0;
>> -		end = writeback_index - 1;

BTW, I notice that range_cyclic writeback flow was refactored in below commit,
and skeleton of f2fs.writepages was copied from mm/page-writeback.c::write_cache_pages(),
I guess we need follow that change.

64081362e8ff ("mm/page-writeback.c: fix range_cyclic writeback vs writepages deadlock")

Thanks,

>> +		end = retry ? -1 : writeback_index - 1;
>>  		goto retry;
>>  	}
>>  	if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
>>
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@...ts.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ