• J
    btrfs: change how we decide to commit transactions during flushing · 996478ca
    Josef Bacik 提交于
    Nikolay reported that generic/273 was failing currently with ENOSPC.
    Turns out this is because we get to the point where the outstanding
    reservations are greater than the pinned space on the fs.  This is a
    mistake, previously we used the current reservation amount in
    may_commit_transaction, not the entire outstanding reservation amount.
    Fix this to find the minimum byte size needed to make progress in
    flushing, and pass that into may_commit_transaction.  From there we can
    make a smarter decision on whether to commit the transaction or not.
    This fixes the failure in generic/273.
    
    From Nikolai, IOW: when we go to the final stage of deciding whether to
    do trans commit, instead of passing all the reservations from all
    tickets we just pass the reservation for the current ticket. Otherwise,
    in case all reservations exceed pinned space, then we don't commit
    transaction and fail prematurely. Before we passed num_bytes from
    flush_space, where num_bytes was the sum of all pending reserverations,
    but now all we do is take the first ticket and commit the trans if we
    can satisfy that.
    
    Fixes: 957780eb ("Btrfs: introduce ticketed enospc infrastructure")
    Cc: stable@vger.kernel.org # 4.8
    Reported-by: NNikolay Borisov <nborisov@suse.com>
    Signed-off-by: NJosef Bacik <jbacik@fb.com>
    Reviewed-by: NNikolay Borisov <nborisov@suse.com>
    Tested-by: NNikolay Borisov <nborisov@suse.com>
    [ added Nikolai's comment ]
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    996478ca
extent-tree.c 301.7 KB