[CRIU] [PATCH 6/7] inotify: Use ghost files if the watchee is a deleted file

Cyrill Gorcunov gorcunov at openvz.org
Wed Dec 5 08:25:51 EST 2012


On Wed, Dec 05, 2012 at 05:16:57PM +0400, Pavel Emelyanov wrote:
> On 12/05/2012 05:12 PM, Cyrill Gorcunov wrote:
> > On Wed, Dec 05, 2012 at 05:02:49PM +0400, Cyrill Gorcunov wrote:
> >> On Wed, Dec 05, 2012 at 04:48:28PM +0400, Pavel Emelyanov wrote:
> >>>> @@ -131,12 +133,16 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
> >>>>  
> >>>>  	target = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
> >>>>  	if (target < 0) {
> >>>> -		pr_perror("Can't open file handle for 0x%08x:0x%016lx",
> >>>> -			  iwe->s_dev, iwe->i_ino);
> >>>> -		goto err;
> >>>> -	}
> >>>> +		gf = lookup_ghost_file_st(iwe->s_dev, iwe->i_ino);
> >>>
> >>> At that point gf may have already being removed. The fact that you bump up
> >>> users _here_ doesn't work. Users should be counted before actual restore starts.
> >>
> >> yup :( a race window here. I'll fix it up. Thanks!
> > 
> > Something like this I think.
> > 
> 
> > @@ -43,6 +44,7 @@
> >  struct inotify_wd_info {
> >  	struct list_head		list;
> >  	InotifyWdEntry			*iwe;
> > +	struct ghost_file		*gf;
> 
> You don't want the whole gf here, you just need the remap.

I believe this will be ugly. Ghost file concept does operate with
struct ghost_file so I don't see a reason to grind it down. And
after all it's a _pointer_ not the structure which we carry here.

	Cyrill


More information about the CRIU mailing list