• Pavel Begunkov's avatar
    btrfs: fix async discard stall · ea9ed87c
    Pavel Begunkov authored
    Might happen that bg->discard_eligible_time was changed without
    rescheduling, so btrfs_discard_workfn() wakes up earlier than that new
    time, peek_discard_list() returns NULL, and all work halts and goes to
    sleep without further rescheduling even there are block groups to
    discard.
    
    It happens pretty often, but not so visible from the userspace because
    after some time it usually will be kicked off anyway by someone else
    calling btrfs_discard_reschedule_work().
    
    Fix it by continue rescheduling if block group discard lists are not
    empty.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ea9ed87c
discard.c 22.8 KB