[PATCH] preallocate result for glfs_realpath in vfs_glusterfs

Michael Adam obnox at samba.org
Fri Oct 21 21:25:45 UTC 2016


On 2016-10-21 at 06:00 -0400, Ira Cooper wrote:
> The code is the correct reaction to the change.
> 
> Everyone can have their own malloc! :)  What a flipping mess.
> 
> Feel free to push it, Michael.
> 
> Reviewed-by: Ira Cooper <ira at samba.org>

Thanks, Ira!

Pushed to to autobuild.

Michael



> On Fri, Oct 21, 2016 at 4:52 AM, Anoop C S <anoopcs at redhat.com> wrote:
> > On Fri, 2016-10-21 at 04:12 -0400, Ira Cooper wrote:
> >> How are we handling older versions of Gluster here?
> >>
> >
> > As I mentioned before, glfs_realpath() accepts pre-allocated string passed to it prior to the new
> > change. So older versions of Gluster should work fine with this change in vfs module.
> >
> > --Anoop C S.
> >
> >> -Ira
> >>
> >> Sent from a mobile phone.  Please treat as any good RFC compliant thing will:
> >> "Be strict in what you send, but liberal in what you receive."
> >>
> >> >
> >> > On Oct 21, 2016, at 02:36, Michael Adam <obnox at samba.org> wrote:
> >> >
> >> > >
> >> > > On 2016-10-21 at 11:46 +0530, Anoop C S wrote:
> >> > > >
> >> > > > On Fri, 2016-10-21 at 00:57 +0200, Michael Adam wrote:
> >> > > > Hi all,
> >> > > >
> >> > > > due to a recent change in glusterfs
> >> > > > https://review.gluster.org/#/c/15332/ ,
> >> > > > it is now wrong to just free the result
> >> > > > of glfs_realpath(). This needs to be discussed,
> >> > > > but here is a patch that makes us indedpendent
> >> > > > of the allocation mechanism used by glfs_realpath()
> >> > > > by handing in a pre-malloced result string.
> >> > > >
> >> > > > This is based on discussions I had with
> >> > > > Rajesh and Anoop today.
> >> > > >
> >> > > > Reviews appreciated!
> >> > > > Rajesh/Anoop, please also confirm this approach!
> >> > > >
> >> > >
> >> > > I can confirm that with this patch smbd no longer segfaults while mounting the share via
> >> > > Windows,
> >> > > CIFS and smbclient.
> >> > >
> >> > > Since glfs_realpath honours pre-allocated memory this would be the most favourable approach.
> >> >
> >> > Thanks for confirming Anoop!
> >> >
> >> > Rajesh further pointed out to me that the code should
> >> > free the pre-allocated string if glfs_realpath fails,
> >> > which is obviously true.
> >> >
> >> > Attached find an updated version of the patch.
> >> >
> >> > Cheers - Michael
> >> >
> >> > <0001-vfs-glusterfs-preallocate-result-for-glfs_realpath.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161021/5b174a40/signature.sig>


More information about the samba-technical mailing list