Re: ZFS vs Samba Debugging Results ... Need Help.

From: Joe Marcus Clarke <marcus_at_marcuscom.com>
Date: Fri, 06 Jul 2007 01:10:37 -0400
On Thu, 2007-07-05 at 20:39 -0400, Brian Donnell wrote:
> Thanks to Pascal Hofstee and Joe Marcus Clarke I found a way to get ZFS
> samba shared.  I haven't run into any problems yet, but consider it
> experimental.  You're going to love how simple this one was.
> 
> cd /usr/ports/net/samba3
> make patch
> cd work/samba-3.0.25a/source/lib/replace
> rm repdir_get*
> cd /usr/ports/net/samba3
> make install

Yes, this "works" as Pascal tested for me earlier.  However, if you read
the comments in this file there was a reason these functions are
overridden.  The way that telldir() works can cause issues when
closedir() is called (e.g. network timeouts).

In any event, I'm not sure there's a better way to do this when it comes
to ZFS.  When doing an lseek() on a ZFS directory, the internal offset
is set to a hash code value (as far as I can tell).  You can not
reliably increment this by some number, and get back to the same
location in a given directory (in fact, you can easily get a segfault by
doing that).

Joe

> 
> And now it works.  Just get rid of the offending functions.  I've had no
> problems reading or writing files of large and small size in directories
> with only a couple files or a couple hundred.  It was so simple it makes me
> think something is still very wrong.  But I'm having no problems now.
> 
> -- Brian
> 
> On 7/5/07, Pascal Hofstee <caelian_at_gmail.com> wrote:
> >
> > Hi,
> >
> > I did some addititional debugging and adding a small workaround to
> > smbd/vfs.c making the function vfs_readdirname() return ptr->d_name
> > directly instead of relying on the temporary variable dname gets the
> > code properly skipping the "." and ".." entries.
> >
> > >From that point on the code enters into a new problem area which can be
> > observed in the backtrace posted at http://pastebin.ca/604961
> >
> > Joe Marcus Clarke helped me out further with debugging this problem and
> > we have come to the conclusion that the following assertion in samba's
> > telldir() implementation located in lib/replace/repdir_getdirentries.c
> > does not hold true on ZFS directories (marcus mentioned something about
> > lseek() behaving differently on ZFS than it does on UFS):
> >
> >         if (d->seekpos & (DIR_BUF_SIZE-1)) {
> >                  abort();
> >         }
> >
> > Marcus was so kind to put up a simple test case at
> > http://www.marcuscom.com/downloads/samba_zfs.c
> >
> > Change main() to point to a ZFS directory, and watch it crash.
> > Then point to a UFS directory, and it works.
> > The seekpos is printed each time.
> >
> > Hopefully this will be enough information to get us to figure out a
> > workable solution here.
> >
> > --
> >   Pascal Hofstee
> >
> >
> >
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
> 
-- 
PGP Key : http://www.marcuscom.com/pgp.asc

Received on Fri Jul 06 2007 - 03:10:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC