• Dmitry Fomichev's avatar
    dm zoned: improve error handling in reclaim · 8b7c17bb
    Dmitry Fomichev authored
    commit b234c6d7 upstream.
    
    There are several places in reclaim code where errors are not
    propagated to the main function, dmz_reclaim(). This function
    is responsible for unlocking zones that might be still locked
    at the end of any failed reclaim iterations. As the result,
    some device zones may be left permanently locked for reclaim,
    degrading target's capability to reclaim zones.
    
    This patch fixes these issues as follows -
    
    Make sure that dmz_reclaim_buf(), dmz_reclaim_seq_data() and
    dmz_reclaim_rnd_data() return error codes to the caller.
    
    dmz_reclaim() function is renamed to dmz_do_reclaim() to avoid
    clashing with "struct dmz_reclaim" and is modified to return the
    error to the caller.
    
    dmz_get_zone_for_reclaim() now returns an error instead of NULL
    pointer and reclaim code checks for that error.
    
    Error logging/debug messages are added where necessary.
    
    Fixes: 3b1a94c8 ("dm zoned: drive-managed zoned block device target")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarDmitry Fomichev <dmitry.fomichev@wdc.com>
    Reviewed-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    8b7c17bb
dm-zoned-metadata.c 58.4 KB