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 <[email protected]>
---
 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);
-- 
1.6.3.3

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to