]> git.baikalelectronics.ru Git - kernel.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)
commitaddfd1b1dba5a4a4b992d88c8478447d0ee98478
treeab7de5bd26fc932bed7ee9d3dd2610197ce98e16
parent7a1954b67c02e43f0eb175742bee64ee6bdd2ff2
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