From patchwork Sat Oct 6 07:38:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stef Walter X-Patchwork-Id: 10629225 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 300C614BD for ; Sat, 6 Oct 2018 07:39:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ECC228AFD for ; Sat, 6 Oct 2018 07:39:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 110D12920D; Sat, 6 Oct 2018 07:39:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C885628AFD for ; Sat, 6 Oct 2018 07:39:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75C8EC047B94; Sat, 6 Oct 2018 07:39:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 404C217B36; Sat, 6 Oct 2018 07:39:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0010E4BB79; Sat, 6 Oct 2018 07:39:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w967dOCV025502 for ; Sat, 6 Oct 2018 03:39:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id DC37162487; Sat, 6 Oct 2018 07:39:24 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from falcon.thewalter.lan (ovpn-116-48.ams2.redhat.com [10.36.116.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3435D6247D; Sat, 6 Oct 2018 07:39:24 +0000 (UTC) From: Stef Walter To: dm-devel@redhat.com Date: Sat, 6 Oct 2018 09:38:56 +0200 Message-Id: <20181006073856.15246-2-stefw@redhat.com> In-Reply-To: <20181006073856.15246-1-stefw@redhat.com> References: <20181006073856.15246-1-stefw@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: Stef Walter Subject: [dm-devel] [PATCH 1/1] kpartx: Use absolute paths to create mappings X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 06 Oct 2018 07:39:27 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP kpartx -d now uses absolute paths to delete mappings, since the commit 9bdfa3eb8e24b668e6c2bb882cddb0ccfe23ed5b. We should use those same absolute paths to create the mappings. Without this patch, the following workflow (as seen in the manual page for kpartx) fails to actually remove the devices: # kpartx -av disk.img ... # kpartx -d disk.img Reviewed-by: Benjamin Marzinski --- kpartx/kpartx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index 442b6bd9..d4fb53be 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -341,7 +341,7 @@ main(int argc, char **argv){ if (!loopdev) { loopdev = find_unused_loop_device(); - if (set_loop(loopdev, device, 0, &ro)) { + if (set_loop(loopdev, rpath, 0, &ro)) { fprintf(stderr, "can't set up loop\n"); exit (1); }