From patchwork Fri Mar 18 08:54:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Menjo X-Patchwork-Id: 8618941 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BEB859F54C for ; Fri, 18 Mar 2016 13:13:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBF8220351 for ; Fri, 18 Mar 2016 13:12:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAE07201F5 for ; Fri, 18 Mar 2016 13:12:58 +0000 (UTC) Received: from localhost ([::1]:43637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aguD3-0007kp-Ma for patchwork-qemu-devel@patchwork.kernel.org; Fri, 18 Mar 2016 09:12:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqC7-00023c-VP for qemu-devel@nongnu.org; Fri, 18 Mar 2016 04:55:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agqC3-0007Gs-QY for qemu-devel@nongnu.org; Fri, 18 Mar 2016 04:55:43 -0400 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:50145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqC3-0007GV-5P for qemu-devel@nongnu.org; Fri, 18 Mar 2016 04:55:39 -0400 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u2I8tPuX006970; Fri, 18 Mar 2016 17:55:25 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id B572D5F65B; Fri, 18 Mar 2016 17:55:25 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id A83B15F612; Fri, 18 Mar 2016 17:55:25 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (unknown [129.60.81.207]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTP id A04BF400BF6; Fri, 18 Mar 2016 17:55:25 +0900 (JST) From: Takashi Menjo Date: Fri, 18 Mar 2016 17:54:38 +0900 Message-Id: <1458291278-5460-1-git-send-email-menjo.takashi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4.windows.1 To: qemu-devel@nongnu.org X-TM-AS-MML: disable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 129.60.39.148 X-Mailman-Approved-At: Fri, 18 Mar 2016 09:12:50 -0400 Cc: Hitoshi Mitake , Takashi Menjo , Jeff Cody , sheepdog@lists.wpkg.org, Vasiliy Tolstov Subject: [Qemu-devel] [PATCH] block/sheepdog: add error handling to sd_snapshot_delete() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Errors have been ignored in some code paths in sd_snapshot_delete(). This patch adds error handling. Signed-off-by: Takashi Menjo --- block/sheepdog.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index a3aeae4..6492405 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2565,6 +2565,7 @@ static int sd_snapshot_delete(BlockDriverState *bs, SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr; if (!remove_objects(s)) { + error_report("failed to discard snapshot inode"); return -1; } @@ -2588,6 +2589,7 @@ static int sd_snapshot_delete(BlockDriverState *bs, ret = find_vdi_name(s, s->name, snap_id, snap_tag, &vid, true, &local_err); if (ret) { + error_report_err(local_err); return ret; } @@ -2601,6 +2603,7 @@ static int sd_snapshot_delete(BlockDriverState *bs, buf, &wlen, &rlen); closesocket(fd); if (ret) { + error_setg_errno(errp, -ret, "failed to delete %s", s->name); return ret; }