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:   Wed, 29 Sep 2021 08:05:12 +0800
From:   Chao Yu <chao@...nel.org>
To:     Jaegeuk Kim <jaegeuk@...nel.org>
Cc:     linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] f2fs: skip f2fs_preallocate_blocks() for overwrite case

On 2021/9/29 3:08, Jaegeuk Kim wrote:
> On 09/28, Chao Yu wrote:
>> In f2fs_file_write_iter(), let's use f2fs_overwrite_io() to
>> check whethere it is overwrite case, for such case, we can skip
>> f2fs_preallocate_blocks() in order to avoid f2fs_do_map_lock(),
>> which may be blocked by checkpoint() potentially.
>>
>> Signed-off-by: Chao Yu <chao@...nel.org>
>> ---
>>   fs/f2fs/file.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 13deae03df06..51fecb2f4db5 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -4321,6 +4321,10 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>>   		preallocated = true;
>>   		target_size = iocb->ki_pos + iov_iter_count(from);
>>   
>> +		if (f2fs_overwrite_io(inode, iocb->ki_pos,
>> +						iov_iter_count(from)))
>> +			goto write;
> 
> This calls f2fs_map_blocks() which can be duplicate, if it's not the overwirte
> case. Do we have other benefit?

f2fs_overwrite_io() will break for append write case w/ below check:

	if (pos + len > i_size_read(inode))
		return false;

I guess we may only suffer double f2fs_map_blocks() for write hole
case, e.g. truncate to large size & write inside the filesize. For
this case, how about adding a condition to allow double f2fs_map_blocks()
only if write size is smaller than a threshold?

Thanks,

> 
>> +
>>   		err = f2fs_preallocate_blocks(iocb, from);
>>   		if (err) {
>>   out_err:
>> -- 
>> 2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ