[CRIU] [PATCH] inotify: Skip opening deleted file

Cyrill Gorcunov gorcunov at openvz.org
Wed Nov 28 12:46:43 EST 2012


On Wed, Nov 28, 2012 at 09:38:42PM +0400, Pavel Emelyanov wrote:
> On 11/28/2012 09:34 PM, Cyrill Gorcunov wrote:
> > On Wed, Nov 28, 2012 at 09:28:59PM +0400, Pavel Emelyanov wrote:
> >> On 11/28/2012 09:26 PM, Cyrill Gorcunov wrote:
> >>> In case if we're monitoring deleted file we can't open
> >>> it on restore procedure, thus simply skip its recreation.
> >>
> >> NAK. This should be done the other way.
> >>
> >> On dump we should find out, that the file is unlinked and note this
> >> fact in the image. On restore we should restore a temp file, inotify
> >> it and unlink back.
> > 
> > No. Create/unlink generates "delete" event which we should escape
> > receiving. To figure out that file is unlinked (note we have only
> > a file handle here) we could try to open it and if we get EBADF
> > then we can assume it was removed.
> 
> If the file being watched is unlinked it _should_ have generated this
> event already, no?

There might be a chain of files. Imagine

	/a/b

and inotify hooked on both a and b. Then b removed and generated
"deleted" event. And on restore we might have a situoation where
we have restored inotify on /a and now open/unlink 'b', the event
will be propagated to a (if event mask on a set to all-events),
if only I've not missed something.

But true, drop this patch for now, need to think...

	Cyrill


More information about the CRIU mailing list