[Gluster-devel] afr's return "struct stat" scheme
lidaobing at kingsoft.com
Tue Jan 8 03:08:41 UTC 2008
just a little review on the afr return "struct stat" scheme
there are 18 functions in xlator_fops which return a struct stat*
in cbk. in 1.3.7 afr implement 16 of them(except fchmod and fchown,
which return ENOSYS), and in TLA, all of them is implemented.
most of them adopt a scheme to return a stable struct stat* when no
child is out of work. It pick the successful returned value which is
first appeared in the conf file. fstat and 1.3.7 readv is a little
difference with others, these two functions do not send the op to all
children, but only the first succesful child. So it's also stable. And
in TLA, some funtion is changed to serial call (for example, mknod),
and the returned struct stat is also come from the first succesful
child, so it's also stable.
but ftruncate, writev, lookup and TLA-version does not return a stable
struct stat, ftruncate and writev pick the return value from the last
successful returned child . and lookup pick the child with the largest
mtime. the TLA-version readv return the struct stat from the rchild.
when you use vim on a glusterfs file system (with afr and the children
of afr direct to different machine). Sometimes you will get a warning:
The file has been changed since reading it!!! I have submitted this
bug at https://savannah.nongnu.org/bugs/?21945, but the patch provided
by me only concern the writev and ftruncate functions, so it still
can't fix this bug. I will provide a improved patch later.
But is there a good excuse to let lookup return the stat with a largest mtime?
If you use read-volume option in afr, I suggest you putting the
`read-volume' volume at the first place in the sub-volumes.
More information about the Gluster-devel