[Gluster-devel] aclaration about local stat structs

Angel clist at uah.es
Sat Jan 19 18:38:03 UTC 2008


Hi 

I found on posix  writev that stbuf is local , but a ptr to it is returned to caller.

int32_t
posix_writev (call_frame_t *frame,
              xlator_t *this,
              fd_t *fd,
              struct iovec *vector,
              int32_t count,
              off_t offset)
{
  int32_t op_ret;
  int32_t op_errno;
  int32_t _fd;
  struct posix_private *priv = this->private;
  data_t *pfd_data = dict_get (fd->ctx, this->name);
  struct posix_fd *pfd;
  struct stat stbuf = {0,};

...
...
  STACK_UNWIND (frame, op_ret, op_errno, &stbuf);

}

Upper modules (for example my pet QUOTA) declare args as:

static int32_t
quota_writev_cbk (call_frame_t *frame,
                  void *cookie,
                  xlator_t *this,
                  int32_t op_ret,
                  int32_t op_errno,
                  struct stat *buf)

Shouldnt be stat declared as 'struct stat const *buf'?
 also as stat is local to posix_writev can two or more threads hold a ponter to it while serving diferent requests
and thus cause a race condition??


regards, Angel
-- 
------------------------------------------------
Clist UAH
------------------------------------------------





More information about the Gluster-devel mailing list