From patchwork Tue Jan 8 13:54:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1946001 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork2.kernel.org (Postfix) with ESMTP id ABCC0DF23A for ; Tue, 8 Jan 2013 13:57:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DtvjI019936; Tue, 8 Jan 2013 08:55:57 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsbGi004768 for ; Tue, 8 Jan 2013 08:54:37 -0500 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r08DsbQq028109 for ; Tue, 8 Jan 2013 08:54:37 -0500 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 r08DsXaE018848 for ; Tue, 8 Jan 2013 08:54:34 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 47916A3E1C; Tue, 8 Jan 2013 14:54:30 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 8 Jan 2013 14:54:19 +0100 Message-Id: <1357653259-62650-42-git-send-email-hare@suse.de> In-Reply-To: <1357653259-62650-1-git-send-email-hare@suse.de> References: <1357653259-62650-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.299 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 42/42] multipathd: lock vectors during initial configuration 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 During initial configuration the CLI thread is already running, so we need to lock the vectors here to not race with the 'reconfigure' CLI command. Signed-off-by: Hannes Reinecke --- multipathd/main.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 395307e..8917499 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1389,7 +1389,6 @@ reconfigure (struct vectors * vecs) struct config * old = conf; int retval = 1; - lock(vecs->lock); /* * free old map and path vectors ... they use old conf state */ @@ -1410,7 +1409,6 @@ reconfigure (struct vectors * vecs) retval = 0; } - unlock(vecs->lock); return retval; } @@ -1641,9 +1639,9 @@ child (void * param) /* * fetch and configure both paths and multipaths */ - lock(vecs->lock); running_state = DAEMON_CONFIGURE; + lock(vecs->lock); if (configure(vecs, 1)) { unlock(vecs->lock); condlog(0, "failure during configuration");