Skip to content
  • Hanna Reitz's avatar
    041e32b8
    qemu-nbd: Ignore SIGPIPE · 041e32b8
    Hanna Reitz authored
    qemu proper has done so for 13 years
    (8a7ddc38), qemu-img and qemu-io have
    done so for four years (526eda14).
    Ignoring this signal is especially important in qemu-nbd because
    otherwise a client can easily take down the qemu-nbd server by dropping
    the connection when the server wants to send something, for example:
    
    $ qemu-nbd -x foo -f raw -t null-co:// &
    [1] 12726
    $ qemu-io -c quit nbd://localhost/bar
    can't open device nbd://localhost/bar
    
    : No export with name 'bar' available
    [1]  + 12726 broken pipe  qemu-nbd -x foo -f raw -t null-co://
    
    In this case, the client sends an NBD_OPT_ABORT and closes the
    connection (because it is not required to wait for a reply), but the
    server replies with an NBD_REP_ACK (because it is required to reply).
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-Id: <20170611123714.31292-1-mreitz@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    041e32b8
    qemu-nbd: Ignore SIGPIPE
    Hanna Reitz authored
    qemu proper has done so for 13 years
    (8a7ddc38), qemu-img and qemu-io have
    done so for four years (526eda14).
    Ignoring this signal is especially important in qemu-nbd because
    otherwise a client can easily take down the qemu-nbd server by dropping
    the connection when the server wants to send something, for example:
    
    $ qemu-nbd -x foo -f raw -t null-co:// &
    [1] 12726
    $ qemu-io -c quit nbd://localhost/bar
    can't open device nbd://localhost/bar
    
    : No export with name 'bar' available
    [1]  + 12726 broken pipe  qemu-nbd -x foo -f raw -t null-co://
    
    In this case, the client sends an NBD_OPT_ABORT and closes the
    connection (because it is not required to wait for a reply), but the
    server replies with an NBD_REP_ACK (because it is required to reply).
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Message-Id: <20170611123714.31292-1-mreitz@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading