VDE backend does not handle EINTR properly
When running the VDE backend with 2 uml instances and running iperf between them, the vde_send() function often returns EINTR. I noticed that this is accounted for in net_user.c via the use of the CATCH_EINTR() macro. Thus the following patch uses the same approach for calls into VDE. It could be argued that the VDE library itself should handle EINTR, but this patch will work with older (or current) versions of VDE. This patch was created against 3.0.3.
arch/um/drivers/vde_user.c +12 -2
@@ -11,6 +11,7 @@#include "um_malloc.h" #include "user.h" #include "vde.h" +#include "os.h" static int vde_user_init (void *data,void *dev) {
@@ -103,7 +104,7 @@ int vde_user_read(void *conn, void *buf,if (vconn ==NULL )return 0 ; - rv =vde_recv (vconn, buf, len,0 ); +CATCH_EINTR (rv =vde_recv (vconn, buf, len,0 ));if (rv <0 ) {if (errno ==EAGAIN )return 0 ;
@@ -118,10 +119,19 @@ int vde_user_read(void *conn, void *buf,int vde_user_write (void *conn,void *buf,int len) {VDECONN *vconn = conn; +int rv;if (vconn ==NULL )return 0 ; -return vde_send (vconn, buf, len,0 ); +CATCH_EINTR (rv =vde_send (vconn, buf, len,0 )); +if (rv <0 ) { +if (errno ==EAGAIN ) +return 0 ; +return -errno; + } +else if (rv ==0 ) +return -ENOTCONN ; +return rv; }
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Am 20.11.2011 00:16, schrieb Frank Laub:
Quoted 7 lines
When running the VDE backend with 2 uml instances and running iperf between them, the
vde_send()function often returns EINTR. I noticed that this is accounted for innet_user.cvia the use of theCATCH_EINTR()macro. Thus the following patch uses the same approach for calls into VDE. It could be argued that the VDE library itself should handle EINTR, but this patch will work with older (or current) versions of VDE. This patch was created against 3.0.3.
Please add a Signed-off-by tag,
so that I can give you the credit. :-)
See: http://linux.yyz.us/patch-format.html
Quoted 20 lines
arch/um/drivers/vde_user.c +2
-1@@ -11,6 +11,7 @@#include "um_malloc.h" #include "user.h" #include "vde.h" +#include "os.h" static int vde_user_init (void *data,void *dev) {@@ -103,7 +104,7 @@ int vde_user_read(void *conn, void *buf,if (vconn ==NULL )return 0 ; - rv =vde_recv (vconn, buf, len,0 ); +CATCH_EINTR (rv =vde_recv (vconn, buf, len,0 ));if (rv <0 ) {if (errno ==EAGAIN )return 0 ;
arch/um/drivers/vde_user.c int vde_user_read(void *conn, void *buf, · line 125
Quoted 9 lines
arch/um/drivers/vde_user.c +1
-1@@ -118,10 +119,19 @@ int vde_user_read(void *conn, void *buf,int vde_user_write (void *conn,void *buf,int len) {VDECONN *vconn = conn; +int rv;if (vconn ==NULL )return 0 ; -return vde_send (vconn, buf, len,0 );
Is the additional if-branch really needed?
arch/um/drivers/vde_user.c int vde_user_read(void *conn, void *buf, · line 137
Quoted 11 lines
arch/um/drivers/vde_user.c +9
-0+CATCH_EINTR (rv =vde_send (vconn, buf, len,0 )); +if (rv <0 ) { +if (errno ==EAGAIN ) +return 0 ; +return -errno; + } +else if (rv ==0 ) +return -ENOTCONN ; +return rv; }
Thanks,
//richard
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] ]PATCH 3.03 1/1] um: VDE backend needs to handle EINTR/EAGAIN
Handle EINTR and EAGAIN during vde_send() and vde_recv() in case the VDE library doesn't. Use the same approach that net_user.c takes.
arch/um/drivers/vde_user.c +10 -2
@@ -11,6 +11,7 @@#include "um_malloc.h" #include "user.h" #include "vde.h" +#include "os.h" static int vde_user_init (void *data,void *dev) {
@@ -103,7 +104,7 @@ int vde_user_read(void *conn, void *buf,if (vconn ==NULL )return 0 ; - rv =vde_recv (vconn, buf, len,0 ); +CATCH_EINTR (rv =vde_recv (vconn, buf, len,0 ));if (rv <0 ) {if (errno ==EAGAIN )return 0 ;
@@ -118,10 +119,17 @@ int vde_user_read(void *conn, void *buf,int vde_user_write (void *conn,void *buf,int len) {VDECONN *vconn = conn; +int rv;if (vconn ==NULL )return 0 ; -return vde_send (vconn, buf, len,0 ); +CATCH_EINTR (rv =vde_send (vconn, buf, len,0 )); +if (rv <0 ) { +if (errno ==EAGAIN ) +return 0 ; +return -errno; + } +return rv; }
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel