On Fri, Sep 04, 2020 at 04:18:42PM -0500, Eric Blake wrote:
The NBD protocol states that a 0-length request is undefined; we were inconsistent in that we let it through for read, write, and cache, but blocked it for trim, zero, and block_status. The NBD protocol also has documented rules on handling access beyond EOF, but we are currently wasting traffic to the server when we can give the same answer ourselves. Exposing this as a strictness knob gives the user finer-grained control over what behavior they want.
---
Question: should this be split into two flags, one to prevent 0-length requests, and the other to prevent out-of-bounds requests?
Looks fine, ACK. My only comment would be that it might be better to factor the checking code into a new function -- it looks like the checks only differ by one errno value. Two flags could be better here because I can see it might be useful to disable one check but not the other, but up to you. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org