tools/blktap2: Handle read/write interrupts in blktap2 control plane.

The following patch:

tools: Retry blktap2 tapdisk message on interrupt.

Addressed a long standing regression with the blktap2 control
plane.  An interruption of the select system call would
prematurely terminate the message sequence needed to properly
shutdown a blktap2 tapdisk instance.

Ian Jackson correctly noted that the read and write systems calls
responsible for receiving and sending the control messages could
also return EINTR resulting in similar effects.  While this
regression was not noted in field testing this patch adds support
to re-start the calls to provide a technically complete
implementation of control plane management in the presence of
signals.

Signed-off-by: Dr. Greg Wettstein <xen@wind.enjellic.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Dr. Greg Wettstein authored and Ian Jackson committed 2013-03-28 14:35:23 +00:00
1 parent 7242e0dc2c
commit a5c800142c
1 file changed
+8 -2
+8 -2
View File
@@ -71,8 +71,11 @@ tap_ctl_read_message(int fd, tapdisk_message_t *message, int timeout)
}
else if (FD_ISSET(fd, &readfds)) {
ret = read(fd, message + offset, len - offset);
if (ret <= 0)
if (ret <= 0) {
if (errno == EINTR)
continue;
break;
}
offset += ret;
} else
break;
@@ -124,8 +127,11 @@ tap_ctl_write_message(int fd, tapdisk_message_t *message, int timeout)
}
else if (FD_ISSET(fd, &writefds)) {
ret = write(fd, message + offset, len - offset);
if (ret <= 0)
if (ret <= 0) {
if (errno == EINTR)
continue;
break;
}
offset += ret;
} else
break;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.