[CRIU] [PATCH 2/2] sk-unix: Fix path resolving for sockets with abs symlinks in paths

Cyrill Gorcunov gorcunov at gmail.com
Sun Jun 12 06:09:26 PDT 2016


On Thu, Jun 09, 2016 at 06:13:53PM +0300, Pavel Emelyanov wrote:
> On 06/08/2016 10:22 AM, Cyrill Gorcunov wrote:
> > On Wed, Jun 08, 2016 at 12:03:43AM -0700, Andrey Vagin wrote:
> >> Actually we need to fix the same problem not only for unix sockets.
> >>
> >> We need to check all places where we work with mntns_root.
> > 
> > Yes, I said so in the cover message.
> > 
> >>>  
> >>> +		if (cr_set_root(mntns_root, &root_fd))
> >>> +			goto err;
> >>> +
> >>>  		snprintf(path, sizeof(path), ".%s/%s", dir, sk->name);
> >>> -		if (fstatat(mntns_root, path, &st, 0)) {
> >>> -			if (errno == ENOENT)
> >>> +		ret = fstatat(mntns_root, path, &st, 0);
> >>> +		errno_save = errno;
> >>> +		if (cr_restore_root(root_fd))
> >>> +			goto err;
> >>
> >> I was talking with Pavel about this problem and we decided to not
> >> restore root each time. We can do it only when it's requred. In this
> >> case the overhead will be much smaller.
> > 
> > How can we figure out if we don't need to use this helper?
> 
> We need to (I don't know how :) ) make sure that we use only -at calls
> that work with paths.

I believe the work on code refactoring and optimization should be done
on top: currently we loose mysql socket after the restore :(

I've taked to Andrew, as far as I understand we may call this helper
without restoring former root until explicitly needed, which will
speedup procedure.

Anyway, for unix sockets these two patches works as expected and
fix the issue, so I vote for merging them.


More information about the CRIU mailing list