[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] tools/blktap2: Handle read/write interrupts in blktap2 control plane.



commit a5c800142cfc82159fcb85b47116cf296caebcc5
Author:     Dr. Greg Wettstein <greg@xxxxxxxxxxxxxxxxx>
AuthorDate: Thu Mar 28 07:50:34 2013 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Thu Mar 28 14:35:23 2013 +0000

    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@xxxxxxxxxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/blktap2/control/tap-ctl-ipc.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/blktap2/control/tap-ctl-ipc.c 
b/tools/blktap2/control/tap-ctl-ipc.c
index c8aad1c..c7e42d9 100644
--- a/tools/blktap2/control/tap-ctl-ipc.c
+++ b/tools/blktap2/control/tap-ctl-ipc.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.