Hi,

According to POSIX semantics, when open is does with O_CREAT and
O_EXCL then it should return EEXIST. But, ganesha always expects fsal
layer to return EEXIST from create if the file already exists. This is
handled in cache_inode_create. If fsal create returns EEXIST then
ganesha does a lookup and checks for the type of file and then returns
the entry if the type matches.

On the other hand, if fsal create does not return error even if the
file exists (non O_EXCL semantics), ganesha goes ahead and tries to
add a directory entry (cache_inode_add_cached_dirent), which returns
CACHE_INODE_ENTRY_EXISTS and create fails!

A simple way to reproduce this is, mount same export on two different
clients and do the following steps to reproduce.

client1:/mnt> echo abc > testfile
client2:/mnt> echo abc > testfile
bash: testfile: File exists

I think ganesha should ignore the return status of
cache_inode_add_cached_dirent if it is CACHE_INODE_ENTRY_EXISTS (This
is already done in cache_inode_lookup_impl). This way the EEXIST error
will not be propagated to nfs-client.

Thanks,
Sriram

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to