]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
nbd: handle ERESTARTSYS properly
authorJosef Bacik <jbacik@fb.com>
Fri, 24 Mar 2017 18:08:26 +0000 (14:08 -0400)
committerJens Axboe <axboe@fb.com>
Fri, 24 Mar 2017 21:42:47 +0000 (15:42 -0600)
commit9dd5d3ab49f74e1a3fab92c432a7600bd9081ccc
treeab7de5bd26fc932bed7ee9d3dd2610197ce98e16
parent93efe9817e651607d83e5f100076ae62d0ce0b93
nbd: handle ERESTARTSYS properly

We can submit IO in a processes context, which means there can be
pending signals.  This isn't a fatal error for NBD, but it does require
some finesse.  If the signal happens before we transmit anything then we
are ok, just requeue the request and carry on.  However if we've done a
partial transmit we can't allow anything else to be transmitted on this
socket until we transmit the remaining part of the request.  Deal with
this by keeping track of how much we've sent for the current request,
and if we get an ERESTARTSYS during any part of our transmission save
the state of that request and requeue the IO.  If anybody tries to
submit a request that isn't our pending request then requeue that
request until we are able to service the one that is pending.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nbd.c