retry: Check size before transactions
commitb18bc714fd52149220fc9b6c04690c4f91f2bd75
authorEric Blake <eblake@redhat.com>
Fri, 4 Oct 2019 02:35:14 +0000 (3 21:35 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 4 Oct 2019 15:13:49 +0000 (4 10:13 -0500)
treec033b5e83c2f0a1898d25e895d9e6c8996b5e889
parent1c96a7e6a0078000395d25708c2e4dd0a447e2b7
retry: Check size before transactions

Although it is unusual for a plugin to shrink size on reopen, it is
not impossible.  Failure to check our bounds could result in violating
assumptions in the plugin that all requests are in-bounds.  Note that
if the plugin gains a larger size, we merely never access the new tail
of the file (when the NBD protocol ever gains dynamic resize support,
we'll get to revisit how the retry filter fits in).  If it reports a
smaller size, and the request tries to access that portion of the
file, then retry just the same as if can_write or similar disappears,
on the hopes that yet another retry will fix the problem.

Fixes: f0f0ec49
Signed-off-by: Eric Blake <eblake@redhat.com>
filters/retry/retry.c