Skip to content

Commit

Permalink
block/file-posix: fix update_zones_wp() caller
Browse files Browse the repository at this point in the history
When the zoned request fail, it needs to update only the wp of
the target zones for not disrupting the in-flight writes on
these other zones. The wp is updated successfully after the
request completes.

Fixed the callers with right offset and nr_zones.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Message-Id: <20230825040556.4217-1-faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[hreitz: Rebased and fixed comment spelling]
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
(cherry picked from commit 10b9e08)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
sgzerolc authored and Michael Tokarev committed Nov 9, 2023
1 parent cc9f53b commit a753815
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions block/file-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,10 @@ static int coroutine_fn raw_co_prw(BlockDriverState *bs, uint64_t offset,
}
}
} else {
update_zones_wp(bs, s->fd, 0, 1);
/*
* write and append write are not allowed to cross zone boundaries
*/
update_zones_wp(bs, s->fd, offset, 1);
}

qemu_co_mutex_unlock(&wps->colock);
Expand Down Expand Up @@ -3470,7 +3473,7 @@ static int coroutine_fn raw_co_zone_mgmt(BlockDriverState *bs, BlockZoneOp op,
len >> BDRV_SECTOR_BITS);
ret = raw_thread_pool_submit(handle_aiocb_zone_mgmt, &acb);
if (ret != 0) {
update_zones_wp(bs, s->fd, offset, i);
update_zones_wp(bs, s->fd, offset, nrz);
error_report("ioctl %s failed %d", op_name, ret);
return ret;
}
Expand Down

0 comments on commit a753815

Please sign in to comment.