lkml.org 
[lkml]   [2021]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 5.10 045/306] f2fs: fix to do sanity check for sb/cp fields correctly
    Hi!

    This code looks quite confused: part of function returns 1 on
    corruption, part returns -errno. The problem is not stable-specific.

    Best regards,
    Pavel

    > @@ -3058,6 +3061,17 @@ int f2fs_sanity_check_ckpt(struct f2fs_s
    > return 1;
    > }
    >
    > + nat_blocks = nat_segs << log_blocks_per_seg;
    > + nat_bits_bytes = nat_blocks / BITS_PER_BYTE;
    > + nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8);
    > + if (__is_set_ckpt_flags(ckpt, CP_NAT_BITS_FLAG) &&
    > + (cp_payload + F2FS_CP_PACKS +
    > + NR_CURSEG_PERSIST_TYPE + nat_bits_blocks >= blocks_per_seg)) {
    > + f2fs_warn(sbi, "Insane cp_payload: %u, nat_bits_blocks: %u)",
    > + cp_payload, nat_bits_blocks);
    > + return -EFSCORRUPTED;
    > + }
    > +
    > if (unlikely(f2fs_cp_error(sbi))) {
    > f2fs_err(sbi, "A bug case: need to run fsck");
    > return 1;
    >

    --
    DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
    HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2021-09-19 21:07    [W:2.323 / U:0.144 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site