[RFC PATCH] CephFS Snapshots VFS module

David Disseldorp ddiss at samba.org
Fri Mar 29 12:35:13 UTC 2019


On Fri, 29 Mar 2019 11:45:37 +0100, David Disseldorp wrote:

> > Any chance libcephfs will be implementing fdopendir()
> > sometime ?  
> 
> I'm not aware of any work on this. I'll raise it upstream.
> 
> > It's a really important call for removing pathname
> > race conditions from Samba.  
> 
> Thanks for the heads-up.

Looking at glusterfs, it seems to avoid the fd->DIR* translation
entirely with the following in the open hook:
 588 static int vfs_gluster_open(struct vfs_handle_struct *handle,
...
 595         p_tmp = VFS_ADD_FSP_EXTENSION(handle, fsp, glfs_fd_t *, NULL);
...
 601         if (flags & O_DIRECTORY) {
 602                 glfd = glfs_opendir(handle->data, smb_fname->base_name);
 603         } else if (flags & O_CREAT) {
 604                 glfd = glfs_creat(handle->data, smb_fname->base_name, flags,
 605                                   mode);
 606         } else {
 607                 glfd = glfs_open(handle->data, smb_fname->base_name, flags);
 608         }
...
 616         *p_tmp = glfd;

This leaves fdopendir a simple:
 515 static DIR *vfs_gluster_fdopendir(struct vfs_handle_struct *handle,
 516                                   files_struct *fsp, const char *mask,
 517                                   uint32_t attributes)
 518 {       
 519         glfs_fd_t *glfd = vfs_gluster_fetch_glfd(handle, fsp);
...
 525         return (DIR *)glfd;

I guess we might be able to do something similar in vfs_ceph, but
libcephfs' differentiation between file and dir handles would likely
make things a little more complex.

Cheers, David



More information about the samba-technical mailing list