|
From: Dietmar M. <di...@pr...> - 2015-10-14 08:09:24
|
Hi all, we recently observed very strange behavior with 'rename'. Our software uses temporary files to make sure file creation is atomic. For example, we first create 'testfile.tmp.XYZ', write the file, and then simply rename the file to 'testfile'. The strange thing is that 'testfile' vanish from time to time when read from other processes. I assembled a test case using 'fusexmp.c'. Simply download attached fuse-rename-bug.tgz package and do: # tar xf fuse-rename-bug.tgz # cd fuse-rename-bug # Note: needs to be run as root (sorry) # make Start test Waiting for CRM [10224] and LRM [10222] write:0:Wed Oct 14 09:36:33 2015 read:0:Wed Oct 14 09:36:33 2015 read:1:Wed Oct 14 09:36:33 2015 write:1:Wed Oct 14 09:36:33 2015 READ ERROR: can't open './testmnt/test-file' - No such file or directory read:2:Wed Oct 14 09:36:33 2015 write:2:Wed Oct 14 09:36:33 2015 read:3:Wed Oct 14 09:36:33 2015 read:4:Wed Oct 14 09:36:33 2015 write:3:Wed Oct 14 09:36:33 2015 READ ERROR: can't open './testmnt/test-file' - No such file or directory exit[10222]: 0 write:4:Wed Oct 14 09:36:33 2015 exit[10224]: 0 End test The real test is inside test_fuse_exmp.pl, which mounts fusexmp at directory './testmnt'. So when you are done with testing you should # umount ./testmnt AFAIK this bug triggers with any fuse based file system, for example sshfs. I guess it is quite dangerous for any software that assume a rename is an atomic action. Any idea how to fix that? |