From patchwork Fri Nov 20 15:08:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chauhan, Vijay" X-Patchwork-Id: 61660 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAKFAduS019856 for ; Fri, 20 Nov 2009 15:10:39 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 430D0619F00; Fri, 20 Nov 2009 10:10:38 -0500 (EST) Received: from int-mx02.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nAKFAaWB017110 for ; Fri, 20 Nov 2009 10:10:36 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.6]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAKFAatm012296 for ; Fri, 20 Nov 2009 10:10:36 -0500 Received: from na3sys009aog104.obsmtp.com (na3sys009aog104.obsmtp.com [74.125.149.73]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAKFA9b9025301 for ; Fri, 20 Nov 2009 10:10:10 -0500 Received: from source ([147.145.40.20]) by na3sys009aob104.postini.com ([74.125.148.12]) with SMTP ID DSNKSwaxUHT5mU5l3LzNvXSa2/GwaeBi5sSe@postini.com; Fri, 20 Nov 2009 07:10:21 PST Received: from milmhbs0.lsil.com (mhbs.lsil.com [147.145.1.30]) by mail0.lsil.com (8.12.11/8.12.11) with ESMTP id nAKFA68R017412; Fri, 20 Nov 2009 07:10:06 -0800 (PST) Received: from inbmail01.lsi.com (inbmail01.in.lsil.com [172.28.140.213]) by milmhbs0.lsil.com (8.12.11/8.12.11) with ESMTP id nAKFA7DY021844; Fri, 20 Nov 2009 07:10:08 -0800 Received: from inbmail01.lsi.com ([172.28.140.213]) by inbmail01.lsi.com ([172.28.140.213]) with mapi; Fri, 20 Nov 2009 20:40:05 +0530 From: "Chauhan, Vijay" To: "christophe.varoqui@free.fr" , device-mapper development Date: Fri, 20 Nov 2009 20:38:18 +0530 Thread-Topic: [PATCH] multipath-tools: multipath should allow only path with valid size to get added in the map Thread-Index: Acpp80qxzgKsuJ13TH6Aate0zwdyFA== Message-ID: <0D1E8821739E724A86F4D16902CE275C1C93C74DFE@inbmail01.lsi.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.6 X-Scanned-By: MIMEDefang 2.39 X-RedHat-Spam-Score: 0 () X-MIME-Autoconverted: from quoted-printable to 8bit by listman.util.phx.redhat.com id nAKFAaWB017110 X-loop: dm-devel@redhat.com Cc: "Dachepalli, Sudhir" , "Stankey, Robert" , "sekharan@linux.vnet.ibm.com" , "Moger, Babu" Subject: [dm-devel] [PATCH] multipath-tools: multipath should allow only path with valid size to get added in the map X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development 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 diff -uprN multipath-tools-orig/multipathd/main.c multipath-tools/multipathd/main.c --- multipath-tools-orig/multipathd/main.c 2009-11-20 23:39:09.000000000 +0530 +++ multipath-tools/multipathd/main.c 2009-11-21 01:09:16.000000000 +0530 @@ -398,6 +398,17 @@ ev_add_path (char * devname, struct vect mpp = pp->mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid); rescan: if (mpp) { + if ((!pp->size) || (mpp->size != pp->size)) { + condlog(0, "%s: failed to add new path %s, " + "device size mismatch", + devname, pp->dev); + int i = find_slot(vecs->pathvec, (void *)pp); + if (i != -1) + vector_del_slot(vecs->pathvec, i); + free_path(pp); + return 1; + } + condlog(4,"%s: adopting all paths for path %s", mpp->alias, pp->dev); if (adopt_paths(vecs->pathvec, mpp)) @@ -408,6 +419,16 @@ rescan: mpp->action = ACT_RELOAD; } else { + if (!pp->size) { + condlog(0, "%s: failed to create new map," + " %s device size is 0 ", devname, pp->dev); + int i = find_slot(vecs->pathvec, (void *)pp); + if (i != -1) + vector_del_slot(vecs->pathvec, i); + free_path(pp); + return 1; + } + condlog(4,"%s: creating new map", pp->dev); if ((mpp = add_map_with_path(vecs, pp, 1))) mpp->action = ACT_CREATE;