• Damien Le Moal's avatar
    zonefs: Fix management of open zones · 1da18a29
    Damien Le Moal authored
    The mount option "explicit_open" manages the device open zone
    resources to ensure that if an application opens a sequential file for
    writing, the file zone can always be written by explicitly opening
    the zone and accounting for that state with the s_open_zones counter.
    
    However, if some zones are already open when mounting, the device open
    zone resource usage status will be larger than the initial s_open_zones
    value of 0. Ensure that this inconsistency does not happen by closing
    any sequential zone that is open when mounting.
    
    Furthermore, with ZNS drives, closing an explicitly open zone that has
    not been written will change the zone state to "closed", that is, the
    zone will remain in an active state. Since this can then cause failures
    of explicit open operations on other zones if the drive active zone
    resources are exceeded, we need to make sure that the zone is not
    active anymore by resetting it instead of closing it. To address this,
    zonefs_zone_mgmt() is modified to change a REQ_OP_ZONE_CLOSE request
    into a REQ_OP_ZONE_RESET for sequential zones that have not been
    written.
    
    Fixes: b5c00e97 ("zonefs: open/close zone on file open/close")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: default avatarHans Holmberg <hans.holmberg@wdc.com>
    1da18a29
super.c 47.1 KB