Skip to content

Commit

Permalink
CA-122162: immediately fail request when reaching 2TiB limit
Browse files Browse the repository at this point in the history
When hitting the 2TiB limit, fail the request with ENOSPC instead of
EIO, because tapdisk retries requests that have failed with EIO hoping
that the request will utterly succeeded, which can never happen in our
case.

Signed-off-by: Thanos Makatos <[email protected]>
Reviewed-by: Keith Petley <[email protected]>

GitHub: closes #68 on xapi-project/blktap
  • Loading branch information
Thanos Makatos committed Jan 13, 2014
1 parent 8c8bbb6 commit 57ee889
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/block-vhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ reserve_new_block(struct vhd_state *s, uint32_t blk)
gap = (s->spp - ((s->next_db + s->bm_secs) % s->spp));

if (s->next_db + gap > UINT_MAX)
return (uint64_t)EIO << 32;
return (uint64_t)ENOSPC << 32;

s->bat.pbw_blk = blk;
s->bat.pbw_offset = s->next_db + gap;
Expand Down Expand Up @@ -1511,7 +1511,7 @@ allocate_block(struct vhd_state *s, uint32_t blk)
}

if (next_db > UINT_MAX)
return -EIO;
return -ENOSPC;

s->next_db = next_db;

Expand Down

0 comments on commit 57ee889

Please sign in to comment.