I wasn't using the synctask_new worker, but now I implemented my code using it to trigger the create/write call. Btw, is the usage of syncop calls documented somewhere? I found it through the history of the dev-list.
But going ahead on my issue, I was able to create the file avoiding the NFS stale handle error. The file is being created at the backend, but the syncop_create call it's still returning an error from the posix translator at the server side. I copied the error from the glusterd log below... I am checking the code trying to figure it out.
To write the file I am generating a new gfid for the local file and setting the pargfid as 1 (root node) with the loc.parent pointing to the inode->table->root inode. Below I copied what is being copied the loc, fd, flag and mode_t structures being used at the create call.
*** From the glusterd log:
[2012-09-10 18:12:34.035940] W [posix-handle.c:590:posix_handle_hard] 0-examplevol1: mismatching ino/dev between file /bricks/exampleDir_local/1ccfca9f (146628/2049) and handle /bricks/exampleDir_local/.glusterfs/00/00/00000000-0000-0000-0000-000000000000 (146617/2049)
[2012-09-10 18:12:34.035977] E [posix.c:1724:posix_create] 0-examplevol1: setting gfid on /bricks/exampleDir_local/1ccfca9f failed
*** Relevant code before calling the create function
107 inode_t *newinode = inode_new (old_loc.inode->table);
108
109 loc.path = strdup(hashed_path_str);
110
loc.name = strdup(hashed_filename_str);
111 loc.inode = newinode;
113 loc.parent = loc.inode->table->root;
115 uuid_copy(loc.gfid, gfid);
116
118 memset (loc.pargfid, 0, 16);
119 loc.pargfid[15] = 1;
120
121 fd = fd_create (loc.inode, getpid());
...
127
128 uint32_t flags = O_CREAT | O_RDWR | O_EXCL;
129 mode_t mode = (mode_t)0700;
130 fd->flags = flags;
131 fd = fd_ref(fd);