[qemu-xen master] osdep: Retry SETLK upon EINTR

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[qemu-xen master] osdep: Retry SETLK upon EINTR

patchbot
commit dccdaacc3d2c315f16e2723c619afcb0832e01fe
Author:     Fam Zheng <[hidden email]>
AuthorDate: Tue Dec 26 14:53:00 2017 +0800
Commit:     Michael Roth <[hidden email]>
CommitDate: Mon Jan 29 09:14:03 2018 -0600

    osdep: Retry SETLK upon EINTR
   
    We could hit lock failure if there is a signal that makes fcntl return
    -1 and errno set to EINTR. In this case we should retry.
   
    Cc: [hidden email]
    Signed-off-by: Fam Zheng <[hidden email]>
    Reviewed-by: Eric Blake <[hidden email]>
    Signed-off-by: Kevin Wolf <[hidden email]>
    (cherry picked from commit f86428a1f4f91a460ed585682af70d3e8c31dc06)
    Signed-off-by: Michael Roth <[hidden email]>
---
 util/osdep.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/osdep.c b/util/osdep.c
index 1231f9f..a73de0e 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -244,7 +244,9 @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
         .l_type   = fl_type,
     };
     qemu_probe_lock_ops();
-    ret = fcntl(fd, fcntl_op_setlk, &fl);
+    do {
+        ret = fcntl(fd, fcntl_op_setlk, &fl);
+    } while (ret == -1 && errno == EINTR);
     return ret == -1 ? -errno : 0;
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog