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] [day] [month] [year] [list]
Date:   Thu, 10 Nov 2022 10:32:14 +0800
From:   Sheng Yong <shengyong@...o.com>
To:     Chao Yu <chao@...nel.org>, jaegeuk@...nel.org
Cc:     linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] f2fs: fix to enable compress for newly created file if
 extension matches



在 2022/11/9 21:57, Chao Yu 写道:
> On 2022/11/9 19:01, Sheng Yong wrote:
>> If compress_extension is set, and a newly created file matches the
>> extension, the file could be marked as compression file. However,
>> if inline_data is also enabled, there is no chance to check its
>> extension since f2fs_should_compress() always returns false.
>>
>> So if a new file is created (its inode has I_NEW flag and must have
>> no pin/atomic/swap flag), instead of calling f2fs_should_compress(),
>> checking its file type is enough here.
>>
>> Signed-off-by: Sheng Yong <shengyong@...o.com>
>> ---
>>   fs/f2fs/namei.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
>> index e104409c3a0e5..99dbd051ae0ba 100644
>> --- a/fs/f2fs/namei.c
>> +++ b/fs/f2fs/namei.c
>> @@ -295,9 +295,14 @@ static void set_compress_inode(struct 
>> f2fs_sb_info *sbi, struct inode *inode,
>>
>>          if (!f2fs_sb_has_compression(sbi) ||
>>                          F2FS_I(inode)->i_flags & F2FS_NOCOMP_FL ||
>> -                       !f2fs_may_compress(inode) ||
>>                          (!ext_cnt && !noext_cnt))
>>                  return;
>> +       if (inode->i_state & I_NEW) {
>> +               if (!S_ISREG(inode->i_mode))
>> +                       return;
>> +       } else if (!f2fs_may_compress(inode)) {
>> +               return;
>> +       }
> 
> How about moving set_compress_inode() into f2fs_new_inode()?

Hi, Chao

I prefer not to move it. Because set_compress_inode() needs 
dentry->d_name as a parameter, but dentry is not passed to 
f2fs_new_inode(). I think that's why it was called outside of 
f2fs_new_inode() in the first place.

thanks,
shengyong

> 
>      if (f2fs_sb_has_compression(sbi)) {
>          /* Inherit the compression flag in directory */
>          if ((F2FS_I(dir)->i_flags & F2FS_COMPR_FL) &&
>                      f2fs_may_compress(inode))
>              set_compress_context(inode);
> 
>          set_compress_inode(sbi, inode, name);
>      }
> 
>      /* Should enable inline_data after compression set */
>      if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode))
>          set_inode_flag(inode, FI_INLINE_DATA);
> 
>>
>>          f2fs_down_read(&sbi->sb_lock);
>>
>> -- 
>> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ