[Devel] [PATCH] eventfd: Add missing spin locks around eventfd checkpoint.
Matt Helsley
matthltc at us.ibm.com
Fri Apr 16 09:07:32 PDT 2010
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);
--
1.6.3.3
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list