[Samba] acl handling on delete (performance problem)

Jure Peèar
Sat, 24 Jul 2004 22:08:59 -0000

Hi all,

I'm debugging a performance problem for a client. Needless to say, the
organisation of their data is such that this problem is really annoying.
Here's the situation:

Samba 3.0.x PDC in a mixed 9x/nt/xp environment, using acls. When trying to
delete a large number of folders from a folder, the 'preparing to
delete'
stage takes about half hour.

It's simple to repeat: set up samba pdc, join an xp client into the domain,
map a share with some 4000 folders and try to delete them.

Strace of a smbd proccess in the 'preparing to delete' stage looks like
this:

stat("/mnt/test/test/0220", {st_mode=S_IFDIR|0755, st_size=6, ...}) =
0
gettimeofday({1090703949, 903367}, NULL) = 0
stat("/mnt/test/test/0220", {st_mode=S_IFDIR|0755, st_size=6, ...}) =
0
getxattr("/mnt/test/test/0220", "system.posix_acl_access",
0x11fffe940, 132)
= -1 ENODATA (No data available)
stat("/mnt/test/test/0220", {st_mode=S_IFDIR|0755, st_size=6, ...}) =
0
getxattr("/mnt/test/test/0220", "system.posix_acl_default",
0x11fffe940,
132) = -1 ENODATA (No data available)
stat("/mnt/test/test/0220", {st_mode=S_IFDIR|0755, st_size=6, ...}) =
0
getxattr("/mnt/test/test/0220", "user.SAMBA_PAI",
0x1207f0aa0, 1024) = -1
ENODATA (No data available)

For every folder it wants to delete, it walks all the folders doing this. So
for 4k folders we get 16 milion such tests, which take waay too much time.
Are these loops necessary? Can they be optimised?

We've tested ext3+acl and xfs as an underlying filesystem, with no
difference. We also noticed this behaviour on win98 as a client.

Tested on 3.0.2a and 3.0.4, smb.conf attached.


In my own testings i've noticed that with security=share and with anon r/w
public share samba doesn't do any getxattr calls and this whole tests
completes within minutes, as it should. Also, on a linux client mounting the
share via smbmount deleting also takes just minutes.


--

Jure Peèar