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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux