[PATCH v9] vfs_glusterfs: Samba VFS module for glusterfs

Anand Avati avati at redhat.com
Wed May 29 13:23:04 MDT 2013


On 5/29/13 5:23 AM, Andrew Bartlett wrote:
> On Wed, 2013-05-29 at 07:21 -0400, Anand Avati wrote:
>> Implement a Samba VFS plugin for glusterfs based on gluster's gfapi.
>> This is a "bottom" vfs plugin (not something to be stacked on top of
>> another module), and translates (most) calls into closest actions
>> on gfapi.
>>
>> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
>> Signed-off-by: Anand Avati <avati at redhat.com>
>
> Thanks.  If nobody else pushes this to master by tomorrow, I'll handle
> it then.
>
> Thank you for your patience!
>
> Andrew Bartlett
>

We just uncovered this issue in our QE testing -

On Wed, May 29, 2013 at 4:21 AM, Anand Avati <avati at redhat.com> wrote:
+static DIR *vfs_gluster_fdopendir(struct vfs_handle_struct *handle,
+                                 files_struct *fsp, const char *mask,
+                                 uint32 attributes)
+{
+       return (DIR *) glfd_fd_get(fsp->fh->fd);
+}

When code takes this vfs_fdopendir() path (happened when testing 
fsstress, most of the times vfs_opendir() is called - not sure why), we 
are just passing a pointer of glfs_fd structure ...

+static int vfs_gluster_closedir(struct vfs_handle_struct *handle, DIR 
*dirp)
+{
+       return glfs_closedir((void *)dirp);
+}

... and Samba does a vfs_closedir() _and_ vfs_close(), essentially doing 
a double free on the glfs_fd structure.

I am sending out a v10 patch which fixes this by doing a glfs_dup() in 
vfs_fdopendir().

Avati


More information about the samba-technical mailing list