[Devel] Re: [PATCH] [RFC] Checkpoint/restart eventfd

Matt Helsley matthltc at us.ibm.com
Mon Oct 26 09:24:37 PDT 2009


On Mon, Oct 26, 2009 at 10:21:51AM -0500, Serge E. Hallyn wrote:
> Quoting Matt Helsley (matthltc at us.ibm.com):
> > Save/restore eventfd files. These are anon_inodes just like epoll

<snip>

> > diff --git a/fs/eventfd.c b/fs/eventfd.c
> > index 31d12de..5d30cd5 100644
> > --- a/fs/eventfd.c
> > +++ b/fs/eventfd.c
> > @@ -18,6 +18,8 @@
> >  #include <linux/module.h>
> >  #include <linux/kref.h>
> >  #include <linux/eventfd.h>
> > +#include <linux/checkpoint.h>
> > +#include <linux/checkpoint_hdr.h>
> > 
> >  struct eventfd_ctx {
> >  	struct kref kref;
> > @@ -223,11 +225,34 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
> >  	return res;
> >  }
> > 
> > +static int eventfd_checkpoint(struct ckpt_ctx *ckpt_ctx, struct file *file)
> > +{
> > +	struct eventfd_ctx *ctx;
> > +	struct ckpt_hdr_file_eventfd *h;
> > +	int ret = -ENOMEM;
> > +
> > +	h = ckpt_hdr_get_type(ckpt_ctx, sizeof(*h), CKPT_HDR_FILE);
> > +	if (!h)
> > +		return -ENOMEM;
> > +	h->common.f_type = CKPT_FILE_EVENTFD;
> > +	ret = checkpoint_file_common(ckpt_ctx, file, &h->common);
> > +	if (ret < 0)
> > +		goto out;
> > +	ctx = file->private_data;
> > +	h->count = ctx->count;
> 
> I only took a very cursory glance at the eventfd code, but eventfd_poll()
> suggests that ULLONG_MAX is a valid value for ctx->count (suggesting error).
> Should you be checking for that?  (Or is that a special case that will
> never be checkpointed somehow?)

The code doesn't prevent nor do anything special for ULLONG_MAX. It
didn't seem that it should -- the existing code which restarts
read/write/poll syscalls should take care of the rest.

Cheers,
	-Matt Helsley
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list