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>] [day] [month] [year] [list]
Message-ID: <5bf29cb0-96a6-4100-8755-750215d31ab6@kernel.org>
Date: Tue, 20 Feb 2024 15:58:00 +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 15:45, Zhiguo Niu wrote:
> 
> 
> On Tue, Feb 20, 2024 at 2:32 PM Chao Yu <chao@...nel.org <mailto:chao@...nel.org>> wrote:
>  >
>  > On 2024/2/20 13:34, Zhiguo Niu wrote:
>  > > I think do f2fs_handle_error in __is_bitmap_valid is a good way.
>  >
>  > Like this?
>  >
>  > ---
>  >   fs/f2fs/checkpoint.c | 28 ++++++++++++++--------------
>  >   1 file changed, 14 insertions(+), 14 deletions(-)
>  >
>  > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>  > index 87b7c988c8ca..b8a7e83eb4e0 100644
>  > --- a/fs/f2fs/checkpoint.c
>  > +++ b/fs/f2fs/checkpoint.c
>  > @@ -155,21 +155,24 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
>  >                 return exist;
>  >
>  >         if ((exist && type == DATA_GENERIC_ENHANCE_UPDATE) ||
>  > -               (!exist && type == DATA_GENERIC_ENHANCE)) {
>  > -               f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d",
>  > -                        blkaddr, exist);
>  > -               set_sbi_flag(sbi, SBI_NEED_FSCK);
>  > -               dump_stack();
>  > -       }
>  > -
>  > +               (!exist && type == DATA_GENERIC_ENHANCE))
>  > +               goto out_err;
>  > +       if (!exist && type != DATA_GENERIC_ENHANCE_UPDATE)
>  > +               goto out_handle;
>  > +       return exist;
>  > +out_err:
>  > +       f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d",
>  > +                blkaddr, exist);
>  > +       set_sbi_flag(sbi, SBI_NEED_FSCK);
>  > +       dump_stack();
>  > +out_handle:
>  > +       f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
>  >         return exist;
>  >   }
>  >
>  >   static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  >                                         block_t blkaddr, int type)
>  >   {
>  > -       bool valid = false;
>  > -
>  >         switch (type) {
>  >         case META_NAT:
>  >                 break;
>  > @@ -209,10 +212,7 @@ 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))
>  > -                               goto err;
>  > +                       return __is_bitmap_valid(sbi, blkaddr, type);
>  >                 }
>  >                 break;
>  >         case META_GENERIC:
>  > @@ -227,7 +227,7 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  >         return true;
>  >   err:
>  >         f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
>  > -       return valid;
>  > +       return false;
> I think it's OK.
> Do we need to wait for Jaegeuk Kim’s suggestion or should I update the new patch  version first😀?
> thanks!

I guess we'd better to wait for Jaegeuk's comments.

Thanks,

>  >   }
>  >
>  >   bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  > --
>  > 2.40.1
>  >
>  >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ