[PATCH] preallocate result for glfs_realpath in vfs_glusterfs

Ira Cooper ira at wakeful.net
Fri Oct 21 10:00:31 UTC 2016


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>

-Ira

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>



More information about the samba-technical mailing list