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

From: <tridge_at_samba.org>
Date: Sun, 22 Jul 2007 11:25:09 +1000
Timur,

 > This is an old standing problem, came as a workaround for some
 > assumptions about the opendir/telldir/seekdir behaviour in the POSIX
 > systems, which made Andrew to write this workaround

yes, this is a long standing problem. Basically we need
telldir()/seekdir() to actually work, and not consume unlimited
amounts of memory.

The original problems were:

  - when you use seekdir() after having deleted a file in the
    directory, you end up in the wrong place in the directory
    stream. 

  - on some systems each telldir() allocates some memory, adding it to
    a linked list. So if you do it a few million times then you lose a
    lot of memory, and the closedir() takes an extraordinary amount of
    time as it slowly frees the linked list

Here are our current attempts to fix this problem:

  http://samba.org/ftp/unpacked/samba4/source/lib/replace/repdir_getdents.c
  http://samba.org/ftp/unpacked/samba4/source/lib/replace/repdir_getdirentries.c

and here is some test code that demonstrates the problem:

  http://samba.org/ftp/unpacked/samba4/source/lib/replace/test/os2_delete.c

It's called os2_delete as this is the pattern of calls that OS/2
clients use against Samba when they want to delete all files in a
large directory. It is an insane pattern of calls, but it should work,
and it does work if seekdir()/telldir() work correctly.

I know this is a difficult problem to fix on some filesystems because
of the way directories are stored on disk. The thing is, it is even
harder to solve in application code where you have absolutely no
knowledge of the directory layout, and are trying to second guess
everthing.

There are many possible "quick fixes" in Samba. Unfortunately they
tend to have O(n^2) time or O(dirsize) memory usage, or both. That's
no good unfortunately.

Cheers, Tridge
Received on Sat Jul 21 2007 - 23:42:39 UTC

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