A small problem between Samba 3.5.8+ and libceph, the user-space Ceph client

Richard Sharpe realrichardsharpe at gmail.com
Wed Jun 29 08:48:53 MDT 2011


On Tue, Jun 28, 2011 at 7:54 PM, Jeremy Allison <jra at samba.org> wrote:
> On Tue, Jun 28, 2011 at 09:02:04AM -0700, Richard Sharpe wrote:
>> Hi folks,
>>
>> libceph does not like paths that look like .//some-file.txt.
>> Specifically, the // causes problems.
>>
>> I have tracked down what in Samba is doing that, and it is here. The
>> asprintf is inserting a slash without regard for whether there will be
>> one, two or three there afterwards.
>>
>> --- ../../../SOURCES/samba/source3/smbd/dir.c 2011-06-27
>> 09:29:44.934507000 -0700
>> +++ smbd/dir.c        2011-06-28 07:58:23.123927000 -0700
>> @@ -662,6 +662,13 @@
>>               goto ret;
>>       }
>>
>> +     {
>> +             /* Get rid of any trailing / in the path name */
>> +             int path_len = strlen(dptr->path);
>> +             if (dptr->path[path_len - 1] == '/')
>> +                     dptr->path[path_len - 1] = 0;
>> +     }
>> +
>>       pathreal = talloc_asprintf(ctx,
>>                               "%s/%s",
>>                               dptr->path,
>> @@ -669,6 +676,8 @@
>>       if (!pathreal)
>>               return NULL;
>>
>> +     DEBUG(10, ("pathreal = %s\n", pathreal));
>> +
>>       /* Create an smb_filename with stream_name == NULL. */
>>       ZERO_STRUCT(smb_fname_base);
>>       smb_fname_base.base_name = pathreal;
>>
>> However, I wonder if this is the correct way to solve this problem.
>
> Yes, we shouldn't ever be creating non-canonical pathnames.
>
> I'll take a look at this to see if this is the correct place
> to do the fix and get it into 3.5.next and (almost certainly
> 3.6.1).

Since this was causing the Ceph MDS to crash (libceph was passing the
empty components through), I submitted a patch to libceph which I
believe they accepted and they also fixed the MDS so it wouldn't crash
under those circumstances, so this is less of an issue now, but it is
good to see that the change will be in 3.6.1 or so.

-- 
Regards,
Richard Sharpe


More information about the samba-technical mailing list