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]
Message-ID: <c2bc04b6-be23-426f-ad6c-1d47dad7259b@kernel.org>
Date: Tue, 20 Feb 2024 14:13:56 +0800
From: Chao Yu <chao@...nel.org>
To: Zhiguo Niu <niuzhiguo84@...il.com>
Cc: Jaegeuk Kim <jaegeuk@...nel.org>, ke.wang@...soc.com,
 linux-kernel@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
 hongyu.jin@...soc.com, Zhiguo Niu <zhiguo.niu@...soc.com>
Subject: Re: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of
 f2fs_is_valid_blkaddr

On 2024/2/20 13:34, Zhiguo Niu wrote:
> On Tue, Feb 20, 2024 at 10:36 AM Chao Yu <chao@...nel.org> wrote:
>>
>> On 2024/2/19 22:36, Chao Yu wrote:
>>>>>> Please think about how to optimize this, which is really ugly now
>> ---
>>    fs/f2fs/checkpoint.c | 12 ++++++++----
>>    1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 87b7c988c8ca..089c26b80be3 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -135,7 +135,7 @@ struct page *f2fs_get_tmp_page(struct f2fs_sb_info *sbi, pgoff_t index)
>>    }
>>
>>    static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
>> -                                                       int type)
>> +                                               int type, bool *record_error)
>>    {
>>          struct seg_entry *se;
>>          unsigned int segno, offset;
>> @@ -160,6 +160,7 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
>>                           blkaddr, exist);
>>                  set_sbi_flag(sbi, SBI_NEED_FSCK);
>>                  dump_stack();
>> +               *record_error = true;
>>          }
>>
>>          return exist;
>> @@ -209,10 +210,13 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>>                          dump_stack();
>>                          goto err;
>>                  } else {
>> -                       valid = __is_bitmap_valid(sbi, blkaddr, type);
>> -                       if ((!valid && type != DATA_GENERIC_ENHANCE_UPDATE) ||
>> -                               (valid && type == DATA_GENERIC_ENHANCE_UPDATE))
>> +                       bool record_error = false;
>> +
>> +                       valid = __is_bitmap_valid(sbi, blkaddr, type,
>> +                                                       &record_error);
>> +                       if (!valid || record_error)
> if   type == DATA_GENERIC_ENHANCE_UPDATE && bitmap check invalid,  it
> is a OK case, but !valid
> will goto do error handling.

Yes, it looks we need to remove !valid condition to avoid error handling,
and assign record_error correctly inside __is_bitmap_valid() for all the
cases.

> I think do f2fs_handle_error in __is_bitmap_valid is a good way.

Let me revise the diff patch for comments.

Thanks,

> 
>>                                  goto err;
>> +                       return valid;
>>                  }
>>                  break;
>>          case META_GENERIC:
>> --
>> 2.40.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ