[PATCH] eventfd: Add missing spin locks around eventfd checkpoint.

Oren Laadan orenl at cs.columbia.edu
Sat Apr 24 16:58:07 PDT 2010


Applied for ckpt-v21-rc3


Matt Helsley wrote:
> Ensure that we get a consistent set of count and flag values at checkpoint
> by locking the eventfd structures to prevent races with non-frozen tasks
> sharing the underlying struct file *.
> 
> The locking during restart is fine since it relies entirely on the eventd
> creation syscall.
> 
> Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
> ---
>  fs/eventfd.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/eventfd.c b/fs/eventfd.c
> index e412a02..65307e0 100644
> --- a/fs/eventfd.c
> +++ b/fs/eventfd.c
> @@ -303,8 +303,10 @@ static int eventfd_checkpoint(struct ckpt_ctx *ckpt_ctx, struct file *file)
>  	if (ret < 0)
>  		goto out;
>  	ctx = file->private_data;
> +	spin_lock_irq(&ctx->wqh.lock);
>  	h->count = ctx->count;
>  	h->flags = ctx->flags;
> +	spin_unlock_irq(&ctx->wqh.lock);
>  	ret = ckpt_write_obj(ckpt_ctx, &h->common.h);
>  out:
>  	ckpt_hdr_put(ckpt_ctx, h);


More information about the Containers mailing list