Project

General

Profile

Bug #4012

Upper limit of zfs set bounds check for refreservation on volumes is too low

Added by Sašo Kiselkov about 7 years ago. Updated almost 7 years ago.

Status:
Feedback
Priority:
Normal
Category:
-
Start date:
2013-08-08
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

When doing a zfs set refreservation on a volume, the upper bound of the value check is set too low. ATM the bounds check validates that the new refreservation value is <= volume size, but this may not be enough to reserve all space needed for the volume, as there is some metadata overhead. When non-sparse volumes are created, this is even explicitly handled by libzfs in zvol_volsize_to_reservation - the reservation is slightly overprovisioned (which is correct). However, once a volume is set to sparse (refreservation=0), it is not possible to go back to the original value, as we will bump up against the broken check in libzfs:

# zfs create -V 128M rpool/test 
# zfs get -p refreservation rpool/test 
NAME       PROPERTY        VALUE      SOURCE 
rpool/test refreservation  138674176  local 
# zfs set refreservation=138674176 rpool/test 
cannot set property for 'rpool/test': 'refreservation' is greater than current volume size 

The fix is simple: make the bounds check in libzfs check against the overprovisioned value as used at volume creation time.

History

#1

Updated by Sašo Kiselkov almost 7 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Feedback

Coding done, all that's needed is review & RTI.

Also available in: Atom PDF