From patchwork Tue Oct 25 08:41:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: ding.yemin@zte.com.cn X-Patchwork-Id: 9404351 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.web.codeaurora.org (Postfix) with ESMTP id A8CE4601C0 for ; Sun, 30 Oct 2016 08:07:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96AB12866E for ; Sun, 30 Oct 2016 08:07:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B6D729001; Sun, 30 Oct 2016 08:07:30 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) (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 DD4EA2866E for ; Sun, 30 Oct 2016 08:07:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9U84kCj039812; Sun, 30 Oct 2016 04:04:46 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9P8h5mi005159 for ; Tue, 25 Oct 2016 04:43:05 -0400 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9P8h44e022900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 25 Oct 2016 04:43:05 -0400 Received: from mx5.zte.com.cn (mx5.zte.com.cn [63.217.80.70]) by mx1.redhat.com (Postfix) with ESMTP id 9FBD48EB48; Tue, 25 Oct 2016 08:43:02 +0000 (UTC) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Websense Email Security Gateway with ESMTP id 2074E47745746; Tue, 25 Oct 2016 16:42:58 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id u9P8ggrN080278; Tue, 25 Oct 2016 16:42:42 +0800 (GMT-8) (envelope-from ding.yemin@zte.com.cn) Received: from localhost.localdomain ([10.118.202.203]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2016102516424512-2126847 ; Tue, 25 Oct 2016 16:42:45 +0800 From: ding.yemin@zte.com.cn To: Christophe Varoqui Date: Tue, 25 Oct 2016 16:41:52 +0800 Message-Id: <1477384912-10940-1-git-send-email-ding.yemin@zte.com.cn> MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2016-10-25 16:42:45, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2016-10-25 16:42:26 X-MAIL: mse01.zte.com.cn u9P8ggrN080278 X-Greylist: Sender IP whitelisted by DNSRBL, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 25 Oct 2016 08:43:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 25 Oct 2016 08:43:03 +0000 (UTC) for IP:'63.217.80.70' DOMAIN:'mx5.zte.com.cn' HELO:'mx5.zte.com.cn' FROM:'ding.yemin@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -3.241 (BAYES_50, DCC_REPUT_00_12, RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2, RP_MATCHES_RCVD, SPF_PASS) 63.217.80.70 mx5.zte.com.cn 63.217.80.70 mx5.zte.com.cn X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id u9P8h5mi005159 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 28 Oct 2016 10:25:49 -0400 Cc: tang.junhui@zte.com.cn, zhang.kai16@zte.com.cn, "ding.yemin" , dm-devel@redhat.com Subject: [dm-devel] [PATCH] RCU protection for variable conf in add_map_with_path() 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP From: "ding.yemin" Take the variable "conf" under RCU protection in add_map_with_path()。 Signed-off-by: ding.yemin --- libmultipath/structs_vec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index a0c8869..b8ae87c 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -489,12 +489,14 @@ add_map_with_path (struct vectors * vecs, conf = get_multipath_config(); mpp->mpe = find_mpe(conf->mptable, pp->wwid); mpp->hwe = pp->hwe; - put_multipath_config(conf); strcpy(mpp->wwid, pp->wwid); find_existing_alias(mpp, vecs); - if (select_alias(conf, mpp)) + if (select_alias(conf, mpp)) { + put_multipath_config(conf); goto out; + } + put_multipath_config(conf); mpp->size = pp->size; if (adopt_paths(vecs->pathvec, mpp))