提交 f86428a1 编写于 作者: F Fam Zheng 提交者: Kevin Wolf

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: NFam Zheng <famz@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 ee86981b
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册