Leases for mutable files are handled incorrectly in `slot_testv_and_readv_and_writev`
Created by: tomprince
There are a couple of things that can happen:
- the writev could indicate that a new sharefile should be created on this server. In this case, the sharefile will not have a lease applied to it, so the file could be collected immediately.
- the first share found doesn't have a lease (probably from the first case). In this case, we will treat things as if no sharefiles have a lease[1], so pay for the entire existing size of the file, and extend the lease, losing the value of any existing leases.
- Otherwise, we pay for the difference in size between the current and new sizes, but don't change the lease time, losing the paid value beyond the current lease time.
[1] StorageServer.get_slot_leases
(called by has_active_leases
) returns the lease from the first sharefile it finds. It looks like that function is not called in tahoe at all.