plugins/nbd/nbd.c
/* Called during transmission phases when there is no hope of
 * resynchronizing with the server, and all further requests from the
 * client will fail.  Returns -1 for convenience. */
Called during transmission phases when there is no hope of
resynchronizing with the server, and all further requests from the
client will fail.  Returns -1 for convenience.
Called during transmission phases when there is no hope of resynchronizing with the server and all further requests from the client will fail . Returns - 1 for convenience .
static int
nbd_mark_dead (struct handle *h)
{
  int err = errno;
  nbd_lock (h);
  if (!h->dead) {
    nbdkit_debug ("permanent failure while talking to server %s: %m",
                  sockname);
    h->dead = true;
  }
  else if (!err)
    errno = ESHUTDOWN;
  nbd_unlock (h);
  if (err == EPIPE || err == EBADMSG)
    nbdkit_set_error (ESHUTDOWN);
  return -1;
}
static int nbd_mark_dead ( struct handle * h ) { int err = errno ; nbd_lock ( h ) ; if ( ! h -> dead ) { nbdkit_debug ( " " , sockname ) ; h -> dead = true ; } else if ( ! err ) errno = ESHUTDOWN ; nbd_unlock ( h ) ; if ( err == EPIPE || err == EBADMSG ) nbdkit_set_error ( ESHUTDOWN ) ; return -1 ; }
Called during transmission phases when there is no hope of
 resynchronizing with the server, and all further requests from the
 client will fail.
Called during transmission phases when there is no hope of resynchronizing with the server and all further requests from the client will fail .
/* NBD only accepts a limited set of errno values over the wire, and
     nbdkit converts all other values to EINVAL. If we died due to an
     errno value that cannot transmit over the wire, translate it to
     ESHUTDOWN instead.  */