From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 547672E89 for ; Thu, 6 Nov 2014 21:40:21 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 06 Nov 2014 12:47:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,327,1413270000"; d="scan'208";a="618462779" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by fmsmga001.fm.intel.com with ESMTP; 06 Nov 2014 12:47:44 -0800 Received: from kmsmsx151.gar.corp.intel.com (172.21.73.86) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 7 Nov 2014 04:47:43 +0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 7 Nov 2014 04:47:43 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.202]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.13]) with mapi id 14.03.0195.001; Fri, 7 Nov 2014 04:47:41 +0800 From: "Xie, Huawei" To: "Ouyang, Changchun" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue Thread-Index: AQHP9z5ZPyMYv+0Ta06WGuZbD1h80pxS5i+w//+n5ICAAYddwA== Date: Thu, 6 Nov 2014 20:47:40 +0000 Message-ID: References: <1415002313-15661-1-git-send-email-changchun.ouyang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2014 20:40:22 -0000 > -----Original Message----- > From: Ouyang, Changchun > Sent: Wednesday, November 05, 2014 10:20 PM > To: Xie, Huawei; dev@dpdk.org > Cc: Ouyang, Changchun > Subject: RE: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue >=20 > Hi Huawei, > Thanks for the comments, > And my response as follows. >=20 > > -----Original Message----- > > From: Xie, Huawei > > Sent: Thursday, November 6, 2014 10:39 AM > > To: Ouyang, Changchun; dev@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue > > > > > path =3D realpath(memfile, resolved_path); > > > - if (path =3D=3D NULL) { > > > + if ((path =3D=3D NULL) && (strlen(resolved_path) =3D=3D 0)) { > > > RTE_LOG(ERR, VHOST_CONFIG, > > > "(%"PRIu64") Failed to resolve fd directory\n", > > > dev->device_fh); > > Changchun: > > For some strange file, according to API description, we shouldn't check > > resolved_path as it is undefined. > > To make the loop go on, we could use "continue" when we detect path is > > NULL. > > > > RETURN VALUE > > If there is no error, realpath() returns a pointer to the resolv= ed_path. > > > > Otherwise it returns a NULL pointer, and the contents of the arr= ay > > resolved_path are undefined, and errno is set to indicate the error. >=20 > After my investigation this issue and find out using continue doesn't wor= k. >=20 > The reason is procmap.fname itself is > "/dev/hugepages/qemu_back_mem.pc.ram.zxfqLq", > It is not a normal path, so in this case, path is null, while resolved-pa= th is > /dev/hugepages/qemu_back_mem.pc.ram.zxfqLq >=20 > If 'continue' is used, then procmap.fname could not be hit in the directo= ry list, > And then app will exit after report:=1B$B!!=1B(BFailed to find memory fi= le for pid.... I did some investigation. This is due to that qemu unlink the file after it= maps=20 the huge page file. So this is a special case, it is ok we check the resolv= ed path when path is NULL if errno indicates "No such file or directory". >=20 > So I have to keep it. >=20 > Thanks again > Changchun