Disconnect NBD proxy correctly without leaving a zombie [vitastor-nbd] process in D state

nfs-proxy-old
Vitaliy Filippov 2022-04-07 16:03:32 +03:00
parent 39531ef1a6
commit cd18ef7323
1 changed files with 6 additions and 0 deletions

View File

@ -705,6 +705,12 @@ protected:
if (read_state == CL_READ_HDR)
{
int req_type = be32toh(cur_req.type);
if (be32toh(cur_req.magic) == NBD_REQUEST_MAGIC && req_type == NBD_CMD_DISC)
{
// Disconnect
close(nbd_fd);
exit(0);
}
if (be32toh(cur_req.magic) != NBD_REQUEST_MAGIC ||
req_type != NBD_CMD_READ && req_type != NBD_CMD_WRITE && req_type != NBD_CMD_FLUSH)
{