[Varnish] #1343: Storage file handling is confused if file exists

Varnish varnish-bugs at varnish-cache.org
Wed Oct 29 14:59:11 CET 2014


#1343: Storage file handling is confused if file exists
----------------------+-----------------------------------------------
 Reporter:  lkarsten  |       Owner:  Martin Blix Grydeland <martin@…>
     Type:  defect    |      Status:  closed
 Priority:  normal    |   Milestone:
Component:  varnishd  |     Version:  trunk
 Severity:  minor     |  Resolution:  fixed
 Keywords:            |
----------------------+-----------------------------------------------

Comment (by kristian):

 For the record and for future troubleshooters (we ran into this on
 #varnish today and it took a while to map it to this bug):

 The original description is correct but somewhat misses the bigger point.
 It points out that the error message is misleading, but the real problem
 is that the calculation is plain wrong, and the error message would have
 been meaningful if the calculations to get there were correct.

 Part of the problem here is that it DID take existing file size into
 account, but incorrectly.  If the old size was 4GB and the new size was
 2GB, you'd check "if (2G-4G > fssize) { set size to 80% of fssize }". It
 would seem that the subtraction was done unsigned, since all variables are
 (correctly) unsigned. I'm somewhat surprised this wasn't caught by some
 warning, as this should have been cast to some signed type if my
 assumptions are correct...

 The result was that reducing size of -s file would blow the file up to 80%
 of fssize. Increasing file size would be treated fine, though still not
 taking sparseness into account I suppose.

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1343#comment:5>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator



More information about the varnish-bugs mailing list