mirror of https://github.com/xemu-project/xemu.git
sheepdog: Fix error handling sd_create()
As a bdrv_create() method, sd_create() must set an error and return negative errno on failure. It prints the error instead of setting it when connect_to_sdog() fails. Fix that. While there, return the value of connect_to_sdog() like we do elsewhere, instead of -EIO. No functional change, as connect_to_sdog() returns no other error code. Many more suspicious uses of error_report() and error_report_err() remain in other functions. Left for another day. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
e25cad6921
commit
48d7c4af06
|
@ -1829,14 +1829,12 @@ static int sd_create(const char *filename, QemuOpts *opts,
|
||||||
if (s->inode.block_size_shift == 0) {
|
if (s->inode.block_size_shift == 0) {
|
||||||
SheepdogVdiReq hdr;
|
SheepdogVdiReq hdr;
|
||||||
SheepdogClusterRsp *rsp = (SheepdogClusterRsp *)&hdr;
|
SheepdogClusterRsp *rsp = (SheepdogClusterRsp *)&hdr;
|
||||||
Error *local_err = NULL;
|
|
||||||
int fd;
|
int fd;
|
||||||
unsigned int wlen = 0, rlen = 0;
|
unsigned int wlen = 0, rlen = 0;
|
||||||
|
|
||||||
fd = connect_to_sdog(s, &local_err);
|
fd = connect_to_sdog(s, errp);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
error_report_err(local_err);
|
ret = fd;
|
||||||
ret = -EIO;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue