• T
    ext4: don't use the orphan list when migrating an inode · 277de38d
    Theodore Ts'o 提交于
    stable inclusion
    from linux-4.19.226
    commit 33446496d21753b5ceb55be4d6e593b487a61239
    
    --------------------------------
    
    commit 6eeaf88f upstream.
    
    We probably want to remove the indirect block to extents migration
    feature after a deprecation window, but until then, let's fix a
    potential data loss problem caused by the fact that we put the
    tmp_inode on the orphan list.  In the unlikely case where we crash and
    do a journal recovery, the data blocks belonging to the inode being
    migrated are also represented in the tmp_inode on the orphan list ---
    and so its data blocks will get marked unallocated, and available for
    reuse.
    
    Instead, stop putting the tmp_inode on the oprhan list.  So in the
    case where we crash while migrating the inode, we'll leak an inode,
    which is not a disaster.  It will be easily fixed the next time we run
    fsck, and it's better than potentially having blocks getting claimed
    by two different files, and losing data as a result.
    Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
    Reviewed-by: NLukas Czerner <lczerner@redhat.com>
    Cc: stable@kernel.org
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
    Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
    277de38d
migrate.c 16.7 KB