gluster-devel
[Top][All Lists]
Advanced

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

[Gluster-devel] aclaration about local stat structs


From: Angel
Subject: [Gluster-devel] aclaration about local stat structs
Date: Sat, 19 Jan 2008 19:38:03 +0100
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

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
------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]