Commit f86428a1 authored by Fam Zheng's avatar Fam Zheng Committed by Kevin Wolf
Browse files

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: qemu-stable@nongnu.org
Signed-off-by: default avatarFam Zheng <famz@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent ee86981b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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();
    do {
        ret = fcntl(fd, fcntl_op_setlk, &fl);
    } while (ret == -1 && errno == EINTR);
    return ret == -1 ? -errno : 0;
}