<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 22, 2016 at 1:33 PM, Takashi Menjo <span dir="ltr"><<a href="mailto:menjo.takashi@lab.ntt.co.jp" target="_blank">menjo.takashi@lab.ntt.co.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Errors have been ignored or not propagated in some code paths<br>
<span class="">in sd_snapshot_delete(). This patch adds error handling.<br>
<br>
</span>Cc: Hitoshi Mitake <<a href="mailto:mitake.hitoshi@lab.ntt.co.jp">mitake.hitoshi@lab.ntt.co.jp</a>><br>
Cc: Jeff Cody <<a href="mailto:jcody@redhat.com">jcody@redhat.com</a>><br>
Cc: Vasiliy Tolstov <<a href="mailto:v.tolstov@selfip.ru">v.tolstov@selfip.ru</a>><br>
Cc: <a href="mailto:sheepdog@lists.wpkg.org">sheepdog@lists.wpkg.org</a><br>
<span class=""><br>
Signed-off-by: Takashi Menjo <<a href="mailto:menjo.takashi@lab.ntt.co.jp">menjo.takashi@lab.ntt.co.jp</a>><br>
---<br>
</span> block/sheepdog.c | 9 ++++++---<br>
1 file changed, 6 insertions(+), 3 deletions(-)<br></blockquote><div><br></div><div>Looks good to me.</div><div>Reviewed-by: Hitoshi Mitake <<a href="mailto:mitake.hitoshi@lab.ntt.co.jp">mitake.hitoshi@lab.ntt.co.jp</a>></div><div><br></div><div>Vasiliy, could you test it on your environment if you have a time?</div><div><br></div><div>Thanks,</div><div>Hitoshi</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
diff --git a/block/sheepdog.c b/block/sheepdog.c<br>
index a3aeae4..39d13d2 100644<br>
<span class="">--- a/block/sheepdog.c<br>
+++ b/block/sheepdog.c<br>
@@ -2565,6 +2565,7 @@ static int sd_snapshot_delete(BlockDriverState *bs,<br>
SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;<br>
<br>
if (!remove_objects(s)) {<br>
</span>+ error_setg(errp, "failed to discard snapshot inode");<br>
return -1;<br>
}<br>
<br>
@@ -2588,12 +2589,13 @@ static int sd_snapshot_delete(BlockDriverState *bs,<br>
<span class=""> ret = find_vdi_name(s, s->name, snap_id, snap_tag, &vid, true,<br>
&local_err);<br>
if (ret) {<br>
</span>+ error_propagate(errp, local_err);<br>
return ret;<br>
}<br>
<br>
fd = connect_to_sdog(s, &local_err);<br>
if (fd < 0) {<br>
- error_report_err(local_err);<br>
+ error_propagate(errp, local_err);<br>
return -1;<br>
}<br>
<br>
@@ -2601,16 +2603,17 @@ static int sd_snapshot_delete(BlockDriverState *bs,<br>
<span class=""> buf, &wlen, &rlen);<br>
closesocket(fd);<br>
if (ret) {<br>
+ error_setg_errno(errp, -ret, "failed to delete %s", s->name);<br>
return ret;<br>
}<br>
<br>
</span> switch (rsp->result) {<br>
case SD_RES_NO_VDI:<br>
- error_report("%s was already deleted", s->name);<br>
+ error_setg(errp, "%s was already deleted", s->name);<br>
case SD_RES_SUCCESS:<br>
break;<br>
default:<br>
- error_report("%s, %s", sd_strerror(rsp->result), s->name);<br>
+ error_setg(errp, "%s, %s", sd_strerror(rsp->result), s->name);<br>
return -1;<br>
}<br>
<span class=""><font color="#888888"><br>
--<br>
2.7.4.windows.1<br>
</font></span><div class=""><div class="h5"><br>
<br>
<br>
--<br>
sheepdog mailing list<br>
<a href="mailto:sheepdog@lists.wpkg.org">sheepdog@lists.wpkg.org</a><br>
<a href="https://lists.wpkg.org/mailman/listinfo/sheepdog" rel="noreferrer" target="_blank">https://lists.wpkg.org/mailman/listinfo/sheepdog</a><br>
</div></div></blockquote></div><br></div></div>