Re: [PATCH] fuse: Make created files visible immediately



On Wed, 2011-03-16 at 19:02 +0000, Stefan Hajnoczi wrote:
> This patch changes .vfs_create() to force file creation and then opens
> the file again for replacement.  This ensures that the created file is
> visible before its file handle is released.
> 
> Simple programs like touch(1) and cp(1) encounter ENOENT from creat(2)
> on a WebDAV volume.  FUSE calls .vfs_create() followed by .vfs_getattr()
> on the file as part of creat(2).  The .vfs_getattr() call after
> .vfs_create() fails with ENOENT since the file handle is still open and
> the file has not yet been created on the server side.  The WebDAV server
> fails the PROPFIND request to the non-existent file.
> 
> Solve this problem by creating a file first and then reusing .vfs_open()
> code to open the file writeable with O_TRUNC.

I'm not sure this is really a good idea in general. In some backends
creating a file like this can cause problems. For instance, we used to
do something similar in gnome-vfs and it caused double revisions each
time you saved to a svn webdav destination. I can also see it causing
secondary problems when saving on something where overwriting a file is
problematic, I don't have an exact example here, but I wouldn't be
suprised if it breaks saving on some ftp servers or suchlike due to the
second open for write failing. 

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl redhat com            alexander larsson gmail com 
He's a leather-clad Amish vampire hunter with nothing left to lose. She's a 
sharp-shooting mute soap star from beyond the grave. They fight crime! 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]