From patchwork Tue Jul 16 07:13:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 2827939 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8E84D9F7D6 for ; Tue, 16 Jul 2013 07:18:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAD6B20186 for ; Tue, 16 Jul 2013 07:18:44 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 8FBC92017F for ; Tue, 16 Jul 2013 07:18:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6G7E3aJ030473; Tue, 16 Jul 2013 03:14:03 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6G7DU1p027892 for ; Tue, 16 Jul 2013 03:13:30 -0400 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6G7DUPK010144 for ; Tue, 16 Jul 2013 03:13:30 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6G7DSdS013896 for ; Tue, 16 Jul 2013 03:13:29 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F1DEEA5599; Tue, 16 Jul 2013 09:13:24 +0200 (CEST) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 16 Jul 2013 09:13:20 +0200 Message-Id: <1373958801-103613-30-git-send-email-hare@suse.de> In-Reply-To: <1373958801-103613-1-git-send-email-hare@suse.de> References: <1373958801-103613-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.69 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 29/30] multipath: reset queue_if_no_path if flush failed X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development 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-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 When flushing a map failed the 'queue_if_no_path' setting is getting lost. Signed-off-by: Hannes Reinecke --- libmultipath/devmapper.c | 21 +++++++++++++++++---- libmultipath/devmapper.h | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 69f475c..4c8b923 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -366,7 +366,7 @@ out: } extern int -dm_get_map(char * name, unsigned long long * size, char * outparams) +dm_get_map(const char * name, unsigned long long * size, char * outparams) { int r = 1; struct dm_task *dmt; @@ -685,7 +685,9 @@ _dm_flush_map (const char * mapname, int need_sync) extern int dm_suspend_and_flush_map (const char * mapname) { - int s; + int s = 0, queue_if_no_path = 0; + unsigned long long mapsize; + char params[PARAMS_SIZE] = {0}; if (!dm_map_present(mapname)) return 0; @@ -693,8 +695,17 @@ dm_suspend_and_flush_map (const char * mapname) if (dm_type(mapname, TGT_MPATH) <= 0) return 0; /* nothing to do */ - s = dm_queue_if_no_path((char *)mapname, 0); - if (!s) + if (!dm_get_map(mapname, &mapsize, params)) { + if (strstr(params, "queue_if_no_path")) + queue_if_no_path = 1; + } + + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 0); + /* Leave queue_if_no_path alone if unset failed */ + if (s) + queue_if_no_path = 0; + else s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); if (!dm_flush_map(mapname)) { @@ -703,6 +714,8 @@ dm_suspend_and_flush_map (const char * mapname) } condlog(2, "failed to remove multipath map %s", mapname); dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 1); return 1; } diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h index 8ea9dd3..b27db56 100644 --- a/libmultipath/devmapper.h +++ b/libmultipath/devmapper.h @@ -16,7 +16,7 @@ int dm_addmap_create_ro (struct multipath *mpp, char *params); int dm_addmap_reload (struct multipath *mpp, char *params); int dm_addmap_reload_ro (struct multipath *mpp, char *params); int dm_map_present (const char *); -int dm_get_map(char *, unsigned long long *, char *); +int dm_get_map(const char *, unsigned long long *, char *); int dm_get_status(char *, char *); int dm_type(const char *, char *); int _dm_flush_map (const char *, int);