lkml.org 
[lkml]   [2020]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 4.19 29/71] btrfs: tree-checker: Verify inode item
    From
    Date


    On 2020/11/11 下午9:13, Pavel Machek wrote:
    > Hi!
    >
    >> From: Qu Wenruo <wqu@suse.com>
    >>
    >> commit 496245cac57e26d8b738d85c7a29cf9a47610f3f upstream.
    >>
    >> There is a report in kernel bugzilla about mismatch file type in dir
    >> item and inode item.
    >>
    >> This inspires us to check inode mode in inode item.
    >>
    >> This patch will check the following members:
    >
    >> + /* Here we use super block generation + 1 to handle log tree */
    >> + if (btrfs_inode_generation(leaf, iitem) > super_gen + 1) {
    >> + inode_item_err(fs_info, leaf, slot,
    >> + "invalid inode generation: has %llu expect (0, %llu]",
    >> + btrfs_inode_generation(leaf, iitem),
    >> + super_gen + 1);
    >> + return -EUCLEAN;
    >> + }
    >
    > Printk suggests btrfs_inode_generation() may not be zero, but the
    > condition does not actually check that. Should that be added?

    Sorry, btrfs_inode_generation() here is exactly what we're checking
    here, so what's wrong?

    Or did you mean the next chunk of btrfs_inode_transid() check?

    That error message is wrong, and we had upstream fix for it:
    f96d6960abbc ("btrfs: tree-checker: fix the error message for transid
    error")

    Thanks,
    Qu

    >
    >> + /* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */
    >> + if (btrfs_inode_transid(leaf, iitem) > super_gen + 1) {
    >> + inode_item_err(fs_info, leaf, slot,
    >> + "invalid inode generation: has %llu expect [0, %llu]",
    >> + btrfs_inode_transid(leaf, iitem), super_gen + 1);
    >> + return -EUCLEAN;
    >> + }
    >
    > Best regards,
    > Pavel
    >

    \
     
     \ /
      Last update: 2020-11-11 14:40    [W:2.320 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site