Skip to content
Snippets Groups Projects
  • Naohiro Aota's avatar
    ad4feaca
    file-posix: fix over-writing of returning zone_append offset · ad4feaca
    Naohiro Aota authored
    
    raw_co_zone_append() sets "s->offset" where "BDRVRawState *s". This pointer
    is used later at raw_co_prw() to save the block address where the data is
    written.
    
    When multiple IOs are on-going at the same time, a later IO's
    raw_co_zone_append() call over-writes a former IO's offset address before
    raw_co_prw() completes. As a result, the former zone append IO returns the
    initial value (= the start address of the writing zone), instead of the
    proper address.
    
    Fix the issue by passing the offset pointer to raw_co_prw() instead of
    passing it through s->offset. Also, remove "offset" from BDRVRawState as
    there is no usage anymore.
    
    Fixes: 4751d09a ("block: introduce zone append write for zoned devices")
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Message-Id: <20231030073853.2601162-1-naohiro.aota@wdc.com>
    Reviewed-by: default avatarSam Li <faithilikerun@gmail.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarHanna Czenczek <hreitz@redhat.com>
    ad4feaca
    History
    file-posix: fix over-writing of returning zone_append offset
    Naohiro Aota authored
    
    raw_co_zone_append() sets "s->offset" where "BDRVRawState *s". This pointer
    is used later at raw_co_prw() to save the block address where the data is
    written.
    
    When multiple IOs are on-going at the same time, a later IO's
    raw_co_zone_append() call over-writes a former IO's offset address before
    raw_co_prw() completes. As a result, the former zone append IO returns the
    initial value (= the start address of the writing zone), instead of the
    proper address.
    
    Fix the issue by passing the offset pointer to raw_co_prw() instead of
    passing it through s->offset. Also, remove "offset" from BDRVRawState as
    there is no usage anymore.
    
    Fixes: 4751d09a ("block: introduce zone append write for zoned devices")
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Message-Id: <20231030073853.2601162-1-naohiro.aota@wdc.com>
    Reviewed-by: default avatarSam Li <faithilikerun@gmail.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarHanna Czenczek <hreitz@redhat.com>