Hi,

Eddie Horng:
> I have another workaround is to touch all dirs right after aufs mount, this
> will force aufs always return copied-up file handle, although the cost is
> extra time and space, but it does work for me to complete the building of
> my codebase.

Here is another workaround from me.
This getcwd(2) does
- a usual operation. if it succeeds, then return at once.
- if it fails and satisfied these conditions
  + cwd is NFS
  + error code is ESTALE or ENOENT
  + and the dir nlink is not zero
- then this getcwd(2) knows that "Ah, this is Eddie Horng's case." and
  simulate "cd ." command internally.
- by this simulation, the internal cwd dentry is updated. then getcwd(2)
  goes back to the first step.

Note:
- anyone can run mkdir(1) which makes cwd to be "dropped." So the worst
  case for getcwd(2) will be the case someone keeps running mkdir(1)
  forever. In such case, this getcwd(2) will give up its operation after
  retring 3 times.
- any other thread in the same process may issue chdir(2) during
  getcwd(2) is running. In this case, the returned string from getcwd(2)
  may look incorrect. But this is not a problem specific to this patch.
  getcwd(2) just returns the path at that time.

Still I am not sure this is the correct solution. I am afraid the patch
may violate something in NFS world. If you use it, I'd advise you to
watch the behaviour carefully.


J. R. Okajima

Attachment: a.patch.bz2
Description: BZip2 compressed data

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Reply via email to