• J
    btrfs: mark ordered extent and inode with error if we fail to finish · 4952fc08
    Josef Bacik 提交于
    stable inclusion
    from stable-5.10.43
    commit b547a16b24918edd63042f9d81c0d310212d2e94
    bugzilla: 109284
    CVE: NA
    
    --------------------------------
    
    commit d61bec08 upstream.
    
    While doing error injection testing I saw that sometimes we'd get an
    abort that wouldn't stop the current transaction commit from completing.
    This abort was coming from finish ordered IO, but at this point in the
    transaction commit we should have gotten an error and stopped.
    
    It turns out the abort came from finish ordered io while trying to write
    out the free space cache.  It occurred to me that any failure inside of
    finish_ordered_io isn't actually raised to the person doing the writing,
    so we could have any number of failures in this path and think the
    ordered extent completed successfully and the inode was fine.
    
    Fix this by marking the ordered extent with BTRFS_ORDERED_IOERR, and
    marking the mapping of the inode with mapping_set_error, so any callers
    that simply call fdatawait will also get the error.
    
    With this we're seeing the IO error on the free space inode when we fail
    to do the finish_ordered_io.
    
    CC: stable@vger.kernel.org # 4.19+
    Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: NDavid Sterba <dsterba@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NChen Jun <chenjun102@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    4952fc08
inode.c 289.3 KB