[Sheepdog] Need inputs on performing some operations atomically

Narendra Prasad Madanapalli narendramind at gmail.com
Sun Sep 12 16:11:34 CEST 2010


Hi,

I found there are two functions that are to be executed atomically in
sheep. These functions are below:

1. sheep/store.c:
                        /* FIXME: need to update atomically */
/*                      ret = verify_object(fd, NULL, 0, 1); */
/*                      if (ret < 0) { */
/*                              eprintf("failed to set checksum,
%"PRIx64"\n", oid); */
/*                              ret = SD_RES_EIO; */
/*                              goto out; */
/*                      } */

2. sheep/vdi.c:
/* TODO: should be performed atomically */
static int create_vdi_obj(uint32_t epoch, char *name, uint32_t
new_vid, uint64_t size,
                          uint32_t base_vid, uint32_t cur_vid, uint32_t copies,
                          uint32_t snapid, int is_snapshot)
{

My understanding is that these two functions get executed in
worker_routine() in response to queue_request() & queue_work().

Solution for verify_object()
Since this operates on file descriptor, I think this can be performed
with the help of file locking mechanism.

Solution for create_vdi_obj()
This can be fixed by introducing global pthread lock.


I would appreciate if anyone can provide more inputs to solve these
two problems.


Thanks,
Narendra.



More information about the sheepdog mailing list