[dpdk-dev] [PATCH] librte_vhost: Fix the path test issue

Xie, Huawei huawei.xie at intel.com
Thu Nov 6 21:47:40 CET 2014



> -----Original Message-----
> From: Ouyang, Changchun
> Sent: Wednesday, November 05, 2014 10:20 PM
> To: Xie, Huawei; dev at dpdk.org
> Cc: Ouyang, Changchun
> Subject: RE: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue
> 
> Hi Huawei,
> Thanks for the comments,
> And my response as follows.
> 
> > -----Original Message-----
> > From: Xie, Huawei
> > Sent: Thursday, November 6, 2014 10:39 AM
> > To: Ouyang, Changchun; dev at dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH] librte_vhost: Fix the path test issue
> >
> > >  		path = realpath(memfile, resolved_path);
> > > -		if (path == NULL) {
> > > +		if ((path == NULL) && (strlen(resolved_path) == 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 resolved_path.
> >
> >        Otherwise it returns a NULL pointer, and the contents of the array
> > resolved_path are undefined, and errno is set to indicate the error.
> 
> After my investigation this issue and find out using continue doesn't work.
> 
> 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-path is
> /dev/hugepages/qemu_back_mem.pc.ram.zxfqLq
> 
> If 'continue' is used, then procmap.fname could not be hit in the directory list,
> And then  app will exit after report: Failed to find memory file for pid....

I did some investigation. This is due to that qemu unlink the file after it maps 
the huge page file. So this is a special case, it is ok we check the resolved path
when path is NULL if errno indicates "No such file or directory".
> 
> So I have to keep it.
> 
> Thanks again
> Changchun



More information about the dev mailing list