[ceph-users] CTDB Cluster Samba on Cephfs

Jeremy Allison jra at samba.org
Tue Apr 9 17:13:11 MDT 2013


On Thu, Apr 04, 2013 at 09:17:47PM -0700, Jeremy Allison wrote:
> 
> Ok, figured this out. Here's what I'm going to do.
> 
> It's possible to remove all uses of dirfd(DIR *) completely
> from the Samba code (and someone started using it in one
> of the modules where it's not needed, so I can remove it
> from there also). It was my mistake to add it, it's not
> needed to do what needs doing in source3/smbd/dir.c and
> I can achieve the same thing merely by having an additional
> back-pointer to the owning fsp in the internal dir struct.
> 
> So for 4.0.x this will suffice to fix the bugs caused
> by not treating DIR * as a competely opaque pointer
> by using it in dirfd(). I have most of that patch
> written already, but I'm off tomorrow so will finish
> it up, log a bug and attach the fix to it on Monday.
> 
> For master - aka 4.1.0, I'll change the VFS opendir
> and fdopendir operations to return an different opaque
> pointer type such as SMB_DIR * (interestingly, this
> is what we originally used to do inside the VFS) which
> is deliberately defined as a pointer to an undefined
> struct (or a void).
> 
> I don't think we need then to add a new dirfd() VFS
> op, as there will be no internal code that needs it,
> and making the Samba VFS opendir()/fdopendir ops return
> a differnt pointer type than DIR * should prevent people
> from assuming that can just call dirfd() on that pointer
> type. If someone comes up with a compelling need for it
> later we can always revisit and add it before 4.1.0
> ships (hopefully by the end of this year).

Ok, I have logged 2 bugs :

https://bugzilla.samba.org/show_bug.cgi?id=9777
(vfs_dirsort uses non-stackable calls, dirfd(), malloc
instead of talloc and doesn't cope with directories being modified whilst reading.)

which has a patch attached that removes the use of dirfd()
from that module, and bug:

https://bugzilla.samba.org/show_bug.cgi?id=9778

Samba directory code uses dirfd() without vectoring through a VFS call.

for which I have a patch (not uploaded yet) that
removes the dirfd() call from the main source3/smbd/dir.c
code.

I'll get these fixes into master via the normal
review process, then into 4.0.x.

That should fix the CEPH VFS module, and also
any other module that returns a non-DIR pointer
as an opaque blob from VFS_OPENDIR/VFS_FDOPENDIR.

Cheers,

	Jeremy.


More information about the samba-technical mailing list