From: Alain S. <asp...@gm...> - 2011-03-10 18:37:39
|
On Thu, Mar 10, 2011 at 1:22 PM, Miklos Szeredi <mi...@sz...> wrote: > On Thu, 10 Mar 2011, Alain Spineux wrote: >> > doing a >> > # echo hello > /mnt2/tmp/hello >> > when /mnt2/tmp/hello already exists >> > >> > I don't understand why FUSE do a : >> > >> > open >> > truncate >> > >> > instead of >> > >> > truncate >> > open >> > >> > or at least >> > >> > open >> > ftruncate (with a F) >> > >> > because in the first case, all initializations done in fi->fh in >> > invalidate by the truncate. >> > If ftruncate wall called instead, I could update fi->fh myself. >> > I thing I read somewhere FUSE should do a truncate before the open. > > The open+ftruncate doesn't work in the open(..., O_TRUNC|O_RDONLY) > case. > >> My probleme is identical to the one described here. >> My fedora 14 is working as the Ubuntu : >> >> http://marc.info/?l=fuse-devel&m=129540380518880&w=1 >> >> Anyways the answere is incomplete and the post tell me the problem is real. > > The problem is because different kernels call truncate/open in > different orders. This doesn't help us ! > > This can be solved by setting FUSE_CAP_ATOMIC_O_TRUNC. I'll fix > libfuse to set this flag if the kernel supprts it and order the > truncate and the open in the way it was done previously. This will help. > > In the mean time you can set FUSE_CAP_ATOMIC_O_TRUNC yourself and > handle O_TRUNC in the open() method, which should solve your problem. Yes I saw that, this is in my mind. Thanks for answering. > > Thanks, > Miklos > -- Alain Spineux | aspineux gmail com Your email 100% available | http://www.emailgency.com Send backup mail report | http://www.magikmon.com/mksbackup |