[Gluster-devel] rename(2) race condition

Emmanuel Dreyfus manu at netbsd.org
Sun May 20 08:47:02 UTC 2012


After I patched to fix the mkdir issue, I now encounter a race in
rename(2). Most of the time it works, but sometimes:

  3548      1 tar      CALL  open(0xbb9010e0,0xa02,0x180)
  3548      1 tar      NAMI  "usr/src/gnu/CVS/Tag.03548f"
  3548      1 tar      RET   open 8
  3548      1 tar      CALL  __fstat50(8,0xbfbfe69c)
  3548      1 tar      RET   __fstat50 0
  3548      1 tar      CALL  write(8,0x8067880,0x16)
  3548      1 tar      GIO   fd 8 wrote 22 bytes
       "Nnetbsd-5-1-2-RELEASE\n"
  3548      1 tar      RET   write 22/0x16
  3548      1 tar      CALL  close(8)
  3548      1 tar      RET   close 0
  3548      1 tar      CALL  lchmod(0xbb9010e0,0x1a4)
  3548      1 tar      NAMI  "usr/src/gnu/CVS/Tag.03548f"
  3548      1 tar      RET   lchmod 0
  3548      1 tar      CALL  __lutimes50(0xbb9010e0,0xbfbfe6d8)
  3548      1 tar      NAMI  "usr/src/gnu/CVS/Tag.03548f"
  3548      1 tar      RET   __lutimes50 0
  3548      1 tar      CALL  rename(0xbb9010e0,0x8071584)
  3548      1 tar      NAMI  "usr/src/gnu/CVS/Tag.03548f"
  3548      1 tar      RET   rename -1 errno 13 Permission denied

I can reproduce it with the command below. It runs fine for a few
seconds and then hit permission denied. It needs a level of hierarchy to
exhibit the hebavior: just install a b will not fail.

mkdir test && echo "xxx" > tmp/a 
while [ 1 ] ; do rm -f test/b && install test/a test/b ; done

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu at netbsd.org




More information about the Gluster-devel mailing list