failing LOCK1 smbtorture test

MCCALL,DON (HP-USA,ex1) don_mccall at hp.com
Tue Jul 24 15:14:01 GMT 2001


Hi Jeremy,
I have been having a hard time getting samba 2.2.latestcvs to pass LOCK1
smbtorture test,
and I think i MAY have discovered why...
I added some debug statements to the code to print out the tdb->map_ptr
value after 
opening/expanding/ect  a tdb file when calling tdb_mmap, and discovered that

HP-UX mmap can return a tdb_mmap value of '0'.  The man page for mmap SAYS
that this 
should not happen, but hey...

I think what is happening in my case is that because we are falling thru to
filesystem
reads and writes if mmap isn't working, and HP-UX doesn't have a unified
buffer cache, that 
when we DO use a tdb_mmap of 0, we start using reads and writes (see code
snippet from tdb.c
below)
/* read a lump of data at a specified offset, maybe convert */
static int tdb_read(TDB_CONTEXT *tdb,tdb_off off,void *buf,tdb_len len,int
cv)
{
        if (tdb_oob(tdb, off + len, 0) != 0) return -1;

        if (tdb->map_ptr) memcpy(buf, off + (char *)tdb->map_ptr, len);
        else if (lseek(tdb->fd, off, SEEK_SET) != off
                 || read(tdb->fd, buf, len) != (ssize_t)len) {
...

but not all of the other tdb calls (like tdb_fetch, for example)  test
against tdb->map_ptr
being 0...

I have debug files that show this behavior, as well as the tdb.c where I
have added additional
TDB_LOG() statements to display the returned tdb->map_ptr if you would like
to look at them.

A snippet of the log from running smbtorture LOCK1 test:

 BUILD opened file lockt1.lck read=Yes write=Yes (numopen=1)
[2001/07/23 22:53:21, 2, pid=13485] locking/locking.c:(411)
  tdb_fetch tdb->map_ptr=c0cdc000
[2001/07/23 22:53:21, 10, pid=13485] smbd/open.c:(841)
  open_file_shared : share_mode = 42
[2001/07/23 22:53:21, 2, pid=13485] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): tdb_mmap failed for size 8192
(No
t enough space)errno=c, tdb->map_ptr = ffffffff, tdb->fd=d
[2001/07/23 22:53:21, 2, pid=13485] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): tdb_mmap succeeded for size
8192,
  but tdb->map_ptr is null,and = 0, tdb->fd=d
[2001/07/23 22:53:21, 2, pid=13485] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): tdb_mmap succeeded for size
8192,
  tdb->map_ptr = 0, tdb->fd=d
[2001/07/23 22:53:21, 0, pid=13485] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): just did tdb_mmap in
tdb_expand

... and later in the same log/test:

  BUILD opened file lockt1.lck read=Yes write=Yes (numopen=1)
[2001/07/23 22:53:21, 10, pid=13486] smbd/open.c:(841)
  open_file_shared : share_mode = 42
[2001/07/23 22:53:21, 2, pid=13486] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): tdb_mmap succeeded for size
8192,
  tdb->map_ptr = c0e25000, tdb->fd=d
[2001/07/23 22:53:21, 0, pid=13486] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): just did tdb_mmap in tdb_oob
[2001/07/23 22:53:22, 2, pid=13486] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): tdb_mmap succeeded for size
16384
,  tdb->map_ptr = c0e25000, tdb->fd=d
[2001/07/23 22:53:22, 0, pid=13486] tdb/tdbutil.c:(342)
  tdb(/usr/local/samba/var/locks/locking.tdb): just did tdb_mmap in
tdb_expand

I'm going to be out on vacation starting thursday, but will be back on
August 6th.

If you have any feedback/pointers to help me out in debugging/fixing this, I
would be 
MOST appreciative!

Thanks,
Don




More information about the samba-technical mailing list